From d17e2b488553c1b10f64a4d81e5b70d466f73304 Mon Sep 17 00:00:00 2001 From: Matt Cole Date: Tue, 10 Jan 2023 17:11:32 -0500 Subject: [PATCH 1/3] build: generate rest using open-api-generator --- twilio/rest/accounts/__init__.py | 54 +- .../accounts/v1/.openapi-generator-ignore | 23 + .../rest/accounts/v1/.openapi-generator/FILES | 11 + .../accounts/v1/.openapi-generator/VERSION | 1 + .../rest/accounts/v1/auth_token_promotion.py | 248 ++--- twilio/rest/accounts/v1/credential.py | 48 + twilio/rest/accounts/v1/credential/aws.py | 457 +++------ .../rest/accounts/v1/credential/public_key.py | 457 +++------ .../rest/accounts/v1/secondary_auth_token.py | 271 ++---- twilio/rest/api/__init__.py | 224 +---- .../rest/api/v2010/.openapi-generator-ignore | 23 + .../rest/api/v2010/.openapi-generator/FILES | 159 ++++ .../rest/api/v2010/.openapi-generator/VERSION | 1 + twilio/rest/api/v2010/account.py | 254 +++++ twilio/rest/api/v2010/account/address.py | 179 ++++ .../account/address/dependent_phone_number.py | 445 +-------- twilio/rest/api/v2010/account/application.py | 716 +++----------- .../v2010/account/authorized_connect_app.py | 416 ++------- .../account/available_phone_number_country.py | 160 ++++ .../available_phone_number_country/local.py | 58 ++ .../machine_to_machine.py | 58 ++ .../available_phone_number_country/mobile.py | 58 ++ .../national.py | 58 ++ .../shared_cost.py | 58 ++ .../toll_free.py | 58 ++ .../available_phone_number_country/voip.py | 58 ++ twilio/rest/api/v2010/account/balance.py | 165 ++-- twilio/rest/api/v2010/account/call.py | 222 +++++ twilio/rest/api/v2010/account/call/event.py | 217 +---- .../rest/api/v2010/account/call/feedback.py | 370 ++------ .../v2010/account/call/feedback_summary.py | 424 ++------- .../api/v2010/account/call/notification.py | 529 ++--------- twilio/rest/api/v2010/account/call/payment.py | 412 ++------- .../rest/api/v2010/account/call/recording.py | 666 +++---------- twilio/rest/api/v2010/account/call/siprec.py | 853 ++--------------- twilio/rest/api/v2010/account/call/stream.py | 852 ++--------------- .../account/call/user_defined_message.py | 193 ++-- .../call/user_defined_message_subscription.py | 304 ++---- twilio/rest/api/v2010/account/conference.py | 158 ++++ .../v2010/account/conference/participant.py | 781 +++------------- .../api/v2010/account/conference/recording.py | 607 +++--------- twilio/rest/api/v2010/account/connect_app.py | 522 +++-------- .../v2010/account/incoming_phone_number.py | 200 ++++ .../incoming_phone_number/assigned_add_on.py | 163 ++++ .../assigned_add_on_extension.py | 440 ++------- .../account/incoming_phone_number/local.py | 690 ++------------ .../account/incoming_phone_number/mobile.py | 690 ++------------ .../incoming_phone_number/toll_free.py | 690 ++------------ twilio/rest/api/v2010/account/key.py | 408 ++------ twilio/rest/api/v2010/account/message.py | 187 ++++ .../api/v2010/account/message/feedback.py | 216 ++--- .../rest/api/v2010/account/message/media.py | 449 ++------- twilio/rest/api/v2010/account/new_key.py | 190 ++-- .../rest/api/v2010/account/new_signing_key.py | 190 ++-- twilio/rest/api/v2010/account/notification.py | 509 ++-------- .../api/v2010/account/outgoing_caller_id.py | 462 ++------- twilio/rest/api/v2010/account/queue.py | 172 ++++ twilio/rest/api/v2010/account/queue/member.py | 422 ++------- twilio/rest/api/v2010/account/recording.py | 165 ++++ .../v2010/account/recording/add_on_result.py | 152 +++ .../recording/add_on_result/payload.py | 149 +++ .../v2010/account/recording/transcription.py | 485 ++-------- twilio/rest/api/v2010/account/short_code.py | 507 ++-------- twilio/rest/api/v2010/account/signing_key.py | 408 ++------ twilio/rest/api/v2010/account/sip.py | 49 + .../api/v2010/account/sip/credential_list.py | 170 ++++ .../account/sip/credential_list/credential.py | 499 +++------- twilio/rest/api/v2010/account/sip/domain.py | 192 ++++ .../v2010/account/sip/domain/auth_types.py | 48 + .../sip/domain/auth_types/auth_type_calls.py | 48 + .../auth_calls_credential_list_mapping.py | 153 +++ ...th_calls_ip_access_control_list_mapping.py | 153 +++ .../auth_types/auth_type_registrations.py | 47 + ...h_registrations_credential_list_mapping.py | 153 +++ .../sip/domain/credential_list_mapping.py | 454 ++------- .../domain/ip_access_control_list_mapping.py | 454 ++------- .../account/sip/ip_access_control_list.py | 170 ++++ .../sip/ip_access_control_list/ip_address.py | 541 +++-------- twilio/rest/api/v2010/account/token.py | 210 ++--- .../rest/api/v2010/account/transcription.py | 465 ++-------- twilio/rest/api/v2010/account/usage.py | 48 + twilio/rest/api/v2010/account/usage/record.py | 66 ++ .../v2010/account/usage/record/all_time.py | 614 +----------- .../api/v2010/account/usage/record/daily.py | 614 +----------- .../v2010/account/usage/record/last_month.py | 614 +----------- .../api/v2010/account/usage/record/monthly.py | 614 +----------- .../v2010/account/usage/record/this_month.py | 614 +----------- .../api/v2010/account/usage/record/today.py | 614 +----------- .../api/v2010/account/usage/record/yearly.py | 614 +----------- .../v2010/account/usage/record/yesterday.py | 614 +----------- .../rest/api/v2010/account/usage/trigger.py | 875 +++--------------- .../api/v2010/account/validation_request.py | 205 ++-- twilio/rest/autopilot/__init__.py | 51 +- .../autopilot/v1/.openapi-generator-ignore | 23 + .../autopilot/v1/.openapi-generator/FILES | 31 + .../autopilot/v1/.openapi-generator/VERSION | 1 + twilio/rest/autopilot/v1/assistant.py | 205 ++++ .../rest/autopilot/v1/assistant/defaults.py | 298 ++---- .../rest/autopilot/v1/assistant/dialogue.py | 280 ++---- .../rest/autopilot/v1/assistant/field_type.py | 172 ++++ .../v1/assistant/field_type/field_value.py | 506 +++------- .../autopilot/v1/assistant/model_build.py | 517 +++-------- twilio/rest/autopilot/v1/assistant/query.py | 593 +++--------- .../autopilot/v1/assistant/style_sheet.py | 298 ++---- twilio/rest/autopilot/v1/assistant/task.py | 185 ++++ .../rest/autopilot/v1/assistant/task/field.py | 487 +++------- .../autopilot/v1/assistant/task/sample.py | 551 +++-------- .../v1/assistant/task/task_actions.py | 328 ++----- .../v1/assistant/task/task_statistics.py | 300 ++---- twilio/rest/autopilot/v1/assistant/webhook.py | 535 +++-------- twilio/rest/autopilot/v1/restore_assistant.py | 265 ++---- twilio/rest/bulkexports/__init__.py | 51 +- .../bulkexports/v1/.openapi-generator-ignore | 23 + .../bulkexports/v1/.openapi-generator/FILES | 11 + .../bulkexports/v1/.openapi-generator/VERSION | 1 + twilio/rest/bulkexports/v1/export.py | 127 +++ twilio/rest/bulkexports/v1/export/day.py | 356 ++----- .../v1/export/export_custom_job.py | 373 ++------ twilio/rest/bulkexports/v1/export/job.py | 371 ++------ .../bulkexports/v1/export_configuration.py | 304 ++---- twilio/rest/chat/__init__.py | 86 +- twilio/rest/chat/v1/.openapi-generator-ignore | 23 + twilio/rest/chat/v1/.openapi-generator/FILES | 19 + .../rest/chat/v1/.openapi-generator/VERSION | 1 + twilio/rest/chat/v1/credential.py | 519 +++-------- twilio/rest/chat/v1/service.py | 192 ++++ twilio/rest/chat/v1/service/channel.py | 185 ++++ twilio/rest/chat/v1/service/channel/invite.py | 492 +++------- twilio/rest/chat/v1/service/channel/member.py | 548 +++-------- .../rest/chat/v1/service/channel/message.py | 569 +++--------- twilio/rest/chat/v1/service/role.py | 496 +++------- twilio/rest/chat/v1/service/user.py | 177 ++++ .../rest/chat/v1/service/user/user_channel.py | 278 +----- twilio/rest/chat/v2/.openapi-generator-ignore | 23 + twilio/rest/chat/v2/.openapi-generator/FILES | 25 + .../rest/chat/v2/.openapi-generator/VERSION | 1 + twilio/rest/chat/v2/credential.py | 519 +++-------- twilio/rest/chat/v2/service.py | 198 ++++ twilio/rest/chat/v2/service/binding.py | 474 ++-------- twilio/rest/chat/v2/service/channel.py | 189 ++++ twilio/rest/chat/v2/service/channel/invite.py | 492 +++------- twilio/rest/chat/v2/service/channel/member.py | 616 +++--------- .../rest/chat/v2/service/channel/message.py | 657 +++---------- .../rest/chat/v2/service/channel/webhook.py | 574 +++--------- twilio/rest/chat/v2/service/role.py | 496 +++------- twilio/rest/chat/v2/service/user.py | 181 ++++ .../rest/chat/v2/service/user/user_binding.py | 482 ++-------- .../rest/chat/v2/service/user/user_channel.py | 533 ++--------- twilio/rest/chat/v3/.openapi-generator-ignore | 23 + twilio/rest/chat/v3/.openapi-generator/FILES | 3 + .../rest/chat/v3/.openapi-generator/VERSION | 1 + twilio/rest/chat/v3/channel.py | 375 ++------ twilio/rest/content/__init__.py | 48 +- .../rest/content/v1/.openapi-generator-ignore | 23 + .../rest/content/v1/.openapi-generator/FILES | 5 + .../content/v1/.openapi-generator/VERSION | 1 + twilio/rest/content/v1/content.py | 152 +++ .../rest/content/v1/content/approval_fetch.py | 262 ++---- twilio/rest/conversations/__init__.py | 77 +- .../v1/.openapi-generator-ignore | 23 + .../conversations/v1/.openapi-generator/FILES | 55 ++ .../v1/.openapi-generator/VERSION | 1 + .../conversations/v1/address_configuration.py | 581 +++--------- twilio/rest/conversations/v1/configuration.py | 134 +++ .../conversations/v1/configuration/webhook.py | 343 ++----- twilio/rest/conversations/v1/conversation.py | 185 ++++ .../conversations/v1/conversation/message.py | 177 ++++ .../conversation/message/delivery_receipt.py | 438 ++------- .../v1/conversation/participant.py | 617 +++--------- .../conversations/v1/conversation/webhook.py | 532 +++-------- twilio/rest/conversations/v1/credential.py | 523 +++-------- .../v1/participant_conversation.py | 356 +------ twilio/rest/conversations/v1/role.py | 489 +++------- twilio/rest/conversations/v1/service.py | 179 ++++ .../rest/conversations/v1/service/binding.py | 464 ++-------- .../conversations/v1/service/configuration.py | 135 +++ .../v1/service/configuration/notification.py | 392 ++------ .../v1/service/configuration/webhook.py | 338 ++----- .../conversations/v1/service/conversation.py | 185 ++++ .../v1/service/conversation/message.py | 178 ++++ .../conversation/message/delivery_receipt.py | 468 ++-------- .../v1/service/conversation/participant.py | 642 +++---------- .../v1/service/conversation/webhook.py | 573 +++--------- .../v1/service/participant_conversation.py | 362 +------- twilio/rest/conversations/v1/service/role.py | 496 +++------- twilio/rest/conversations/v1/service/user.py | 176 ++++ .../v1/service/user/user_conversation.py | 598 +++--------- twilio/rest/conversations/v1/user.py | 176 ++++ .../v1/user/user_conversation.py | 579 +++--------- twilio/rest/events/__init__.py | 57 +- .../rest/events/v1/.openapi-generator-ignore | 23 + .../rest/events/v1/.openapi-generator/FILES | 17 + .../rest/events/v1/.openapi-generator/VERSION | 1 + twilio/rest/events/v1/event_type.py | 381 ++------ twilio/rest/events/v1/schema.py | 124 +++ .../rest/events/v1/schema/schema_version.py | 132 +++ twilio/rest/events/v1/sink.py | 176 ++++ twilio/rest/events/v1/sink/sink_test.py | 151 ++- twilio/rest/events/v1/sink/sink_validate.py | 155 ++-- twilio/rest/events/v1/subscription.py | 171 ++++ .../v1/subscription/subscribed_event.py | 472 +++------- twilio/rest/flexApi/__init__.py | 55 ++ .../rest/flexApi/v1/.openapi-generator-ignore | 23 + .../rest/flexApi/v1/.openapi-generator/FILES | 23 + .../flexApi/v1/.openapi-generator/VERSION | 1 + twilio/rest/flexApi/v1/assessments.py | 104 +++ twilio/rest/flexApi/v1/channel.py | 156 ++++ twilio/rest/flexApi/v1/configuration.py | 160 ++++ twilio/rest/flexApi/v1/flex_flow.py | 173 ++++ twilio/rest/flexApi/v1/good_data.py | 108 +++ twilio/rest/flexApi/v1/interaction.py | 134 +++ .../v1/interaction/interaction_channel.py | 154 +++ .../interaction_channel_invite.py | 105 +++ .../interaction_channel_participant.py | 136 +++ twilio/rest/flexApi/v1/user_roles.py | 117 +++ twilio/rest/flexApi/v1/web_channel.py | 165 ++++ .../rest/flexApi/v2/.openapi-generator-ignore | 23 + .../rest/flexApi/v2/.openapi-generator/FILES | 3 + .../flexApi/v2/.openapi-generator/VERSION | 1 + twilio/rest/flexApi/v2/web_channels.py | 90 ++ twilio/rest/frontlineApi/__init__.py | 55 ++ .../frontlineApi/v1/.openapi-generator-ignore | 23 + .../frontlineApi/v1/.openapi-generator/FILES | 3 + .../v1/.openapi-generator/VERSION | 1 + twilio/rest/frontlineApi/v1/user.py | 133 +++ twilio/rest/insights/__init__.py | 72 +- .../insights/v1/.openapi-generator-ignore | 23 + .../rest/insights/v1/.openapi-generator/FILES | 23 + .../insights/v1/.openapi-generator/VERSION | 1 + twilio/rest/insights/v1/call.py | 134 +++ twilio/rest/insights/v1/call/annotation.py | 412 ++------- twilio/rest/insights/v1/call/call_summary.py | 138 +++ twilio/rest/insights/v1/call/event.py | 325 +------ twilio/rest/insights/v1/call/metric.py | 313 +------ twilio/rest/insights/v1/call_summaries.py | 577 +----------- twilio/rest/insights/v1/conference.py | 154 +++ .../v1/conference/conference_participant.py | 659 ++----------- twilio/rest/insights/v1/room.py | 157 ++++ twilio/rest/insights/v1/room/participant.py | 518 ++--------- twilio/rest/insights/v1/setting.py | 302 ++---- twilio/rest/ipMessaging/__init__.py | 63 ++ .../ipMessaging/v1/.openapi-generator-ignore | 23 + .../ipMessaging/v1/.openapi-generator/FILES | 19 + .../ipMessaging/v1/.openapi-generator/VERSION | 1 + twilio/rest/ipMessaging/v1/credential.py | 167 ++++ twilio/rest/ipMessaging/v1/service.py | 192 ++++ twilio/rest/ipMessaging/v1/service/channel.py | 185 ++++ .../ipMessaging/v1/service/channel/invite.py | 158 ++++ .../ipMessaging/v1/service/channel/member.py | 170 ++++ .../ipMessaging/v1/service/channel/message.py | 172 ++++ twilio/rest/ipMessaging/v1/service/role.py | 168 ++++ twilio/rest/ipMessaging/v1/service/user.py | 177 ++++ .../v1/service/user/user_channel.py | 58 ++ .../ipMessaging/v2/.openapi-generator-ignore | 23 + .../ipMessaging/v2/.openapi-generator/FILES | 25 + .../ipMessaging/v2/.openapi-generator/VERSION | 1 + twilio/rest/ipMessaging/v2/credential.py | 167 ++++ twilio/rest/ipMessaging/v2/service.py | 198 ++++ twilio/rest/ipMessaging/v2/service/binding.py | 150 +++ twilio/rest/ipMessaging/v2/service/channel.py | 189 ++++ .../ipMessaging/v2/service/channel/invite.py | 158 ++++ .../ipMessaging/v2/service/channel/member.py | 171 ++++ .../ipMessaging/v2/service/channel/message.py | 175 ++++ .../ipMessaging/v2/service/channel/webhook.py | 168 ++++ twilio/rest/ipMessaging/v2/service/role.py | 168 ++++ twilio/rest/ipMessaging/v2/service/user.py | 181 ++++ .../v2/service/user/user_binding.py | 150 +++ .../v2/service/user/user_channel.py | 160 ++++ twilio/rest/lookups/__init__.py | 62 +- .../rest/lookups/v1/.openapi-generator-ignore | 23 + .../rest/lookups/v1/.openapi-generator/FILES | 3 + .../lookups/v1/.openapi-generator/VERSION | 1 + twilio/rest/lookups/v1/phone_number.py | 310 ++----- .../rest/lookups/v2/.openapi-generator-ignore | 23 + .../rest/lookups/v2/.openapi-generator/FILES | 3 + .../lookups/v2/.openapi-generator/VERSION | 1 + twilio/rest/lookups/v2/phone_number.py | 427 ++------- twilio/rest/media/__init__.py | 54 +- .../rest/media/v1/.openapi-generator-ignore | 23 + twilio/rest/media/v1/.openapi-generator/FILES | 9 + .../rest/media/v1/.openapi-generator/VERSION | 1 + twilio/rest/media/v1/media_processor.py | 520 +++-------- twilio/rest/media/v1/media_recording.py | 153 +++ twilio/rest/media/v1/player_streamer.py | 164 ++++ .../v1/player_streamer/playback_grant.py | 292 ++---- twilio/rest/messaging/__init__.py | 69 +- .../messaging/v1/.openapi-generator-ignore | 23 + .../messaging/v1/.openapi-generator/FILES | 29 + .../messaging/v1/.openapi-generator/VERSION | 1 + .../rest/messaging/v1/brand_registration.py | 172 ++++ .../v1/brand_registration/brand_vetting.py | 457 ++------- twilio/rest/messaging/v1/deactivations.py | 116 +++ twilio/rest/messaging/v1/domain_certs.py | 145 +++ twilio/rest/messaging/v1/domain_config.py | 355 ++----- twilio/rest/messaging/v1/external_campaign.py | 195 ++-- twilio/rest/messaging/v1/service.py | 202 ++++ .../rest/messaging/v1/service/alpha_sender.py | 447 +++------ .../rest/messaging/v1/service/phone_number.py | 457 +++------ .../rest/messaging/v1/service/short_code.py | 457 +++------ .../messaging/v1/service/us_app_to_person.py | 652 +++---------- .../v1/service/us_app_to_person_usecase.py | 161 +--- .../messaging/v1/tollfree_verification.py | 734 +++------------ twilio/rest/messaging/v1/usecase.py | 147 +-- twilio/rest/microvisor/__init__.py | 51 +- .../microvisor/v1/.openapi-generator-ignore | 23 + .../microvisor/v1/.openapi-generator/FILES | 5 + .../microvisor/v1/.openapi-generator/VERSION | 1 + twilio/rest/microvisor/v1/app.py | 406 ++------ twilio/rest/microvisor/v1/device.py | 147 +++ twilio/rest/monitor/__init__.py | 51 +- .../rest/monitor/v1/.openapi-generator-ignore | 23 + .../rest/monitor/v1/.openapi-generator/FILES | 5 + .../monitor/v1/.openapi-generator/VERSION | 1 + twilio/rest/monitor/v1/alert.py | 514 ++-------- twilio/rest/monitor/v1/event.py | 488 ++-------- twilio/rest/notify/__init__.py | 51 +- .../rest/notify/v1/.openapi-generator-ignore | 23 + .../rest/notify/v1/.openapi-generator/FILES | 9 + .../rest/notify/v1/.openapi-generator/VERSION | 1 + twilio/rest/notify/v1/credential.py | 527 +++-------- twilio/rest/notify/v1/service.py | 187 ++++ twilio/rest/notify/v1/service/binding.py | 566 +++-------- twilio/rest/notify/v1/service/notification.py | 391 ++------ twilio/rest/numbers/__init__.py | 48 +- .../rest/numbers/v2/.openapi-generator-ignore | 23 + .../rest/numbers/v2/.openapi-generator/FILES | 23 + .../numbers/v2/.openapi-generator/VERSION | 1 + .../rest/numbers/v2/regulatory_compliance.py | 52 ++ .../v2/regulatory_compliance/bundle.py | 187 ++++ .../bundle/bundle_copy.py | 349 ++----- .../bundle/evaluation.py | 410 ++------ .../bundle/item_assignment.py | 419 ++------- .../bundle/replace_items.py | 258 ++---- .../v2/regulatory_compliance/end_user.py | 481 +++------- .../v2/regulatory_compliance/end_user_type.py | 348 ++----- .../v2/regulatory_compliance/regulation.py | 400 ++------ .../supporting_document.py | 515 +++-------- .../supporting_document_type.py | 348 ++----- twilio/rest/oauth/__init__.py | 68 +- .../rest/oauth/v1/.openapi-generator-ignore | 23 + twilio/rest/oauth/v1/.openapi-generator/FILES | 11 + .../rest/oauth/v1/.openapi-generator/VERSION | 1 + twilio/rest/oauth/v1/device_code.py | 203 ++-- twilio/rest/oauth/v1/oauth.py | 228 ++--- twilio/rest/oauth/v1/openid_discovery.py | 335 ++----- twilio/rest/oauth/v1/token.py | 207 ++--- twilio/rest/oauth/v1/user_info.py | 265 ++---- twilio/rest/preview/.openapi-generator-ignore | 23 + twilio/rest/preview/.openapi-generator/FILES | 79 ++ .../rest/preview/.openapi-generator/VERSION | 1 + twilio/rest/preview/DeployedDevices.py | 55 ++ twilio/rest/preview/HostedNumbers.py | 63 ++ twilio/rest/preview/Marketplace.py | 63 ++ twilio/rest/preview/Sync.py | 55 ++ twilio/rest/preview/Understand.py | 55 ++ twilio/rest/preview/Wireless.py | 71 ++ twilio/rest/preview/deployed_devices/fleet.py | 184 ++++ .../deployed_devices/fleet/certificate.py | 516 +++-------- .../deployed_devices/fleet/deployment.py | 492 +++------- .../preview/deployed_devices/fleet/device.py | 567 +++--------- .../preview/deployed_devices/fleet/key.py | 510 +++------- .../hosted_numbers/authorization_document.py | 161 ++++ .../dependent_hosted_number_order.py | 465 +--------- .../hosted_numbers/hosted_number_order.py | 781 +++------------- .../preview/marketplace/available_add_on.py | 138 +++ .../available_add_on_extension.py | 385 ++------ .../preview/marketplace/installed_add_on.py | 173 ++++ .../installed_add_on_extension.py | 433 ++------- twilio/rest/preview/sync/service.py | 181 ++++ twilio/rest/preview/sync/service/document.py | 174 ++++ .../service/document/document_permission.py | 486 ++-------- twilio/rest/preview/sync/service/sync_list.py | 166 ++++ .../sync/service/sync_list/sync_list_item.py | 570 +++--------- .../service/sync_list/sync_list_permission.py | 486 ++-------- twilio/rest/preview/sync/service/sync_map.py | 166 ++++ .../sync/service/sync_map/sync_map_item.py | 571 +++--------- .../service/sync_map/sync_map_permission.py | 486 ++-------- twilio/rest/preview/understand/assistant.py | 203 ++++ .../assistant/assistant_fallback_actions.py | 301 ++---- .../assistant/assistant_initiation_actions.py | 307 ++---- .../preview/understand/assistant/dialogue.py | 280 ++---- .../understand/assistant/field_type.py | 172 ++++ .../assistant/field_type/field_value.py | 506 +++------- .../understand/assistant/model_build.py | 517 +++-------- .../preview/understand/assistant/query.py | 582 +++--------- .../understand/assistant/style_sheet.py | 298 ++---- .../rest/preview/understand/assistant/task.py | 185 ++++ .../understand/assistant/task/field.py | 487 +++------- .../understand/assistant/task/sample.py | 551 +++-------- .../understand/assistant/task/task_actions.py | 328 ++----- .../assistant/task/task_statistics.py | 300 ++---- twilio/rest/preview/wireless/command.py | 498 ++-------- twilio/rest/preview/wireless/rate_plan.py | 568 +++--------- twilio/rest/preview/wireless/sim.py | 164 ++++ twilio/rest/preview/wireless/sim/usage.py | 320 ++----- twilio/rest/pricing/__init__.py | 88 +- .../rest/pricing/v1/.openapi-generator-ignore | 23 + .../rest/pricing/v1/.openapi-generator/FILES | 15 + .../pricing/v1/.openapi-generator/VERSION | 1 + twilio/rest/pricing/v1/messaging.py | 47 + twilio/rest/pricing/v1/messaging/country.py | 356 ++----- twilio/rest/pricing/v1/phone_number.py | 47 + .../rest/pricing/v1/phone_number/country.py | 348 ++----- twilio/rest/pricing/v1/voice.py | 48 + twilio/rest/pricing/v1/voice/country.py | 356 ++----- twilio/rest/pricing/v1/voice/number.py | 282 ++---- .../rest/pricing/v2/.openapi-generator-ignore | 23 + .../rest/pricing/v2/.openapi-generator/FILES | 11 + .../pricing/v2/.openapi-generator/VERSION | 1 + twilio/rest/pricing/v2/country.py | 356 ++----- twilio/rest/pricing/v2/number.py | 295 ++---- twilio/rest/pricing/v2/voice.py | 48 + twilio/rest/pricing/v2/voice/country.py | 356 ++----- twilio/rest/pricing/v2/voice/number.py | 295 ++---- twilio/rest/proxy/__init__.py | 48 +- .../rest/proxy/v1/.openapi-generator-ignore | 23 + twilio/rest/proxy/v1/.openapi-generator/FILES | 15 + .../rest/proxy/v1/.openapi-generator/VERSION | 1 + twilio/rest/proxy/v1/service.py | 185 ++++ twilio/rest/proxy/v1/service/phone_number.py | 528 +++-------- twilio/rest/proxy/v1/service/session.py | 183 ++++ .../proxy/v1/service/session/interaction.py | 576 ++---------- .../proxy/v1/service/session/participant.py | 165 ++++ .../participant/message_interaction.py | 611 ++---------- twilio/rest/proxy/v1/service/short_code.py | 505 +++------- twilio/rest/routes/__init__.py | 54 +- .../rest/routes/v2/.openapi-generator-ignore | 23 + .../rest/routes/v2/.openapi-generator/FILES | 7 + .../rest/routes/v2/.openapi-generator/VERSION | 1 + twilio/rest/routes/v2/phone_number.py | 330 ++----- twilio/rest/routes/v2/sip_domain.py | 330 ++----- twilio/rest/routes/v2/trunk.py | 330 ++----- twilio/rest/serverless/__init__.py | 48 +- .../serverless/v1/.openapi-generator-ignore | 23 + .../serverless/v1/.openapi-generator/FILES | 25 + .../serverless/v1/.openapi-generator/VERSION | 1 + twilio/rest/serverless/v1/service.py | 186 ++++ twilio/rest/serverless/v1/service/asset.py | 171 ++++ .../v1/service/asset/asset_version.py | 414 ++------- twilio/rest/serverless/v1/service/build.py | 164 ++++ .../v1/service/build/build_status.py | 292 ++---- .../rest/serverless/v1/service/environment.py | 171 ++++ .../v1/service/environment/deployment.py | 443 ++------- .../serverless/v1/service/environment/log.py | 483 ++-------- .../v1/service/environment/variable.py | 524 +++-------- twilio/rest/serverless/v1/service/function.py | 171 ++++ .../v1/service/function/function_version.py | 140 +++ .../function_version_content.py | 305 ++---- twilio/rest/studio/__init__.py | 63 +- .../rest/studio/v1/.openapi-generator-ignore | 23 + .../rest/studio/v1/.openapi-generator/FILES | 19 + .../rest/studio/v1/.openapi-generator/VERSION | 1 + twilio/rest/studio/v1/flow.py | 155 ++++ twilio/rest/studio/v1/flow/engagement.py | 167 ++++ .../v1/flow/engagement/engagement_context.py | 279 ++---- twilio/rest/studio/v1/flow/engagement/step.py | 143 +++ .../v1/flow/engagement/step/step_context.py | 297 ++---- twilio/rest/studio/v1/flow/execution.py | 178 ++++ .../v1/flow/execution/execution_context.py | 279 ++---- .../v1/flow/execution/execution_step.py | 143 +++ .../execution_step/execution_step_context.py | 297 ++---- .../rest/studio/v2/.openapi-generator-ignore | 23 + .../rest/studio/v2/.openapi-generator/FILES | 17 + .../rest/studio/v2/.openapi-generator/VERSION | 1 + twilio/rest/studio/v2/flow.py | 186 ++++ twilio/rest/studio/v2/flow/execution.py | 177 ++++ .../v2/flow/execution/execution_context.py | 279 ++---- .../v2/flow/execution/execution_step.py | 143 +++ .../execution_step/execution_step_context.py | 297 ++---- twilio/rest/studio/v2/flow/flow_revision.py | 425 ++------- twilio/rest/studio/v2/flow/flow_test_user.py | 129 +++ twilio/rest/studio/v2/flow_validate.py | 157 +--- twilio/rest/supersim/__init__.py | 72 +- .../supersim/v1/.openapi-generator-ignore | 23 + .../rest/supersim/v1/.openapi-generator/FILES | 25 + .../supersim/v1/.openapi-generator/VERSION | 1 + twilio/rest/supersim/v1/esim_profile.py | 482 ++-------- twilio/rest/supersim/v1/fleet.py | 591 +++--------- twilio/rest/supersim/v1/ip_command.py | 525 ++--------- twilio/rest/supersim/v1/network.py | 381 ++------ .../supersim/v1/network_access_profile.py | 159 ++++ .../network_access_profile_network.py | 443 ++------- twilio/rest/supersim/v1/settings_update.py | 290 +----- twilio/rest/supersim/v1/sim.py | 166 ++++ twilio/rest/supersim/v1/sim/billing_period.py | 270 +----- twilio/rest/supersim/v1/sim/sim_ip_address.py | 223 +---- twilio/rest/supersim/v1/sms_command.py | 467 ++-------- twilio/rest/supersim/v1/usage_record.py | 376 +------- twilio/rest/sync/__init__.py | 48 +- twilio/rest/sync/v1/.openapi-generator-ignore | 23 + twilio/rest/sync/v1/.openapi-generator/FILES | 23 + .../rest/sync/v1/.openapi-generator/VERSION | 1 + twilio/rest/sync/v1/service.py | 189 ++++ twilio/rest/sync/v1/service/document.py | 175 ++++ .../service/document/document_permission.py | 474 ++-------- twilio/rest/sync/v1/service/sync_list.py | 178 ++++ .../v1/service/sync_list/sync_list_item.py | 596 +++--------- .../service/sync_list/sync_list_permission.py | 474 ++-------- twilio/rest/sync/v1/service/sync_map.py | 178 ++++ .../sync/v1/service/sync_map/sync_map_item.py | 598 +++--------- .../service/sync_map/sync_map_permission.py | 474 ++-------- twilio/rest/sync/v1/service/sync_stream.py | 173 ++++ .../v1/service/sync_stream/stream_message.py | 169 ++-- twilio/rest/taskrouter/__init__.py | 48 +- .../taskrouter/v1/.openapi-generator-ignore | 23 + .../taskrouter/v1/.openapi-generator/FILES | 51 + .../taskrouter/v1/.openapi-generator/VERSION | 1 + twilio/rest/taskrouter/v1/workspace.py | 214 +++++ .../rest/taskrouter/v1/workspace/activity.py | 508 +++------- twilio/rest/taskrouter/v1/workspace/event.py | 560 ++--------- twilio/rest/taskrouter/v1/workspace/task.py | 184 ++++ .../v1/workspace/task/reservation.py | 805 ++-------------- .../taskrouter/v1/workspace/task_channel.py | 514 +++------- .../taskrouter/v1/workspace/task_queue.py | 187 ++++ .../task_queue_cumulative_statistics.py | 477 ++-------- .../task_queue_real_time_statistics.py | 374 ++------ .../task_queue/task_queue_statistics.py | 318 ++----- .../task_queue/task_queues_statistics.py | 297 +----- twilio/rest/taskrouter/v1/workspace/worker.py | 187 ++++ .../v1/workspace/worker/reservation.py | 774 ++-------------- .../v1/workspace/worker/worker_channel.py | 492 ++-------- .../v1/workspace/worker/worker_statistics.py | 302 ++---- .../worker/workers_cumulative_statistics.py | 361 ++------ .../worker/workers_real_time_statistics.py | 274 ++---- .../v1/workspace/worker/workers_statistics.py | 302 ++---- .../rest/taskrouter/v1/workspace/workflow.py | 184 ++++ .../workflow_cumulative_statistics.py | 477 ++-------- .../workflow/workflow_real_time_statistics.py | 324 ++----- .../workspace/workflow/workflow_statistics.py | 318 ++----- .../workspace_cumulative_statistics.py | 457 ++------- .../workspace_real_time_statistics.py | 324 ++----- .../v1/workspace/workspace_statistics.py | 292 ++---- twilio/rest/trunking/__init__.py | 48 +- .../trunking/v1/.openapi-generator-ignore | 23 + .../rest/trunking/v1/.openapi-generator/FILES | 13 + .../trunking/v1/.openapi-generator/VERSION | 1 + twilio/rest/trunking/v1/trunk.py | 196 ++++ .../rest/trunking/v1/trunk/credential_list.py | 429 +++------ .../v1/trunk/ip_access_control_list.py | 429 +++------ .../rest/trunking/v1/trunk/origination_url.py | 541 +++-------- twilio/rest/trunking/v1/trunk/phone_number.py | 625 +++---------- twilio/rest/trunking/v1/trunk/recording.py | 279 ++---- twilio/rest/trusthub/__init__.py | 66 +- .../trusthub/v1/.openapi-generator-ignore | 23 + .../rest/trusthub/v1/.openapi-generator/FILES | 27 + .../trusthub/v1/.openapi-generator/VERSION | 1 + twilio/rest/trusthub/v1/customer_profiles.py | 183 ++++ ...er_profiles_channel_endpoint_assignment.py | 472 ++-------- .../customer_profiles_entity_assignments.py | 434 ++------- .../customer_profiles_evaluations.py | 429 ++------- twilio/rest/trusthub/v1/end_user.py | 477 +++------- twilio/rest/trusthub/v1/end_user_type.py | 348 ++----- twilio/rest/trusthub/v1/policies.py | 344 ++----- .../rest/trusthub/v1/supporting_document.py | 505 +++------- .../trusthub/v1/supporting_document_type.py | 348 ++----- twilio/rest/trusthub/v1/trust_products.py | 183 ++++ ...st_products_channel_endpoint_assignment.py | 473 +++------- .../trust_products_entity_assignments.py | 435 ++------- .../trust_products_evaluations.py | 430 ++------- twilio/rest/verify/__init__.py | 75 +- .../rest/verify/v2/.openapi-generator-ignore | 23 + .../rest/verify/v2/.openapi-generator/FILES | 37 + .../rest/verify/v2/.openapi-generator/VERSION | 1 + twilio/rest/verify/v2/form.py | 263 ++---- twilio/rest/verify/v2/safelist.py | 303 ++---- twilio/rest/verify/v2/service.py | 205 ++++ twilio/rest/verify/v2/service/access_token.py | 351 ++----- twilio/rest/verify/v2/service/entity.py | 168 ++++ .../verify/v2/service/entity/challenge.py | 170 ++++ .../service/entity/challenge/notification.py | 246 ++--- .../rest/verify/v2/service/entity/factor.py | 581 +++--------- .../verify/v2/service/entity/new_factor.py | 344 ++----- .../v2/service/messaging_configuration.py | 484 +++------- twilio/rest/verify/v2/service/rate_limit.py | 172 ++++ .../verify/v2/service/rate_limit/bucket.py | 516 +++-------- twilio/rest/verify/v2/service/verification.py | 471 ++-------- .../verify/v2/service/verification_check.py | 279 ++---- twilio/rest/verify/v2/service/webhook.py | 561 +++-------- twilio/rest/verify/v2/template.py | 246 +---- twilio/rest/verify/v2/verification_attempt.py | 513 ++-------- .../v2/verification_attempts_summary.py | 295 ++---- twilio/rest/video/__init__.py | 63 +- .../rest/video/v1/.openapi-generator-ignore | 23 + twilio/rest/video/v1/.openapi-generator/FILES | 27 + .../rest/video/v1/.openapi-generator/VERSION | 1 + twilio/rest/video/v1/composition.py | 169 ++++ twilio/rest/video/v1/composition_hook.py | 652 +++---------- twilio/rest/video/v1/composition_settings.py | 344 ++----- twilio/rest/video/v1/recording.py | 156 ++++ twilio/rest/video/v1/recording_settings.py | 344 ++----- twilio/rest/video/v1/room.py | 184 ++++ twilio/rest/video/v1/room/participant.py | 166 ++++ .../video/v1/room/participant/anonymize.py | 120 +++ .../v1/room/participant/published_track.py | 136 +++ .../v1/room/participant/subscribe_rules.py | 91 ++ .../v1/room/participant/subscribed_track.py | 137 +++ twilio/rest/video/v1/room/recording_rules.py | 90 ++ twilio/rest/video/v1/room/room_recording.py | 155 ++++ twilio/rest/voice/__init__.py | 63 +- .../rest/voice/v1/.openapi-generator-ignore | 23 + twilio/rest/voice/v1/.openapi-generator/FILES | 23 + .../rest/voice/v1/.openapi-generator/VERSION | 1 + twilio/rest/voice/v1/archived_call.py | 242 +---- twilio/rest/voice/v1/byoc_trunk.py | 615 +++--------- twilio/rest/voice/v1/connection_policy.py | 170 ++++ .../connection_policy_target.py | 555 +++-------- twilio/rest/voice/v1/dialing_permissions.py | 49 + .../bulk_country_update.py | 167 ++-- .../voice/v1/dialing_permissions/country.py | 140 +++ .../country/highrisk_special_prefix.py | 211 +---- .../voice/v1/dialing_permissions/settings.py | 274 ++---- twilio/rest/voice/v1/ip_record.py | 477 +++------- twilio/rest/voice/v1/source_ip_mapping.py | 451 +++------ twilio/rest/wireless/__init__.py | 69 +- .../wireless/v1/.openapi-generator-ignore | 23 + .../rest/wireless/v1/.openapi-generator/FILES | 13 + .../wireless/v1/.openapi-generator/VERSION | 1 + twilio/rest/wireless/v1/command.py | 544 +++-------- twilio/rest/wireless/v1/rate_plan.py | 583 +++--------- twilio/rest/wireless/v1/sim.py | 181 ++++ twilio/rest/wireless/v1/sim/data_session.py | 338 +------ twilio/rest/wireless/v1/sim/usage_record.py | 269 +----- twilio/rest/wireless/v1/usage_record.py | 258 +----- 623 files changed, 53966 insertions(+), 100216 deletions(-) create mode 100644 twilio/rest/accounts/v1/.openapi-generator-ignore create mode 100644 twilio/rest/accounts/v1/.openapi-generator/FILES create mode 100644 twilio/rest/accounts/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/accounts/v1/credential.py create mode 100644 twilio/rest/api/v2010/.openapi-generator-ignore create mode 100644 twilio/rest/api/v2010/.openapi-generator/FILES create mode 100644 twilio/rest/api/v2010/.openapi-generator/VERSION create mode 100644 twilio/rest/api/v2010/account.py create mode 100644 twilio/rest/api/v2010/account/address.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country/local.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country/mobile.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country/national.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py create mode 100644 twilio/rest/api/v2010/account/available_phone_number_country/voip.py create mode 100644 twilio/rest/api/v2010/account/call.py create mode 100644 twilio/rest/api/v2010/account/conference.py create mode 100644 twilio/rest/api/v2010/account/incoming_phone_number.py create mode 100644 twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on.py create mode 100644 twilio/rest/api/v2010/account/message.py create mode 100644 twilio/rest/api/v2010/account/queue.py create mode 100644 twilio/rest/api/v2010/account/recording.py create mode 100644 twilio/rest/api/v2010/account/recording/add_on_result.py create mode 100644 twilio/rest/api/v2010/account/recording/add_on_result/payload.py create mode 100644 twilio/rest/api/v2010/account/sip.py create mode 100644 twilio/rest/api/v2010/account/sip/credential_list.py create mode 100644 twilio/rest/api/v2010/account/sip/domain.py create mode 100644 twilio/rest/api/v2010/account/sip/domain/auth_types.py create mode 100644 twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.py create mode 100644 twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py create mode 100644 twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py create mode 100644 twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.py create mode 100644 twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py create mode 100644 twilio/rest/api/v2010/account/sip/ip_access_control_list.py create mode 100644 twilio/rest/api/v2010/account/usage.py create mode 100644 twilio/rest/api/v2010/account/usage/record.py create mode 100644 twilio/rest/autopilot/v1/.openapi-generator-ignore create mode 100644 twilio/rest/autopilot/v1/.openapi-generator/FILES create mode 100644 twilio/rest/autopilot/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/autopilot/v1/assistant.py create mode 100644 twilio/rest/autopilot/v1/assistant/field_type.py create mode 100644 twilio/rest/autopilot/v1/assistant/task.py create mode 100644 twilio/rest/bulkexports/v1/.openapi-generator-ignore create mode 100644 twilio/rest/bulkexports/v1/.openapi-generator/FILES create mode 100644 twilio/rest/bulkexports/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/bulkexports/v1/export.py create mode 100644 twilio/rest/chat/v1/.openapi-generator-ignore create mode 100644 twilio/rest/chat/v1/.openapi-generator/FILES create mode 100644 twilio/rest/chat/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/chat/v1/service.py create mode 100644 twilio/rest/chat/v1/service/channel.py create mode 100644 twilio/rest/chat/v1/service/user.py create mode 100644 twilio/rest/chat/v2/.openapi-generator-ignore create mode 100644 twilio/rest/chat/v2/.openapi-generator/FILES create mode 100644 twilio/rest/chat/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/chat/v2/service.py create mode 100644 twilio/rest/chat/v2/service/channel.py create mode 100644 twilio/rest/chat/v2/service/user.py create mode 100644 twilio/rest/chat/v3/.openapi-generator-ignore create mode 100644 twilio/rest/chat/v3/.openapi-generator/FILES create mode 100644 twilio/rest/chat/v3/.openapi-generator/VERSION create mode 100644 twilio/rest/content/v1/.openapi-generator-ignore create mode 100644 twilio/rest/content/v1/.openapi-generator/FILES create mode 100644 twilio/rest/content/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/content/v1/content.py create mode 100644 twilio/rest/conversations/v1/.openapi-generator-ignore create mode 100644 twilio/rest/conversations/v1/.openapi-generator/FILES create mode 100644 twilio/rest/conversations/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/conversations/v1/configuration.py create mode 100644 twilio/rest/conversations/v1/conversation.py create mode 100644 twilio/rest/conversations/v1/conversation/message.py create mode 100644 twilio/rest/conversations/v1/service.py create mode 100644 twilio/rest/conversations/v1/service/configuration.py create mode 100644 twilio/rest/conversations/v1/service/conversation.py create mode 100644 twilio/rest/conversations/v1/service/conversation/message.py create mode 100644 twilio/rest/conversations/v1/service/user.py create mode 100644 twilio/rest/conversations/v1/user.py create mode 100644 twilio/rest/events/v1/.openapi-generator-ignore create mode 100644 twilio/rest/events/v1/.openapi-generator/FILES create mode 100644 twilio/rest/events/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/events/v1/schema.py create mode 100644 twilio/rest/events/v1/schema/schema_version.py create mode 100644 twilio/rest/events/v1/sink.py create mode 100644 twilio/rest/events/v1/subscription.py create mode 100644 twilio/rest/flexApi/__init__.py create mode 100644 twilio/rest/flexApi/v1/.openapi-generator-ignore create mode 100644 twilio/rest/flexApi/v1/.openapi-generator/FILES create mode 100644 twilio/rest/flexApi/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/flexApi/v1/assessments.py create mode 100644 twilio/rest/flexApi/v1/channel.py create mode 100644 twilio/rest/flexApi/v1/configuration.py create mode 100644 twilio/rest/flexApi/v1/flex_flow.py create mode 100644 twilio/rest/flexApi/v1/good_data.py create mode 100644 twilio/rest/flexApi/v1/interaction.py create mode 100644 twilio/rest/flexApi/v1/interaction/interaction_channel.py create mode 100644 twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_invite.py create mode 100644 twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_participant.py create mode 100644 twilio/rest/flexApi/v1/user_roles.py create mode 100644 twilio/rest/flexApi/v1/web_channel.py create mode 100644 twilio/rest/flexApi/v2/.openapi-generator-ignore create mode 100644 twilio/rest/flexApi/v2/.openapi-generator/FILES create mode 100644 twilio/rest/flexApi/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/flexApi/v2/web_channels.py create mode 100644 twilio/rest/frontlineApi/__init__.py create mode 100644 twilio/rest/frontlineApi/v1/.openapi-generator-ignore create mode 100644 twilio/rest/frontlineApi/v1/.openapi-generator/FILES create mode 100644 twilio/rest/frontlineApi/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/frontlineApi/v1/user.py create mode 100644 twilio/rest/insights/v1/.openapi-generator-ignore create mode 100644 twilio/rest/insights/v1/.openapi-generator/FILES create mode 100644 twilio/rest/insights/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/insights/v1/call.py create mode 100644 twilio/rest/insights/v1/call/call_summary.py create mode 100644 twilio/rest/insights/v1/conference.py create mode 100644 twilio/rest/insights/v1/room.py create mode 100644 twilio/rest/ipMessaging/__init__.py create mode 100644 twilio/rest/ipMessaging/v1/.openapi-generator-ignore create mode 100644 twilio/rest/ipMessaging/v1/.openapi-generator/FILES create mode 100644 twilio/rest/ipMessaging/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/ipMessaging/v1/credential.py create mode 100644 twilio/rest/ipMessaging/v1/service.py create mode 100644 twilio/rest/ipMessaging/v1/service/channel.py create mode 100644 twilio/rest/ipMessaging/v1/service/channel/invite.py create mode 100644 twilio/rest/ipMessaging/v1/service/channel/member.py create mode 100644 twilio/rest/ipMessaging/v1/service/channel/message.py create mode 100644 twilio/rest/ipMessaging/v1/service/role.py create mode 100644 twilio/rest/ipMessaging/v1/service/user.py create mode 100644 twilio/rest/ipMessaging/v1/service/user/user_channel.py create mode 100644 twilio/rest/ipMessaging/v2/.openapi-generator-ignore create mode 100644 twilio/rest/ipMessaging/v2/.openapi-generator/FILES create mode 100644 twilio/rest/ipMessaging/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/ipMessaging/v2/credential.py create mode 100644 twilio/rest/ipMessaging/v2/service.py create mode 100644 twilio/rest/ipMessaging/v2/service/binding.py create mode 100644 twilio/rest/ipMessaging/v2/service/channel.py create mode 100644 twilio/rest/ipMessaging/v2/service/channel/invite.py create mode 100644 twilio/rest/ipMessaging/v2/service/channel/member.py create mode 100644 twilio/rest/ipMessaging/v2/service/channel/message.py create mode 100644 twilio/rest/ipMessaging/v2/service/channel/webhook.py create mode 100644 twilio/rest/ipMessaging/v2/service/role.py create mode 100644 twilio/rest/ipMessaging/v2/service/user.py create mode 100644 twilio/rest/ipMessaging/v2/service/user/user_binding.py create mode 100644 twilio/rest/ipMessaging/v2/service/user/user_channel.py create mode 100644 twilio/rest/lookups/v1/.openapi-generator-ignore create mode 100644 twilio/rest/lookups/v1/.openapi-generator/FILES create mode 100644 twilio/rest/lookups/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/lookups/v2/.openapi-generator-ignore create mode 100644 twilio/rest/lookups/v2/.openapi-generator/FILES create mode 100644 twilio/rest/lookups/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/media/v1/.openapi-generator-ignore create mode 100644 twilio/rest/media/v1/.openapi-generator/FILES create mode 100644 twilio/rest/media/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/media/v1/media_recording.py create mode 100644 twilio/rest/media/v1/player_streamer.py create mode 100644 twilio/rest/messaging/v1/.openapi-generator-ignore create mode 100644 twilio/rest/messaging/v1/.openapi-generator/FILES create mode 100644 twilio/rest/messaging/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/messaging/v1/brand_registration.py create mode 100644 twilio/rest/messaging/v1/deactivations.py create mode 100644 twilio/rest/messaging/v1/domain_certs.py create mode 100644 twilio/rest/messaging/v1/service.py create mode 100644 twilio/rest/microvisor/v1/.openapi-generator-ignore create mode 100644 twilio/rest/microvisor/v1/.openapi-generator/FILES create mode 100644 twilio/rest/microvisor/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/microvisor/v1/device.py create mode 100644 twilio/rest/monitor/v1/.openapi-generator-ignore create mode 100644 twilio/rest/monitor/v1/.openapi-generator/FILES create mode 100644 twilio/rest/monitor/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/notify/v1/.openapi-generator-ignore create mode 100644 twilio/rest/notify/v1/.openapi-generator/FILES create mode 100644 twilio/rest/notify/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/notify/v1/service.py create mode 100644 twilio/rest/numbers/v2/.openapi-generator-ignore create mode 100644 twilio/rest/numbers/v2/.openapi-generator/FILES create mode 100644 twilio/rest/numbers/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/numbers/v2/regulatory_compliance.py create mode 100644 twilio/rest/numbers/v2/regulatory_compliance/bundle.py create mode 100644 twilio/rest/oauth/v1/.openapi-generator-ignore create mode 100644 twilio/rest/oauth/v1/.openapi-generator/FILES create mode 100644 twilio/rest/oauth/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/preview/.openapi-generator-ignore create mode 100644 twilio/rest/preview/.openapi-generator/FILES create mode 100644 twilio/rest/preview/.openapi-generator/VERSION create mode 100644 twilio/rest/preview/DeployedDevices.py create mode 100644 twilio/rest/preview/HostedNumbers.py create mode 100644 twilio/rest/preview/Marketplace.py create mode 100644 twilio/rest/preview/Sync.py create mode 100644 twilio/rest/preview/Understand.py create mode 100644 twilio/rest/preview/Wireless.py create mode 100644 twilio/rest/preview/deployed_devices/fleet.py create mode 100644 twilio/rest/preview/hosted_numbers/authorization_document.py create mode 100644 twilio/rest/preview/marketplace/available_add_on.py create mode 100644 twilio/rest/preview/marketplace/installed_add_on.py create mode 100644 twilio/rest/preview/sync/service.py create mode 100644 twilio/rest/preview/sync/service/document.py create mode 100644 twilio/rest/preview/sync/service/sync_list.py create mode 100644 twilio/rest/preview/sync/service/sync_map.py create mode 100644 twilio/rest/preview/understand/assistant.py create mode 100644 twilio/rest/preview/understand/assistant/field_type.py create mode 100644 twilio/rest/preview/understand/assistant/task.py create mode 100644 twilio/rest/preview/wireless/sim.py create mode 100644 twilio/rest/pricing/v1/.openapi-generator-ignore create mode 100644 twilio/rest/pricing/v1/.openapi-generator/FILES create mode 100644 twilio/rest/pricing/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/pricing/v1/messaging.py create mode 100644 twilio/rest/pricing/v1/phone_number.py create mode 100644 twilio/rest/pricing/v1/voice.py create mode 100644 twilio/rest/pricing/v2/.openapi-generator-ignore create mode 100644 twilio/rest/pricing/v2/.openapi-generator/FILES create mode 100644 twilio/rest/pricing/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/pricing/v2/voice.py create mode 100644 twilio/rest/proxy/v1/.openapi-generator-ignore create mode 100644 twilio/rest/proxy/v1/.openapi-generator/FILES create mode 100644 twilio/rest/proxy/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/proxy/v1/service.py create mode 100644 twilio/rest/proxy/v1/service/session.py create mode 100644 twilio/rest/proxy/v1/service/session/participant.py create mode 100644 twilio/rest/routes/v2/.openapi-generator-ignore create mode 100644 twilio/rest/routes/v2/.openapi-generator/FILES create mode 100644 twilio/rest/routes/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/serverless/v1/.openapi-generator-ignore create mode 100644 twilio/rest/serverless/v1/.openapi-generator/FILES create mode 100644 twilio/rest/serverless/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/serverless/v1/service.py create mode 100644 twilio/rest/serverless/v1/service/asset.py create mode 100644 twilio/rest/serverless/v1/service/build.py create mode 100644 twilio/rest/serverless/v1/service/environment.py create mode 100644 twilio/rest/serverless/v1/service/function.py create mode 100644 twilio/rest/serverless/v1/service/function/function_version.py create mode 100644 twilio/rest/studio/v1/.openapi-generator-ignore create mode 100644 twilio/rest/studio/v1/.openapi-generator/FILES create mode 100644 twilio/rest/studio/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/studio/v1/flow.py create mode 100644 twilio/rest/studio/v1/flow/engagement.py create mode 100644 twilio/rest/studio/v1/flow/engagement/step.py create mode 100644 twilio/rest/studio/v1/flow/execution.py create mode 100644 twilio/rest/studio/v1/flow/execution/execution_step.py create mode 100644 twilio/rest/studio/v2/.openapi-generator-ignore create mode 100644 twilio/rest/studio/v2/.openapi-generator/FILES create mode 100644 twilio/rest/studio/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/studio/v2/flow.py create mode 100644 twilio/rest/studio/v2/flow/execution.py create mode 100644 twilio/rest/studio/v2/flow/execution/execution_step.py create mode 100644 twilio/rest/studio/v2/flow/flow_test_user.py create mode 100644 twilio/rest/supersim/v1/.openapi-generator-ignore create mode 100644 twilio/rest/supersim/v1/.openapi-generator/FILES create mode 100644 twilio/rest/supersim/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/supersim/v1/network_access_profile.py create mode 100644 twilio/rest/supersim/v1/sim.py create mode 100644 twilio/rest/sync/v1/.openapi-generator-ignore create mode 100644 twilio/rest/sync/v1/.openapi-generator/FILES create mode 100644 twilio/rest/sync/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/sync/v1/service.py create mode 100644 twilio/rest/sync/v1/service/document.py create mode 100644 twilio/rest/sync/v1/service/sync_list.py create mode 100644 twilio/rest/sync/v1/service/sync_map.py create mode 100644 twilio/rest/sync/v1/service/sync_stream.py create mode 100644 twilio/rest/taskrouter/v1/.openapi-generator-ignore create mode 100644 twilio/rest/taskrouter/v1/.openapi-generator/FILES create mode 100644 twilio/rest/taskrouter/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/taskrouter/v1/workspace.py create mode 100644 twilio/rest/taskrouter/v1/workspace/task.py create mode 100644 twilio/rest/taskrouter/v1/workspace/task_queue.py create mode 100644 twilio/rest/taskrouter/v1/workspace/worker.py create mode 100644 twilio/rest/taskrouter/v1/workspace/workflow.py create mode 100644 twilio/rest/trunking/v1/.openapi-generator-ignore create mode 100644 twilio/rest/trunking/v1/.openapi-generator/FILES create mode 100644 twilio/rest/trunking/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/trunking/v1/trunk.py create mode 100644 twilio/rest/trusthub/v1/.openapi-generator-ignore create mode 100644 twilio/rest/trusthub/v1/.openapi-generator/FILES create mode 100644 twilio/rest/trusthub/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/trusthub/v1/customer_profiles.py create mode 100644 twilio/rest/trusthub/v1/trust_products.py create mode 100644 twilio/rest/verify/v2/.openapi-generator-ignore create mode 100644 twilio/rest/verify/v2/.openapi-generator/FILES create mode 100644 twilio/rest/verify/v2/.openapi-generator/VERSION create mode 100644 twilio/rest/verify/v2/service.py create mode 100644 twilio/rest/verify/v2/service/entity.py create mode 100644 twilio/rest/verify/v2/service/entity/challenge.py create mode 100644 twilio/rest/verify/v2/service/rate_limit.py create mode 100644 twilio/rest/video/v1/.openapi-generator-ignore create mode 100644 twilio/rest/video/v1/.openapi-generator/FILES create mode 100644 twilio/rest/video/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/video/v1/composition.py create mode 100644 twilio/rest/video/v1/recording.py create mode 100644 twilio/rest/video/v1/room.py create mode 100644 twilio/rest/video/v1/room/participant.py create mode 100644 twilio/rest/video/v1/room/participant/anonymize.py create mode 100644 twilio/rest/video/v1/room/participant/published_track.py create mode 100644 twilio/rest/video/v1/room/participant/subscribe_rules.py create mode 100644 twilio/rest/video/v1/room/participant/subscribed_track.py create mode 100644 twilio/rest/video/v1/room/recording_rules.py create mode 100644 twilio/rest/video/v1/room/room_recording.py create mode 100644 twilio/rest/voice/v1/.openapi-generator-ignore create mode 100644 twilio/rest/voice/v1/.openapi-generator/FILES create mode 100644 twilio/rest/voice/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/voice/v1/connection_policy.py create mode 100644 twilio/rest/voice/v1/dialing_permissions.py create mode 100644 twilio/rest/voice/v1/dialing_permissions/country.py create mode 100644 twilio/rest/wireless/v1/.openapi-generator-ignore create mode 100644 twilio/rest/wireless/v1/.openapi-generator/FILES create mode 100644 twilio/rest/wireless/v1/.openapi-generator/VERSION create mode 100644 twilio/rest/wireless/v1/sim.py diff --git a/twilio/rest/accounts/__init__.py b/twilio/rest/accounts/__init__.py index 191c8b4507..1298221549 100644 --- a/twilio/rest/accounts/__init__.py +++ b/twilio/rest/accounts/__init__.py @@ -1,66 +1,70 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.accounts.v1 import V1 + Twilio - Accounts + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Accounts(Domain): +from twilio.base.domain import Domain +from twilio.rest.Accounts.v1 import V1 +class Accounts(Domain): def __init__(self, twilio): """ Initialize the Accounts Domain :returns: Domain for Accounts - :rtype: twilio.rest.accounts.Accounts + :rtype: twilio.rest.v1.Accounts """ super(Accounts, self).__init__(twilio) - - self.base_url = 'https://accounts.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Accounts.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of accounts - :rtype: twilio.rest.accounts.v1.V1 + :returns: Versions v1 of Accounts + :rtype: twilio.rest.Accounts.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def auth_token_promotion(self): """ - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionList + :rtype: twilio.rest.v1.auth_token_promotion """ return self.v1.auth_token_promotion + @property def credentials(self): """ - :rtype: twilio.rest.accounts.v1.credential.CredentialList + :rtype: twilio.rest.v1.credentials """ return self.v1.credentials + @property def secondary_auth_token(self): """ - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenList + :rtype: twilio.rest.v1.secondary_auth_token """ return self.v1.secondary_auth_token + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/accounts/v1/.openapi-generator-ignore b/twilio/rest/accounts/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/accounts/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/accounts/v1/.openapi-generator/FILES b/twilio/rest/accounts/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..5374914e31 --- /dev/null +++ b/twilio/rest/accounts/v1/.openapi-generator/FILES @@ -0,0 +1,11 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +auth_token_promotion.py +credential.py +credential/aws.py +credential/public_key.py +secondary_auth_token.py diff --git a/twilio/rest/accounts/v1/.openapi-generator/VERSION b/twilio/rest/accounts/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/accounts/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/accounts/v1/auth_token_promotion.py b/twilio/rest/accounts/v1/auth_token_promotion.py index 7d807f54de..126d3f717d 100644 --- a/twilio/rest/accounts/v1/auth_token_promotion.py +++ b/twilio/rest/accounts/v1/auth_token_promotion.py @@ -1,232 +1,114 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Accounts + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AuthTokenPromotionList(ListResource): - - def __init__(self, version): - """ - Initialize the AuthTokenPromotionList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionList - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionList - """ - super(AuthTokenPromotionList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a AuthTokenPromotionContext - - :returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext - """ - return AuthTokenPromotionContext(self._version, ) - - def __call__(self): - """ - Constructs a AuthTokenPromotionContext - - :returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext - """ - return AuthTokenPromotionContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthTokenPromotionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthTokenPromotionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionPage - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionPage - """ - super(AuthTokenPromotionPage, self).__init__(version, response) - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthTokenPromotionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance - """ - return AuthTokenPromotionInstance(self._version, payload, ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AuthTokenPromotionContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the AuthTokenPromotionContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext - """ - super(AuthTokenPromotionContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AuthTokenPromotionContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/AuthTokens/Promote'.format(**self._solution) - - def update(self): - """ - Update the AuthTokenPromotionInstance - - :returns: The updated AuthTokenPromotionInstance - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance - """ - payload = self._version.update(method='POST', uri=self._uri, ) - - return AuthTokenPromotionInstance(self._version, payload, ) + self._solution = { } + self._uri = '/AuthTokens/Promote' + + + def update(self): + data = values.of({ + + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AuthTokenPromotionInstance(self._version, payload, ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AuthTokenPromotionInstance(InstanceResource): +class AuthTokenPromotionInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the AuthTokenPromotionInstance - - :returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance - """ super(AuthTokenPromotionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'auth_token': payload.get('auth_token'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'auth_token' = payload.get('auth_token'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthTokenPromotionContext for this AuthTokenPromotionInstance - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext - """ if self._context is None: - self._context = AuthTokenPromotionContext(self._version, ) + self._context = AuthTokenPromotionContext( + self._version, + + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that the secondary Auth Token was created for - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def auth_token(self): - """ - :returns: The promoted Auth Token - :rtype: unicode - """ - return self._properties['auth_token'] + - @property - def date_created(self): + def __repr__(self): """ - :returns: The ISO 8601 formatted date and time in UTC when the resource was created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The ISO 8601 formatted date and time in UTC when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - :rtype: unicode - """ - return self._properties['url'] - def update(self): - """ - Update the AuthTokenPromotionInstance +class AuthTokenPromotionListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AuthTokenPromotionListInstanceList, self).__init__(version) - :returns: The updated AuthTokenPromotionInstance - :rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance - """ - return self._proxy.update() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/accounts/v1/credential.py b/twilio/rest/accounts/v1/credential.py new file mode 100644 index 0000000000..2cbcab3c71 --- /dev/null +++ b/twilio/rest/accounts/v1/credential.py @@ -0,0 +1,48 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Accounts + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.credential.aws import AwsListInstancefrom twilio.rest.credential.public_key import PublicKeyListInstance + + + + +class CredentialListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Credentials' + + self._aws = None + self._public_key = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py index e365ff1130..ac61e478fb 100644 --- a/twilio/rest/accounts/v1/credential/aws.py +++ b/twilio/rest/accounts/v1/credential/aws.py @@ -1,390 +1,165 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Accounts + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AwsList(ListResource): - - def __init__(self, version): - """ - Initialize the AwsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.credential.aws.AwsList - :rtype: twilio.rest.accounts.v1.credential.aws.AwsList - """ - super(AwsList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials/AWS'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AwsInstance 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 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.accounts.v1.credential.aws.AwsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AwsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.accounts.v1.credential.aws.AwsInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AwsInstance records from the API. - Request is executed immediately - - :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 AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AwsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AwsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AwsPage(self._version, response, self._solution) - - def create(self, credentials, friendly_name=values.unset, - account_sid=values.unset): - """ - Create the AwsInstance - - :param unicode credentials: A string that contains the AWS access credentials in the format : - :param unicode friendly_name: A string to describe the resource - :param unicode account_sid: The Subaccount this Credential should be associated with. - :returns: The created AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - data = values.of({ - 'Credentials': credentials, - 'FriendlyName': friendly_name, - 'AccountSid': account_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AwsInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a AwsContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.accounts.v1.credential.aws.AwsContext - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ - return AwsContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AwsContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.accounts.v1.credential.aws.AwsContext - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ - return AwsContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AwsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AwsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.accounts.v1.credential.aws.AwsPage - :rtype: twilio.rest.accounts.v1.credential.aws.AwsPage - """ - super(AwsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of AwsInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.accounts.v1.credential.aws.AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - return AwsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AwsContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the AwsContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.accounts.v1.credential.aws.AwsContext - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ - super(AwsContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(AwsContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/AWS/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AwsInstance - - :returns: The fetched AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AwsInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset): - """ - Update the AwsInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The updated AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return AwsInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the AwsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Credentials/AWS/${sid}' + + + def delete(self): + + + """ + Deletes the AwsInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AwsInstance + + :returns: The fetched AwsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AwsInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AwsInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AwsInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the AwsInstance - - :returns: twilio.rest.accounts.v1.credential.aws.AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ +class AwsInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(AwsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AwsContext for this AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsContext - """ if self._context is None: - self._context = AwsContext(self._version, sid=self._solution['sid'], ) + self._context = AwsContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the AwsInstance - - :returns: The fetched AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the AwsInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the resource - :returns: The updated AwsInstance - :rtype: twilio.rest.accounts.v1.credential.aws.AwsInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - def delete(self): - """ - Deletes the AwsInstance +class AwsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AwsListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/Credentials/AWS' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AwsInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AwsPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py index d9425c48c2..4e58ffdff5 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -1,390 +1,165 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Accounts + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PublicKeyList(ListResource): - - def __init__(self, version): - """ - Initialize the PublicKeyList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - """ - super(PublicKeyList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials/PublicKeys'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams PublicKeyInstance 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 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.accounts.v1.credential.public_key.PublicKeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PublicKeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.accounts.v1.credential.public_key.PublicKeyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PublicKeyInstance records from the API. - Request is executed immediately - - :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 PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PublicKeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PublicKeyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PublicKeyPage(self._version, response, self._solution) - - def create(self, public_key, friendly_name=values.unset, - account_sid=values.unset): - """ - Create the PublicKeyInstance - - :param unicode public_key: A URL encoded representation of the public key - :param unicode friendly_name: A string to describe the resource - :param unicode account_sid: The Subaccount this Credential should be associated with. - :returns: The created PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - data = values.of({ - 'PublicKey': public_key, - 'FriendlyName': friendly_name, - 'AccountSid': account_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return PublicKeyInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a PublicKeyContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ - return PublicKeyContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PublicKeyContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ - return PublicKeyContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PublicKeyPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PublicKeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyPage - """ - super(PublicKeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of PublicKeyInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - return PublicKeyInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class PublicKeyContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the PublicKeyContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ - super(PublicKeyContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(PublicKeyContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/PublicKeys/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the PublicKeyInstance - - :returns: The fetched PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PublicKeyInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset): - """ - Update the PublicKeyInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The updated PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return PublicKeyInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the PublicKeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Credentials/PublicKeys/${sid}' + + + def delete(self): + + + """ + Deletes the PublicKeyInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the PublicKeyInstance + + :returns: The fetched PublicKeyInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PublicKeyInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return PublicKeyInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PublicKeyInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the PublicKeyInstance - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ +class PublicKeyInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(PublicKeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PublicKeyContext for this PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyContext - """ if self._context is None: - self._context = PublicKeyContext(self._version, sid=self._solution['sid'], ) + self._context = PublicKeyContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Credential that the PublicKey resource belongs to - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the PublicKeyInstance - - :returns: The fetched PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the PublicKeyInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the resource - :returns: The updated PublicKeyInstance - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - def delete(self): - """ - Deletes the PublicKeyInstance +class PublicKeyListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(PublicKeyListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/Credentials/PublicKeys' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return PublicKeyInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PublicKeyPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/accounts/v1/secondary_auth_token.py b/twilio/rest/accounts/v1/secondary_auth_token.py index 1221ee0e3a..d8ae780c1b 100644 --- a/twilio/rest/accounts/v1/secondary_auth_token.py +++ b/twilio/rest/accounts/v1/secondary_auth_token.py @@ -1,250 +1,119 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Accounts + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SecondaryAuthTokenList(ListResource): - - def __init__(self, version): - """ - Initialize the SecondaryAuthTokenList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenList - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenList - """ - super(SecondaryAuthTokenList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a SecondaryAuthTokenContext - - :returns: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenContext - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenContext - """ - return SecondaryAuthTokenContext(self._version, ) - - def __call__(self): - """ - Constructs a SecondaryAuthTokenContext - - :returns: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenContext - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenContext - """ - return SecondaryAuthTokenContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SecondaryAuthTokenPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SecondaryAuthTokenPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenPage - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenPage - """ - super(SecondaryAuthTokenPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SecondaryAuthTokenInstance - :param dict payload: Payload response from the API - :returns: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenInstance - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenInstance - """ - return SecondaryAuthTokenInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SecondaryAuthTokenContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the SecondaryAuthTokenContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenContext - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenContext - """ - super(SecondaryAuthTokenContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SecondaryAuthTokenContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/AuthTokens/Secondary'.format(**self._solution) - - def create(self): - """ - Create the SecondaryAuthTokenInstance - - :returns: The created SecondaryAuthTokenInstance - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenInstance - """ - payload = self._version.create(method='POST', uri=self._uri, ) - - return SecondaryAuthTokenInstance(self._version, payload, ) - - def delete(self): - """ - Deletes the SecondaryAuthTokenInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { } + self._uri = '/AuthTokens/Secondary' + + + def create(self): + + + + + def delete(self): + + + """ + Deletes the SecondaryAuthTokenInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SecondaryAuthTokenInstance(InstanceResource): +class SecondaryAuthTokenInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the SecondaryAuthTokenInstance - - :returns: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenInstance - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenInstance - """ super(SecondaryAuthTokenInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'secondary_auth_token': payload.get('secondary_auth_token'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'secondary_auth_token' = payload.get('secondary_auth_token'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SecondaryAuthTokenContext for this SecondaryAuthTokenInstance - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenContext - """ if self._context is None: - self._context = SecondaryAuthTokenContext(self._version, ) + self._context = SecondaryAuthTokenContext( + self._version, + + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that the secondary Auth Token was created for - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 formatted date and time in UTC when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The ISO 8601 formatted date and time in UTC when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def secondary_auth_token(self): - """ - :returns: The generated secondary Auth Token - :rtype: unicode - """ - return self._properties['secondary_auth_token'] - - @property - def url(self): + def __repr__(self): """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def create(self): - """ - Create the SecondaryAuthTokenInstance - :returns: The created SecondaryAuthTokenInstance - :rtype: twilio.rest.accounts.v1.secondary_auth_token.SecondaryAuthTokenInstance - """ - return self._proxy.create() - def delete(self): - """ - Deletes the SecondaryAuthTokenInstance +class SecondaryAuthTokenListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SecondaryAuthTokenListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/__init__.py b/twilio/rest/api/__init__.py index 68711290a3..b43c2e4536 100644 --- a/twilio/rest/api/__init__.py +++ b/twilio/rest/api/__init__.py @@ -1,228 +1,62 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.api.v2010 import V2010 + Twilio - Api + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Api(Domain): +from twilio.base.domain import Domain +from twilio.rest.Api.v2010 import V2010 +class Api(Domain): def __init__(self, twilio): """ Initialize the Api Domain :returns: Domain for Api - :rtype: twilio.rest.api.Api + :rtype: twilio.rest.v2010.Api """ super(Api, self).__init__(twilio) - - self.base_url = 'https://api.twilio.com' - - # Versions - self._v2010 = None + self.base_url = 'https://Api.twilio.com' + self._V2010 = None @property - def v2010(self): + def V2010(self): """ - :returns: Version v2010 of api - :rtype: twilio.rest.api.v2010.V2010 + :returns: Versions v2010 of Api + :rtype: twilio.rest.Api.v2010 """ - if self._v2010 is None: - self._v2010 = V2010(self) - return self._v2010 - - @property - def account(self): - """ - :returns: Account provided as the authenticating account - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - return self.v2010.account + if self._V2010 is None: + self._V2010 = V2010(self) + return self._V2010 + @property def accounts(self): """ - :rtype: twilio.rest.api.v2010.account.AccountList + :rtype: twilio.rest.v2010.accounts """ return self.v2010.accounts + @property - def addresses(self): - """ - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - return self.account.addresses - - @property - def applications(self): - """ - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - return self.account.applications - - @property - def authorized_connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - return self.account.authorized_connect_apps - - @property - def available_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - return self.account.available_phone_numbers - - @property - def balance(self): - """ - :rtype: twilio.rest.api.v2010.account.balance.BalanceList - """ - return self.account.balance - - @property - def calls(self): - """ - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - return self.account.calls - - @property - def conferences(self): - """ - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - return self.account.conferences - - @property - def connect_apps(self): - """ - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - return self.account.connect_apps - - @property - def incoming_phone_numbers(self): - """ - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - return self.account.incoming_phone_numbers - - @property - def keys(self): - """ - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - return self.account.keys - - @property - def messages(self): - """ - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - return self.account.messages - - @property - def new_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - return self.account.new_keys - - @property - def new_signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - return self.account.new_signing_keys - - @property - def notifications(self): - """ - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - return self.account.notifications - - @property - def outgoing_caller_ids(self): - """ - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - return self.account.outgoing_caller_ids - - @property - def queues(self): - """ - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - return self.account.queues - - @property - def recordings(self): - """ - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - return self.account.recordings - - @property - def signing_keys(self): - """ - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - return self.account.signing_keys - - @property - def sip(self): - """ - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - return self.account.sip - - @property - def short_codes(self): - """ - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - return self.account.short_codes - - @property - def tokens(self): - """ - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - return self.account.tokens - - @property - def transcriptions(self): - """ - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - return self.account.transcriptions - - @property - def usage(self): - """ - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - return self.account.usage - - @property - def validation_requests(self): + def account(self): """ - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList + :rtype: twilio.rest.v2010.account """ - return self.account.validation_requests + return self.v2010.account + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/api/v2010/.openapi-generator-ignore b/twilio/rest/api/v2010/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/api/v2010/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/api/v2010/.openapi-generator/FILES b/twilio/rest/api/v2010/.openapi-generator/FILES new file mode 100644 index 0000000000..858816ac9e --- /dev/null +++ b/twilio/rest/api/v2010/.openapi-generator/FILES @@ -0,0 +1,159 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +account.py +account/address.py +account/address/dependent_phone_number.py +account/application.py +account/authorized_connect_app.py +account/available_phone_number_country.py +account/available_phone_number_country/local.py +account/available_phone_number_country/machine_to_machine.py +account/available_phone_number_country/mobile.py +account/available_phone_number_country/national.py +account/available_phone_number_country/shared_cost.py +account/available_phone_number_country/toll_free.py +account/available_phone_number_country/voip.py +account/balance.py +account/call.py +account/call/event.py +account/call/feedback.py +account/call/feedback_summary.py +account/call/notification.py +account/call/payment.py +account/call/recording.py +account/call/siprec.py +account/call/stream.py +account/call/user_defined_message.py +account/call/user_defined_message_subscription.py +account/conference.py +account/conference/participant.py +account/conference/recording.py +account/connect_app.py +account/incoming_phone_number.py +account/incoming_phone_number/assigned_add_on.py +account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py +account/incoming_phone_number/local.py +account/incoming_phone_number/mobile.py +account/incoming_phone_number/toll_free.py +account/key.py +account/message.py +account/message/feedback.py +account/message/media.py +account/new_key.py +account/new_signing_key.py +account/notification.py +account/outgoing_caller_id.py +account/queue.py +account/queue/member.py +account/recording.py +account/recording/add_on_result.py +account/recording/add_on_result/payload.py +account/recording/transcription.py +account/short_code.py +account/signing_key.py +account/sip.py +account/sip/credential_list.py +account/sip/credential_list/credential.py +account/sip/domain.py +account/sip/domain/auth_types.py +account/sip/domain/auth_types/auth_type_calls.py +account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py +account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py +account/sip/domain/auth_types/auth_type_registrations.py +account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py +account/sip/domain/credential_list_mapping.py +account/sip/domain/ip_access_control_list_mapping.py +account/sip/ip_access_control_list.py +account/sip/ip_access_control_list/ip_address.py +account/token.py +account/transcription.py +account/usage.py +account/usage/record.py +account/usage/record/all_time.py +account/usage/record/daily.py +account/usage/record/last_month.py +account/usage/record/monthly.py +account/usage/record/this_month.py +account/usage/record/today.py +account/usage/record/yearly.py +account/usage/record/yesterday.py +account/usage/trigger.py +account/validation_request.py diff --git a/twilio/rest/api/v2010/.openapi-generator/VERSION b/twilio/rest/api/v2010/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/api/v2010/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/api/v2010/account.py b/twilio/rest/api/v2010/account.py new file mode 100644 index 0000000000..c0d04a5467 --- /dev/null +++ b/twilio/rest/api/v2010/account.py @@ -0,0 +1,254 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.account.address import AddressListInstancefrom twilio.rest.account.application import ApplicationListInstancefrom twilio.rest.account.authorized_connect_app import AuthorizedConnectAppListInstancefrom twilio.rest.account.available_phone_number_country import AvailablePhoneNumberCountryListInstancefrom twilio.rest.account.balance import BalanceListInstancefrom twilio.rest.account.call import CallListInstancefrom twilio.rest.account.conference import ConferenceListInstancefrom twilio.rest.account.connect_app import ConnectAppListInstancefrom twilio.rest.account.incoming_phone_number import IncomingPhoneNumberListInstancefrom twilio.rest.account.key import KeyListInstancefrom twilio.rest.account.message import MessageListInstancefrom twilio.rest.account.new_key import NewKeyListInstancefrom twilio.rest.account.new_signing_key import NewSigningKeyListInstancefrom twilio.rest.account.notification import NotificationListInstancefrom twilio.rest.account.outgoing_caller_id import OutgoingCallerIdListInstancefrom twilio.rest.account.queue import QueueListInstancefrom twilio.rest.account.recording import RecordingListInstancefrom twilio.rest.account.short_code import ShortCodeListInstancefrom twilio.rest.account.signing_key import SigningKeyListInstancefrom twilio.rest.account.sip import SipListInstancefrom twilio.rest.account.token import TokenListInstancefrom twilio.rest.account.transcription import TranscriptionListInstancefrom twilio.rest.account.usage import UsageListInstancefrom twilio.rest.account.validation_request import ValidationRequestListInstance + + +class AccountContext(InstanceContext): + def __init__(self, version: V2010, sid: str): + # TODO: needs autogenerated docs + super(AccountContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Accounts/${sid}.json' + + self._addresses = None + self._applications = None + self._authorized_connect_apps = None + self._available_phone_numbers = None + self._balance = None + self._calls = None + self._conferences = None + self._connect_apps = None + self._incoming_phone_numbers = None + self._keys = None + self._messages = None + self._new_keys = None + self._new_signing_keys = None + self._notifications = None + self._outgoing_caller_ids = None + self._queues = None + self._recordings = None + self._short_codes = None + self._signing_keys = None + self._sip = None + self._tokens = None + self._transcriptions = None + self._usage = None + self._validation_requests = None + + def fetch(self): + + """ + Fetch the AccountInstance + + :returns: The fetched AccountInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AccountInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AccountInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AccountInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(AccountInstance, self).__init__(version) + self._properties = { + 'auth_token' = payload.get('auth_token'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'owner_account_sid' = payload.get('owner_account_sid'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'subresource_uris' = payload.get('subresource_uris'), + 'type' = payload.get('type'), + 'uri' = payload.get('uri'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AccountContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def addresses(self): + return self._proxy.addresses + @property + def applications(self): + return self._proxy.applications + @property + def authorized_connect_apps(self): + return self._proxy.authorized_connect_apps + @property + def available_phone_numbers(self): + return self._proxy.available_phone_numbers + @property + def balance(self): + return self._proxy.balance + @property + def calls(self): + return self._proxy.calls + @property + def conferences(self): + return self._proxy.conferences + @property + def connect_apps(self): + return self._proxy.connect_apps + @property + def incoming_phone_numbers(self): + return self._proxy.incoming_phone_numbers + @property + def keys(self): + return self._proxy.keys + @property + def messages(self): + return self._proxy.messages + @property + def new_keys(self): + return self._proxy.new_keys + @property + def new_signing_keys(self): + return self._proxy.new_signing_keys + @property + def notifications(self): + return self._proxy.notifications + @property + def outgoing_caller_ids(self): + return self._proxy.outgoing_caller_ids + @property + def queues(self): + return self._proxy.queues + @property + def recordings(self): + return self._proxy.recordings + @property + def short_codes(self): + return self._proxy.short_codes + @property + def signing_keys(self): + return self._proxy.signing_keys + @property + def sip(self): + return self._proxy.sip + @property + def tokens(self): + return self._proxy.tokens + @property + def transcriptions(self): + return self._proxy.transcriptions + @property + def usage(self): + return self._proxy.usage + @property + def validation_requests(self): + return self._proxy.validation_requests + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AccountListInstance(ListResource): + def __init__(self, version: V2010): + # TODO: needs autogenerated docs + super(AccountListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Accounts.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AccountInstance(self._version, payload, ) + + + def page(self, friendly_name, status, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AccountPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/address.py b/twilio/rest/api/v2010/account/address.py new file mode 100644 index 0000000000..f8e31e4c85 --- /dev/null +++ b/twilio/rest/api/v2010/account/address.py @@ -0,0 +1,179 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.address.dependent_phone_number import DependentPhoneNumberListInstance + + +class AddressContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AddressContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Addresses/${sid}.json' + + self._dependent_phone_numbers = None + + def delete(self): + + + """ + Deletes the AddressInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AddressInstance + + :returns: The fetched AddressInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AddressInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AddressInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(AddressInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'city' = payload.get('city'), + 'customer_name' = payload.get('customer_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'iso_country' = payload.get('iso_country'), + 'postal_code' = payload.get('postal_code'), + 'region' = payload.get('region'), + 'sid' = payload.get('sid'), + 'street' = payload.get('street'), + 'uri' = payload.get('uri'), + 'emergency_enabled' = payload.get('emergency_enabled'), + 'validated' = payload.get('validated'), + 'verified' = payload.get('verified'), + 'street_secondary' = payload.get('street_secondary'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AddressContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def dependent_phone_numbers(self): + return self._proxy.dependent_phone_numbers + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AddressListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(AddressListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Addresses.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AddressInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, customer_name, friendly_name, iso_country, page_size): + + data = values.of({ + 'customer_name': customer_name,'friendly_name': friendly_name,'iso_country': iso_country,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AddressPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/address/dependent_phone_number.py b/twilio/rest/api/v2010/account/address/dependent_phone_number.py index 06bf3c4772..c8a740aa0e 100644 --- a/twilio/rest/api/v2010/account/address/dependent_phone_number.py +++ b/twilio/rest/api/v2010/account/address/dependent_phone_number.py @@ -1,437 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DependentPhoneNumberList(ListResource): - - def __init__(self, version, account_sid, address_sid): - """ - Initialize the DependentPhoneNumberList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param address_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - """ - super(DependentPhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'address_sid': address_sid, } - self._uri = '/Accounts/{account_sid}/Addresses/{address_sid}/DependentPhoneNumbers.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DependentPhoneNumberInstance 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 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.address.dependent_phone_number.DependentPhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DependentPhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.address.dependent_phone_number.DependentPhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DependentPhoneNumberInstance records from the API. - Request is executed immediately - - :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 DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DependentPhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DependentPhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return DependentPhoneNumberPage(self._version, response, self._solution) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' -class DependentPhoneNumberPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the DependentPhoneNumberPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param address_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberPage - """ - super(DependentPhoneNumberPage, self).__init__(version, response) +class DependentPhoneNumberListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, address_sid: str): + # TODO: needs autogenerated docs + super(DependentPhoneNumberListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { account_sid, address_sid, } + self._uri = '/Accounts/${account_sid}/Addresses/${address_sid}/DependentPhoneNumbers.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of DependentPhoneNumberInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - """ - return DependentPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - address_sid=self._solution['address_sid'], - ) + return DependentPhoneNumberPage(self._version, payload, account_sid=self._solution['account_sid']address_sid=self._solution['address_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class DependentPhoneNumberInstance(InstanceResource): - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - class EmergencyStatus(object): - ACTIVE = "Active" - INACTIVE = "Inactive" - - def __init__(self, version, payload, account_sid, address_sid): - """ - Initialize the DependentPhoneNumberInstance - - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberInstance - """ - super(DependentPhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'voice_url': payload.get('voice_url'), - 'voice_method': payload.get('voice_method'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_caller_id_lookup': payload.get('voice_caller_id_lookup'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'address_requirements': payload.get('address_requirements'), - 'capabilities': payload.get('capabilities'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'api_version': payload.get('api_version'), - 'sms_application_sid': payload.get('sms_application_sid'), - 'voice_application_sid': payload.get('voice_application_sid'), - 'trunk_sid': payload.get('trunk_sid'), - 'emergency_status': payload.get('emergency_status'), - 'emergency_address_sid': payload.get('emergency_address_sid'), - 'uri': payload.get('uri'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'address_sid': address_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] + return '' - @property - def voice_url(self): - """ - :returns: The URL we call when the phone number receives a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method used with the voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs in TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Whether to lookup the caller's name - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sms_fallback_method(self): - """ - :returns: The HTTP method used with sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The URL we call when the phone number receives an incoming SMS message - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def address_requirements(self): - """ - :returns: Whether the phone number requires an Address registered with Twilio - :rtype: DependentPhoneNumberInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: dict - """ - return self._properties['capabilities'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def sms_application_sid(self): - """ - :returns: The SID of the application that handles SMS messages sent to the phone number - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def voice_application_sid(self): - """ - :returns: The SID of the application that handles calls to the phone number - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk that handles calls to the phone number - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def emergency_status(self): - """ - :returns: Whether the phone number is enabled for emergency calling - :rtype: DependentPhoneNumberInstance.EmergencyStatus - """ - return self._properties['emergency_status'] - - @property - def emergency_address_sid(self): - """ - :returns: The emergency address configuration to use for emergency calling - :rtype: unicode - """ - return self._properties['emergency_address_sid'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index 31076b4375..0c222810ff 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -1,645 +1,179 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ApplicationList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the ApplicationList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.application.ApplicationList - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - super(ApplicationList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Applications.json'.format(**self._solution) - - def create(self, 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, friendly_name=values.unset): - """ - Create the ApplicationInstance - - :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 - :param unicode friendly_name: A string to describe the new resource - - :returns: The created ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - data = values.of({ - '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, - 'FriendlyName': friendly_name, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ApplicationInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams ApplicationInstance 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 friendly_name: The string that identifies the Application resources to read - :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.application.ApplicationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists ApplicationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The string that identifies the Application resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.application.ApplicationInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ApplicationInstance records from the API. - Request is executed immediately - :param unicode friendly_name: The string that identifies the Application resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationPage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ApplicationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ApplicationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ApplicationPage(self._version, response, self._solution) - - 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, ) - - def __call__(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, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ApplicationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ApplicationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.application.ApplicationPage - :rtype: twilio.rest.api.v2010.account.application.ApplicationPage - """ - super(ApplicationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ApplicationContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the ApplicationContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :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 - """ - super(ApplicationContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ApplicationContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Applications/{sid}.json'.format(**self._solution) - - def delete(self): - """ - Deletes the ApplicationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Applications/${sid}.json' + + + def delete(self): + + + """ + Deletes the ApplicationInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ApplicationInstance + + :returns: The fetched ApplicationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ApplicationInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def fetch(self): - """ - Fetch the ApplicationInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The fetched ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ApplicationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - 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: Same as message_status_callback. Deprecated, included for backwards compatibility. - :param unicode message_status_callback: The URL to send message status information to your application - - :returns: The updated 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.update(method='POST', uri=self._uri, data=data, ) - - return ApplicationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return ApplicationInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ApplicationInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ApplicationInstance - :returns: twilio.rest.api.v2010.account.application.ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ +class ApplicationInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(ApplicationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'message_status_callback': payload.get('message_status_callback'), - 'sid': payload.get('sid'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_status_callback': payload.get('sms_status_callback'), - 'sms_url': payload.get('sms_url'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'uri': payload.get('uri'), - 'voice_caller_id_lookup': payload.get('voice_caller_id_lookup'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'message_status_callback' = payload.get('message_status_callback'), + 'sid' = payload.get('sid'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_status_callback' = payload.get('sms_status_callback'), + 'sms_url' = payload.get('sms_url'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'uri' = payload.get('uri'), + 'voice_caller_id_lookup' = payload.get('voice_caller_id_lookup'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ApplicationContext for this ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationContext - """ if self._context is None: self._context = ApplicationContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def message_status_callback(self): - """ - :returns: The URL to send message status information to your application - :rtype: unicode - """ - return self._properties['message_status_callback'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The HTTP method used with sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['sms_status_callback'] - - @property - def sms_url(self): - """ - :returns: The URL we call when the phone number receives an incoming SMS message - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Whether to lookup the caller's name - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when a TwiML error occurs - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method used with the voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): + def __repr__(self): """ - :returns: The URL we call when the phone number receives a call - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['voice_url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the ApplicationInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the ApplicationInstance +class ApplicationListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(ApplicationListInstanceList, self).__init__(version) - :returns: The fetched ApplicationInstance - :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance - """ - return self._proxy.fetch() - - 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: Same as message_status_callback. Deprecated, included for backwards compatibility. - :param unicode message_status_callback: The URL to send message status information to your application - - :returns: The 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, - ) + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Applications.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ApplicationInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ApplicationPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/authorized_connect_app.py b/twilio/rest/api/v2010/account/authorized_connect_app.py index bd612fb81e..b75740e4a4 100644 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ b/twilio/rest/api/v2010/account/authorized_connect_app.py @@ -1,391 +1,137 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AuthorizedConnectAppList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the AuthorizedConnectAppList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - super(AuthorizedConnectAppList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/AuthorizedConnectApps.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AuthorizedConnectAppInstance 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 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.authorized_connect_app.AuthorizedConnectAppInstance] - """ - limits = self._version.read_limits(limit, page_size) - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AuthorizedConnectAppInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.authorized_connect_app.AuthorizedConnectAppInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AuthorizedConnectAppInstance records from the API. - Request is executed immediately - - :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 AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AuthorizedConnectAppPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AuthorizedConnectAppInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AuthorizedConnectAppPage(self._version, response, self._solution) - - def get(self, connect_app_sid): - """ - Constructs a AuthorizedConnectAppContext - - :param connect_app_sid: The SID of the Connect App to fetch - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ - return AuthorizedConnectAppContext( - self._version, - account_sid=self._solution['account_sid'], - connect_app_sid=connect_app_sid, - ) - - def __call__(self, connect_app_sid): - """ - Constructs a AuthorizedConnectAppContext - - :param connect_app_sid: The SID of the Connect App to fetch - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ - return AuthorizedConnectAppContext( - self._version, - account_sid=self._solution['account_sid'], - connect_app_sid=connect_app_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthorizedConnectAppPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthorizedConnectAppPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppPage - """ - super(AuthorizedConnectAppPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthorizedConnectAppInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ - return AuthorizedConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class AuthorizedConnectAppContext(InstanceContext): - - def __init__(self, version, account_sid, connect_app_sid): - """ - Initialize the AuthorizedConnectAppContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param connect_app_sid: The SID of the Connect App to fetch - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ - super(AuthorizedConnectAppContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, connect_app_sid: str): + # TODO: needs autogenerated docs + super(AuthorizedConnectAppContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'connect_app_sid': connect_app_sid, } - self._uri = '/Accounts/{account_sid}/AuthorizedConnectApps/{connect_app_sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the AuthorizedConnectAppInstance - - :returns: The fetched AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AuthorizedConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - connect_app_sid=self._solution['connect_app_sid'], - ) + self._solution = { account_sid, connect_app_sid, } + self._uri = '/Accounts/${account_sid}/AuthorizedConnectApps/${connect_app_sid}.json' + + + def fetch(self): + + """ + Fetch the AuthorizedConnectAppInstance + + :returns: The fetched AuthorizedConnectAppInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AuthorizedConnectAppInstance( + self._version, + payload, + account_sidconnect_app_sid=self._solution['account_sid''connect_app_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AuthorizedConnectAppInstance(InstanceResource): - class Permission(object): - GET_ALL = "get-all" - POST_ALL = "post-all" - - def __init__(self, version, payload, account_sid, connect_app_sid=None): - """ - Initialize the AuthorizedConnectAppInstance - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ +class AuthorizedConnectAppInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, connect_app_sid: str): super(AuthorizedConnectAppInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'connect_app_company_name': payload.get('connect_app_company_name'), - 'connect_app_description': payload.get('connect_app_description'), - 'connect_app_friendly_name': payload.get('connect_app_friendly_name'), - 'connect_app_homepage_url': payload.get('connect_app_homepage_url'), - 'connect_app_sid': payload.get('connect_app_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'permissions': payload.get('permissions'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'connect_app_company_name' = payload.get('connect_app_company_name'), + 'connect_app_description' = payload.get('connect_app_description'), + 'connect_app_friendly_name' = payload.get('connect_app_friendly_name'), + 'connect_app_homepage_url' = payload.get('connect_app_homepage_url'), + 'connect_app_sid' = payload.get('connect_app_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'permissions' = payload.get('permissions'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'connect_app_sid': connect_app_sid or self._properties['connect_app_sid'], + 'account_sid': account_sid or self._properties['account_sid']'connect_app_sid': connect_app_sid or self._properties['connect_app_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthorizedConnectAppContext for this AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppContext - """ if self._context is None: self._context = AuthorizedConnectAppContext( self._version, - account_sid=self._solution['account_sid'], - connect_app_sid=self._solution['connect_app_sid'], + account_sid=self._solution['account_sid'],connect_app_sid=self._solution['connect_app_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def connect_app_company_name(self): - """ - :returns: The company name set for the Connect App - :rtype: unicode - """ - return self._properties['connect_app_company_name'] - - @property - def connect_app_description(self): - """ - :returns: A detailed description of the app - :rtype: unicode - """ - return self._properties['connect_app_description'] - - @property - def connect_app_friendly_name(self): - """ - :returns: The name of the Connect App - :rtype: unicode - """ - return self._properties['connect_app_friendly_name'] - - @property - def connect_app_homepage_url(self): - """ - :returns: The public URL for the Connect App - :rtype: unicode - """ - return self._properties['connect_app_homepage_url'] - - @property - def connect_app_sid(self): + def __repr__(self): """ - :returns: The SID that we assigned to the Connect App - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['connect_app_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def permissions(self): - """ - :returns: Permissions authorized to the app - :rtype: list[AuthorizedConnectAppInstance.Permission] - """ - return self._properties['permissions'] +class AuthorizedConnectAppListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(AuthorizedConnectAppListInstanceList, self).__init__(version) - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/AuthorizedConnectApps.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the AuthorizedConnectAppInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched AuthorizedConnectAppInstance - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppInstance - """ - return self._proxy.fetch() + return AuthorizedConnectAppPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country.py b/twilio/rest/api/v2010/account/available_phone_number_country.py new file mode 100644 index 0000000000..07bf318062 --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country.py @@ -0,0 +1,160 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.available_phone_number_country.local import LocalListInstancefrom twilio.rest.available_phone_number_country.machine_to_machine import MachineToMachineListInstancefrom twilio.rest.available_phone_number_country.mobile import MobileListInstancefrom twilio.rest.available_phone_number_country.national import NationalListInstancefrom twilio.rest.available_phone_number_country.shared_cost import SharedCostListInstancefrom twilio.rest.available_phone_number_country.toll_free import TollFreeListInstancefrom twilio.rest.available_phone_number_country.voip import VoipListInstance + + +class AvailablePhoneNumberCountryContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(AvailablePhoneNumberCountryContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}.json' + + self._local = None + self._machine_to_machine = None + self._mobile = None + self._national = None + self._shared_cost = None + self._toll_free = None + self._voip = None + + def fetch(self): + + """ + Fetch the AvailablePhoneNumberCountryInstance + + :returns: The fetched AvailablePhoneNumberCountryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AvailablePhoneNumberCountryInstance( + self._version, + payload, + account_sidcountry_code=self._solution['account_sid''country_code'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AvailablePhoneNumberCountryInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, country_code: str): + super(AvailablePhoneNumberCountryInstance, self).__init__(version) + self._properties = { + 'country_code' = payload.get('country_code'), + 'country' = payload.get('country'), + 'uri' = payload.get('uri'), + 'beta' = payload.get('beta'), + 'subresource_uris' = payload.get('subresource_uris'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'country_code': country_code or self._properties['country_code'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AvailablePhoneNumberCountryContext( + self._version, + account_sid=self._solution['account_sid'],country_code=self._solution['country_code'], + ) + return self._context + + @property + def local(self): + return self._proxy.local + @property + def machine_to_machine(self): + return self._proxy.machine_to_machine + @property + def mobile(self): + return self._proxy.mobile + @property + def national(self): + return self._proxy.national + @property + def shared_cost(self): + return self._proxy.shared_cost + @property + def toll_free(self): + return self._proxy.toll_free + @property + def voip(self): + return self._proxy.voip + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AvailablePhoneNumberCountryListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(AvailablePhoneNumberCountryListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AvailablePhoneNumberCountryPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/local.py b/twilio/rest/api/v2010/account/available_phone_number_country/local.py new file mode 100644 index 0000000000..b4db6116c2 --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country/local.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class LocalListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(LocalListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}/Local.json' + + + def page(self, area_code, contains, sms_enabled, mms_enabled, voice_enabled, exclude_all_address_required, exclude_local_address_required, exclude_foreign_address_required, beta, near_number, near_lat_long, distance, in_postal_code, in_region, in_rate_center, in_lata, in_locality, fax_enabled, page_size): + + data = values.of({ + 'area_code': area_code,'contains': contains,'sms_enabled': sms_enabled,'mms_enabled': mms_enabled,'voice_enabled': voice_enabled,'exclude_all_address_required': exclude_all_address_required,'exclude_local_address_required': exclude_local_address_required,'exclude_foreign_address_required': exclude_foreign_address_required,'beta': beta,'near_number': near_number,'near_lat_long': near_lat_long,'distance': distance,'in_postal_code': in_postal_code,'in_region': in_region,'in_rate_center': in_rate_center,'in_lata': in_lata,'in_locality': in_locality,'fax_enabled': fax_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return LocalPage(self._version, payload, account_sid=self._solution['account_sid']country_code=self._solution['country_code']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py new file mode 100644 index 0000000000..e60f72c540 --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class MachineToMachineListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(MachineToMachineListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}/MachineToMachine.json' + + + def page(self, area_code, contains, sms_enabled, mms_enabled, voice_enabled, exclude_all_address_required, exclude_local_address_required, exclude_foreign_address_required, beta, near_number, near_lat_long, distance, in_postal_code, in_region, in_rate_center, in_lata, in_locality, fax_enabled, page_size): + + data = values.of({ + 'area_code': area_code,'contains': contains,'sms_enabled': sms_enabled,'mms_enabled': mms_enabled,'voice_enabled': voice_enabled,'exclude_all_address_required': exclude_all_address_required,'exclude_local_address_required': exclude_local_address_required,'exclude_foreign_address_required': exclude_foreign_address_required,'beta': beta,'near_number': near_number,'near_lat_long': near_lat_long,'distance': distance,'in_postal_code': in_postal_code,'in_region': in_region,'in_rate_center': in_rate_center,'in_lata': in_lata,'in_locality': in_locality,'fax_enabled': fax_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MachineToMachinePage(self._version, payload, account_sid=self._solution['account_sid']country_code=self._solution['country_code']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py new file mode 100644 index 0000000000..60b35e6fff --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class MobileListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(MobileListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}/Mobile.json' + + + def page(self, area_code, contains, sms_enabled, mms_enabled, voice_enabled, exclude_all_address_required, exclude_local_address_required, exclude_foreign_address_required, beta, near_number, near_lat_long, distance, in_postal_code, in_region, in_rate_center, in_lata, in_locality, fax_enabled, page_size): + + data = values.of({ + 'area_code': area_code,'contains': contains,'sms_enabled': sms_enabled,'mms_enabled': mms_enabled,'voice_enabled': voice_enabled,'exclude_all_address_required': exclude_all_address_required,'exclude_local_address_required': exclude_local_address_required,'exclude_foreign_address_required': exclude_foreign_address_required,'beta': beta,'near_number': near_number,'near_lat_long': near_lat_long,'distance': distance,'in_postal_code': in_postal_code,'in_region': in_region,'in_rate_center': in_rate_center,'in_lata': in_lata,'in_locality': in_locality,'fax_enabled': fax_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MobilePage(self._version, payload, account_sid=self._solution['account_sid']country_code=self._solution['country_code']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/national.py b/twilio/rest/api/v2010/account/available_phone_number_country/national.py new file mode 100644 index 0000000000..ed3710b30f --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country/national.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class NationalListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(NationalListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}/National.json' + + + def page(self, area_code, contains, sms_enabled, mms_enabled, voice_enabled, exclude_all_address_required, exclude_local_address_required, exclude_foreign_address_required, beta, near_number, near_lat_long, distance, in_postal_code, in_region, in_rate_center, in_lata, in_locality, fax_enabled, page_size): + + data = values.of({ + 'area_code': area_code,'contains': contains,'sms_enabled': sms_enabled,'mms_enabled': mms_enabled,'voice_enabled': voice_enabled,'exclude_all_address_required': exclude_all_address_required,'exclude_local_address_required': exclude_local_address_required,'exclude_foreign_address_required': exclude_foreign_address_required,'beta': beta,'near_number': near_number,'near_lat_long': near_lat_long,'distance': distance,'in_postal_code': in_postal_code,'in_region': in_region,'in_rate_center': in_rate_center,'in_lata': in_lata,'in_locality': in_locality,'fax_enabled': fax_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return NationalPage(self._version, payload, account_sid=self._solution['account_sid']country_code=self._solution['country_code']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py new file mode 100644 index 0000000000..49e8820dec --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class SharedCostListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(SharedCostListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}/SharedCost.json' + + + def page(self, area_code, contains, sms_enabled, mms_enabled, voice_enabled, exclude_all_address_required, exclude_local_address_required, exclude_foreign_address_required, beta, near_number, near_lat_long, distance, in_postal_code, in_region, in_rate_center, in_lata, in_locality, fax_enabled, page_size): + + data = values.of({ + 'area_code': area_code,'contains': contains,'sms_enabled': sms_enabled,'mms_enabled': mms_enabled,'voice_enabled': voice_enabled,'exclude_all_address_required': exclude_all_address_required,'exclude_local_address_required': exclude_local_address_required,'exclude_foreign_address_required': exclude_foreign_address_required,'beta': beta,'near_number': near_number,'near_lat_long': near_lat_long,'distance': distance,'in_postal_code': in_postal_code,'in_region': in_region,'in_rate_center': in_rate_center,'in_lata': in_lata,'in_locality': in_locality,'fax_enabled': fax_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SharedCostPage(self._version, payload, account_sid=self._solution['account_sid']country_code=self._solution['country_code']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py new file mode 100644 index 0000000000..e1668adb59 --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class TollFreeListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(TollFreeListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}/TollFree.json' + + + def page(self, area_code, contains, sms_enabled, mms_enabled, voice_enabled, exclude_all_address_required, exclude_local_address_required, exclude_foreign_address_required, beta, near_number, near_lat_long, distance, in_postal_code, in_region, in_rate_center, in_lata, in_locality, fax_enabled, page_size): + + data = values.of({ + 'area_code': area_code,'contains': contains,'sms_enabled': sms_enabled,'mms_enabled': mms_enabled,'voice_enabled': voice_enabled,'exclude_all_address_required': exclude_all_address_required,'exclude_local_address_required': exclude_local_address_required,'exclude_foreign_address_required': exclude_foreign_address_required,'beta': beta,'near_number': near_number,'near_lat_long': near_lat_long,'distance': distance,'in_postal_code': in_postal_code,'in_region': in_region,'in_rate_center': in_rate_center,'in_lata': in_lata,'in_locality': in_locality,'fax_enabled': fax_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TollFreePage(self._version, payload, account_sid=self._solution['account_sid']country_code=self._solution['country_code']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py new file mode 100644 index 0000000000..eaf0ff409d --- /dev/null +++ b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class VoipListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, country_code: str): + # TODO: needs autogenerated docs + super(VoipListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, country_code, } + self._uri = '/Accounts/${account_sid}/AvailablePhoneNumbers/${country_code}/Voip.json' + + + def page(self, area_code, contains, sms_enabled, mms_enabled, voice_enabled, exclude_all_address_required, exclude_local_address_required, exclude_foreign_address_required, beta, near_number, near_lat_long, distance, in_postal_code, in_region, in_rate_center, in_lata, in_locality, fax_enabled, page_size): + + data = values.of({ + 'area_code': area_code,'contains': contains,'sms_enabled': sms_enabled,'mms_enabled': mms_enabled,'voice_enabled': voice_enabled,'exclude_all_address_required': exclude_all_address_required,'exclude_local_address_required': exclude_local_address_required,'exclude_foreign_address_required': exclude_foreign_address_required,'beta': beta,'near_number': near_number,'near_lat_long': near_lat_long,'distance': distance,'in_postal_code': in_postal_code,'in_region': in_region,'in_rate_center': in_rate_center,'in_lata': in_lata,'in_locality': in_locality,'fax_enabled': fax_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return VoipPage(self._version, payload, account_sid=self._solution['account_sid']country_code=self._solution['country_code']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/balance.py b/twilio/rest/api/v2010/account/balance.py index 0ebd01d2e1..12410560ae 100644 --- a/twilio/rest/api/v2010/account/balance.py +++ b/twilio/rest/api/v2010/account/balance.py @@ -1,146 +1,85 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class BalanceList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the BalanceList - - :param Version version: Version that contains the resource - :param account_sid: Account Sid. - :returns: twilio.rest.api.v2010.account.balance.BalanceList - :rtype: twilio.rest.api.v2010.account.balance.BalanceList - """ - super(BalanceList, self).__init__(version) - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Balance.json'.format(**self._solution) +class BalanceInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(BalanceInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'balance' = payload.get('balance'), + 'currency' = payload.get('currency'), + } - def fetch(self): - """ - Fetch the BalanceInstance + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - :returns: The fetched BalanceInstance - :rtype: twilio.rest.api.v2010.account.balance.BalanceInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + @property + def _proxy(self): + if self._context is None: + self._context = BalanceContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class BalancePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the BalancePage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: Account Sid. - - :returns: twilio.rest.api.v2010.account.balance.BalancePage - :rtype: twilio.rest.api.v2010.account.balance.BalancePage - """ - super(BalancePage, self).__init__(version, response) +class BalanceListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(BalanceListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BalanceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.balance.BalanceInstance - :rtype: twilio.rest.api.v2010.account.balance.BalanceInstance - """ - return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Balance.json' + + + def fetch(self): + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class BalanceInstance(InstanceResource): - - def __init__(self, version, payload, account_sid): - """ - Initialize the BalanceInstance - - :returns: twilio.rest.api.v2010.account.balance.BalanceInstance - :rtype: twilio.rest.api.v2010.account.balance.BalanceInstance - """ - super(BalanceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'balance': payload.get('balance'), - 'currency': payload.get('currency'), - } + return '' - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def balance(self): - """ - :returns: Account balance - :rtype: unicode - """ - return self._properties['balance'] - - @property - def currency(self): - """ - :returns: Currency units - :rtype: unicode - """ - return self._properties['currency'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/call.py b/twilio/rest/api/v2010/account/call.py new file mode 100644 index 0000000000..78bb1dd1f8 --- /dev/null +++ b/twilio/rest/api/v2010/account/call.py @@ -0,0 +1,222 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.call.event import EventListInstancefrom twilio.rest.call.feedback import FeedbackListInstancefrom twilio.rest.call.feedback_summary import FeedbackSummaryListInstancefrom twilio.rest.call.notification import NotificationListInstancefrom twilio.rest.call.payment import PaymentListInstancefrom twilio.rest.call.recording import RecordingListInstancefrom twilio.rest.call.siprec import SiprecListInstancefrom twilio.rest.call.stream import StreamListInstancefrom twilio.rest.call.user_defined_message import UserDefinedMessageListInstancefrom twilio.rest.call.user_defined_message_subscription import UserDefinedMessageSubscriptionListInstance + + +class CallContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CallContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/${sid}.json' + + self._events = None + self._feedback = None + self._notifications = None + self._payments = None + self._recordings = None + self._siprec = None + self._streams = None + self._user_defined_messages = None + self._user_defined_message_subscriptions = None + + def delete(self): + + + """ + Deletes the CallInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CallInstance + + :returns: The fetched CallInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CallInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CallInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(CallInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'parent_call_sid' = payload.get('parent_call_sid'), + 'account_sid' = payload.get('account_sid'), + 'to' = payload.get('to'), + 'to_formatted' = payload.get('to_formatted'), + '_from' = payload.get('from'), + 'from_formatted' = payload.get('from_formatted'), + 'phone_number_sid' = payload.get('phone_number_sid'), + 'status' = payload.get('status'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'duration' = payload.get('duration'), + 'price' = payload.get('price'), + 'price_unit' = payload.get('price_unit'), + 'direction' = payload.get('direction'), + 'answered_by' = payload.get('answered_by'), + 'api_version' = payload.get('api_version'), + 'forwarded_from' = payload.get('forwarded_from'), + 'group_sid' = payload.get('group_sid'), + 'caller_name' = payload.get('caller_name'), + 'queue_time' = payload.get('queue_time'), + 'trunk_sid' = payload.get('trunk_sid'), + 'uri' = payload.get('uri'), + 'subresource_uris' = payload.get('subresource_uris'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CallContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def events(self): + return self._proxy.events + @property + def feedback(self): + return self._proxy.feedback + @property + def notifications(self): + return self._proxy.notifications + @property + def payments(self): + return self._proxy.payments + @property + def recordings(self): + return self._proxy.recordings + @property + def siprec(self): + return self._proxy.siprec + @property + def streams(self): + return self._proxy.streams + @property + def user_defined_messages(self): + return self._proxy.user_defined_messages + @property + def user_defined_message_subscriptions(self): + return self._proxy.user_defined_message_subscriptions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CallListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(CallListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Calls.json' + + self._feedback_summaries = None + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CallInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, to, _from, parent_call_sid, status, start_time, start_time, start_time, end_time, end_time, end_time, page_size): + + data = values.of({ + 'to': to,'_from': _from,'parent_call_sid': parent_call_sid,'status': status,'start_time': start_time,'start_time': start_time,'start_time': start_time,'end_time': end_time,'end_time': end_time,'end_time': end_time,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CallPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/call/event.py b/twilio/rest/api/v2010/account/call/event.py index a2d2852448..9487bc87f3 100644 --- a/twilio/rest/api/v2010/account/call/event.py +++ b/twilio/rest/api/v2010/account/call/event.py @@ -1,207 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EventList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the EventList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - :param call_sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.call.event.EventList - :rtype: twilio.rest.api.v2010.account.call.event.EventList - """ - super(EventList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Events.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams EventInstance 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 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.call.event.EventInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) + Twilio - Api + This is the public Twilio REST API. - def list(self, limit=None, page_size=None): - """ - Lists EventInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.call.event.EventInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EventInstance records from the API. - Request is executed immediately - - :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 EventInstance - :rtype: twilio.rest.api.v2010.account.call.event.EventPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EventPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EventInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - :returns: Page of EventInstance - :rtype: twilio.rest.api.v2010.account.call.event.EventPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return EventPage(self._version, response, self._solution) +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class EventPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the EventPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - :param call_sid: The unique string that identifies this resource - :returns: twilio.rest.api.v2010.account.call.event.EventPage - :rtype: twilio.rest.api.v2010.account.call.event.EventPage - """ - super(EventPage, self).__init__(version, response) +class EventListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(EventListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Events.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of EventInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.call.event.EventInstance - :rtype: twilio.rest.api.v2010.account.call.event.EventInstance - """ - return EventInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) + return EventPage(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class EventInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, call_sid): - """ - Initialize the EventInstance + return '' - :returns: twilio.rest.api.v2010.account.call.event.EventInstance - :rtype: twilio.rest.api.v2010.account.call.event.EventInstance - """ - super(EventInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'request': payload.get('request'), 'response': payload.get('response'), } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - - @property - def request(self): - """ - :returns: Call Request. - :rtype: dict - """ - return self._properties['request'] - - @property - def response(self): - """ - :returns: Call Response with Events. - :rtype: dict - """ - return self._properties['response'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/call/feedback.py b/twilio/rest/api/v2010/account/call/feedback.py index bb7c979be8..c12f83ee7c 100644 --- a/twilio/rest/api/v2010/account/call/feedback.py +++ b/twilio/rest/api/v2010/account/call/feedback.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,335 +19,114 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FeedbackList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the FeedbackList - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param call_sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackList - """ - super(FeedbackList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - - def get(self): - """ - Constructs a FeedbackContext - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ - return FeedbackContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __call__(self): - """ - Constructs a FeedbackContext - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ - return FeedbackContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FeedbackPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the FeedbackPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique sid that identifies this account - :param call_sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackPage - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackPage - """ - super(FeedbackPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FeedbackInstance - :param dict payload: Payload response from the API - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class FeedbackContext(InstanceContext): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the FeedbackContext - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param call_sid: The call sid that uniquely identifies the call - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ - super(FeedbackContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(FeedbackContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Feedback.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the FeedbackInstance - - :returns: The fetched FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def create(self, quality_score, issue=values.unset): - """ - Create the FeedbackInstance - - :param unicode quality_score: The call quality expressed as an integer from 1 to 5 - :param list[FeedbackInstance.Issues] issue: Issues experienced during the call - - :returns: The created FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - data = values.of({'QualityScore': quality_score, 'Issue': serialize.map(issue, lambda e: e), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def update(self, quality_score=values.unset, issue=values.unset): - """ - Update the FeedbackInstance - - :param unicode quality_score: The call quality expressed as an integer from 1 to 5 - :param list[FeedbackInstance.Issues] issue: Issues experienced during the call - - :returns: The updated FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - data = values.of({'QualityScore': quality_score, 'Issue': serialize.map(issue, lambda e: e), }) + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Feedback.json' + + + def fetch(self): + + """ + Fetch the FeedbackInstance + + :returns: The fetched FeedbackInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FeedbackInstance( + self._version, + payload, + account_sidcall_sid=self._solution['account_sid''call_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) + return FeedbackInstance(self._version, payload, account_sid=self._solution['account_sid'], call_sid=self._solution['call_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class FeedbackInstance(InstanceResource): - - class Issues(object): - AUDIO_LATENCY = "audio-latency" - DIGITS_NOT_CAPTURED = "digits-not-captured" - DROPPED_CALL = "dropped-call" - IMPERFECT_AUDIO = "imperfect-audio" - INCORRECT_CALLER_ID = "incorrect-caller-id" - ONE_WAY_AUDIO = "one-way-audio" - POST_DIAL_DELAY = "post-dial-delay" - UNSOLICITED_CALL = "unsolicited-call" - def __init__(self, version, payload, account_sid, call_sid): - """ - Initialize the FeedbackInstance - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ +class FeedbackInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str): super(FeedbackInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'issues': payload.get('issues'), - 'quality_score': deserialize.integer(payload.get('quality_score')), - 'sid': payload.get('sid'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'issues' = payload.get('issues'), + 'quality_score' = payload.get('quality_score'), + 'sid' = payload.get('sid'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FeedbackContext for this FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackContext - """ if self._context is None: self._context = FeedbackContext( self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def issues(self): - """ - :returns: Issues experienced during the call - :rtype: list[FeedbackInstance.Issues] - """ - return self._properties['issues'] - - @property - def quality_score(self): - """ - :returns: 1 to 5 quality score - :rtype: unicode - """ - return self._properties['quality_score'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this feedback resource - :rtype: unicode - """ - return self._properties['sid'] - - def fetch(self): - """ - Fetch the FeedbackInstance - - :returns: The fetched FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance + def __repr__(self): """ - return self._proxy.fetch() - - def create(self, quality_score, issue=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Create the FeedbackInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode quality_score: The call quality expressed as an integer from 1 to 5 - :param list[FeedbackInstance.Issues] issue: Issues experienced during the call - :returns: The created FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - return self._proxy.create(quality_score, issue=issue, ) - def update(self, quality_score=values.unset, issue=values.unset): - """ - Update the FeedbackInstance +class FeedbackListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(FeedbackListInstanceList, self).__init__(version) - :param unicode quality_score: The call quality expressed as an integer from 1 to 5 - :param list[FeedbackInstance.Issues] issue: Issues experienced during the call - - :returns: The updated FeedbackInstance - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackInstance - """ - return self._proxy.update(quality_score=quality_score, issue=issue, ) + # Path Solution + self._solution = { account_sid, call_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/call/feedback_summary.py b/twilio/rest/api/v2010/account/call/feedback_summary.py index 1f73253588..4af3cf7fd6 100644 --- a/twilio/rest/api/v2010/account/call/feedback_summary.py +++ b/twilio/rest/api/v2010/account/call/feedback_summary.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,371 +19,132 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FeedbackSummaryList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the FeedbackSummaryList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - """ - super(FeedbackSummaryList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Calls/FeedbackSummary.json'.format(**self._solution) - - def create(self, start_date, end_date, include_subaccounts=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Create the FeedbackSummaryInstance - - :param date start_date: Only include feedback given on or after this date - :param date end_date: Only include feedback given on or before this date - :param bool include_subaccounts: `true` includes feedback from the specified account and its subaccounts - :param unicode status_callback: The URL that we will request when the feedback summary is complete - :param unicode status_callback_method: The HTTP method we use to make requests to the StatusCallback URL - - :returns: The created FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - data = values.of({ - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FeedbackSummaryInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a FeedbackSummaryContext - - :param sid: A string that uniquely identifies this feedback summary resource - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ - return FeedbackSummaryContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FeedbackSummaryContext - - :param sid: A string that uniquely identifies this feedback summary resource - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ - return FeedbackSummaryContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' -class FeedbackSummaryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the FeedbackSummaryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryPage - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryPage - """ - super(FeedbackSummaryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FeedbackSummaryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - return FeedbackSummaryInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class FeedbackSummaryContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the FeedbackSummaryContext - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param sid: A string that uniquely identifies this feedback summary resource - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ - super(FeedbackSummaryContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FeedbackSummaryContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/FeedbackSummary/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the FeedbackSummaryInstance - - :returns: The fetched FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FeedbackSummaryInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FeedbackSummaryInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/FeedbackSummary/${sid}.json' + + + def delete(self): + + + """ + Deletes the FeedbackSummaryInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FeedbackSummaryInstance + + :returns: The fetched FeedbackSummaryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FeedbackSummaryInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FeedbackSummaryInstance(InstanceResource): - - class Status(object): - QUEUED = "queued" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the FeedbackSummaryInstance - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ +class FeedbackSummaryInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(FeedbackSummaryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_count': deserialize.integer(payload.get('call_count')), - 'call_feedback_count': deserialize.integer(payload.get('call_feedback_count')), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'include_subaccounts': payload.get('include_subaccounts'), - 'issues': payload.get('issues'), - 'quality_score_average': deserialize.decimal(payload.get('quality_score_average')), - 'quality_score_median': deserialize.decimal(payload.get('quality_score_median')), - 'quality_score_standard_deviation': deserialize.decimal(payload.get('quality_score_standard_deviation')), - 'sid': payload.get('sid'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'status': payload.get('status'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'call_count' = payload.get('call_count'), + 'call_feedback_count' = payload.get('call_feedback_count'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'end_date' = payload.get('end_date'), + 'include_subaccounts' = payload.get('include_subaccounts'), + 'issues' = payload.get('issues'), + 'quality_score_average' = payload.get('quality_score_average'), + 'quality_score_median' = payload.get('quality_score_median'), + 'quality_score_standard_deviation' = payload.get('quality_score_standard_deviation'), + 'sid' = payload.get('sid'), + 'start_date' = payload.get('start_date'), + 'status' = payload.get('status'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FeedbackSummaryContext for this FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryContext - """ if self._context is None: self._context = FeedbackSummaryContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_count(self): - """ - :returns: The total number of calls - :rtype: unicode - """ - return self._properties['call_count'] - - @property - def call_feedback_count(self): - """ - :returns: The total number of calls with a feedback entry - :rtype: unicode - """ - return self._properties['call_feedback_count'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def end_date(self): - """ - :returns: The latest feedback entry date in the summary - :rtype: date - """ - return self._properties['end_date'] - - @property - def include_subaccounts(self): - """ - :returns: Whether the feedback summary includes subaccounts - :rtype: bool - """ - return self._properties['include_subaccounts'] - - @property - def issues(self): - """ - :returns: Issues experienced during the call - :rtype: list[dict] - """ - return self._properties['issues'] - - @property - def quality_score_average(self): - """ - :returns: The average QualityScore of the feedback entries - :rtype: unicode - """ - return self._properties['quality_score_average'] + - @property - def quality_score_median(self): - """ - :returns: The median QualityScore of the feedback entries - :rtype: unicode - """ - return self._properties['quality_score_median'] - - @property - def quality_score_standard_deviation(self): - """ - :returns: The standard deviation of the quality scores - :rtype: unicode - """ - return self._properties['quality_score_standard_deviation'] - - @property - def sid(self): + def __repr__(self): """ - :returns: A string that uniquely identifies this feedback entry - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def start_date(self): - """ - :returns: The earliest feedback entry date in the summary - :rtype: date - """ - return self._properties['start_date'] - @property - def status(self): - """ - :returns: The status of the feedback summary - :rtype: FeedbackSummaryInstance.Status - """ - return self._properties['status'] - def fetch(self): - """ - Fetch the FeedbackSummaryInstance +class FeedbackSummaryListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(FeedbackSummaryListInstanceList, self).__init__(version) - :returns: The fetched FeedbackSummaryInstance - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Calls/FeedbackSummary.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the FeedbackSummaryInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return FeedbackSummaryInstance(self._version, payload, account_sid=self._solution['account_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/call/notification.py b/twilio/rest/api/v2010/account/call/notification.py index 673146ecf8..bd36dd16b6 100644 --- a/twilio/rest/api/v2010/account/call/notification.py +++ b/twilio/rest/api/v2010/account/call/notification.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,488 +19,126 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NotificationList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the NotificationList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Notifications.json'.format(**self._solution) - - def stream(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - limit=None, page_size=None): - """ - Streams NotificationInstance 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 log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :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.call.notification.NotificationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, limit=None, - page_size=None): - """ - Lists NotificationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.call.notification.NotificationInstance] - """ - return list(self.stream( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - limit=limit, - page_size=page_size, - )) - - def page(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of NotificationInstance records from the API. - Request is executed immediately - - :param unicode log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :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 NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationPage - """ - data = values.of({ - 'Log': log, - 'MessageDate<': serialize.iso8601_date(message_date_before), - 'MessageDate': serialize.iso8601_date(message_date), - 'MessageDate>': serialize.iso8601_date(message_date_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return NotificationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NotificationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NotificationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a NotificationContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ - return NotificationContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - def __call__(self, sid): - """ - Constructs a NotificationContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ - return NotificationContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NotificationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationPage - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NotificationInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.api.v2010.account.call.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ - return NotificationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class NotificationContext(InstanceContext): - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the NotificationContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param call_sid: The Call SID of the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ - super(NotificationContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, call_sid: str, sid: str): + # TODO: needs autogenerated docs + super(NotificationContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Notifications/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the NotificationInstance - - :returns: The fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return NotificationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, call_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Notifications/${sid}.json' + + + def fetch(self): + + """ + Fetch the NotificationInstance + + :returns: The fetched NotificationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NotificationInstance( + self._version, + payload, + account_sidcall_sidsid=self._solution['account_sid''call_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NotificationInstance(InstanceResource): - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ +class NotificationInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str, sid: str): super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'call_sid': payload.get('call_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'error_code': payload.get('error_code'), - 'log': payload.get('log'), - 'message_date': deserialize.rfc2822_datetime(payload.get('message_date')), - 'message_text': payload.get('message_text'), - 'more_info': payload.get('more_info'), - 'request_method': payload.get('request_method'), - 'request_url': payload.get('request_url'), - 'request_variables': payload.get('request_variables'), - 'response_body': payload.get('response_body'), - 'response_headers': payload.get('response_headers'), - 'sid': payload.get('sid'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'call_sid' = payload.get('call_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'error_code' = payload.get('error_code'), + 'log' = payload.get('log'), + 'message_date' = payload.get('message_date'), + 'message_text' = payload.get('message_text'), + 'more_info' = payload.get('more_info'), + 'request_method' = payload.get('request_method'), + 'request_url' = payload.get('request_url'), + 'request_variables' = payload.get('request_variables'), + 'response_body' = payload.get('response_body'), + 'response_headers' = payload.get('response_headers'), + 'sid' = payload.get('sid'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NotificationContext for this NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationContext - """ if self._context is None: self._context = NotificationContext( self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the Call Notification resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def error_code(self): - """ - :returns: A unique error code corresponding to the notification - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def log(self): - """ - :returns: An integer log level - :rtype: unicode - """ - return self._properties['log'] - - @property - def message_date(self): - """ - :returns: The date the notification was generated - :rtype: datetime - """ - return self._properties['message_date'] - - @property - def message_text(self): - """ - :returns: The text of the notification - :rtype: unicode - """ - return self._properties['message_text'] - - @property - def more_info(self): - """ - :returns: A URL for more information about the error code - :rtype: unicode - """ - return self._properties['more_info'] - - @property - def request_method(self): - """ - :returns: HTTP method used with the request url - :rtype: unicode - """ - return self._properties['request_method'] - - @property - def request_url(self): - """ - :returns: URL of the resource that generated the notification - :rtype: unicode - """ - return self._properties['request_url'] + - @property - def request_variables(self): + def __repr__(self): """ - :returns: Twilio-generated HTTP variables sent to the server - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['request_variables'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def response_body(self): - """ - :returns: The HTTP body returned by your server - :rtype: unicode - """ - return self._properties['response_body'] - @property - def response_headers(self): - """ - :returns: The HTTP headers returned by your server - :rtype: unicode - """ - return self._properties['response_headers'] - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] +class NotificationListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(NotificationListInstanceList, self).__init__(version) - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] + # Path Solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Notifications.json' + + + def page(self, log, message_date, message_date, message_date, page_size): + + data = values.of({ + 'log': log,'message_date': message_date,'message_date': message_date,'message_date': message_date,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the NotificationInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationInstance - """ - return self._proxy.fetch() + return NotificationPage(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index f025527df6..160241ee26 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,388 +19,107 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PaymentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the PaymentList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the Payments resource. - :param call_sid: The SID of the Call the resource is associated with. - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentList - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentList - """ - super(PaymentList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Payments.json'.format(**self._solution) - - def create(self, idempotency_key, status_callback, - bank_account_type=values.unset, charge_amount=values.unset, - currency=values.unset, description=values.unset, input=values.unset, - min_postal_code_length=values.unset, parameter=values.unset, - payment_connector=values.unset, payment_method=values.unset, - postal_code=values.unset, security_code=values.unset, - timeout=values.unset, token_type=values.unset, - valid_card_types=values.unset): - """ - Create the PaymentInstance - - :param unicode idempotency_key: A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. - :param unicode status_callback: Provide an absolute or relative URL to receive status updates regarding your Pay session.. - :param PaymentInstance.BankAccountType bank_account_type: Type of bank account if payment source is ACH. - :param unicode charge_amount: A positive decimal value less than 1,000,000 to charge against the credit card or bank account. - :param unicode currency: The currency of the `charge_amount`. - :param unicode description: The description can be used to provide more details regarding the transaction. - :param unicode input: A list of inputs that should be accepted. Currently only `dtmf` is supported. - :param unicode min_postal_code_length: A positive integer that is used to validate the length of the `PostalCode` inputted by the user. - :param dict parameter: A single-level JSON object used to pass custom parameters to payment processors. (Required for ACH payments) - :param unicode payment_connector: This is the unique name corresponding to the Pay Connector installed in the Twilio Add-ons. - :param PaymentInstance.PaymentMethod payment_method: Type of payment being captured. - :param bool postal_code: Indicates whether the credit card PostalCode (zip code) is a required piece of payment information that must be provided by the caller. - :param bool security_code: Indicates whether the credit card security code is a required piece of payment information that must be provided by the caller. - :param unicode timeout: The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. - :param PaymentInstance.TokenType token_type: Indicates whether the payment method should be tokenized as a `one-time` or `reusable` token. - :param unicode valid_card_types: Credit card types separated by space that Pay should accept. - - :returns: The created PaymentInstance - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentInstance - """ - data = values.of({ - 'IdempotencyKey': idempotency_key, - 'StatusCallback': status_callback, - 'BankAccountType': bank_account_type, - 'ChargeAmount': charge_amount, - 'Currency': currency, - 'Description': description, - 'Input': input, - 'MinPostalCodeLength': min_postal_code_length, - 'Parameter': serialize.object(parameter), - 'PaymentConnector': payment_connector, - 'PaymentMethod': payment_method, - 'PostalCode': postal_code, - 'SecurityCode': security_code, - 'Timeout': timeout, - 'TokenType': token_type, - 'ValidCardTypes': valid_card_types, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return PaymentInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def get(self, sid): - """ - Constructs a PaymentContext - - :param sid: The SID of Payments session - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentContext - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentContext - """ - return PaymentContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a PaymentContext - - :param sid: The SID of Payments session - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentContext - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentContext - """ - return PaymentContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PaymentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the PaymentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the Payments resource. - :param call_sid: The SID of the Call the resource is associated with. - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentPage - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentPage - """ - super(PaymentPage, self).__init__(version, response) - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PaymentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentInstance - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentInstance - """ - return PaymentInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class PaymentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the PaymentContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that will update the resource - :param call_sid: The SID of the call that will create the resource. - :param sid: The SID of Payments session - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentContext - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentContext - """ - super(PaymentContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, call_sid: str, sid: str): + # TODO: needs autogenerated docs + super(PaymentContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Payments/{sid}.json'.format(**self._solution) - - def update(self, idempotency_key, status_callback, capture=values.unset, - status=values.unset): - """ - Update the PaymentInstance - - :param unicode idempotency_key: A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. - :param unicode status_callback: Provide an absolute or relative URL to receive status updates regarding your Pay session. - :param PaymentInstance.Capture capture: The piece of payment information that you wish the caller to enter. - :param PaymentInstance.Status status: Indicates whether the current payment session should be cancelled or completed. - - :returns: The updated PaymentInstance - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentInstance - """ - data = values.of({ - 'IdempotencyKey': idempotency_key, - 'StatusCallback': status_callback, - 'Capture': capture, - 'Status': status, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return PaymentInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, call_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Payments/${sid}.json' + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return PaymentInstance(self._version, payload, account_sid=self._solution['account_sid'], call_sid=self._solution['call_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PaymentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - class PaymentMethod(object): - CREDIT_CARD = "credit-card" - ACH_DEBIT = "ach-debit" - - class BankAccountType(object): - CONSUMER_CHECKING = "consumer-checking" - CONSUMER_SAVINGS = "consumer-savings" - COMMERCIAL_CHECKING = "commercial-checking" - - class TokenType(object): - ONE_TIME = "one-time" - REUSABLE = "reusable" - - class Capture(object): - PAYMENT_CARD_NUMBER = "payment-card-number" - EXPIRATION_DATE = "expiration-date" - SECURITY_CODE = "security-code" - POSTAL_CODE = "postal-code" - BANK_ROUTING_NUMBER = "bank-routing-number" - BANK_ACCOUNT_NUMBER = "bank-account-number" - - class Status(object): - COMPLETE = "complete" - CANCEL = "cancel" - - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the PaymentInstance - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentInstance - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentInstance - """ +class PaymentInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str, sid: str): super(PaymentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'sid': payload.get('sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PaymentContext for this PaymentInstance - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentContext - """ if self._context is None: self._context = PaymentContext( self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Payments resource. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with. - :rtype: unicode - """ - return self._properties['call_sid'] + - @property - def sid(self): + def __repr__(self): """ - :returns: The SID of the Payments resource. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] +class PaymentListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(PaymentListInstanceList, self).__init__(version) - def update(self, idempotency_key, status_callback, capture=values.unset, - status=values.unset): - """ - Update the PaymentInstance + # Path Solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Payments.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param unicode idempotency_key: A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. - :param unicode status_callback: Provide an absolute or relative URL to receive status updates regarding your Pay session. - :param PaymentInstance.Capture capture: The piece of payment information that you wish the caller to enter. - :param PaymentInstance.Status status: Indicates whether the current payment session should be cancelled or completed. + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated PaymentInstance - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentInstance - """ - return self._proxy.update(idempotency_key, status_callback, capture=capture, status=status, ) + return PaymentInstance(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py index d962116dec..509e084d7a 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,592 +19,159 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RecordingList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json'.format(**self._solution) - - def create(self, recording_status_callback_event=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, trim=values.unset, - recording_channels=values.unset, recording_track=values.unset): - """ - Create the RecordingInstance - - :param list[unicode] recording_status_callback_event: The recording status changes that should generate a callback - :param unicode recording_status_callback: The callback URL on each selected recording event - :param unicode recording_status_callback_method: The HTTP method we should use to call `recording_status_callback` - :param unicode trim: Whether to trim the silence in the recording - :param unicode recording_channels: The number of channels that the output recording will be configured with - :param unicode recording_track: Which track(s) to record - - :returns: The created RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - data = values.of({ - 'RecordingStatusCallbackEvent': serialize.map(recording_status_callback_event, lambda e: e), - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'Trim': trim, - 'RecordingChannels': recording_channels, - 'RecordingTrack': recording_track, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Streams RecordingInstance 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 date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :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.call.recording.RecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Lists RecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.call.recording.RecordingInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RecordingInstance records from the API. - Request is executed immediately - - :param date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingPage - """ - data = values.of({ - 'DateCreated<': serialize.iso8601_date(date_created_before), - 'DateCreated': serialize.iso8601_date(date_created), - 'DateCreated>': serialize.iso8601_date(date_created_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RecordingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ - return RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a RecordingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ - return RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingPage - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RecordingContext(InstanceContext): - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param call_sid: The Call SID of the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, call_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RecordingContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{sid}.json'.format(**self._solution) - - def update(self, status, pause_behavior=values.unset): - """ - Update the RecordingInstance - - :param RecordingInstance.Status status: The new status of the recording - :param unicode pause_behavior: Whether to record or not during the pause period. - - :returns: The updated RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - data = values.of({'Status': status, 'PauseBehavior': pause_behavior, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) - - def fetch(self): - """ - Fetch the RecordingInstance - - :returns: The fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, call_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Recordings/${sid}.json' + + + def delete(self): + + + """ + Deletes the RecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RecordingInstance + + :returns: The fetched RecordingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RecordingInstance( + self._version, + payload, + account_sidcall_sidsid=self._solution['account_sid''call_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the RecordingInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return RecordingInstance(self._version, payload, account_sid=self._solution['account_sid'], call_sid=self._solution['call_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RecordingInstance(InstanceResource): - class Status(object): - IN_PROGRESS = "in-progress" - PAUSED = "paused" - STOPPED = "stopped" - PROCESSING = "processing" - COMPLETED = "completed" - ABSENT = "absent" - - class Source(object): - DIALVERB = "DialVerb" - CONFERENCE = "Conference" - OUTBOUNDAPI = "OutboundAPI" - TRUNKING = "Trunking" - RECORDVERB = "RecordVerb" - STARTCALLRECORDINGAPI = "StartCallRecordingAPI" - STARTCONFERENCERECORDINGAPI = "StartConferenceRecordingAPI" - - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the RecordingInstance - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ +class RecordingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str, sid: str): super(RecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'call_sid': payload.get('call_sid'), - 'conference_sid': payload.get('conference_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'start_time': deserialize.rfc2822_datetime(payload.get('start_time')), - 'duration': payload.get('duration'), - 'sid': payload.get('sid'), - 'price': deserialize.decimal(payload.get('price')), - 'uri': payload.get('uri'), - 'encryption_details': payload.get('encryption_details'), - 'price_unit': payload.get('price_unit'), - 'status': payload.get('status'), - 'channels': deserialize.integer(payload.get('channels')), - 'source': payload.get('source'), - 'error_code': deserialize.integer(payload.get('error_code')), - 'track': payload.get('track'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'call_sid' = payload.get('call_sid'), + 'conference_sid' = payload.get('conference_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'start_time' = payload.get('start_time'), + 'duration' = payload.get('duration'), + 'sid' = payload.get('sid'), + 'price' = payload.get('price'), + 'uri' = payload.get('uri'), + 'encryption_details' = payload.get('encryption_details'), + 'price_unit' = payload.get('price_unit'), + 'status' = payload.get('status'), + 'channels' = payload.get('channels'), + 'source' = payload.get('source'), + 'error_code' = payload.get('error_code'), + 'track' = payload.get('track'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingContext - """ if self._context is None: self._context = RecordingContext( self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to make the recording - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def conference_sid(self): - """ - :returns: The Conference SID that identifies the conference associated with the recording - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def start_time(self): - """ - :returns: The start time of the recording, given in RFC 2822 format - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def duration(self): - """ - :returns: The length of the recording in seconds - :rtype: unicode - """ - return self._properties['duration'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def price(self): - """ - :returns: The one-time cost of creating the recording. - :rtype: unicode - """ - return self._properties['price'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def encryption_details(self): - """ - :returns: How to decrypt the recording. - :rtype: dict - """ - return self._properties['encryption_details'] - - @property - def price_unit(self): - """ - :returns: The currency used in the price property. - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def status(self): - """ - :returns: The status of the recording - :rtype: RecordingInstance.Status - """ - return self._properties['status'] - - @property - def channels(self): - """ - :returns: The number of channels in the final recording file - :rtype: unicode - """ - return self._properties['channels'] - - @property - def source(self): - """ - :returns: How the recording was created - :rtype: RecordingInstance.Source - """ - return self._properties['source'] - - @property - def error_code(self): - """ - :returns: More information about why the recording is missing, if status is `absent`. - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def track(self): - """ - :returns: The recorded track. Can be: `inbound`, `outbound`, or `both`. - :rtype: unicode - """ - return self._properties['track'] + - def update(self, status, pause_behavior=values.unset): + def __repr__(self): """ - Update the RecordingInstance - - :param RecordingInstance.Status status: The new status of the recording - :param unicode pause_behavior: Whether to record or not during the pause period. - - :returns: The updated RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(status, pause_behavior=pause_behavior, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the RecordingInstance - :returns: The fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the RecordingInstance +class RecordingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(RecordingListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Recordings.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RecordingInstance(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + + + def page(self, date_created, date_created, date_created, page_size): + + data = values.of({ + 'date_created': date_created,'date_created': date_created,'date_created': date_created,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RecordingPage(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/call/siprec.py b/twilio/rest/api/v2010/account/call/siprec.py index 21e45a712c..e89239fe85 100644 --- a/twilio/rest/api/v2010/account/call/siprec.py +++ b/twilio/rest/api/v2010/account/call/siprec.py @@ -1,837 +1,126 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SiprecList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the SiprecList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecList - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecList - """ - super(SiprecList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json'.format(**self._solution) - - def create(self, name=values.unset, connector_name=values.unset, - track=values.unset, status_callback=values.unset, - status_callback_method=values.unset, parameter1_name=values.unset, - parameter1_value=values.unset, parameter2_name=values.unset, - parameter2_value=values.unset, parameter3_name=values.unset, - parameter3_value=values.unset, parameter4_name=values.unset, - parameter4_value=values.unset, parameter5_name=values.unset, - parameter5_value=values.unset, parameter6_name=values.unset, - parameter6_value=values.unset, parameter7_name=values.unset, - parameter7_value=values.unset, parameter8_name=values.unset, - parameter8_value=values.unset, parameter9_name=values.unset, - parameter9_value=values.unset, parameter10_name=values.unset, - parameter10_value=values.unset, parameter11_name=values.unset, - parameter11_value=values.unset, parameter12_name=values.unset, - parameter12_value=values.unset, parameter13_name=values.unset, - parameter13_value=values.unset, parameter14_name=values.unset, - parameter14_value=values.unset, parameter15_name=values.unset, - parameter15_value=values.unset, parameter16_name=values.unset, - parameter16_value=values.unset, parameter17_name=values.unset, - parameter17_value=values.unset, parameter18_name=values.unset, - parameter18_value=values.unset, parameter19_name=values.unset, - parameter19_value=values.unset, parameter20_name=values.unset, - parameter20_value=values.unset, parameter21_name=values.unset, - parameter21_value=values.unset, parameter22_name=values.unset, - parameter22_value=values.unset, parameter23_name=values.unset, - parameter23_value=values.unset, parameter24_name=values.unset, - parameter24_value=values.unset, parameter25_name=values.unset, - parameter25_value=values.unset, parameter26_name=values.unset, - parameter26_value=values.unset, parameter27_name=values.unset, - parameter27_value=values.unset, parameter28_name=values.unset, - parameter28_value=values.unset, parameter29_name=values.unset, - parameter29_value=values.unset, parameter30_name=values.unset, - parameter30_value=values.unset, parameter31_name=values.unset, - parameter31_value=values.unset, parameter32_name=values.unset, - parameter32_value=values.unset, parameter33_name=values.unset, - parameter33_value=values.unset, parameter34_name=values.unset, - parameter34_value=values.unset, parameter35_name=values.unset, - parameter35_value=values.unset, parameter36_name=values.unset, - parameter36_value=values.unset, parameter37_name=values.unset, - parameter37_value=values.unset, parameter38_name=values.unset, - parameter38_value=values.unset, parameter39_name=values.unset, - parameter39_value=values.unset, parameter40_name=values.unset, - parameter40_value=values.unset, parameter41_name=values.unset, - parameter41_value=values.unset, parameter42_name=values.unset, - parameter42_value=values.unset, parameter43_name=values.unset, - parameter43_value=values.unset, parameter44_name=values.unset, - parameter44_value=values.unset, parameter45_name=values.unset, - parameter45_value=values.unset, parameter46_name=values.unset, - parameter46_value=values.unset, parameter47_name=values.unset, - parameter47_value=values.unset, parameter48_name=values.unset, - parameter48_value=values.unset, parameter49_name=values.unset, - parameter49_value=values.unset, parameter50_name=values.unset, - parameter50_value=values.unset, parameter51_name=values.unset, - parameter51_value=values.unset, parameter52_name=values.unset, - parameter52_value=values.unset, parameter53_name=values.unset, - parameter53_value=values.unset, parameter54_name=values.unset, - parameter54_value=values.unset, parameter55_name=values.unset, - parameter55_value=values.unset, parameter56_name=values.unset, - parameter56_value=values.unset, parameter57_name=values.unset, - parameter57_value=values.unset, parameter58_name=values.unset, - parameter58_value=values.unset, parameter59_name=values.unset, - parameter59_value=values.unset, parameter60_name=values.unset, - parameter60_value=values.unset, parameter61_name=values.unset, - parameter61_value=values.unset, parameter62_name=values.unset, - parameter62_value=values.unset, parameter63_name=values.unset, - parameter63_value=values.unset, parameter64_name=values.unset, - parameter64_value=values.unset, parameter65_name=values.unset, - parameter65_value=values.unset, parameter66_name=values.unset, - parameter66_value=values.unset, parameter67_name=values.unset, - parameter67_value=values.unset, parameter68_name=values.unset, - parameter68_value=values.unset, parameter69_name=values.unset, - parameter69_value=values.unset, parameter70_name=values.unset, - parameter70_value=values.unset, parameter71_name=values.unset, - parameter71_value=values.unset, parameter72_name=values.unset, - parameter72_value=values.unset, parameter73_name=values.unset, - parameter73_value=values.unset, parameter74_name=values.unset, - parameter74_value=values.unset, parameter75_name=values.unset, - parameter75_value=values.unset, parameter76_name=values.unset, - parameter76_value=values.unset, parameter77_name=values.unset, - parameter77_value=values.unset, parameter78_name=values.unset, - parameter78_value=values.unset, parameter79_name=values.unset, - parameter79_value=values.unset, parameter80_name=values.unset, - parameter80_value=values.unset, parameter81_name=values.unset, - parameter81_value=values.unset, parameter82_name=values.unset, - parameter82_value=values.unset, parameter83_name=values.unset, - parameter83_value=values.unset, parameter84_name=values.unset, - parameter84_value=values.unset, parameter85_name=values.unset, - parameter85_value=values.unset, parameter86_name=values.unset, - parameter86_value=values.unset, parameter87_name=values.unset, - parameter87_value=values.unset, parameter88_name=values.unset, - parameter88_value=values.unset, parameter89_name=values.unset, - parameter89_value=values.unset, parameter90_name=values.unset, - parameter90_value=values.unset, parameter91_name=values.unset, - parameter91_value=values.unset, parameter92_name=values.unset, - parameter92_value=values.unset, parameter93_name=values.unset, - parameter93_value=values.unset, parameter94_name=values.unset, - parameter94_value=values.unset, parameter95_name=values.unset, - parameter95_value=values.unset, parameter96_name=values.unset, - parameter96_value=values.unset, parameter97_name=values.unset, - parameter97_value=values.unset, parameter98_name=values.unset, - parameter98_value=values.unset, parameter99_name=values.unset, - parameter99_value=values.unset): - """ - Create the SiprecInstance - :param unicode name: The name of this resource - :param unicode connector_name: Unique name used when configuring the connector via Marketplace Add-on. - :param SiprecInstance.Track track: One of `inbound_track`, `outbound_track`, `both_tracks`. - :param unicode status_callback: Absolute URL of the status callback. - :param unicode status_callback_method: The http method for the status_callback. - :param unicode parameter1_name: Parameter name - :param unicode parameter1_value: Parameter value - :param unicode parameter2_name: Parameter name - :param unicode parameter2_value: Parameter value - :param unicode parameter3_name: Parameter name - :param unicode parameter3_value: Parameter value - :param unicode parameter4_name: Parameter name - :param unicode parameter4_value: Parameter value - :param unicode parameter5_name: Parameter name - :param unicode parameter5_value: Parameter value - :param unicode parameter6_name: Parameter name - :param unicode parameter6_value: Parameter value - :param unicode parameter7_name: Parameter name - :param unicode parameter7_value: Parameter value - :param unicode parameter8_name: Parameter name - :param unicode parameter8_value: Parameter value - :param unicode parameter9_name: Parameter name - :param unicode parameter9_value: Parameter value - :param unicode parameter10_name: Parameter name - :param unicode parameter10_value: Parameter value - :param unicode parameter11_name: Parameter name - :param unicode parameter11_value: Parameter value - :param unicode parameter12_name: Parameter name - :param unicode parameter12_value: Parameter value - :param unicode parameter13_name: Parameter name - :param unicode parameter13_value: Parameter value - :param unicode parameter14_name: Parameter name - :param unicode parameter14_value: Parameter value - :param unicode parameter15_name: Parameter name - :param unicode parameter15_value: Parameter value - :param unicode parameter16_name: Parameter name - :param unicode parameter16_value: Parameter value - :param unicode parameter17_name: Parameter name - :param unicode parameter17_value: Parameter value - :param unicode parameter18_name: Parameter name - :param unicode parameter18_value: Parameter value - :param unicode parameter19_name: Parameter name - :param unicode parameter19_value: Parameter value - :param unicode parameter20_name: Parameter name - :param unicode parameter20_value: Parameter value - :param unicode parameter21_name: Parameter name - :param unicode parameter21_value: Parameter value - :param unicode parameter22_name: Parameter name - :param unicode parameter22_value: Parameter value - :param unicode parameter23_name: Parameter name - :param unicode parameter23_value: Parameter value - :param unicode parameter24_name: Parameter name - :param unicode parameter24_value: Parameter value - :param unicode parameter25_name: Parameter name - :param unicode parameter25_value: Parameter value - :param unicode parameter26_name: Parameter name - :param unicode parameter26_value: Parameter value - :param unicode parameter27_name: Parameter name - :param unicode parameter27_value: Parameter value - :param unicode parameter28_name: Parameter name - :param unicode parameter28_value: Parameter value - :param unicode parameter29_name: Parameter name - :param unicode parameter29_value: Parameter value - :param unicode parameter30_name: Parameter name - :param unicode parameter30_value: Parameter value - :param unicode parameter31_name: Parameter name - :param unicode parameter31_value: Parameter value - :param unicode parameter32_name: Parameter name - :param unicode parameter32_value: Parameter value - :param unicode parameter33_name: Parameter name - :param unicode parameter33_value: Parameter value - :param unicode parameter34_name: Parameter name - :param unicode parameter34_value: Parameter value - :param unicode parameter35_name: Parameter name - :param unicode parameter35_value: Parameter value - :param unicode parameter36_name: Parameter name - :param unicode parameter36_value: Parameter value - :param unicode parameter37_name: Parameter name - :param unicode parameter37_value: Parameter value - :param unicode parameter38_name: Parameter name - :param unicode parameter38_value: Parameter value - :param unicode parameter39_name: Parameter name - :param unicode parameter39_value: Parameter value - :param unicode parameter40_name: Parameter name - :param unicode parameter40_value: Parameter value - :param unicode parameter41_name: Parameter name - :param unicode parameter41_value: Parameter value - :param unicode parameter42_name: Parameter name - :param unicode parameter42_value: Parameter value - :param unicode parameter43_name: Parameter name - :param unicode parameter43_value: Parameter value - :param unicode parameter44_name: Parameter name - :param unicode parameter44_value: Parameter value - :param unicode parameter45_name: Parameter name - :param unicode parameter45_value: Parameter value - :param unicode parameter46_name: Parameter name - :param unicode parameter46_value: Parameter value - :param unicode parameter47_name: Parameter name - :param unicode parameter47_value: Parameter value - :param unicode parameter48_name: Parameter name - :param unicode parameter48_value: Parameter value - :param unicode parameter49_name: Parameter name - :param unicode parameter49_value: Parameter value - :param unicode parameter50_name: Parameter name - :param unicode parameter50_value: Parameter value - :param unicode parameter51_name: Parameter name - :param unicode parameter51_value: Parameter value - :param unicode parameter52_name: Parameter name - :param unicode parameter52_value: Parameter value - :param unicode parameter53_name: Parameter name - :param unicode parameter53_value: Parameter value - :param unicode parameter54_name: Parameter name - :param unicode parameter54_value: Parameter value - :param unicode parameter55_name: Parameter name - :param unicode parameter55_value: Parameter value - :param unicode parameter56_name: Parameter name - :param unicode parameter56_value: Parameter value - :param unicode parameter57_name: Parameter name - :param unicode parameter57_value: Parameter value - :param unicode parameter58_name: Parameter name - :param unicode parameter58_value: Parameter value - :param unicode parameter59_name: Parameter name - :param unicode parameter59_value: Parameter value - :param unicode parameter60_name: Parameter name - :param unicode parameter60_value: Parameter value - :param unicode parameter61_name: Parameter name - :param unicode parameter61_value: Parameter value - :param unicode parameter62_name: Parameter name - :param unicode parameter62_value: Parameter value - :param unicode parameter63_name: Parameter name - :param unicode parameter63_value: Parameter value - :param unicode parameter64_name: Parameter name - :param unicode parameter64_value: Parameter value - :param unicode parameter65_name: Parameter name - :param unicode parameter65_value: Parameter value - :param unicode parameter66_name: Parameter name - :param unicode parameter66_value: Parameter value - :param unicode parameter67_name: Parameter name - :param unicode parameter67_value: Parameter value - :param unicode parameter68_name: Parameter name - :param unicode parameter68_value: Parameter value - :param unicode parameter69_name: Parameter name - :param unicode parameter69_value: Parameter value - :param unicode parameter70_name: Parameter name - :param unicode parameter70_value: Parameter value - :param unicode parameter71_name: Parameter name - :param unicode parameter71_value: Parameter value - :param unicode parameter72_name: Parameter name - :param unicode parameter72_value: Parameter value - :param unicode parameter73_name: Parameter name - :param unicode parameter73_value: Parameter value - :param unicode parameter74_name: Parameter name - :param unicode parameter74_value: Parameter value - :param unicode parameter75_name: Parameter name - :param unicode parameter75_value: Parameter value - :param unicode parameter76_name: Parameter name - :param unicode parameter76_value: Parameter value - :param unicode parameter77_name: Parameter name - :param unicode parameter77_value: Parameter value - :param unicode parameter78_name: Parameter name - :param unicode parameter78_value: Parameter value - :param unicode parameter79_name: Parameter name - :param unicode parameter79_value: Parameter value - :param unicode parameter80_name: Parameter name - :param unicode parameter80_value: Parameter value - :param unicode parameter81_name: Parameter name - :param unicode parameter81_value: Parameter value - :param unicode parameter82_name: Parameter name - :param unicode parameter82_value: Parameter value - :param unicode parameter83_name: Parameter name - :param unicode parameter83_value: Parameter value - :param unicode parameter84_name: Parameter name - :param unicode parameter84_value: Parameter value - :param unicode parameter85_name: Parameter name - :param unicode parameter85_value: Parameter value - :param unicode parameter86_name: Parameter name - :param unicode parameter86_value: Parameter value - :param unicode parameter87_name: Parameter name - :param unicode parameter87_value: Parameter value - :param unicode parameter88_name: Parameter name - :param unicode parameter88_value: Parameter value - :param unicode parameter89_name: Parameter name - :param unicode parameter89_value: Parameter value - :param unicode parameter90_name: Parameter name - :param unicode parameter90_value: Parameter value - :param unicode parameter91_name: Parameter name - :param unicode parameter91_value: Parameter value - :param unicode parameter92_name: Parameter name - :param unicode parameter92_value: Parameter value - :param unicode parameter93_name: Parameter name - :param unicode parameter93_value: Parameter value - :param unicode parameter94_name: Parameter name - :param unicode parameter94_value: Parameter value - :param unicode parameter95_name: Parameter name - :param unicode parameter95_value: Parameter value - :param unicode parameter96_name: Parameter name - :param unicode parameter96_value: Parameter value - :param unicode parameter97_name: Parameter name - :param unicode parameter97_value: Parameter value - :param unicode parameter98_name: Parameter name - :param unicode parameter98_value: Parameter value - :param unicode parameter99_name: Parameter name - :param unicode parameter99_value: Parameter value - :returns: The created SiprecInstance - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecInstance - """ - data = values.of({ - 'Name': name, - 'ConnectorName': connector_name, - 'Track': track, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'Parameter1.Name': parameter1_name, - 'Parameter1.Value': parameter1_value, - 'Parameter2.Name': parameter2_name, - 'Parameter2.Value': parameter2_value, - 'Parameter3.Name': parameter3_name, - 'Parameter3.Value': parameter3_value, - 'Parameter4.Name': parameter4_name, - 'Parameter4.Value': parameter4_value, - 'Parameter5.Name': parameter5_name, - 'Parameter5.Value': parameter5_value, - 'Parameter6.Name': parameter6_name, - 'Parameter6.Value': parameter6_value, - 'Parameter7.Name': parameter7_name, - 'Parameter7.Value': parameter7_value, - 'Parameter8.Name': parameter8_name, - 'Parameter8.Value': parameter8_value, - 'Parameter9.Name': parameter9_name, - 'Parameter9.Value': parameter9_value, - 'Parameter10.Name': parameter10_name, - 'Parameter10.Value': parameter10_value, - 'Parameter11.Name': parameter11_name, - 'Parameter11.Value': parameter11_value, - 'Parameter12.Name': parameter12_name, - 'Parameter12.Value': parameter12_value, - 'Parameter13.Name': parameter13_name, - 'Parameter13.Value': parameter13_value, - 'Parameter14.Name': parameter14_name, - 'Parameter14.Value': parameter14_value, - 'Parameter15.Name': parameter15_name, - 'Parameter15.Value': parameter15_value, - 'Parameter16.Name': parameter16_name, - 'Parameter16.Value': parameter16_value, - 'Parameter17.Name': parameter17_name, - 'Parameter17.Value': parameter17_value, - 'Parameter18.Name': parameter18_name, - 'Parameter18.Value': parameter18_value, - 'Parameter19.Name': parameter19_name, - 'Parameter19.Value': parameter19_value, - 'Parameter20.Name': parameter20_name, - 'Parameter20.Value': parameter20_value, - 'Parameter21.Name': parameter21_name, - 'Parameter21.Value': parameter21_value, - 'Parameter22.Name': parameter22_name, - 'Parameter22.Value': parameter22_value, - 'Parameter23.Name': parameter23_name, - 'Parameter23.Value': parameter23_value, - 'Parameter24.Name': parameter24_name, - 'Parameter24.Value': parameter24_value, - 'Parameter25.Name': parameter25_name, - 'Parameter25.Value': parameter25_value, - 'Parameter26.Name': parameter26_name, - 'Parameter26.Value': parameter26_value, - 'Parameter27.Name': parameter27_name, - 'Parameter27.Value': parameter27_value, - 'Parameter28.Name': parameter28_name, - 'Parameter28.Value': parameter28_value, - 'Parameter29.Name': parameter29_name, - 'Parameter29.Value': parameter29_value, - 'Parameter30.Name': parameter30_name, - 'Parameter30.Value': parameter30_value, - 'Parameter31.Name': parameter31_name, - 'Parameter31.Value': parameter31_value, - 'Parameter32.Name': parameter32_name, - 'Parameter32.Value': parameter32_value, - 'Parameter33.Name': parameter33_name, - 'Parameter33.Value': parameter33_value, - 'Parameter34.Name': parameter34_name, - 'Parameter34.Value': parameter34_value, - 'Parameter35.Name': parameter35_name, - 'Parameter35.Value': parameter35_value, - 'Parameter36.Name': parameter36_name, - 'Parameter36.Value': parameter36_value, - 'Parameter37.Name': parameter37_name, - 'Parameter37.Value': parameter37_value, - 'Parameter38.Name': parameter38_name, - 'Parameter38.Value': parameter38_value, - 'Parameter39.Name': parameter39_name, - 'Parameter39.Value': parameter39_value, - 'Parameter40.Name': parameter40_name, - 'Parameter40.Value': parameter40_value, - 'Parameter41.Name': parameter41_name, - 'Parameter41.Value': parameter41_value, - 'Parameter42.Name': parameter42_name, - 'Parameter42.Value': parameter42_value, - 'Parameter43.Name': parameter43_name, - 'Parameter43.Value': parameter43_value, - 'Parameter44.Name': parameter44_name, - 'Parameter44.Value': parameter44_value, - 'Parameter45.Name': parameter45_name, - 'Parameter45.Value': parameter45_value, - 'Parameter46.Name': parameter46_name, - 'Parameter46.Value': parameter46_value, - 'Parameter47.Name': parameter47_name, - 'Parameter47.Value': parameter47_value, - 'Parameter48.Name': parameter48_name, - 'Parameter48.Value': parameter48_value, - 'Parameter49.Name': parameter49_name, - 'Parameter49.Value': parameter49_value, - 'Parameter50.Name': parameter50_name, - 'Parameter50.Value': parameter50_value, - 'Parameter51.Name': parameter51_name, - 'Parameter51.Value': parameter51_value, - 'Parameter52.Name': parameter52_name, - 'Parameter52.Value': parameter52_value, - 'Parameter53.Name': parameter53_name, - 'Parameter53.Value': parameter53_value, - 'Parameter54.Name': parameter54_name, - 'Parameter54.Value': parameter54_value, - 'Parameter55.Name': parameter55_name, - 'Parameter55.Value': parameter55_value, - 'Parameter56.Name': parameter56_name, - 'Parameter56.Value': parameter56_value, - 'Parameter57.Name': parameter57_name, - 'Parameter57.Value': parameter57_value, - 'Parameter58.Name': parameter58_name, - 'Parameter58.Value': parameter58_value, - 'Parameter59.Name': parameter59_name, - 'Parameter59.Value': parameter59_value, - 'Parameter60.Name': parameter60_name, - 'Parameter60.Value': parameter60_value, - 'Parameter61.Name': parameter61_name, - 'Parameter61.Value': parameter61_value, - 'Parameter62.Name': parameter62_name, - 'Parameter62.Value': parameter62_value, - 'Parameter63.Name': parameter63_name, - 'Parameter63.Value': parameter63_value, - 'Parameter64.Name': parameter64_name, - 'Parameter64.Value': parameter64_value, - 'Parameter65.Name': parameter65_name, - 'Parameter65.Value': parameter65_value, - 'Parameter66.Name': parameter66_name, - 'Parameter66.Value': parameter66_value, - 'Parameter67.Name': parameter67_name, - 'Parameter67.Value': parameter67_value, - 'Parameter68.Name': parameter68_name, - 'Parameter68.Value': parameter68_value, - 'Parameter69.Name': parameter69_name, - 'Parameter69.Value': parameter69_value, - 'Parameter70.Name': parameter70_name, - 'Parameter70.Value': parameter70_value, - 'Parameter71.Name': parameter71_name, - 'Parameter71.Value': parameter71_value, - 'Parameter72.Name': parameter72_name, - 'Parameter72.Value': parameter72_value, - 'Parameter73.Name': parameter73_name, - 'Parameter73.Value': parameter73_value, - 'Parameter74.Name': parameter74_name, - 'Parameter74.Value': parameter74_value, - 'Parameter75.Name': parameter75_name, - 'Parameter75.Value': parameter75_value, - 'Parameter76.Name': parameter76_name, - 'Parameter76.Value': parameter76_value, - 'Parameter77.Name': parameter77_name, - 'Parameter77.Value': parameter77_value, - 'Parameter78.Name': parameter78_name, - 'Parameter78.Value': parameter78_value, - 'Parameter79.Name': parameter79_name, - 'Parameter79.Value': parameter79_value, - 'Parameter80.Name': parameter80_name, - 'Parameter80.Value': parameter80_value, - 'Parameter81.Name': parameter81_name, - 'Parameter81.Value': parameter81_value, - 'Parameter82.Name': parameter82_name, - 'Parameter82.Value': parameter82_value, - 'Parameter83.Name': parameter83_name, - 'Parameter83.Value': parameter83_value, - 'Parameter84.Name': parameter84_name, - 'Parameter84.Value': parameter84_value, - 'Parameter85.Name': parameter85_name, - 'Parameter85.Value': parameter85_value, - 'Parameter86.Name': parameter86_name, - 'Parameter86.Value': parameter86_value, - 'Parameter87.Name': parameter87_name, - 'Parameter87.Value': parameter87_value, - 'Parameter88.Name': parameter88_name, - 'Parameter88.Value': parameter88_value, - 'Parameter89.Name': parameter89_name, - 'Parameter89.Value': parameter89_value, - 'Parameter90.Name': parameter90_name, - 'Parameter90.Value': parameter90_value, - 'Parameter91.Name': parameter91_name, - 'Parameter91.Value': parameter91_value, - 'Parameter92.Name': parameter92_name, - 'Parameter92.Value': parameter92_value, - 'Parameter93.Name': parameter93_name, - 'Parameter93.Value': parameter93_value, - 'Parameter94.Name': parameter94_name, - 'Parameter94.Value': parameter94_value, - 'Parameter95.Name': parameter95_name, - 'Parameter95.Value': parameter95_value, - 'Parameter96.Name': parameter96_name, - 'Parameter96.Value': parameter96_value, - 'Parameter97.Name': parameter97_name, - 'Parameter97.Value': parameter97_value, - 'Parameter98.Name': parameter98_name, - 'Parameter98.Value': parameter98_value, - 'Parameter99.Name': parameter99_name, - 'Parameter99.Value': parameter99_value, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SiprecInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def get(self, sid): - """ - Constructs a SiprecContext - - :param sid: The SID of the Siprec resource, or the `name` - - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecContext - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecContext - """ - return SiprecContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a SiprecContext - - :param sid: The SID of the Siprec resource, or the `name` - - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecContext - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecContext - """ - return SiprecContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SiprecPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SiprecPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecPage - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecPage - """ - super(SiprecPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SiprecInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecInstance - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecInstance - """ - return SiprecInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SiprecContext(InstanceContext): - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the SiprecContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - :param call_sid: The SID of the Call the resource is associated with - :param sid: The SID of the Siprec resource, or the `name` - - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecContext - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecContext - """ - super(SiprecContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, call_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SiprecContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{sid}.json'.format(**self._solution) - - def update(self, status): - """ - Update the SiprecInstance - - :param SiprecInstance.UpdateStatus status: The status. Must have the value `stopped` - - :returns: The updated SiprecInstance - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SiprecInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, call_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Siprec/${sid}.json' + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SiprecInstance(self._version, payload, account_sid=self._solution['account_sid'], call_sid=self._solution['call_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SiprecInstance(InstanceResource): - - class Track(object): - INBOUND_TRACK = "inbound_track" - OUTBOUND_TRACK = "outbound_track" - BOTH_TRACKS = "both_tracks" + return '' - class Status(object): - IN_PROGRESS = "in-progress" - STOPPED = "stopped" - class UpdateStatus(object): - STOPPED = "stopped" - - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the SiprecInstance - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecInstance - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecInstance - """ +class SiprecInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str, sid: str): super(SiprecInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'name': payload.get('name'), - 'status': payload.get('status'), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'uri': payload.get('uri'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'name' = payload.get('name'), + 'status' = payload.get('status'), + 'date_updated' = payload.get('date_updated'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SiprecContext for this SiprecInstance - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecContext - """ if self._context is None: self._context = SiprecContext( self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The SID of the Siprec resource. - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): - """ - :returns: The SID of the Account that created this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): + def __repr__(self): """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['call_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def name(self): - """ - :returns: The name of this resource - :rtype: unicode - """ - return self._properties['name'] - @property - def status(self): - """ - :returns: The status - one of `stopped`, `in-progress` - :rtype: SiprecInstance.Status - """ - return self._properties['status'] - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] +class SiprecListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(SiprecListInstanceList, self).__init__(version) - def update(self, status): - """ - Update the SiprecInstance + # Path Solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Siprec.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param SiprecInstance.UpdateStatus status: The status. Must have the value `stopped` + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated SiprecInstance - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecInstance - """ - return self._proxy.update(status, ) + return SiprecInstance(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/call/stream.py b/twilio/rest/api/v2010/account/call/stream.py index 94eddd9dac..d02bb1d1c1 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -1,836 +1,126 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class StreamList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the StreamList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.stream.StreamList - :rtype: twilio.rest.api.v2010.account.call.stream.StreamList - """ - super(StreamList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Streams.json'.format(**self._solution) - - def create(self, url, name=values.unset, track=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - parameter1_name=values.unset, parameter1_value=values.unset, - parameter2_name=values.unset, parameter2_value=values.unset, - parameter3_name=values.unset, parameter3_value=values.unset, - parameter4_name=values.unset, parameter4_value=values.unset, - parameter5_name=values.unset, parameter5_value=values.unset, - parameter6_name=values.unset, parameter6_value=values.unset, - parameter7_name=values.unset, parameter7_value=values.unset, - parameter8_name=values.unset, parameter8_value=values.unset, - parameter9_name=values.unset, parameter9_value=values.unset, - parameter10_name=values.unset, parameter10_value=values.unset, - parameter11_name=values.unset, parameter11_value=values.unset, - parameter12_name=values.unset, parameter12_value=values.unset, - parameter13_name=values.unset, parameter13_value=values.unset, - parameter14_name=values.unset, parameter14_value=values.unset, - parameter15_name=values.unset, parameter15_value=values.unset, - parameter16_name=values.unset, parameter16_value=values.unset, - parameter17_name=values.unset, parameter17_value=values.unset, - parameter18_name=values.unset, parameter18_value=values.unset, - parameter19_name=values.unset, parameter19_value=values.unset, - parameter20_name=values.unset, parameter20_value=values.unset, - parameter21_name=values.unset, parameter21_value=values.unset, - parameter22_name=values.unset, parameter22_value=values.unset, - parameter23_name=values.unset, parameter23_value=values.unset, - parameter24_name=values.unset, parameter24_value=values.unset, - parameter25_name=values.unset, parameter25_value=values.unset, - parameter26_name=values.unset, parameter26_value=values.unset, - parameter27_name=values.unset, parameter27_value=values.unset, - parameter28_name=values.unset, parameter28_value=values.unset, - parameter29_name=values.unset, parameter29_value=values.unset, - parameter30_name=values.unset, parameter30_value=values.unset, - parameter31_name=values.unset, parameter31_value=values.unset, - parameter32_name=values.unset, parameter32_value=values.unset, - parameter33_name=values.unset, parameter33_value=values.unset, - parameter34_name=values.unset, parameter34_value=values.unset, - parameter35_name=values.unset, parameter35_value=values.unset, - parameter36_name=values.unset, parameter36_value=values.unset, - parameter37_name=values.unset, parameter37_value=values.unset, - parameter38_name=values.unset, parameter38_value=values.unset, - parameter39_name=values.unset, parameter39_value=values.unset, - parameter40_name=values.unset, parameter40_value=values.unset, - parameter41_name=values.unset, parameter41_value=values.unset, - parameter42_name=values.unset, parameter42_value=values.unset, - parameter43_name=values.unset, parameter43_value=values.unset, - parameter44_name=values.unset, parameter44_value=values.unset, - parameter45_name=values.unset, parameter45_value=values.unset, - parameter46_name=values.unset, parameter46_value=values.unset, - parameter47_name=values.unset, parameter47_value=values.unset, - parameter48_name=values.unset, parameter48_value=values.unset, - parameter49_name=values.unset, parameter49_value=values.unset, - parameter50_name=values.unset, parameter50_value=values.unset, - parameter51_name=values.unset, parameter51_value=values.unset, - parameter52_name=values.unset, parameter52_value=values.unset, - parameter53_name=values.unset, parameter53_value=values.unset, - parameter54_name=values.unset, parameter54_value=values.unset, - parameter55_name=values.unset, parameter55_value=values.unset, - parameter56_name=values.unset, parameter56_value=values.unset, - parameter57_name=values.unset, parameter57_value=values.unset, - parameter58_name=values.unset, parameter58_value=values.unset, - parameter59_name=values.unset, parameter59_value=values.unset, - parameter60_name=values.unset, parameter60_value=values.unset, - parameter61_name=values.unset, parameter61_value=values.unset, - parameter62_name=values.unset, parameter62_value=values.unset, - parameter63_name=values.unset, parameter63_value=values.unset, - parameter64_name=values.unset, parameter64_value=values.unset, - parameter65_name=values.unset, parameter65_value=values.unset, - parameter66_name=values.unset, parameter66_value=values.unset, - parameter67_name=values.unset, parameter67_value=values.unset, - parameter68_name=values.unset, parameter68_value=values.unset, - parameter69_name=values.unset, parameter69_value=values.unset, - parameter70_name=values.unset, parameter70_value=values.unset, - parameter71_name=values.unset, parameter71_value=values.unset, - parameter72_name=values.unset, parameter72_value=values.unset, - parameter73_name=values.unset, parameter73_value=values.unset, - parameter74_name=values.unset, parameter74_value=values.unset, - parameter75_name=values.unset, parameter75_value=values.unset, - parameter76_name=values.unset, parameter76_value=values.unset, - parameter77_name=values.unset, parameter77_value=values.unset, - parameter78_name=values.unset, parameter78_value=values.unset, - parameter79_name=values.unset, parameter79_value=values.unset, - parameter80_name=values.unset, parameter80_value=values.unset, - parameter81_name=values.unset, parameter81_value=values.unset, - parameter82_name=values.unset, parameter82_value=values.unset, - parameter83_name=values.unset, parameter83_value=values.unset, - parameter84_name=values.unset, parameter84_value=values.unset, - parameter85_name=values.unset, parameter85_value=values.unset, - parameter86_name=values.unset, parameter86_value=values.unset, - parameter87_name=values.unset, parameter87_value=values.unset, - parameter88_name=values.unset, parameter88_value=values.unset, - parameter89_name=values.unset, parameter89_value=values.unset, - parameter90_name=values.unset, parameter90_value=values.unset, - parameter91_name=values.unset, parameter91_value=values.unset, - parameter92_name=values.unset, parameter92_value=values.unset, - parameter93_name=values.unset, parameter93_value=values.unset, - parameter94_name=values.unset, parameter94_value=values.unset, - parameter95_name=values.unset, parameter95_value=values.unset, - parameter96_name=values.unset, parameter96_value=values.unset, - parameter97_name=values.unset, parameter97_value=values.unset, - parameter98_name=values.unset, parameter98_value=values.unset, - parameter99_name=values.unset, parameter99_value=values.unset): - """ - Create the StreamInstance - :param unicode url: Url where WebSocket connection will be established. - :param unicode name: The name of this resource - :param StreamInstance.Track track: One of `inbound_track`, `outbound_track`, `both_tracks`. - :param unicode status_callback: Absolute URL of the status callback. - :param unicode status_callback_method: The http method for the status_callback. - :param unicode parameter1_name: Parameter name - :param unicode parameter1_value: Parameter value - :param unicode parameter2_name: Parameter name - :param unicode parameter2_value: Parameter value - :param unicode parameter3_name: Parameter name - :param unicode parameter3_value: Parameter value - :param unicode parameter4_name: Parameter name - :param unicode parameter4_value: Parameter value - :param unicode parameter5_name: Parameter name - :param unicode parameter5_value: Parameter value - :param unicode parameter6_name: Parameter name - :param unicode parameter6_value: Parameter value - :param unicode parameter7_name: Parameter name - :param unicode parameter7_value: Parameter value - :param unicode parameter8_name: Parameter name - :param unicode parameter8_value: Parameter value - :param unicode parameter9_name: Parameter name - :param unicode parameter9_value: Parameter value - :param unicode parameter10_name: Parameter name - :param unicode parameter10_value: Parameter value - :param unicode parameter11_name: Parameter name - :param unicode parameter11_value: Parameter value - :param unicode parameter12_name: Parameter name - :param unicode parameter12_value: Parameter value - :param unicode parameter13_name: Parameter name - :param unicode parameter13_value: Parameter value - :param unicode parameter14_name: Parameter name - :param unicode parameter14_value: Parameter value - :param unicode parameter15_name: Parameter name - :param unicode parameter15_value: Parameter value - :param unicode parameter16_name: Parameter name - :param unicode parameter16_value: Parameter value - :param unicode parameter17_name: Parameter name - :param unicode parameter17_value: Parameter value - :param unicode parameter18_name: Parameter name - :param unicode parameter18_value: Parameter value - :param unicode parameter19_name: Parameter name - :param unicode parameter19_value: Parameter value - :param unicode parameter20_name: Parameter name - :param unicode parameter20_value: Parameter value - :param unicode parameter21_name: Parameter name - :param unicode parameter21_value: Parameter value - :param unicode parameter22_name: Parameter name - :param unicode parameter22_value: Parameter value - :param unicode parameter23_name: Parameter name - :param unicode parameter23_value: Parameter value - :param unicode parameter24_name: Parameter name - :param unicode parameter24_value: Parameter value - :param unicode parameter25_name: Parameter name - :param unicode parameter25_value: Parameter value - :param unicode parameter26_name: Parameter name - :param unicode parameter26_value: Parameter value - :param unicode parameter27_name: Parameter name - :param unicode parameter27_value: Parameter value - :param unicode parameter28_name: Parameter name - :param unicode parameter28_value: Parameter value - :param unicode parameter29_name: Parameter name - :param unicode parameter29_value: Parameter value - :param unicode parameter30_name: Parameter name - :param unicode parameter30_value: Parameter value - :param unicode parameter31_name: Parameter name - :param unicode parameter31_value: Parameter value - :param unicode parameter32_name: Parameter name - :param unicode parameter32_value: Parameter value - :param unicode parameter33_name: Parameter name - :param unicode parameter33_value: Parameter value - :param unicode parameter34_name: Parameter name - :param unicode parameter34_value: Parameter value - :param unicode parameter35_name: Parameter name - :param unicode parameter35_value: Parameter value - :param unicode parameter36_name: Parameter name - :param unicode parameter36_value: Parameter value - :param unicode parameter37_name: Parameter name - :param unicode parameter37_value: Parameter value - :param unicode parameter38_name: Parameter name - :param unicode parameter38_value: Parameter value - :param unicode parameter39_name: Parameter name - :param unicode parameter39_value: Parameter value - :param unicode parameter40_name: Parameter name - :param unicode parameter40_value: Parameter value - :param unicode parameter41_name: Parameter name - :param unicode parameter41_value: Parameter value - :param unicode parameter42_name: Parameter name - :param unicode parameter42_value: Parameter value - :param unicode parameter43_name: Parameter name - :param unicode parameter43_value: Parameter value - :param unicode parameter44_name: Parameter name - :param unicode parameter44_value: Parameter value - :param unicode parameter45_name: Parameter name - :param unicode parameter45_value: Parameter value - :param unicode parameter46_name: Parameter name - :param unicode parameter46_value: Parameter value - :param unicode parameter47_name: Parameter name - :param unicode parameter47_value: Parameter value - :param unicode parameter48_name: Parameter name - :param unicode parameter48_value: Parameter value - :param unicode parameter49_name: Parameter name - :param unicode parameter49_value: Parameter value - :param unicode parameter50_name: Parameter name - :param unicode parameter50_value: Parameter value - :param unicode parameter51_name: Parameter name - :param unicode parameter51_value: Parameter value - :param unicode parameter52_name: Parameter name - :param unicode parameter52_value: Parameter value - :param unicode parameter53_name: Parameter name - :param unicode parameter53_value: Parameter value - :param unicode parameter54_name: Parameter name - :param unicode parameter54_value: Parameter value - :param unicode parameter55_name: Parameter name - :param unicode parameter55_value: Parameter value - :param unicode parameter56_name: Parameter name - :param unicode parameter56_value: Parameter value - :param unicode parameter57_name: Parameter name - :param unicode parameter57_value: Parameter value - :param unicode parameter58_name: Parameter name - :param unicode parameter58_value: Parameter value - :param unicode parameter59_name: Parameter name - :param unicode parameter59_value: Parameter value - :param unicode parameter60_name: Parameter name - :param unicode parameter60_value: Parameter value - :param unicode parameter61_name: Parameter name - :param unicode parameter61_value: Parameter value - :param unicode parameter62_name: Parameter name - :param unicode parameter62_value: Parameter value - :param unicode parameter63_name: Parameter name - :param unicode parameter63_value: Parameter value - :param unicode parameter64_name: Parameter name - :param unicode parameter64_value: Parameter value - :param unicode parameter65_name: Parameter name - :param unicode parameter65_value: Parameter value - :param unicode parameter66_name: Parameter name - :param unicode parameter66_value: Parameter value - :param unicode parameter67_name: Parameter name - :param unicode parameter67_value: Parameter value - :param unicode parameter68_name: Parameter name - :param unicode parameter68_value: Parameter value - :param unicode parameter69_name: Parameter name - :param unicode parameter69_value: Parameter value - :param unicode parameter70_name: Parameter name - :param unicode parameter70_value: Parameter value - :param unicode parameter71_name: Parameter name - :param unicode parameter71_value: Parameter value - :param unicode parameter72_name: Parameter name - :param unicode parameter72_value: Parameter value - :param unicode parameter73_name: Parameter name - :param unicode parameter73_value: Parameter value - :param unicode parameter74_name: Parameter name - :param unicode parameter74_value: Parameter value - :param unicode parameter75_name: Parameter name - :param unicode parameter75_value: Parameter value - :param unicode parameter76_name: Parameter name - :param unicode parameter76_value: Parameter value - :param unicode parameter77_name: Parameter name - :param unicode parameter77_value: Parameter value - :param unicode parameter78_name: Parameter name - :param unicode parameter78_value: Parameter value - :param unicode parameter79_name: Parameter name - :param unicode parameter79_value: Parameter value - :param unicode parameter80_name: Parameter name - :param unicode parameter80_value: Parameter value - :param unicode parameter81_name: Parameter name - :param unicode parameter81_value: Parameter value - :param unicode parameter82_name: Parameter name - :param unicode parameter82_value: Parameter value - :param unicode parameter83_name: Parameter name - :param unicode parameter83_value: Parameter value - :param unicode parameter84_name: Parameter name - :param unicode parameter84_value: Parameter value - :param unicode parameter85_name: Parameter name - :param unicode parameter85_value: Parameter value - :param unicode parameter86_name: Parameter name - :param unicode parameter86_value: Parameter value - :param unicode parameter87_name: Parameter name - :param unicode parameter87_value: Parameter value - :param unicode parameter88_name: Parameter name - :param unicode parameter88_value: Parameter value - :param unicode parameter89_name: Parameter name - :param unicode parameter89_value: Parameter value - :param unicode parameter90_name: Parameter name - :param unicode parameter90_value: Parameter value - :param unicode parameter91_name: Parameter name - :param unicode parameter91_value: Parameter value - :param unicode parameter92_name: Parameter name - :param unicode parameter92_value: Parameter value - :param unicode parameter93_name: Parameter name - :param unicode parameter93_value: Parameter value - :param unicode parameter94_name: Parameter name - :param unicode parameter94_value: Parameter value - :param unicode parameter95_name: Parameter name - :param unicode parameter95_value: Parameter value - :param unicode parameter96_name: Parameter name - :param unicode parameter96_value: Parameter value - :param unicode parameter97_name: Parameter name - :param unicode parameter97_value: Parameter value - :param unicode parameter98_name: Parameter name - :param unicode parameter98_value: Parameter value - :param unicode parameter99_name: Parameter name - :param unicode parameter99_value: Parameter value - :returns: The created StreamInstance - :rtype: twilio.rest.api.v2010.account.call.stream.StreamInstance - """ - data = values.of({ - 'Url': url, - 'Name': name, - 'Track': track, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'Parameter1.Name': parameter1_name, - 'Parameter1.Value': parameter1_value, - 'Parameter2.Name': parameter2_name, - 'Parameter2.Value': parameter2_value, - 'Parameter3.Name': parameter3_name, - 'Parameter3.Value': parameter3_value, - 'Parameter4.Name': parameter4_name, - 'Parameter4.Value': parameter4_value, - 'Parameter5.Name': parameter5_name, - 'Parameter5.Value': parameter5_value, - 'Parameter6.Name': parameter6_name, - 'Parameter6.Value': parameter6_value, - 'Parameter7.Name': parameter7_name, - 'Parameter7.Value': parameter7_value, - 'Parameter8.Name': parameter8_name, - 'Parameter8.Value': parameter8_value, - 'Parameter9.Name': parameter9_name, - 'Parameter9.Value': parameter9_value, - 'Parameter10.Name': parameter10_name, - 'Parameter10.Value': parameter10_value, - 'Parameter11.Name': parameter11_name, - 'Parameter11.Value': parameter11_value, - 'Parameter12.Name': parameter12_name, - 'Parameter12.Value': parameter12_value, - 'Parameter13.Name': parameter13_name, - 'Parameter13.Value': parameter13_value, - 'Parameter14.Name': parameter14_name, - 'Parameter14.Value': parameter14_value, - 'Parameter15.Name': parameter15_name, - 'Parameter15.Value': parameter15_value, - 'Parameter16.Name': parameter16_name, - 'Parameter16.Value': parameter16_value, - 'Parameter17.Name': parameter17_name, - 'Parameter17.Value': parameter17_value, - 'Parameter18.Name': parameter18_name, - 'Parameter18.Value': parameter18_value, - 'Parameter19.Name': parameter19_name, - 'Parameter19.Value': parameter19_value, - 'Parameter20.Name': parameter20_name, - 'Parameter20.Value': parameter20_value, - 'Parameter21.Name': parameter21_name, - 'Parameter21.Value': parameter21_value, - 'Parameter22.Name': parameter22_name, - 'Parameter22.Value': parameter22_value, - 'Parameter23.Name': parameter23_name, - 'Parameter23.Value': parameter23_value, - 'Parameter24.Name': parameter24_name, - 'Parameter24.Value': parameter24_value, - 'Parameter25.Name': parameter25_name, - 'Parameter25.Value': parameter25_value, - 'Parameter26.Name': parameter26_name, - 'Parameter26.Value': parameter26_value, - 'Parameter27.Name': parameter27_name, - 'Parameter27.Value': parameter27_value, - 'Parameter28.Name': parameter28_name, - 'Parameter28.Value': parameter28_value, - 'Parameter29.Name': parameter29_name, - 'Parameter29.Value': parameter29_value, - 'Parameter30.Name': parameter30_name, - 'Parameter30.Value': parameter30_value, - 'Parameter31.Name': parameter31_name, - 'Parameter31.Value': parameter31_value, - 'Parameter32.Name': parameter32_name, - 'Parameter32.Value': parameter32_value, - 'Parameter33.Name': parameter33_name, - 'Parameter33.Value': parameter33_value, - 'Parameter34.Name': parameter34_name, - 'Parameter34.Value': parameter34_value, - 'Parameter35.Name': parameter35_name, - 'Parameter35.Value': parameter35_value, - 'Parameter36.Name': parameter36_name, - 'Parameter36.Value': parameter36_value, - 'Parameter37.Name': parameter37_name, - 'Parameter37.Value': parameter37_value, - 'Parameter38.Name': parameter38_name, - 'Parameter38.Value': parameter38_value, - 'Parameter39.Name': parameter39_name, - 'Parameter39.Value': parameter39_value, - 'Parameter40.Name': parameter40_name, - 'Parameter40.Value': parameter40_value, - 'Parameter41.Name': parameter41_name, - 'Parameter41.Value': parameter41_value, - 'Parameter42.Name': parameter42_name, - 'Parameter42.Value': parameter42_value, - 'Parameter43.Name': parameter43_name, - 'Parameter43.Value': parameter43_value, - 'Parameter44.Name': parameter44_name, - 'Parameter44.Value': parameter44_value, - 'Parameter45.Name': parameter45_name, - 'Parameter45.Value': parameter45_value, - 'Parameter46.Name': parameter46_name, - 'Parameter46.Value': parameter46_value, - 'Parameter47.Name': parameter47_name, - 'Parameter47.Value': parameter47_value, - 'Parameter48.Name': parameter48_name, - 'Parameter48.Value': parameter48_value, - 'Parameter49.Name': parameter49_name, - 'Parameter49.Value': parameter49_value, - 'Parameter50.Name': parameter50_name, - 'Parameter50.Value': parameter50_value, - 'Parameter51.Name': parameter51_name, - 'Parameter51.Value': parameter51_value, - 'Parameter52.Name': parameter52_name, - 'Parameter52.Value': parameter52_value, - 'Parameter53.Name': parameter53_name, - 'Parameter53.Value': parameter53_value, - 'Parameter54.Name': parameter54_name, - 'Parameter54.Value': parameter54_value, - 'Parameter55.Name': parameter55_name, - 'Parameter55.Value': parameter55_value, - 'Parameter56.Name': parameter56_name, - 'Parameter56.Value': parameter56_value, - 'Parameter57.Name': parameter57_name, - 'Parameter57.Value': parameter57_value, - 'Parameter58.Name': parameter58_name, - 'Parameter58.Value': parameter58_value, - 'Parameter59.Name': parameter59_name, - 'Parameter59.Value': parameter59_value, - 'Parameter60.Name': parameter60_name, - 'Parameter60.Value': parameter60_value, - 'Parameter61.Name': parameter61_name, - 'Parameter61.Value': parameter61_value, - 'Parameter62.Name': parameter62_name, - 'Parameter62.Value': parameter62_value, - 'Parameter63.Name': parameter63_name, - 'Parameter63.Value': parameter63_value, - 'Parameter64.Name': parameter64_name, - 'Parameter64.Value': parameter64_value, - 'Parameter65.Name': parameter65_name, - 'Parameter65.Value': parameter65_value, - 'Parameter66.Name': parameter66_name, - 'Parameter66.Value': parameter66_value, - 'Parameter67.Name': parameter67_name, - 'Parameter67.Value': parameter67_value, - 'Parameter68.Name': parameter68_name, - 'Parameter68.Value': parameter68_value, - 'Parameter69.Name': parameter69_name, - 'Parameter69.Value': parameter69_value, - 'Parameter70.Name': parameter70_name, - 'Parameter70.Value': parameter70_value, - 'Parameter71.Name': parameter71_name, - 'Parameter71.Value': parameter71_value, - 'Parameter72.Name': parameter72_name, - 'Parameter72.Value': parameter72_value, - 'Parameter73.Name': parameter73_name, - 'Parameter73.Value': parameter73_value, - 'Parameter74.Name': parameter74_name, - 'Parameter74.Value': parameter74_value, - 'Parameter75.Name': parameter75_name, - 'Parameter75.Value': parameter75_value, - 'Parameter76.Name': parameter76_name, - 'Parameter76.Value': parameter76_value, - 'Parameter77.Name': parameter77_name, - 'Parameter77.Value': parameter77_value, - 'Parameter78.Name': parameter78_name, - 'Parameter78.Value': parameter78_value, - 'Parameter79.Name': parameter79_name, - 'Parameter79.Value': parameter79_value, - 'Parameter80.Name': parameter80_name, - 'Parameter80.Value': parameter80_value, - 'Parameter81.Name': parameter81_name, - 'Parameter81.Value': parameter81_value, - 'Parameter82.Name': parameter82_name, - 'Parameter82.Value': parameter82_value, - 'Parameter83.Name': parameter83_name, - 'Parameter83.Value': parameter83_value, - 'Parameter84.Name': parameter84_name, - 'Parameter84.Value': parameter84_value, - 'Parameter85.Name': parameter85_name, - 'Parameter85.Value': parameter85_value, - 'Parameter86.Name': parameter86_name, - 'Parameter86.Value': parameter86_value, - 'Parameter87.Name': parameter87_name, - 'Parameter87.Value': parameter87_value, - 'Parameter88.Name': parameter88_name, - 'Parameter88.Value': parameter88_value, - 'Parameter89.Name': parameter89_name, - 'Parameter89.Value': parameter89_value, - 'Parameter90.Name': parameter90_name, - 'Parameter90.Value': parameter90_value, - 'Parameter91.Name': parameter91_name, - 'Parameter91.Value': parameter91_value, - 'Parameter92.Name': parameter92_name, - 'Parameter92.Value': parameter92_value, - 'Parameter93.Name': parameter93_name, - 'Parameter93.Value': parameter93_value, - 'Parameter94.Name': parameter94_name, - 'Parameter94.Value': parameter94_value, - 'Parameter95.Name': parameter95_name, - 'Parameter95.Value': parameter95_value, - 'Parameter96.Name': parameter96_name, - 'Parameter96.Value': parameter96_value, - 'Parameter97.Name': parameter97_name, - 'Parameter97.Value': parameter97_value, - 'Parameter98.Name': parameter98_name, - 'Parameter98.Value': parameter98_value, - 'Parameter99.Name': parameter99_name, - 'Parameter99.Value': parameter99_value, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return StreamInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def get(self, sid): - """ - Constructs a StreamContext - - :param sid: The SID of the Stream resource, or the `name` - - :returns: twilio.rest.api.v2010.account.call.stream.StreamContext - :rtype: twilio.rest.api.v2010.account.call.stream.StreamContext - """ - return StreamContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a StreamContext - - :param sid: The SID of the Stream resource, or the `name` - - :returns: twilio.rest.api.v2010.account.call.stream.StreamContext - :rtype: twilio.rest.api.v2010.account.call.stream.StreamContext - """ - return StreamContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class StreamPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the StreamPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - :param call_sid: The SID of the Call the resource is associated with - - :returns: twilio.rest.api.v2010.account.call.stream.StreamPage - :rtype: twilio.rest.api.v2010.account.call.stream.StreamPage - """ - super(StreamPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StreamInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.stream.StreamInstance - :rtype: twilio.rest.api.v2010.account.call.stream.StreamInstance - """ - return StreamInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class StreamContext(InstanceContext): - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the StreamContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - :param call_sid: The SID of the Call the resource is associated with - :param sid: The SID of the Stream resource, or the `name` - - :returns: twilio.rest.api.v2010.account.call.stream.StreamContext - :rtype: twilio.rest.api.v2010.account.call.stream.StreamContext - """ - super(StreamContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, call_sid: str, sid: str): + # TODO: needs autogenerated docs + super(StreamContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/Streams/{sid}.json'.format(**self._solution) - - def update(self, status): - """ - Update the StreamInstance - - :param StreamInstance.UpdateStatus status: The status. Must have the value `stopped` - - :returns: The updated StreamInstance - :rtype: twilio.rest.api.v2010.account.call.stream.StreamInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return StreamInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, call_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Streams/${sid}.json' + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return StreamInstance(self._version, payload, account_sid=self._solution['account_sid'], call_sid=self._solution['call_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class StreamInstance(InstanceResource): - - class Track(object): - INBOUND_TRACK = "inbound_track" - OUTBOUND_TRACK = "outbound_track" - BOTH_TRACKS = "both_tracks" + return '' - class Status(object): - IN_PROGRESS = "in-progress" - STOPPED = "stopped" - class UpdateStatus(object): - STOPPED = "stopped" - - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the StreamInstance - :returns: twilio.rest.api.v2010.account.call.stream.StreamInstance - :rtype: twilio.rest.api.v2010.account.call.stream.StreamInstance - """ +class StreamInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str, sid: str): super(StreamInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'name': payload.get('name'), - 'status': payload.get('status'), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'uri': payload.get('uri'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'name' = payload.get('name'), + 'status' = payload.get('status'), + 'date_updated' = payload.get('date_updated'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: StreamContext for this StreamInstance - :rtype: twilio.rest.api.v2010.account.call.stream.StreamContext - """ if self._context is None: self._context = StreamContext( self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The SID of the Stream resource. - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): - """ - :returns: The SID of the Account that created this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): + def __repr__(self): """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['call_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def name(self): - """ - :returns: The name of this resource - :rtype: unicode - """ - return self._properties['name'] - @property - def status(self): - """ - :returns: The status - one of `stopped`, `in-progress` - :rtype: StreamInstance.Status - """ - return self._properties['status'] - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] +class StreamListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(StreamListInstanceList, self).__init__(version) - def update(self, status): - """ - Update the StreamInstance + # Path Solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/Streams.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param StreamInstance.UpdateStatus status: The status. Must have the value `stopped` + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated StreamInstance - :rtype: twilio.rest.api.v2010.account.call.stream.StreamInstance - """ - return self._proxy.update(status, ) + return StreamInstance(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/call/user_defined_message.py b/twilio/rest/api/v2010/account/call/user_defined_message.py index 532860e343..3ebbcba2cf 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message.py @@ -1,173 +1,92 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserDefinedMessageList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the UserDefinedMessageList - :param Version version: Version that contains the resource - :param account_sid: Account SID. - :param call_sid: Call SID. - :returns: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageList - :rtype: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageList - """ - super(UserDefinedMessageList, self).__init__(version) - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/UserDefinedMessages.json'.format(**self._solution) - def create(self, content, idempotency_key=values.unset): - """ - Create the UserDefinedMessageInstance - :param unicode content: The User Defined Message in the form of URL-encoded JSON string. - :param unicode idempotency_key: A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. +class UserDefinedMessageInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str): + super(UserDefinedMessageInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + } - :returns: The created UserDefinedMessageInstance - :rtype: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageInstance - """ - data = values.of({'Content': content, 'IdempotencyKey': idempotency_key, }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = UserDefinedMessageContext( + self._version, + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'], + ) + return self._context - return UserDefinedMessageInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class UserDefinedMessagePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the UserDefinedMessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: Account SID. - :param call_sid: Call SID. - :returns: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessagePage - :rtype: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessagePage - """ - super(UserDefinedMessagePage, self).__init__(version, response) +class UserDefinedMessageListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(UserDefinedMessageListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/UserDefinedMessages.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def get_instance(self, payload): - """ - Build an instance of UserDefinedMessageInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageInstance - :rtype: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageInstance - """ - return UserDefinedMessageInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) + return UserDefinedMessageInstance(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class UserDefinedMessageInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, call_sid): - """ - Initialize the UserDefinedMessageInstance - - :returns: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageInstance - :rtype: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageInstance - """ - super(UserDefinedMessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'sid': payload.get('sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - - @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): - """ - :returns: Call SID. - :rtype: unicode - """ - return self._properties['call_sid'] + return '' - @property - def sid(self): - """ - :returns: User Defined Message SID. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The date this User Defined Message was created. - :rtype: datetime - """ - return self._properties['date_created'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py index 5eef182bd0..ce776bdc53 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py @@ -1,288 +1,124 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserDefinedMessageSubscriptionList(ListResource): - - def __init__(self, version, account_sid, call_sid): - """ - Initialize the UserDefinedMessageSubscriptionList - - :param Version version: Version that contains the resource - :param account_sid: Account SID. - :param call_sid: Call SID. - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionList - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionList - """ - super(UserDefinedMessageSubscriptionList, self).__init__(version) - # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/UserDefinedMessageSubscriptions.json'.format(**self._solution) - - def create(self, callback, idempotency_key=values.unset, method=values.unset): - """ - Create the UserDefinedMessageSubscriptionInstance - :param unicode callback: The URL we should call to send user defined messages. - :param unicode idempotency_key: A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. - :param unicode method: HTTP method used with the callback. - - :returns: The created UserDefinedMessageSubscriptionInstance - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionInstance - """ - data = values.of({'Callback': callback, 'IdempotencyKey': idempotency_key, 'Method': method, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return UserDefinedMessageSubscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def get(self, sid): - """ - Constructs a UserDefinedMessageSubscriptionContext - - :param sid: User Defined Message Subscription SID. - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionContext - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionContext - """ - return UserDefinedMessageSubscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a UserDefinedMessageSubscriptionContext - - :param sid: User Defined Message Subscription SID. - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionContext - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionContext - """ - return UserDefinedMessageSubscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserDefinedMessageSubscriptionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserDefinedMessageSubscriptionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: Account SID. - :param call_sid: Call SID. - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionPage - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionPage - """ - super(UserDefinedMessageSubscriptionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserDefinedMessageSubscriptionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionInstance - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionInstance - """ - return UserDefinedMessageSubscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class UserDefinedMessageSubscriptionContext(InstanceContext): - - def __init__(self, version, account_sid, call_sid, sid): - """ - Initialize the UserDefinedMessageSubscriptionContext - - :param Version version: Version that contains the resource - :param account_sid: Account SID. - :param call_sid: Call SID. - :param sid: User Defined Message Subscription SID. - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionContext - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionContext - """ - super(UserDefinedMessageSubscriptionContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, call_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserDefinedMessageSubscriptionContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'call_sid': call_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{call_sid}/UserDefinedMessageSubscriptions/{sid}.json'.format(**self._solution) - - def delete(self): - """ - Deletes the UserDefinedMessageSubscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { account_sid, call_sid, sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/UserDefinedMessageSubscriptions/${sid}.json' + + + def delete(self): + + + """ + Deletes the UserDefinedMessageSubscriptionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserDefinedMessageSubscriptionInstance(InstanceResource): - def __init__(self, version, payload, account_sid, call_sid, sid=None): - """ - Initialize the UserDefinedMessageSubscriptionInstance - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionInstance - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionInstance - """ +class UserDefinedMessageSubscriptionInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, call_sid: str, sid: str): super(UserDefinedMessageSubscriptionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'sid': payload.get('sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'call_sid': call_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'call_sid': call_sid or self._properties['call_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserDefinedMessageSubscriptionContext for this UserDefinedMessageSubscriptionInstance - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionContext - """ if self._context is None: self._context = UserDefinedMessageSubscriptionContext( self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['call_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],call_sid=self._solution['call_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def call_sid(self): + def __repr__(self): """ - :returns: Call SID. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['call_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sid(self): - """ - :returns: User Defined Message Subscription SID. - :rtype: unicode - """ - return self._properties['sid'] - @property - def date_created(self): - """ - :returns: The date this User Defined Message Subscription was created. - :rtype: datetime - """ - return self._properties['date_created'] - @property - def uri(self): - """ - :returns: The URI of the User Defined Message Subscription Resource, relative to `https://api.twilio.com`. - :rtype: unicode - """ - return self._properties['uri'] +class UserDefinedMessageSubscriptionListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(UserDefinedMessageSubscriptionListInstanceList, self).__init__(version) - def delete(self): - """ - Deletes the UserDefinedMessageSubscriptionInstance + # Path Solution + self._solution = { account_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Calls/${call_sid}/UserDefinedMessageSubscriptions.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UserDefinedMessageSubscriptionInstance(self._version, payload, account_sid=self._solution['account_sid']call_sid=self._solution['call_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/conference.py b/twilio/rest/api/v2010/account/conference.py new file mode 100644 index 0000000000..c9a460fc70 --- /dev/null +++ b/twilio/rest/api/v2010/account/conference.py @@ -0,0 +1,158 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.conference.participant import ParticipantListInstancefrom twilio.rest.conference.recording import RecordingListInstance + + +class ConferenceContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ConferenceContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Conferences/${sid}.json' + + self._participants = None + self._recordings = None + + def fetch(self): + + """ + Fetch the ConferenceInstance + + :returns: The fetched ConferenceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConferenceInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ConferenceInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConferenceInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(ConferenceInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'api_version' = payload.get('api_version'), + 'friendly_name' = payload.get('friendly_name'), + 'region' = payload.get('region'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'uri' = payload.get('uri'), + 'subresource_uris' = payload.get('subresource_uris'), + 'reason_conference_ended' = payload.get('reason_conference_ended'), + 'call_sid_ending_conference' = payload.get('call_sid_ending_conference'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConferenceContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def participants(self): + return self._proxy.participants + @property + def recordings(self): + return self._proxy.recordings + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConferenceListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(ConferenceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Conferences.json' + + + def page(self, date_created, date_created, date_created, date_updated, date_updated, date_updated, friendly_name, status, page_size): + + data = values.of({ + 'date_created': date_created,'date_created': date_created,'date_created': date_created,'date_updated': date_updated,'date_updated': date_updated,'date_updated': date_updated,'friendly_name': friendly_name,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ConferencePage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index 0e46ed6fe4..c5980a1188 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,711 +19,155 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ParticipantList(ListResource): - - def __init__(self, version, account_sid, conference_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param conference_sid: The SID of the conference the participant is in - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantList - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'conference_sid': conference_sid, } - self._uri = '/Accounts/{account_sid}/Conferences/{conference_sid}/Participants.json'.format(**self._solution) - - def create(self, from_, to, status_callback=values.unset, - status_callback_method=values.unset, - status_callback_event=values.unset, label=values.unset, - timeout=values.unset, record=values.unset, muted=values.unset, - beep=values.unset, start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, conference_record=values.unset, - conference_trim=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - sip_auth_username=values.unset, sip_auth_password=values.unset, - region=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - recording_status_callback_event=values.unset, - conference_recording_status_callback_event=values.unset, - coaching=values.unset, call_sid_to_coach=values.unset, - jitter_buffer_size=values.unset, byoc=values.unset, - caller_id=values.unset, call_reason=values.unset, - recording_track=values.unset, time_limit=values.unset, - machine_detection=values.unset, - machine_detection_timeout=values.unset, - machine_detection_speech_threshold=values.unset, - machine_detection_speech_end_threshold=values.unset, - machine_detection_silence_timeout=values.unset, - amd_status_callback=values.unset, - amd_status_callback_method=values.unset): - """ - Create the ParticipantInstance - - :param unicode from_: The phone number, Client identifier, or username portion of SIP address that made this call. - :param unicode to: The phone number, SIP address or Client identifier that received this call. - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call `status_callback` - :param list[unicode] status_callback_event: Set state change events that will trigger a callback - :param unicode label: The label of this participant - :param unicode timeout: he number of seconds that we should wait for an answer - :param bool record: Whether to record the participant and their conferences - :param bool muted: Whether to mute the agent - :param unicode beep: Whether to play a notification beep to the conference when the participant joins - :param bool start_conference_on_enter: Whether the conference starts when the participant joins the conference - :param bool end_conference_on_exit: Whether to end the conference when the participant leaves - :param unicode wait_url: URL that hosts pre-conference hold music - :param unicode wait_method: The HTTP method we should use to call `wait_url` - :param bool early_media: Whether agents can hear the state of the outbound call - :param unicode max_participants: The maximum number of agent conference participants - :param unicode conference_record: Whether to record the conference the participant is joining - :param unicode conference_trim: Whether to trim leading and trailing silence from your recorded conference audio files - :param unicode conference_status_callback: The callback URL for conference events - :param unicode conference_status_callback_method: HTTP method for requesting `conference_status_callback` URL - :param list[unicode] conference_status_callback_event: The conference state changes that should generate a call to `conference_status_callback` - :param unicode recording_channels: Specify `mono` or `dual` recording channels - :param unicode recording_status_callback: The URL that we should call using the `recording_status_callback_method` when the recording status changes - :param unicode recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback` - :param unicode sip_auth_username: The SIP username used for authentication - :param unicode sip_auth_password: The SIP password for authentication - :param unicode region: The region where we should mix the conference audio - :param unicode conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available - :param unicode conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback` - :param list[unicode] recording_status_callback_event: The recording state changes that should generate a call to `recording_status_callback` - :param list[unicode] conference_recording_status_callback_event: The conference recording state changes that should generate a call to `conference_recording_status_callback` - :param bool coaching: Indicates if the participant changed to coach - :param unicode call_sid_to_coach: The SID of the participant who is being `coached` - :param unicode jitter_buffer_size: Jitter Buffer size for the connecting participant - :param unicode byoc: BYOC trunk SID (Beta) - :param unicode caller_id: The phone number, Client identifier, or username portion of SIP address that made this call. - :param unicode call_reason: Reason for the call (Branded Calls Beta) - :param unicode recording_track: The track(s) to record - :param unicode time_limit: The maximum duration of the call in seconds. - :param unicode machine_detection: Enable machine detection or end of greeting detection - :param unicode machine_detection_timeout: Number of seconds to wait for machine detection - :param unicode machine_detection_speech_threshold: Number of milliseconds for measuring stick for the length of the speech activity - :param unicode machine_detection_speech_end_threshold: Number of milliseconds of silence after speech activity - :param unicode machine_detection_silence_timeout: Number of milliseconds of initial silence - :param unicode amd_status_callback: The URL we should call to send amd status information to your application - :param unicode amd_status_callback_method: HTTP Method to use with amd_status_callback - - :returns: The created ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - data = values.of({ - 'From': from_, - 'To': to, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'Label': label, - 'Timeout': timeout, - 'Record': record, - 'Muted': muted, - 'Beep': beep, - 'StartConferenceOnEnter': start_conference_on_enter, - 'EndConferenceOnExit': end_conference_on_exit, - 'WaitUrl': wait_url, - 'WaitMethod': wait_method, - 'EarlyMedia': early_media, - 'MaxParticipants': max_participants, - 'ConferenceRecord': conference_record, - 'ConferenceTrim': conference_trim, - 'ConferenceStatusCallback': conference_status_callback, - 'ConferenceStatusCallbackMethod': conference_status_callback_method, - 'ConferenceStatusCallbackEvent': serialize.map(conference_status_callback_event, lambda e: e), - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'Region': region, - 'ConferenceRecordingStatusCallback': conference_recording_status_callback, - 'ConferenceRecordingStatusCallbackMethod': conference_recording_status_callback_method, - 'RecordingStatusCallbackEvent': serialize.map(recording_status_callback_event, lambda e: e), - 'ConferenceRecordingStatusCallbackEvent': serialize.map(conference_recording_status_callback_event, lambda e: e), - 'Coaching': coaching, - 'CallSidToCoach': call_sid_to_coach, - 'JitterBufferSize': jitter_buffer_size, - 'Byoc': byoc, - 'CallerId': caller_id, - 'CallReason': call_reason, - 'RecordingTrack': recording_track, - 'TimeLimit': time_limit, - 'MachineDetection': machine_detection, - 'MachineDetectionTimeout': machine_detection_timeout, - 'MachineDetectionSpeechThreshold': machine_detection_speech_threshold, - 'MachineDetectionSpeechEndThreshold': machine_detection_speech_end_threshold, - 'MachineDetectionSilenceTimeout': machine_detection_silence_timeout, - 'AmdStatusCallback': amd_status_callback, - 'AmdStatusCallbackMethod': amd_status_callback_method, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - ) - - 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']) - - def list(self, muted=values.unset, hold=values.unset, coaching=values.unset, - limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :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. list() guarantees - never to 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, list() 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] - """ - return list(self.stream( - muted=muted, - hold=hold, - coaching=coaching, - limit=limit, - page_size=page_size, - )) - - def page(self, muted=values.unset, hold=values.unset, coaching=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :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 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 ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - """ - data = values.of({ - 'Muted': muted, - 'Hold': hold, - 'Coaching': coaching, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get(self, call_sid): - """ - Constructs a ParticipantContext - - :param call_sid: The Call SID or URL encoded label of the participant to fetch - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=call_sid, - ) - - def __call__(self, call_sid): - """ - Constructs a ParticipantContext - - :param call_sid: The Call SID or URL encoded label of the participant to fetch - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=call_sid, - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param conference_sid: The SID of the conference the participant is in - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ParticipantContext(InstanceContext): - - def __init__(self, version, account_sid, conference_sid, call_sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param conference_sid: The SID of the conference with the participant to fetch - :param call_sid: The Call SID or URL encoded label of the participant to fetch - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, conference_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(ParticipantContextList, self).__init__(version) # Path Solution - self._solution = { - 'account_sid': account_sid, - 'conference_sid': conference_sid, - 'call_sid': call_sid, - } - self._uri = '/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the ParticipantInstance + self._solution = { account_sid, conference_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Conferences/${conference_sid}/Participants/${call_sid}.json' + + + def delete(self): + + + """ + Deletes the ParticipantInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ParticipantInstance + + :returns: The fetched ParticipantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ParticipantInstance( + self._version, + payload, + account_sidconference_sidcall_sid=self._solution['account_sid''conference_sid''call_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=self._solution['call_sid'], - ) - - def update(self, muted=values.unset, hold=values.unset, hold_url=values.unset, - hold_method=values.unset, announce_url=values.unset, - announce_method=values.unset, wait_url=values.unset, - wait_method=values.unset, beep_on_exit=values.unset, - end_conference_on_exit=values.unset, coaching=values.unset, - call_sid_to_coach=values.unset): - """ - Update the ParticipantInstance - - :param bool muted: Whether the participant should be muted - :param bool hold: Whether the participant should be on hold - :param unicode hold_url: The URL we call using the `hold_method` for music that plays when the participant is on hold - :param unicode hold_method: The HTTP method we should use to call hold_url - :param unicode announce_url: The URL we call using the `announce_method` for an announcement to the participant - :param unicode announce_method: The HTTP method we should use to call announce_url - :param unicode wait_url: The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start - :param unicode wait_method: The HTTP method we should use to call `wait_url` - :param bool beep_on_exit: Whether to play a notification beep to the conference when the participant exit - :param bool end_conference_on_exit: Whether to end the conference when the participant leaves - :param bool coaching: Indicates if the participant changed to coach - :param unicode call_sid_to_coach: The SID of the participant who is being `coached` - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - data = values.of({ - 'Muted': muted, - 'Hold': hold, - 'HoldUrl': hold_url, - 'HoldMethod': hold_method, - 'AnnounceUrl': announce_url, - 'AnnounceMethod': announce_method, - 'WaitUrl': wait_url, - 'WaitMethod': wait_method, - 'BeepOnExit': beep_on_exit, - 'EndConferenceOnExit': end_conference_on_exit, - 'Coaching': coaching, - 'CallSidToCoach': call_sid_to_coach, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ParticipantInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=self._solution['call_sid'], - ) - - def delete(self): - """ - Deletes the ParticipantInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return ParticipantInstance(self._version, payload, account_sid=self._solution['account_sid'], conference_sid=self._solution['conference_sid'], call_sid=self._solution['call_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ParticipantInstance(InstanceResource): - class Status(object): - QUEUED = "queued" - CONNECTING = "connecting" - RINGING = "ringing" - CONNECTED = "connected" - COMPLETE = "complete" - FAILED = "failed" - - def __init__(self, version, payload, account_sid, conference_sid, - call_sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ +class ParticipantInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, conference_sid: str, call_sid: str): super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'label': payload.get('label'), - 'call_sid_to_coach': payload.get('call_sid_to_coach'), - 'coaching': payload.get('coaching'), - 'conference_sid': payload.get('conference_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'end_conference_on_exit': payload.get('end_conference_on_exit'), - 'muted': payload.get('muted'), - 'hold': payload.get('hold'), - 'start_conference_on_enter': payload.get('start_conference_on_enter'), - 'status': payload.get('status'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'label' = payload.get('label'), + 'call_sid_to_coach' = payload.get('call_sid_to_coach'), + 'coaching' = payload.get('coaching'), + 'conference_sid' = payload.get('conference_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'end_conference_on_exit' = payload.get('end_conference_on_exit'), + 'muted' = payload.get('muted'), + 'hold' = payload.get('hold'), + 'start_conference_on_enter' = payload.get('start_conference_on_enter'), + 'status' = payload.get('status'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'conference_sid': conference_sid, - 'call_sid': call_sid or self._properties['call_sid'], + 'account_sid': account_sid or self._properties['account_sid']'conference_sid': conference_sid or self._properties['conference_sid']'call_sid': call_sid or self._properties['call_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantContext - """ if self._context is None: self._context = ParticipantContext( self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - call_sid=self._solution['call_sid'], + account_sid=self._solution['account_sid'],conference_sid=self._solution['conference_sid'],call_sid=self._solution['call_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def label(self): - """ - :returns: The label of this participant - :rtype: unicode - """ - return self._properties['label'] - - @property - def call_sid_to_coach(self): - """ - :returns: The SID of the participant who is being `coached` - :rtype: unicode - """ - return self._properties['call_sid_to_coach'] - - @property - def coaching(self): - """ - :returns: Indicates if the participant changed to coach - :rtype: bool - """ - return self._properties['coaching'] - - @property - def conference_sid(self): - """ - :returns: The SID of the conference the participant is in - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def end_conference_on_exit(self): - """ - :returns: Whether the conference ends when the participant leaves - :rtype: bool - """ - return self._properties['end_conference_on_exit'] - - @property - def muted(self): - """ - :returns: Whether the participant is muted - :rtype: bool - """ - return self._properties['muted'] - - @property - def hold(self): - """ - :returns: Whether the participant is on hold - :rtype: bool - """ - return self._properties['hold'] - - @property - def start_conference_on_enter(self): - """ - :returns: Whether the conference starts when the participant joins the conference - :rtype: bool - """ - return self._properties['start_conference_on_enter'] - - @property - def status(self): + def __repr__(self): """ - :returns: The status of the participant's call in a session - :rtype: ParticipantInstance.Status + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['status'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - def fetch(self): - """ - Fetch the ParticipantInstance - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - return self._proxy.fetch() - - def update(self, muted=values.unset, hold=values.unset, hold_url=values.unset, - hold_method=values.unset, announce_url=values.unset, - announce_method=values.unset, wait_url=values.unset, - wait_method=values.unset, beep_on_exit=values.unset, - end_conference_on_exit=values.unset, coaching=values.unset, - call_sid_to_coach=values.unset): - """ - Update the ParticipantInstance - - :param bool muted: Whether the participant should be muted - :param bool hold: Whether the participant should be on hold - :param unicode hold_url: The URL we call using the `hold_method` for music that plays when the participant is on hold - :param unicode hold_method: The HTTP method we should use to call hold_url - :param unicode announce_url: The URL we call using the `announce_method` for an announcement to the participant - :param unicode announce_method: The HTTP method we should use to call announce_url - :param unicode wait_url: The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start - :param unicode wait_method: The HTTP method we should use to call `wait_url` - :param bool beep_on_exit: Whether to play a notification beep to the conference when the participant exit - :param bool end_conference_on_exit: Whether to end the conference when the participant leaves - :param bool coaching: Indicates if the participant changed to coach - :param unicode call_sid_to_coach: The SID of the participant who is being `coached` - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance - """ - return self._proxy.update( - muted=muted, - hold=hold, - hold_url=hold_url, - hold_method=hold_method, - announce_url=announce_url, - announce_method=announce_method, - wait_url=wait_url, - wait_method=wait_method, - beep_on_exit=beep_on_exit, - end_conference_on_exit=end_conference_on_exit, - coaching=coaching, - call_sid_to_coach=call_sid_to_coach, - ) - - def delete(self): - """ - Deletes the ParticipantInstance +class ParticipantListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, conference_sid: str): + # TODO: needs autogenerated docs + super(ParticipantListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, conference_sid, } + self._uri = '/Accounts/${account_sid}/Conferences/${conference_sid}/Participants.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ParticipantInstance(self._version, payload, account_sid=self._solution['account_sid']conference_sid=self._solution['conference_sid']) + + + def page(self, muted, hold, coaching, page_size): + + data = values.of({ + 'muted': muted,'hold': hold,'coaching': coaching,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ParticipantPage(self._version, payload, account_sid=self._solution['account_sid']conference_sid=self._solution['conference_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/conference/recording.py b/twilio/rest/api/v2010/account/conference/recording.py index cfe178db62..54c50bef85 100644 --- a/twilio/rest/api/v2010/account/conference/recording.py +++ b/twilio/rest/api/v2010/account/conference/recording.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,548 +19,148 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RecordingList(ListResource): - - def __init__(self, version, account_sid, conference_sid): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param conference_sid: The Conference SID that identifies the conference associated with the recording - - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'conference_sid': conference_sid, } - self._uri = '/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Streams RecordingInstance 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 date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :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.recording.RecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Lists RecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.recording.RecordingInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RecordingInstance records from the API. - Request is executed immediately - - :param date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingPage - """ - data = values.of({ - 'DateCreated<': serialize.iso8601_date(date_created_before), - 'DateCreated': serialize.iso8601_date(date_created), - 'DateCreated>': serialize.iso8601_date(date_created_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RecordingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingContext - """ - return RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a RecordingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingContext - """ - return RecordingContext( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - sid=sid, - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param conference_sid: The Conference SID that identifies the conference associated with the recording - - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingPage - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - """ - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RecordingContext(InstanceContext): - - def __init__(self, version, account_sid, conference_sid, sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param conference_sid: Fetch by unique Conference SID for the recording - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, conference_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RecordingContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'conference_sid': conference_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings/{sid}.json'.format(**self._solution) - - def update(self, status, pause_behavior=values.unset): - """ - Update the RecordingInstance - - :param RecordingInstance.Status status: The new status of the recording - :param unicode pause_behavior: Whether to record during a pause - - :returns: The updated RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - """ - data = values.of({'Status': status, 'PauseBehavior': pause_behavior, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - sid=self._solution['sid'], - ) - - def fetch(self): - """ - Fetch the RecordingInstance - - :returns: The fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + self._solution = { account_sid, conference_sid, sid, } + self._uri = '/Accounts/${account_sid}/Conferences/${conference_sid}/Recordings/${sid}.json' + + + def delete(self): + + + """ + Deletes the RecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RecordingInstance + + :returns: The fetched RecordingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RecordingInstance( + self._version, + payload, + account_sidconference_sidsid=self._solution['account_sid''conference_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return RecordingInstance(self._version, payload, account_sid=self._solution['account_sid'], conference_sid=self._solution['conference_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RecordingInstance(InstanceResource): + return '' - class Status(object): - IN_PROGRESS = "in-progress" - PAUSED = "paused" - STOPPED = "stopped" - PROCESSING = "processing" - COMPLETED = "completed" - ABSENT = "absent" - class Source(object): - DIALVERB = "DialVerb" - CONFERENCE = "Conference" - OUTBOUNDAPI = "OutboundAPI" - TRUNKING = "Trunking" - RECORDVERB = "RecordVerb" - STARTCALLRECORDINGAPI = "StartCallRecordingAPI" - STARTCONFERENCERECORDINGAPI = "StartConferenceRecordingAPI" - def __init__(self, version, payload, account_sid, conference_sid, sid=None): - """ - Initialize the RecordingInstance - - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - """ +class RecordingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, conference_sid: str, sid: str): super(RecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'call_sid': payload.get('call_sid'), - 'conference_sid': payload.get('conference_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'start_time': deserialize.rfc2822_datetime(payload.get('start_time')), - 'duration': payload.get('duration'), - 'sid': payload.get('sid'), - 'price': payload.get('price'), - 'price_unit': payload.get('price_unit'), - 'status': payload.get('status'), - 'channels': deserialize.integer(payload.get('channels')), - 'source': payload.get('source'), - 'error_code': deserialize.integer(payload.get('error_code')), - 'encryption_details': payload.get('encryption_details'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'call_sid' = payload.get('call_sid'), + 'conference_sid' = payload.get('conference_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'start_time' = payload.get('start_time'), + 'duration' = payload.get('duration'), + 'sid' = payload.get('sid'), + 'price' = payload.get('price'), + 'price_unit' = payload.get('price_unit'), + 'status' = payload.get('status'), + 'channels' = payload.get('channels'), + 'source' = payload.get('source'), + 'error_code' = payload.get('error_code'), + 'encryption_details' = payload.get('encryption_details'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'conference_sid': conference_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'conference_sid': conference_sid or self._properties['conference_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingContext - """ if self._context is None: self._context = RecordingContext( self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['conference_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],conference_sid=self._solution['conference_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the recording - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def conference_sid(self): - """ - :returns: The Conference SID that identifies the conference associated with the recording - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def start_time(self): - """ - :returns: The start time of the recording, given in RFC 2822 format - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def duration(self): - """ - :returns: The length of the recording in seconds - :rtype: unicode - """ - return self._properties['duration'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def price(self): - """ - :returns: The one-time cost of creating the recording. - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency used in the price property. - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def status(self): - """ - :returns: The status of the recording - :rtype: RecordingInstance.Status - """ - return self._properties['status'] - - @property - def channels(self): - """ - :returns: The number of channels in the final recording file as an integer - :rtype: unicode - """ - return self._properties['channels'] - - @property - def source(self): - """ - :returns: How the recording was created - :rtype: RecordingInstance.Source - """ - return self._properties['source'] - - @property - def error_code(self): - """ - :returns: More information about why the recording is missing, if status is `absent`. - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def encryption_details(self): - """ - :returns: How to decrypt the recording. - :rtype: dict - """ - return self._properties['encryption_details'] + - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode + def __repr__(self): """ - return self._properties['uri'] - - def update(self, status, pause_behavior=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the RecordingInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param RecordingInstance.Status status: The new status of the recording - :param unicode pause_behavior: Whether to record during a pause - :returns: The updated RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - """ - return self._proxy.update(status, pause_behavior=pause_behavior, ) - def fetch(self): - """ - Fetch the RecordingInstance +class RecordingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, conference_sid: str): + # TODO: needs autogenerated docs + super(RecordingListInstanceList, self).__init__(version) - :returns: The fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { account_sid, conference_sid, } + self._uri = '/Accounts/${account_sid}/Conferences/${conference_sid}/Recordings.json' + + + def page(self, date_created, date_created, date_created, page_size): + + data = values.of({ + 'date_created': date_created,'date_created': date_created,'date_created': date_created,'page_size': page_size, + }) - def delete(self): - """ - Deletes the RecordingInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return RecordingPage(self._version, payload, account_sid=self._solution['account_sid']conference_sid=self._solution['conference_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/connect_app.py b/twilio/rest/api/v2010/account/connect_app.py index 2fda527557..f7f5d9bafb 100644 --- a/twilio/rest/api/v2010/account/connect_app.py +++ b/twilio/rest/api/v2010/account/connect_app.py @@ -1,474 +1,160 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ConnectAppList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the ConnectAppList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppList - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - super(ConnectAppList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/ConnectApps.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ConnectAppInstance 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 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.connect_app.ConnectAppInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ConnectAppInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.connect_app.ConnectAppInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConnectAppInstance records from the API. - Request is executed immediately - - :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 ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConnectAppPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConnectAppInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConnectAppPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConnectAppContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ - return ConnectAppContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ConnectAppContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ - return ConnectAppContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConnectAppPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConnectAppPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage - """ - super(ConnectAppPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of ConnectAppInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - return ConnectAppInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ConnectAppContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the ConnectAppContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ - super(ConnectAppContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ConnectAppContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/ConnectApps/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the ConnectAppInstance - - :returns: The fetched ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, authorize_redirect_url=values.unset, company_name=values.unset, - deauthorize_callback_method=values.unset, - deauthorize_callback_url=values.unset, description=values.unset, - friendly_name=values.unset, homepage_url=values.unset, - permissions=values.unset): - """ - Update the ConnectAppInstance - - :param unicode authorize_redirect_url: The URL to redirect the user to after authorization - :param unicode company_name: The company name to set for the Connect App - :param unicode deauthorize_callback_method: The HTTP method to use when calling deauthorize_callback_url - :param unicode deauthorize_callback_url: The URL to call to de-authorize the Connect App - :param unicode description: A description of the Connect App - :param unicode friendly_name: A string to describe the resource - :param unicode homepage_url: A public URL where users can obtain more information - :param list[ConnectAppInstance.Permission] permissions: The set of permissions that your ConnectApp will request - - :returns: The updated ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - data = values.of({ - 'AuthorizeRedirectUrl': authorize_redirect_url, - 'CompanyName': company_name, - 'DeauthorizeCallbackMethod': deauthorize_callback_method, - 'DeauthorizeCallbackUrl': deauthorize_callback_url, - 'Description': description, - 'FriendlyName': friendly_name, - 'HomepageUrl': homepage_url, - 'Permissions': serialize.map(permissions, lambda e: e), - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/ConnectApps/${sid}.json' + + + def delete(self): + + + """ + Deletes the ConnectAppInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ConnectAppInstance + + :returns: The fetched ConnectAppInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConnectAppInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - return ConnectAppInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the ConnectAppInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return ConnectAppInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ConnectAppInstance(InstanceResource): - - class Permission(object): - GET_ALL = "get-all" - POST_ALL = "post-all" - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ConnectAppInstance - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ +class ConnectAppInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(ConnectAppInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'authorize_redirect_url': payload.get('authorize_redirect_url'), - 'company_name': payload.get('company_name'), - 'deauthorize_callback_method': payload.get('deauthorize_callback_method'), - 'deauthorize_callback_url': payload.get('deauthorize_callback_url'), - 'description': payload.get('description'), - 'friendly_name': payload.get('friendly_name'), - 'homepage_url': payload.get('homepage_url'), - 'permissions': payload.get('permissions'), - 'sid': payload.get('sid'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'authorize_redirect_url' = payload.get('authorize_redirect_url'), + 'company_name' = payload.get('company_name'), + 'deauthorize_callback_method' = payload.get('deauthorize_callback_method'), + 'deauthorize_callback_url' = payload.get('deauthorize_callback_url'), + 'description' = payload.get('description'), + 'friendly_name' = payload.get('friendly_name'), + 'homepage_url' = payload.get('homepage_url'), + 'permissions' = payload.get('permissions'), + 'sid' = payload.get('sid'), + 'uri' = payload.get('uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConnectAppContext for this ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext - """ if self._context is None: self._context = ConnectAppContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def authorize_redirect_url(self): - """ - :returns: The URL to redirect the user to after authorization - :rtype: unicode - """ - return self._properties['authorize_redirect_url'] - - @property - def company_name(self): - """ - :returns: The company name set for the Connect App - :rtype: unicode - """ - return self._properties['company_name'] - - @property - def deauthorize_callback_method(self): - """ - :returns: The HTTP method we use to call deauthorize_callback_url - :rtype: unicode - """ - return self._properties['deauthorize_callback_method'] - - @property - def deauthorize_callback_url(self): - """ - :returns: The URL we call to de-authorize the Connect App - :rtype: unicode - """ - return self._properties['deauthorize_callback_url'] - - @property - def description(self): - """ - :returns: The description of the Connect App - :rtype: unicode - """ - return self._properties['description'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def homepage_url(self): - """ - :returns: The URL users can obtain more information - :rtype: unicode - """ - return self._properties['homepage_url'] - - @property - def permissions(self): - """ - :returns: The set of permissions that your ConnectApp requests - :rtype: list[ConnectAppInstance.Permission] - """ - return self._properties['permissions'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def uri(self): + def __repr__(self): """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['uri'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the ConnectAppInstance - :returns: The fetched ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - return self._proxy.fetch() - def update(self, authorize_redirect_url=values.unset, company_name=values.unset, - deauthorize_callback_method=values.unset, - deauthorize_callback_url=values.unset, description=values.unset, - friendly_name=values.unset, homepage_url=values.unset, - permissions=values.unset): - """ - Update the ConnectAppInstance - - :param unicode authorize_redirect_url: The URL to redirect the user to after authorization - :param unicode company_name: The company name to set for the Connect App - :param unicode deauthorize_callback_method: The HTTP method to use when calling deauthorize_callback_url - :param unicode deauthorize_callback_url: The URL to call to de-authorize the Connect App - :param unicode description: A description of the Connect App - :param unicode friendly_name: A string to describe the resource - :param unicode homepage_url: A public URL where users can obtain more information - :param list[ConnectAppInstance.Permission] permissions: The set of permissions that your ConnectApp will request +class ConnectAppListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(ConnectAppListInstanceList, self).__init__(version) - :returns: The updated ConnectAppInstance - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance - """ - return self._proxy.update( - authorize_redirect_url=authorize_redirect_url, - company_name=company_name, - deauthorize_callback_method=deauthorize_callback_method, - deauthorize_callback_url=deauthorize_callback_url, - description=description, - friendly_name=friendly_name, - homepage_url=homepage_url, - permissions=permissions, - ) + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/ConnectApps.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def delete(self): - """ - Deletes the ConnectAppInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return ConnectAppPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/incoming_phone_number.py b/twilio/rest/api/v2010/account/incoming_phone_number.py new file mode 100644 index 0000000000..4eb0ab9cbd --- /dev/null +++ b/twilio/rest/api/v2010/account/incoming_phone_number.py @@ -0,0 +1,200 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.incoming_phone_number.assigned_add_on import AssignedAddOnListInstancefrom twilio.rest.incoming_phone_number.local import LocalListInstancefrom twilio.rest.incoming_phone_number.mobile import MobileListInstancefrom twilio.rest.incoming_phone_number.toll_free import TollFreeListInstance + + +class IncomingPhoneNumberContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(IncomingPhoneNumberContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${sid}.json' + + self._assigned_add_ons = None + + def delete(self): + + + """ + Deletes the IncomingPhoneNumberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the IncomingPhoneNumberInstance + + :returns: The fetched IncomingPhoneNumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return IncomingPhoneNumberInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class IncomingPhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(IncomingPhoneNumberInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'address_sid' = payload.get('address_sid'), + 'address_requirements' = payload.get('address_requirements'), + 'api_version' = payload.get('api_version'), + 'beta' = payload.get('beta'), + 'capabilities' = payload.get('capabilities'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'identity_sid' = payload.get('identity_sid'), + 'phone_number' = payload.get('phone_number'), + 'origin' = payload.get('origin'), + 'sid' = payload.get('sid'), + 'sms_application_sid' = payload.get('sms_application_sid'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'trunk_sid' = payload.get('trunk_sid'), + 'uri' = payload.get('uri'), + 'voice_receive_mode' = payload.get('voice_receive_mode'), + 'voice_application_sid' = payload.get('voice_application_sid'), + 'voice_caller_id_lookup' = payload.get('voice_caller_id_lookup'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), + 'emergency_status' = payload.get('emergency_status'), + 'emergency_address_sid' = payload.get('emergency_address_sid'), + 'emergency_address_status' = payload.get('emergency_address_status'), + 'bundle_sid' = payload.get('bundle_sid'), + 'status' = payload.get('status'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = IncomingPhoneNumberContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def assigned_add_ons(self): + return self._proxy.assigned_add_ons + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class IncomingPhoneNumberListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(IncomingPhoneNumberListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers.json' + + self._local = None + self._mobile = None + self._toll_free = None + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, beta, friendly_name, phone_number, origin, page_size): + + data = values.of({ + 'beta': beta,'friendly_name': friendly_name,'phone_number': phone_number,'origin': origin,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IncomingPhoneNumberPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on.py new file mode 100644 index 0000000000..c241b7f711 --- /dev/null +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on.py @@ -0,0 +1,163 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.assigned_add_on.assigned_add_on_extension import AssignedAddOnExtensionListInstance + + +class AssignedAddOnContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, resource_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AssignedAddOnContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, resource_sid, sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns/${sid}.json' + + self._extensions = None + + def delete(self): + + + """ + Deletes the AssignedAddOnInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AssignedAddOnInstance + + :returns: The fetched AssignedAddOnInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssignedAddOnInstance( + self._version, + payload, + account_sidresource_sidsid=self._solution['account_sid''resource_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AssignedAddOnInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, resource_sid: str, sid: str): + super(AssignedAddOnInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'resource_sid' = payload.get('resource_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'description' = payload.get('description'), + 'configuration' = payload.get('configuration'), + 'unique_name' = payload.get('unique_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'uri' = payload.get('uri'), + 'subresource_uris' = payload.get('subresource_uris'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'resource_sid': resource_sid or self._properties['resource_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AssignedAddOnContext( + self._version, + account_sid=self._solution['account_sid'],resource_sid=self._solution['resource_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def extensions(self): + return self._proxy.extensions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AssignedAddOnListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, resource_sid: str): + # TODO: needs autogenerated docs + super(AssignedAddOnListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, resource_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssignedAddOnInstance(self._version, payload, account_sid=self._solution['account_sid']resource_sid=self._solution['resource_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssignedAddOnPage(self._version, payload, account_sid=self._solution['account_sid']resource_sid=self._solution['resource_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py index 9d15620af4..85d5efdadc 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py @@ -1,414 +1,136 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AssignedAddOnExtensionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid, assigned_add_on_sid): - """ - Initialize the AssignedAddOnExtensionList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param resource_sid: The SID of the Phone Number to which the Add-on is assigned - :param assigned_add_on_sid: The SID that uniquely identifies the assigned Add-on installation - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - """ - super(AssignedAddOnExtensionList, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'assigned_add_on_sid': assigned_add_on_sid, - } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns/{assigned_add_on_sid}/Extensions.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssignedAddOnExtensionInstance 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 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.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssignedAddOnExtensionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssignedAddOnExtensionInstance records from the API. - Request is executed immediately - - :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 AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AssignedAddOnExtensionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssignedAddOnExtensionInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssignedAddOnExtensionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AssignedAddOnExtensionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ - return AssignedAddOnExtensionContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AssignedAddOnExtensionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ - return AssignedAddOnExtensionContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssignedAddOnExtensionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssignedAddOnExtensionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param resource_sid: The SID of the Phone Number to which the Add-on is assigned - :param assigned_add_on_sid: The SID that uniquely identifies the assigned Add-on installation - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionPage - """ - super(AssignedAddOnExtensionPage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of AssignedAddOnExtensionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ - return AssignedAddOnExtensionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AssignedAddOnExtensionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid, assigned_add_on_sid, - sid): - """ - Initialize the AssignedAddOnExtensionContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param resource_sid: The SID of the Phone Number to which the Add-on is assigned - :param assigned_add_on_sid: The SID that uniquely identifies the assigned Add-on installation - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ - super(AssignedAddOnExtensionContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, resource_sid: str, assigned_add_on_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AssignedAddOnExtensionContextList, self).__init__(version) # Path Solution - self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'assigned_add_on_sid': assigned_add_on_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns/{assigned_add_on_sid}/Extensions/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the AssignedAddOnExtensionInstance - - :returns: The fetched AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssignedAddOnExtensionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, resource_sid, assigned_add_on_sid, sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns/${assigned_add_on_sid}/Extensions/${sid}.json' + + + def fetch(self): + + """ + Fetch the AssignedAddOnExtensionInstance + + :returns: The fetched AssignedAddOnExtensionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssignedAddOnExtensionInstance( + self._version, + payload, + account_sidresource_sidassigned_add_on_sidsid=self._solution['account_sid''resource_sid''assigned_add_on_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AssignedAddOnExtensionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, account_sid, resource_sid, - assigned_add_on_sid, sid=None): - """ - Initialize the AssignedAddOnExtensionInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ +class AssignedAddOnExtensionInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, resource_sid: str, assigned_add_on_sid: str, sid: str): super(AssignedAddOnExtensionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'resource_sid': payload.get('resource_sid'), - 'assigned_add_on_sid': payload.get('assigned_add_on_sid'), - 'friendly_name': payload.get('friendly_name'), - 'product_name': payload.get('product_name'), - 'unique_name': payload.get('unique_name'), - 'uri': payload.get('uri'), - 'enabled': payload.get('enabled'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'resource_sid' = payload.get('resource_sid'), + 'assigned_add_on_sid' = payload.get('assigned_add_on_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'product_name' = payload.get('product_name'), + 'unique_name' = payload.get('unique_name'), + 'uri' = payload.get('uri'), + 'enabled' = payload.get('enabled'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'assigned_add_on_sid': assigned_add_on_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'resource_sid': resource_sid or self._properties['resource_sid']'assigned_add_on_sid': assigned_add_on_sid or self._properties['assigned_add_on_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssignedAddOnExtensionContext for this AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionContext - """ if self._context is None: self._context = AssignedAddOnExtensionContext( self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['assigned_add_on_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],resource_sid=self._solution['resource_sid'],assigned_add_on_sid=self._solution['assigned_add_on_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def resource_sid(self): - """ - :returns: The SID of the Phone Number to which the Add-on is assigned - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def assigned_add_on_sid(self): - """ - :returns: The SID that uniquely identifies the assigned Add-on installation - :rtype: unicode - """ - return self._properties['assigned_add_on_sid'] + - @property - def friendly_name(self): + def __repr__(self): """ - :returns: The string that you assigned to describe the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['friendly_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def product_name(self): - """ - :returns: A string that you assigned to describe the Product this Extension is used within - :rtype: unicode - """ - return self._properties['product_name'] - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] +class AssignedAddOnExtensionListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, resource_sid: str, assigned_add_on_sid: str): + # TODO: needs autogenerated docs + super(AssignedAddOnExtensionListInstanceList, self).__init__(version) - @property - def enabled(self): - """ - :returns: Whether the Extension will be invoked - :rtype: bool - """ - return self._properties['enabled'] + # Path Solution + self._solution = { account_sid, resource_sid, assigned_add_on_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns/${assigned_add_on_sid}/Extensions.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the AssignedAddOnExtensionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched AssignedAddOnExtensionInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionInstance - """ - return self._proxy.fetch() + return AssignedAddOnExtensionPage(self._version, payload, account_sid=self._solution['account_sid']resource_sid=self._solution['resource_sid']assigned_add_on_sid=self._solution['assigned_add_on_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/local.py b/twilio/rest/api/v2010/account/incoming_phone_number/local.py index 088f29a3dc..a1450189b0 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -1,626 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class LocalList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the LocalList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - """ - super(LocalList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/Local.json'.format(**self._solution) - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams LocalInstance 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 beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :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.incoming_phone_number.local.LocalInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists LocalInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.incoming_phone_number.local.LocalInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of LocalInstance records from the API. - Request is executed immediately - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :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 LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - """ - data = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return LocalPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of LocalInstance records from the API. - Request is executed immediately +from twilio.base.page import Page - :param str target_url: API-generated URL for the requested results page - :returns: Page of LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return LocalPage(self._version, response, self._solution) - def create(self, phone_number, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - identity_sid=values.unset, address_sid=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, voice_receive_mode=values.unset, - bundle_sid=values.unset): - """ - Create the LocalInstance - :param unicode phone_number: The phone number to purchase in E.164 format - :param unicode api_version: The API version to use for incoming calls made to the new phone number - :param unicode friendly_name: A string to describe the new phone number - :param unicode sms_application_sid: The SID of the application to handle SMS messages - :param unicode sms_fallback_method: The HTTP method we use to call status_callback - :param unicode sms_fallback_url: The URL we call when an error occurs while executing TwiML - :param unicode sms_method: The HTTP method to use with sms url - :param unicode sms_url: The URL we should call when the new phone number receives an incoming SMS message - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: HTTP method we should use to call status_callback - :param unicode voice_application_sid: The SID of the application to handle the new phone number - :param bool voice_caller_id_lookup: Whether to lookup the caller's name - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode voice_fallback_url: The URL we will call when an error occurs in TwiML - :param unicode voice_method: The HTTP method used with the voice_url - :param unicode voice_url: The URL we should call when the phone number receives a call - :param unicode identity_sid: The SID of the Identity resource to associate with the new phone number - :param unicode address_sid: The SID of the Address resource associated with the phone number - :param LocalInstance.EmergencyStatus emergency_status: Displays if emergency calling is enabled for this number. - :param unicode emergency_address_sid: The emergency address configuration to use for emergency calling - :param unicode trunk_sid: SID of the trunk to handle calls to the new phone number - :param LocalInstance.VoiceReceiveMode voice_receive_mode: Incoming call type: fax or voice - :param unicode bundle_sid: The SID of the Bundle resource associated with number +class LocalInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(LocalInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'address_sid' = payload.get('address_sid'), + 'address_requirements' = payload.get('address_requirements'), + 'api_version' = payload.get('api_version'), + 'beta' = payload.get('beta'), + 'capabilities' = payload.get('capabilities'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'identity_sid' = payload.get('identity_sid'), + 'phone_number' = payload.get('phone_number'), + 'origin' = payload.get('origin'), + 'sid' = payload.get('sid'), + 'sms_application_sid' = payload.get('sms_application_sid'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'trunk_sid' = payload.get('trunk_sid'), + 'uri' = payload.get('uri'), + 'voice_receive_mode' = payload.get('voice_receive_mode'), + 'voice_application_sid' = payload.get('voice_application_sid'), + 'voice_caller_id_lookup' = payload.get('voice_caller_id_lookup'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), + 'emergency_status' = payload.get('emergency_status'), + 'emergency_address_sid' = payload.get('emergency_address_sid'), + 'emergency_address_status' = payload.get('emergency_address_status'), + 'bundle_sid' = payload.get('bundle_sid'), + 'status' = payload.get('status'), + } - :returns: The created LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - 'EmergencyStatus': emergency_status, - 'EmergencyAddressSid': emergency_address_sid, - 'TrunkSid': trunk_sid, - 'VoiceReceiveMode': voice_receive_mode, - 'BundleSid': bundle_sid, - }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = LocalContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return LocalInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class LocalPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the LocalPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalPage - """ - super(LocalPage, self).__init__(version, response) +class LocalListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(LocalListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of LocalInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - """ - return LocalInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/Local.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return LocalInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, beta, friendly_name, phone_number, origin, page_size): + + data = values.of({ + 'beta': beta,'friendly_name': friendly_name,'phone_number': phone_number,'origin': origin,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return LocalPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class LocalInstance(InstanceResource): - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - class EmergencyStatus(object): - ACTIVE = "Active" - INACTIVE = "Inactive" - - class EmergencyAddressStatus(object): - REGISTERED = "registered" - UNREGISTERED = "unregistered" - PENDING_REGISTRATION = "pending-registration" - REGISTRATION_FAILURE = "registration-failure" - PENDING_UNREGISTRATION = "pending-unregistration" - UNREGISTRATION_FAILURE = "unregistration-failure" - - class VoiceReceiveMode(object): - VOICE = "voice" - FAX = "fax" - - def __init__(self, version, payload, account_sid): - """ - Initialize the LocalInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalInstance - """ - super(LocalInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'address_sid': payload.get('address_sid'), - 'address_requirements': payload.get('address_requirements'), - 'api_version': payload.get('api_version'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'identity_sid': payload.get('identity_sid'), - 'phone_number': payload.get('phone_number'), - 'origin': payload.get('origin'), - 'sid': payload.get('sid'), - 'sms_application_sid': payload.get('sms_application_sid'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'trunk_sid': payload.get('trunk_sid'), - 'uri': payload.get('uri'), - 'voice_receive_mode': payload.get('voice_receive_mode'), - 'voice_application_sid': payload.get('voice_application_sid'), - 'voice_caller_id_lookup': payload.get('voice_caller_id_lookup'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), - 'emergency_status': payload.get('emergency_status'), - 'emergency_address_sid': payload.get('emergency_address_sid'), - 'emergency_address_status': payload.get('emergency_address_status'), - 'bundle_sid': payload.get('bundle_sid'), - 'status': payload.get('status'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: The SID of the Address resource associated with the phone number - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: Whether the phone number requires an Address registered with Twilio. - :rtype: LocalInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + return '' - @property - def identity_sid(self): - """ - :returns: The SID of the Identity resource associated with number - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The phone number's origin. Can be twilio or hosted. - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The SID of the Application resource to handle SMS messages - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The HTTP method used with sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The URL we call when the phone number receives an incoming SMS message - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk that handles calls to the phone number - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_receive_mode(self): - """ - :returns: The voice_receive_mode - :rtype: LocalInstance.VoiceReceiveMode - """ - return self._properties['voice_receive_mode'] - - @property - def voice_application_sid(self): - """ - :returns: The SID of the application that handles calls to the phone number - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Whether to lookup the caller's name - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs in TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method used with the voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The URL we call when this phone number receives a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def emergency_status(self): - """ - :returns: Displays if emergency calling is enabled for this number. - :rtype: LocalInstance.EmergencyStatus - """ - return self._properties['emergency_status'] - - @property - def emergency_address_sid(self): - """ - :returns: The emergency address configuration to use for emergency calling - :rtype: unicode - """ - return self._properties['emergency_address_sid'] - - @property - def emergency_address_status(self): - """ - :returns: State of the emergency address configuration for the phone number - :rtype: LocalInstance.EmergencyAddressStatus - """ - return self._properties['emergency_address_status'] - - @property - def bundle_sid(self): - """ - :returns: The SID of the Bundle resource associated with number - :rtype: unicode - """ - return self._properties['bundle_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py index aa798cc9a5..6f0d178ab6 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -1,626 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MobileList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the MobileList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - """ - super(MobileList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/Mobile.json'.format(**self._solution) - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams MobileInstance 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 beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :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.incoming_phone_number.mobile.MobileInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists MobileInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.incoming_phone_number.mobile.MobileInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MobileInstance records from the API. - Request is executed immediately - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :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 MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - """ - data = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MobilePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MobileInstance records from the API. - Request is executed immediately +from twilio.base.page import Page - :param str target_url: API-generated URL for the requested results page - :returns: Page of MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return MobilePage(self._version, response, self._solution) - def create(self, phone_number, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - identity_sid=values.unset, address_sid=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, voice_receive_mode=values.unset, - bundle_sid=values.unset): - """ - Create the MobileInstance - :param unicode phone_number: The phone number to purchase in E.164 format - :param unicode api_version: The API version to use for incoming calls made to the new phone number - :param unicode friendly_name: A string to describe the new phone number - :param unicode sms_application_sid: The SID of the application to handle SMS messages - :param unicode sms_fallback_method: HTTP method used with sms_fallback_url - :param unicode sms_fallback_url: The URL we call when an error occurs while executing TwiML - :param unicode sms_method: The HTTP method to use with sms url - :param unicode sms_url: The URL we should call when the new phone number receives an incoming SMS message - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param unicode voice_application_sid: The SID of the application to handle the new phone number - :param bool voice_caller_id_lookup: Whether to lookup the caller's name - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode voice_fallback_url: The URL we will call when an error occurs in TwiML - :param unicode voice_method: The HTTP method used with the voice_url - :param unicode voice_url: The URL we should call when the phone number receives a call - :param unicode identity_sid: The SID of the Identity resource to associate with the new phone number - :param unicode address_sid: The SID of the Address resource associated with the phone number - :param MobileInstance.EmergencyStatus emergency_status: Displays if emergency calling is enabled for this number. - :param unicode emergency_address_sid: The emergency address configuration to use for emergency calling - :param unicode trunk_sid: SID of the trunk to handle calls to the new phone number - :param MobileInstance.VoiceReceiveMode voice_receive_mode: Incoming call type: fax or voice - :param unicode bundle_sid: The SID of the Bundle resource associated with number +class MobileInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(MobileInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'address_sid' = payload.get('address_sid'), + 'address_requirements' = payload.get('address_requirements'), + 'api_version' = payload.get('api_version'), + 'beta' = payload.get('beta'), + 'capabilities' = payload.get('capabilities'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'identity_sid' = payload.get('identity_sid'), + 'phone_number' = payload.get('phone_number'), + 'origin' = payload.get('origin'), + 'sid' = payload.get('sid'), + 'sms_application_sid' = payload.get('sms_application_sid'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'trunk_sid' = payload.get('trunk_sid'), + 'uri' = payload.get('uri'), + 'voice_receive_mode' = payload.get('voice_receive_mode'), + 'voice_application_sid' = payload.get('voice_application_sid'), + 'voice_caller_id_lookup' = payload.get('voice_caller_id_lookup'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), + 'emergency_status' = payload.get('emergency_status'), + 'emergency_address_sid' = payload.get('emergency_address_sid'), + 'emergency_address_status' = payload.get('emergency_address_status'), + 'bundle_sid' = payload.get('bundle_sid'), + 'status' = payload.get('status'), + } - :returns: The created MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - 'EmergencyStatus': emergency_status, - 'EmergencyAddressSid': emergency_address_sid, - 'TrunkSid': trunk_sid, - 'VoiceReceiveMode': voice_receive_mode, - 'BundleSid': bundle_sid, - }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = MobileContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return MobileInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class MobilePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the MobilePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobilePage - """ - super(MobilePage, self).__init__(version, response) +class MobileListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(MobileListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MobileInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - """ - return MobileInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/Mobile.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MobileInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, beta, friendly_name, phone_number, origin, page_size): + + data = values.of({ + 'beta': beta,'friendly_name': friendly_name,'phone_number': phone_number,'origin': origin,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MobilePage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class MobileInstance(InstanceResource): - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - class EmergencyStatus(object): - ACTIVE = "Active" - INACTIVE = "Inactive" - - class EmergencyAddressStatus(object): - REGISTERED = "registered" - UNREGISTERED = "unregistered" - PENDING_REGISTRATION = "pending-registration" - REGISTRATION_FAILURE = "registration-failure" - PENDING_UNREGISTRATION = "pending-unregistration" - UNREGISTRATION_FAILURE = "unregistration-failure" - - class VoiceReceiveMode(object): - VOICE = "voice" - FAX = "fax" - - def __init__(self, version, payload, account_sid): - """ - Initialize the MobileInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileInstance - """ - super(MobileInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'address_sid': payload.get('address_sid'), - 'address_requirements': payload.get('address_requirements'), - 'api_version': payload.get('api_version'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'identity_sid': payload.get('identity_sid'), - 'phone_number': payload.get('phone_number'), - 'origin': payload.get('origin'), - 'sid': payload.get('sid'), - 'sms_application_sid': payload.get('sms_application_sid'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'trunk_sid': payload.get('trunk_sid'), - 'uri': payload.get('uri'), - 'voice_receive_mode': payload.get('voice_receive_mode'), - 'voice_application_sid': payload.get('voice_application_sid'), - 'voice_caller_id_lookup': payload.get('voice_caller_id_lookup'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), - 'emergency_status': payload.get('emergency_status'), - 'emergency_address_sid': payload.get('emergency_address_sid'), - 'emergency_address_status': payload.get('emergency_address_status'), - 'bundle_sid': payload.get('bundle_sid'), - 'status': payload.get('status'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: The SID of the Address resource associated with the phone number - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: Whether the phone number requires an Address registered with Twilio. - :rtype: MobileInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + return '' - @property - def identity_sid(self): - """ - :returns: The SID of the Identity resource associated with number - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The phone number's origin. Can be twilio or hosted. - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The SID of the application that handles SMS messages sent to the phone number - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The HTTP method used with sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The URL we call when the phone number receives an incoming SMS message - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk that handles calls to the phone number - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_receive_mode(self): - """ - :returns: The voice_receive_mode - :rtype: MobileInstance.VoiceReceiveMode - """ - return self._properties['voice_receive_mode'] - - @property - def voice_application_sid(self): - """ - :returns: The SID of the application that handles calls to the phone number - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Whether to lookup the caller's name - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs in TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method used with the voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The URL we call when the phone number receives a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def emergency_status(self): - """ - :returns: Displays if emergency calling is enabled for this number. - :rtype: MobileInstance.EmergencyStatus - """ - return self._properties['emergency_status'] - - @property - def emergency_address_sid(self): - """ - :returns: The emergency address configuration to use for emergency calling - :rtype: unicode - """ - return self._properties['emergency_address_sid'] - - @property - def emergency_address_status(self): - """ - :returns: State of the emergency address configuration for the phone number - :rtype: MobileInstance.EmergencyAddressStatus - """ - return self._properties['emergency_address_status'] - - @property - def bundle_sid(self): - """ - :returns: The SID of the Bundle resource associated with number - :rtype: unicode - """ - return self._properties['bundle_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py index 2bea127bc6..c083af6743 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py @@ -1,626 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TollFreeList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the TollFreeList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - """ - super(TollFreeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/TollFree.json'.format(**self._solution) - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams TollFreeInstance 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 beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :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.incoming_phone_number.toll_free.TollFreeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists TollFreeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.incoming_phone_number.toll_free.TollFreeInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TollFreeInstance records from the API. - Request is executed immediately - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the resources to read - :param unicode phone_number: The phone numbers of the resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :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 TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - """ - data = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TollFreePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TollFreeInstance records from the API. - Request is executed immediately +from twilio.base.page import Page - :param str target_url: API-generated URL for the requested results page - :returns: Page of TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return TollFreePage(self._version, response, self._solution) - def create(self, phone_number, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - identity_sid=values.unset, address_sid=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, voice_receive_mode=values.unset, - bundle_sid=values.unset): - """ - Create the TollFreeInstance - :param unicode phone_number: The phone number to purchase in E.164 format - :param unicode api_version: The API version to use for incoming calls made to the new phone number - :param unicode friendly_name: A string to describe the new phone number - :param unicode sms_application_sid: The SID of the application to handle SMS messages - :param unicode sms_fallback_method: HTTP method used with sms_fallback_url - :param unicode sms_fallback_url: The URL we call when an error occurs while executing TwiML - :param unicode sms_method: The HTTP method to use with sms_url - :param unicode sms_url: The URL we should call when the new phone number receives an incoming SMS message - :param unicode status_callback: The URL to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param unicode voice_application_sid: The SID of the application to handle the new phone number - :param bool voice_caller_id_lookup: Whether to lookup the caller's name - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode voice_fallback_url: The URL we will call when an error occurs in TwiML - :param unicode voice_method: The HTTP method used with the voice_url - :param unicode voice_url: The URL we should call when the phone number receives a call - :param unicode identity_sid: The SID of the Identity resource to associate with the new phone number - :param unicode address_sid: The SID of the Address resource associated with the phone number - :param TollFreeInstance.EmergencyStatus emergency_status: Displays if emergency calling is enabled for this number. - :param unicode emergency_address_sid: The emergency address configuration to use for emergency calling - :param unicode trunk_sid: SID of the trunk to handle calls to the new phone number - :param TollFreeInstance.VoiceReceiveMode voice_receive_mode: Incoming call type: fax or voice - :param unicode bundle_sid: The SID of the Bundle resource associated with number +class TollFreeInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(TollFreeInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'address_sid' = payload.get('address_sid'), + 'address_requirements' = payload.get('address_requirements'), + 'api_version' = payload.get('api_version'), + 'beta' = payload.get('beta'), + 'capabilities' = payload.get('capabilities'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'identity_sid' = payload.get('identity_sid'), + 'phone_number' = payload.get('phone_number'), + 'origin' = payload.get('origin'), + 'sid' = payload.get('sid'), + 'sms_application_sid' = payload.get('sms_application_sid'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'trunk_sid' = payload.get('trunk_sid'), + 'uri' = payload.get('uri'), + 'voice_receive_mode' = payload.get('voice_receive_mode'), + 'voice_application_sid' = payload.get('voice_application_sid'), + 'voice_caller_id_lookup' = payload.get('voice_caller_id_lookup'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), + 'emergency_status' = payload.get('emergency_status'), + 'emergency_address_sid' = payload.get('emergency_address_sid'), + 'emergency_address_status' = payload.get('emergency_address_status'), + 'bundle_sid' = payload.get('bundle_sid'), + 'status' = payload.get('status'), + } - :returns: The created TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - 'EmergencyStatus': emergency_status, - 'EmergencyAddressSid': emergency_address_sid, - 'TrunkSid': trunk_sid, - 'VoiceReceiveMode': voice_receive_mode, - 'BundleSid': bundle_sid, - }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = TollFreeContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return TollFreeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class TollFreePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the TollFreePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreePage - """ - super(TollFreePage, self).__init__(version, response) +class TollFreeListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(TollFreeListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TollFreeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - """ - return TollFreeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/TollFree.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TollFreeInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, beta, friendly_name, phone_number, origin, page_size): + + data = values.of({ + 'beta': beta,'friendly_name': friendly_name,'phone_number': phone_number,'origin': origin,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TollFreePage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class TollFreeInstance(InstanceResource): - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - class EmergencyStatus(object): - ACTIVE = "Active" - INACTIVE = "Inactive" - - class EmergencyAddressStatus(object): - REGISTERED = "registered" - UNREGISTERED = "unregistered" - PENDING_REGISTRATION = "pending-registration" - REGISTRATION_FAILURE = "registration-failure" - PENDING_UNREGISTRATION = "pending-unregistration" - UNREGISTRATION_FAILURE = "unregistration-failure" - - class VoiceReceiveMode(object): - VOICE = "voice" - FAX = "fax" - - def __init__(self, version, payload, account_sid): - """ - Initialize the TollFreeInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeInstance - """ - super(TollFreeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'address_sid': payload.get('address_sid'), - 'address_requirements': payload.get('address_requirements'), - 'api_version': payload.get('api_version'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'identity_sid': payload.get('identity_sid'), - 'phone_number': payload.get('phone_number'), - 'origin': payload.get('origin'), - 'sid': payload.get('sid'), - 'sms_application_sid': payload.get('sms_application_sid'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'trunk_sid': payload.get('trunk_sid'), - 'uri': payload.get('uri'), - 'voice_receive_mode': payload.get('voice_receive_mode'), - 'voice_application_sid': payload.get('voice_application_sid'), - 'voice_caller_id_lookup': payload.get('voice_caller_id_lookup'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), - 'emergency_status': payload.get('emergency_status'), - 'emergency_address_sid': payload.get('emergency_address_sid'), - 'emergency_address_status': payload.get('emergency_address_status'), - 'bundle_sid': payload.get('bundle_sid'), - 'status': payload.get('status'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: The SID of the Address resource associated with the phone number - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: Whether the phone number requires an Address registered with Twilio. - :rtype: TollFreeInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + return '' - @property - def identity_sid(self): - """ - :returns: The SID of the Identity resource associated with number - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The phone number's origin. Can be twilio or hosted. - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The SID of the application that handles SMS messages sent to the phone number - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The HTTP method used with sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The URL we call when the phone number receives an incoming SMS message - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk that handles calls to the phone number - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_receive_mode(self): - """ - :returns: The voice_receive_mode - :rtype: TollFreeInstance.VoiceReceiveMode - """ - return self._properties['voice_receive_mode'] - - @property - def voice_application_sid(self): - """ - :returns: The SID of the application that handles calls to the phone number - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Whether to lookup the caller's name - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs in TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method used with the voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The URL we call when the phone number receives a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def emergency_status(self): - """ - :returns: Displays if emergency calling is enabled for this number. - :rtype: TollFreeInstance.EmergencyStatus - """ - return self._properties['emergency_status'] - - @property - def emergency_address_sid(self): - """ - :returns: The emergency address configuration to use for emergency calling - :rtype: unicode - """ - return self._properties['emergency_address_sid'] - - @property - def emergency_address_status(self): - """ - :returns: State of the emergency address configuration for the phone number - :rtype: TollFreeInstance.EmergencyAddressStatus - """ - return self._properties['emergency_address_status'] - - @property - def bundle_sid(self): - """ - :returns: The SID of the Bundle resource associated with number - :rtype: unicode - """ - return self._properties['bundle_sid'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/key.py b/twilio/rest/api/v2010/account/key.py index f56e92cbae..087246027f 100644 --- a/twilio/rest/api/v2010/account/key.py +++ b/twilio/rest/api/v2010/account/key.py @@ -1,367 +1,153 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class KeyList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the KeyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.key.KeyList - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - super(KeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Keys.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams KeyInstance 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 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.key.KeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists KeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.key.KeyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of KeyInstance records from the API. - Request is executed immediately - - :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 KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return KeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of KeyInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - - :returns: Page of KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return KeyPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a KeyContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.key.KeyContext - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ - return KeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a KeyContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.key.KeyContext - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ - return KeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class KeyPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the KeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.key.KeyPage - :rtype: twilio.rest.api.v2010.account.key.KeyPage - """ - super(KeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of KeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.key.KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - return KeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class KeyContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the KeyContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.key.KeyContext - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ - super(KeyContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(KeyContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Keys/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the KeyInstance - - :returns: The fetched KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return KeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the KeyInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The updated KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Keys/${sid}.json' + + + def delete(self): + + + """ + Deletes the KeyInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the KeyInstance + + :returns: The fetched KeyInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return KeyInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - return KeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the KeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return KeyInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class KeyInstance(InstanceResource): - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the KeyInstance - :returns: twilio.rest.api.v2010.account.key.KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ +class KeyInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(KeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: KeyContext for this KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyContext - """ if self._context is None: self._context = KeyContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime + def __repr__(self): """ - return self._properties['date_updated'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the KeyInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - return self._proxy.fetch() - def update(self, friendly_name=values.unset): - """ - Update the KeyInstance - :param unicode friendly_name: A string to describe the resource +class KeyListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(KeyListInstanceList, self).__init__(version) - :returns: The updated KeyInstance - :rtype: twilio.rest.api.v2010.account.key.KeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Keys.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def delete(self): - """ - Deletes the KeyInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return KeyPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/message.py b/twilio/rest/api/v2010/account/message.py new file mode 100644 index 0000000000..7d46c1f8d2 --- /dev/null +++ b/twilio/rest/api/v2010/account/message.py @@ -0,0 +1,187 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.message.feedback import FeedbackListInstancefrom twilio.rest.message.media import MediaListInstance + + +class MessageContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Messages/${sid}.json' + + self._feedback = None + self._media = None + + def delete(self): + + + """ + Deletes the MessageInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessageInstance + + :returns: The fetched MessageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MessageInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(MessageInstance, self).__init__(version) + self._properties = { + 'body' = payload.get('body'), + 'num_segments' = payload.get('num_segments'), + 'direction' = payload.get('direction'), + '_from' = payload.get('from'), + 'to' = payload.get('to'), + 'date_updated' = payload.get('date_updated'), + 'price' = payload.get('price'), + 'error_message' = payload.get('error_message'), + 'uri' = payload.get('uri'), + 'account_sid' = payload.get('account_sid'), + 'num_media' = payload.get('num_media'), + 'status' = payload.get('status'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'sid' = payload.get('sid'), + 'date_sent' = payload.get('date_sent'), + 'date_created' = payload.get('date_created'), + 'error_code' = payload.get('error_code'), + 'price_unit' = payload.get('price_unit'), + 'api_version' = payload.get('api_version'), + 'subresource_uris' = payload.get('subresource_uris'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MessageContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def feedback(self): + return self._proxy.feedback + @property + def media(self): + return self._proxy.media + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MessageListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(MessageListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Messages.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, to, _from, date_sent, date_sent, date_sent, page_size): + + data = values.of({ + 'to': to,'_from': _from,'date_sent': date_sent,'date_sent': date_sent,'date_sent': date_sent,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagePage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/message/feedback.py b/twilio/rest/api/v2010/account/message/feedback.py index 0b6a39c1d7..98d12975f2 100644 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ b/twilio/rest/api/v2010/account/message/feedback.py @@ -1,194 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class FeedbackList(ListResource): - def __init__(self, version, account_sid, message_sid): - """ - Initialize the FeedbackList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param message_sid: The SID of the Message resource for which the feedback was provided - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackList - """ - super(FeedbackList, self).__init__(version) - # Path Solution - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, } - self._uri = '/Accounts/{account_sid}/Messages/{message_sid}/Feedback.json'.format(**self._solution) - def create(self, outcome=values.unset): - """ - Create the FeedbackInstance - :param FeedbackInstance.Outcome outcome: Whether the feedback has arrived +class FeedbackInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, message_sid: str): + super(FeedbackInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'message_sid' = payload.get('message_sid'), + 'outcome' = payload.get('outcome'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'uri' = payload.get('uri'), + } - :returns: The created FeedbackInstance - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - """ - data = values.of({'Outcome': outcome, }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'message_sid': message_sid or self._properties['message_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = FeedbackContext( + self._version, + account_sid=self._solution['account_sid'],message_sid=self._solution['message_sid'], + ) + return self._context - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class FeedbackPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the FeedbackPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param message_sid: The SID of the Message resource for which the feedback was provided - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackPage - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackPage - """ - super(FeedbackPage, self).__init__(version, response) +class FeedbackListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, message_sid: str): + # TODO: needs autogenerated docs + super(FeedbackListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { account_sid, message_sid, } + self._uri = '/Accounts/${account_sid}/Messages/${message_sid}/Feedback.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def get_instance(self, payload): - """ - Build an instance of FeedbackInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - """ - return FeedbackInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - ) + return FeedbackInstance(self._version, payload, account_sid=self._solution['account_sid']message_sid=self._solution['message_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class FeedbackInstance(InstanceResource): - - class Outcome(object): - CONFIRMED = "confirmed" - UNCONFIRMED = "unconfirmed" - - def __init__(self, version, payload, account_sid, message_sid): - """ - Initialize the FeedbackInstance - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackInstance - """ - super(FeedbackInstance, self).__init__(version) + return '' - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'message_sid': payload.get('message_sid'), - 'outcome': payload.get('outcome'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'uri': payload.get('uri'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def message_sid(self): - """ - :returns: The SID of the Message resource for which the feedback was provided - :rtype: unicode - """ - return self._properties['message_sid'] - - @property - def outcome(self): - """ - :returns: Whether the feedback has arrived - :rtype: FeedbackInstance.Outcome - """ - return self._properties['outcome'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/message/media.py b/twilio/rest/api/v2010/account/message/media.py index 5cf7b2dd5c..a49daf1080 100644 --- a/twilio/rest/api/v2010/account/message/media.py +++ b/twilio/rest/api/v2010/account/message/media.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,407 +19,127 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MediaList(ListResource): - - def __init__(self, version, account_sid, message_sid): - """ - Initialize the MediaList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - :param message_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.message.media.MediaList - :rtype: twilio.rest.api.v2010.account.message.media.MediaList - """ - super(MediaList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, } - self._uri = '/Accounts/{account_sid}/Messages/{message_sid}/Media.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Streams MediaInstance 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 datetime date_created_before: Only include media that was created on this date - :param datetime date_created: Only include media that was created on this date - :param datetime date_created_after: Only include media that was created on this date - :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.message.media.MediaInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, limit=None, page_size=None): - """ - Lists MediaInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_before: Only include media that was created on this date - :param datetime date_created: Only include media that was created on this date - :param datetime date_created_after: Only include media that was created on this date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.message.media.MediaInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MediaInstance records from the API. - Request is executed immediately - - :param datetime date_created_before: Only include media that was created on this date - :param datetime date_created: Only include media that was created on this date - :param datetime date_created_after: Only include media that was created on this date - :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 MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaPage - """ - data = values.of({ - 'DateCreated<': serialize.iso8601_datetime(date_created_before), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateCreated>': serialize.iso8601_datetime(date_created_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MediaPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MediaInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - :returns: Page of MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MediaPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MediaContext - - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.message.media.MediaContext - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ - return MediaContext( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MediaContext - - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.message.media.MediaContext - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ - return MediaContext( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MediaPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MediaPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - :param message_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.message.media.MediaPage - :rtype: twilio.rest.api.v2010.account.message.media.MediaPage - """ - super(MediaPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of MediaInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.message.media.MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ - return MediaInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class MediaContext(InstanceContext): - - def __init__(self, version, account_sid, message_sid, sid): - """ - Initialize the MediaContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource(s) to fetch - :param message_sid: The SID of the Message resource that this Media resource belongs to - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.message.media.MediaContext - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ - super(MediaContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, message_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MediaContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'message_sid': message_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Messages/{message_sid}/Media/{sid}.json'.format(**self._solution) - - def delete(self): - """ - Deletes the MediaInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the MediaInstance - - :returns: The fetched MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MediaInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, message_sid, sid, } + self._uri = '/Accounts/${account_sid}/Messages/${message_sid}/Media/${sid}.json' + + + def delete(self): + + + """ + Deletes the MediaInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MediaInstance + + :returns: The fetched MediaInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MediaInstance( + self._version, + payload, + account_sidmessage_sidsid=self._solution['account_sid''message_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class MediaInstance(InstanceResource): - def __init__(self, version, payload, account_sid, message_sid, sid=None): - """ - Initialize the MediaInstance - :returns: twilio.rest.api.v2010.account.message.media.MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ +class MediaInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, message_sid: str, sid: str): super(MediaInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'content_type': payload.get('content_type'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'parent_sid': payload.get('parent_sid'), - 'sid': payload.get('sid'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'content_type' = payload.get('content_type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'parent_sid' = payload.get('parent_sid'), + 'sid' = payload.get('sid'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'message_sid': message_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'message_sid': message_sid or self._properties['message_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MediaContext for this MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaContext - """ if self._context is None: self._context = MediaContext( self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],message_sid=self._solution['message_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def content_type(self): - """ - :returns: The default mime-type of the media - :rtype: unicode - """ - return self._properties['content_type'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def parent_sid(self): + def __repr__(self): """ - :returns: The SID of the resource that created the media - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['parent_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sid(self): - """ - :returns: The unique string that identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - @property - def uri(self): - """ - :returns: The URI of this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - def delete(self): - """ - Deletes the MediaInstance +class MediaListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, message_sid: str): + # TODO: needs autogenerated docs + super(MediaListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, message_sid, } + self._uri = '/Accounts/${account_sid}/Messages/${message_sid}/Media.json' + + + def page(self, date_created, date_created, date_created, page_size): + + data = values.of({ + 'date_created': date_created,'date_created': date_created,'date_created': date_created,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the MediaInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched MediaInstance - :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance - """ - return self._proxy.fetch() + return MediaPage(self._version, payload, account_sid=self._solution['account_sid']message_sid=self._solution['message_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py index 86e106babf..952d8937c5 100644 --- a/twilio/rest/api/v2010/account/new_key.py +++ b/twilio/rest/api/v2010/account/new_key.py @@ -1,169 +1,93 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class NewKeyList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the NewKeyList - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyList - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - super(NewKeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Keys.json'.format(**self._solution) - def create(self, friendly_name=values.unset): - """ - Create the NewKeyInstance - - :param unicode friendly_name: A string to describe the resource +class NewKeyInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(NewKeyInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'secret' = payload.get('secret'), + } - :returns: The created NewKeyInstance - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = NewKeyContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return NewKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class NewKeyPage(Page): + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def __init__(self, version, response, solution): - """ - Initialize the NewKeyPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.new_key.NewKeyPage - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyPage - """ - super(NewKeyPage, self).__init__(version, response) +class NewKeyListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(NewKeyListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NewKeyInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Keys.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.new_key.NewKeyInstance - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyInstance - """ - return NewKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return NewKeyInstance(self._version, payload, account_sid=self._solution['account_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class NewKeyInstance(InstanceResource): - - def __init__(self, version, payload, account_sid): - """ - Initialize the NewKeyInstance - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyInstance - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyInstance - """ - super(NewKeyInstance, self).__init__(version) + return '' - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'secret': payload.get('secret'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def secret(self): - """ - :returns: The secret your application uses to sign Access Tokens and to authenticate to the REST API. - :rtype: unicode - """ - return self._properties['secret'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/new_signing_key.py b/twilio/rest/api/v2010/account/new_signing_key.py index 14db654a68..7beb46e01c 100644 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ b/twilio/rest/api/v2010/account/new_signing_key.py @@ -1,169 +1,93 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class NewSigningKeyList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the NewSigningKeyList - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - super(NewSigningKeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SigningKeys.json'.format(**self._solution) - def create(self, friendly_name=values.unset): - """ - Create the NewSigningKeyInstance - - :param unicode friendly_name: A string to describe the resource +class NewSigningKeyInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(NewSigningKeyInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'secret' = payload.get('secret'), + } - :returns: The created NewSigningKeyInstance - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = NewSigningKeyContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return NewSigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class NewSigningKeyPage(Page): + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def __init__(self, version, response, solution): - """ - Initialize the NewSigningKeyPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyPage - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyPage - """ - super(NewSigningKeyPage, self).__init__(version, response) +class NewSigningKeyListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(NewSigningKeyListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NewSigningKeyInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/SigningKeys.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - """ - return NewSigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return NewSigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class NewSigningKeyInstance(InstanceResource): - - def __init__(self, version, payload, account_sid): - """ - Initialize the NewSigningKeyInstance - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyInstance - """ - super(NewSigningKeyInstance, self).__init__(version) + return '' - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'secret': payload.get('secret'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def secret(self): - """ - :returns: The secret your application uses to sign Access Tokens and to authenticate to the REST API. - :rtype: unicode - """ - return self._properties['secret'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/notification.py b/twilio/rest/api/v2010/account/notification.py index d0873b6ca1..0229122789 100644 --- a/twilio/rest/api/v2010/account/notification.py +++ b/twilio/rest/api/v2010/account/notification.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,464 +19,126 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NotificationList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the NotificationList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Notifications.json'.format(**self._solution) - - def stream(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - limit=None, page_size=None): - """ - Streams NotificationInstance 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 log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :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.notification.NotificationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, limit=None, - page_size=None): - """ - Lists NotificationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.notification.NotificationInstance] - """ - return list(self.stream( - log=log, - message_date_before=message_date_before, - message_date=message_date, - message_date_after=message_date_after, - limit=limit, - page_size=page_size, - )) - - def page(self, log=values.unset, message_date_before=values.unset, - message_date=values.unset, message_date_after=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of NotificationInstance records from the API. - Request is executed immediately - - :param unicode log: Filter by log level - :param date message_date_before: Filter by date - :param date message_date: Filter by date - :param date message_date_after: Filter by date - :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 NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationPage - """ - data = values.of({ - 'Log': log, - 'MessageDate<': serialize.iso8601_date(message_date_before), - 'MessageDate': serialize.iso8601_date(message_date), - 'MessageDate>': serialize.iso8601_date(message_date_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return NotificationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NotificationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NotificationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a NotificationContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ - return NotificationContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - def __call__(self, sid): - """ - Constructs a NotificationContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ - return NotificationContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NotificationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.notification.NotificationPage - :rtype: twilio.rest.api.v2010.account.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NotificationInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.api.v2010.account.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ - return NotificationInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class NotificationContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the NotificationContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.notification.NotificationContext - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ - super(NotificationContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(NotificationContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Notifications/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the NotificationInstance - - :returns: The fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return NotificationInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Notifications/${sid}.json' + + + def fetch(self): + + """ + Fetch the NotificationInstance + + :returns: The fetched NotificationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NotificationInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NotificationInstance(InstanceResource): - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.api.v2010.account.notification.NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ +class NotificationInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'call_sid': payload.get('call_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'error_code': payload.get('error_code'), - 'log': payload.get('log'), - 'message_date': deserialize.rfc2822_datetime(payload.get('message_date')), - 'message_text': payload.get('message_text'), - 'more_info': payload.get('more_info'), - 'request_method': payload.get('request_method'), - 'request_url': payload.get('request_url'), - 'request_variables': payload.get('request_variables'), - 'response_body': payload.get('response_body'), - 'response_headers': payload.get('response_headers'), - 'sid': payload.get('sid'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'call_sid' = payload.get('call_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'error_code' = payload.get('error_code'), + 'log' = payload.get('log'), + 'message_date' = payload.get('message_date'), + 'message_text' = payload.get('message_text'), + 'more_info' = payload.get('more_info'), + 'request_method' = payload.get('request_method'), + 'request_url' = payload.get('request_url'), + 'request_variables' = payload.get('request_variables'), + 'response_body' = payload.get('response_body'), + 'response_headers' = payload.get('response_headers'), + 'sid' = payload.get('sid'), + 'uri' = payload.get('uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NotificationContext for this NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationContext - """ if self._context is None: self._context = NotificationContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to generate the notification - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def error_code(self): - """ - :returns: A unique error code corresponding to the notification - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def log(self): - """ - :returns: An integer log level - :rtype: unicode - """ - return self._properties['log'] - - @property - def message_date(self): - """ - :returns: The date the notification was generated - :rtype: datetime - """ - return self._properties['message_date'] - - @property - def message_text(self): - """ - :returns: The text of the notification - :rtype: unicode - """ - return self._properties['message_text'] - - @property - def more_info(self): - """ - :returns: A URL for more information about the error code - :rtype: unicode - """ - return self._properties['more_info'] - - @property - def request_method(self): - """ - :returns: HTTP method used with the request url - :rtype: unicode - """ - return self._properties['request_method'] - - @property - def request_url(self): - """ - :returns: URL of the resource that generated the notification - :rtype: unicode - """ - return self._properties['request_url'] - - @property - def request_variables(self): + def __repr__(self): """ - :returns: Twilio-generated HTTP variables sent to the server - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['request_variables'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def response_body(self): - """ - :returns: The HTTP body returned by your server - :rtype: unicode - """ - return self._properties['response_body'] - @property - def response_headers(self): - """ - :returns: The HTTP headers returned by your server - :rtype: unicode - """ - return self._properties['response_headers'] - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] +class NotificationListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(NotificationListInstanceList, self).__init__(version) - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Notifications.json' + + + def page(self, log, message_date, message_date, message_date, page_size): + + data = values.of({ + 'log': log,'message_date': message_date,'message_date': message_date,'message_date': message_date,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the NotificationInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched NotificationInstance - :rtype: twilio.rest.api.v2010.account.notification.NotificationInstance - """ - return self._proxy.fetch() + return NotificationPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/outgoing_caller_id.py b/twilio/rest/api/v2010/account/outgoing_caller_id.py index fd7fb74f97..5ef6238e36 100644 --- a/twilio/rest/api/v2010/account/outgoing_caller_id.py +++ b/twilio/rest/api/v2010/account/outgoing_caller_id.py @@ -1,418 +1,156 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class OutgoingCallerIdList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the OutgoingCallerIdList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - super(OutgoingCallerIdList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/OutgoingCallerIds.json'.format(**self._solution) - - def stream(self, phone_number=values.unset, friendly_name=values.unset, - limit=None, page_size=None): - """ - Streams OutgoingCallerIdInstance 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 phone_number: The phone number of the OutgoingCallerId resources to read - :param unicode friendly_name: The string that identifies the OutgoingCallerId resources to read - :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.outgoing_caller_id.OutgoingCallerIdInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - phone_number=phone_number, - friendly_name=friendly_name, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, phone_number=values.unset, friendly_name=values.unset, - limit=None, page_size=None): - """ - Lists OutgoingCallerIdInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode phone_number: The phone number of the OutgoingCallerId resources to read - :param unicode friendly_name: The string that identifies the OutgoingCallerId resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.outgoing_caller_id.OutgoingCallerIdInstance] - """ - return list(self.stream( - phone_number=phone_number, - friendly_name=friendly_name, - limit=limit, - page_size=page_size, - )) - - def page(self, phone_number=values.unset, friendly_name=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of OutgoingCallerIdInstance records from the API. - Request is executed immediately - - :param unicode phone_number: The phone number of the OutgoingCallerId resources to read - :param unicode friendly_name: The string that identifies the OutgoingCallerId resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return OutgoingCallerIdPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of OutgoingCallerIdInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return OutgoingCallerIdPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a OutgoingCallerIdContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ - return OutgoingCallerIdContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a OutgoingCallerIdContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ - return OutgoingCallerIdContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class OutgoingCallerIdPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the OutgoingCallerIdPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdPage - """ - super(OutgoingCallerIdPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of OutgoingCallerIdInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - return OutgoingCallerIdInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class OutgoingCallerIdContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the OutgoingCallerIdContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ - super(OutgoingCallerIdContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(OutgoingCallerIdContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/OutgoingCallerIds/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the OutgoingCallerIdInstance - - :returns: The fetched OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return OutgoingCallerIdInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the OutgoingCallerIdInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The updated OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return OutgoingCallerIdInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/OutgoingCallerIds/${sid}.json' + + + def delete(self): + + + """ + Deletes the OutgoingCallerIdInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the OutgoingCallerIdInstance + + :returns: The fetched OutgoingCallerIdInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return OutgoingCallerIdInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the OutgoingCallerIdInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return OutgoingCallerIdInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class OutgoingCallerIdInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the OutgoingCallerIdInstance - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ +class OutgoingCallerIdInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(OutgoingCallerIdInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'account_sid': payload.get('account_sid'), - 'phone_number': payload.get('phone_number'), - 'uri': payload.get('uri'), + self._properties = { + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'account_sid' = payload.get('account_sid'), + 'phone_number' = payload.get('phone_number'), + 'uri' = payload.get('uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: OutgoingCallerIdContext for this OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdContext - """ if self._context is None: self._context = OutgoingCallerIdContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] + - @property - def uri(self): + def __repr__(self): """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['uri'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the OutgoingCallerIdInstance - :returns: The fetched OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - return self._proxy.fetch() - def update(self, friendly_name=values.unset): - """ - Update the OutgoingCallerIdInstance +class OutgoingCallerIdListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(OutgoingCallerIdListInstanceList, self).__init__(version) - :param unicode friendly_name: A string to describe the resource + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/OutgoingCallerIds.json' + + + def page(self, phone_number, friendly_name, page_size): + + data = values.of({ + 'phone_number': phone_number,'friendly_name': friendly_name,'page_size': page_size, + }) - :returns: The updated OutgoingCallerIdInstance - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) + payload = self._version.create(method='get', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the OutgoingCallerIdInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return OutgoingCallerIdPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/queue.py b/twilio/rest/api/v2010/account/queue.py new file mode 100644 index 0000000000..98242b84f5 --- /dev/null +++ b/twilio/rest/api/v2010/account/queue.py @@ -0,0 +1,172 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.queue.member import MemberListInstance + + +class QueueContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(QueueContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Queues/${sid}.json' + + self._members = None + + def delete(self): + + + """ + Deletes the QueueInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the QueueInstance + + :returns: The fetched QueueInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return QueueInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class QueueInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(QueueInstance, self).__init__(version) + self._properties = { + 'date_updated' = payload.get('date_updated'), + 'current_size' = payload.get('current_size'), + 'friendly_name' = payload.get('friendly_name'), + 'uri' = payload.get('uri'), + 'account_sid' = payload.get('account_sid'), + 'average_wait_time' = payload.get('average_wait_time'), + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'max_size' = payload.get('max_size'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = QueueContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def members(self): + return self._proxy.members + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class QueueListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(QueueListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Queues.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return QueueInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return QueuePage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/queue/member.py b/twilio/rest/api/v2010/account/queue/member.py index 39504eab28..180f76eea5 100644 --- a/twilio/rest/api/v2010/account/queue/member.py +++ b/twilio/rest/api/v2010/account/queue/member.py @@ -1,394 +1,144 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MemberList(ListResource): - - def __init__(self, version, account_sid, queue_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - :param queue_sid: The SID of the Queue the member is in - - :returns: twilio.rest.api.v2010.account.queue.member.MemberList - :rtype: twilio.rest.api.v2010.account.queue.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'queue_sid': queue_sid, } - self._uri = '/Accounts/{account_sid}/Queues/{queue_sid}/Members.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams MemberInstance 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 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.queue.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.queue.member.MemberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :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 MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, call_sid): - """ - Constructs a MemberContext - - :param call_sid: The Call SID of the resource(s) to fetch - - :returns: twilio.rest.api.v2010.account.queue.member.MemberContext - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ - return MemberContext( - self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=call_sid, - ) - - def __call__(self, call_sid): - """ - Constructs a MemberContext - - :param call_sid: The Call SID of the resource(s) to fetch - - :returns: twilio.rest.api.v2010.account.queue.member.MemberContext - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ - return MemberContext( - self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=call_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MemberPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - :param queue_sid: The SID of the Queue the member is in - - :returns: twilio.rest.api.v2010.account.queue.member.MemberPage - :rtype: twilio.rest.api.v2010.account.queue.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MemberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.queue.member.MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class MemberContext(InstanceContext): - - def __init__(self, version, account_sid, queue_sid, call_sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource(s) to fetch - :param queue_sid: The SID of the Queue in which to find the members - :param call_sid: The Call SID of the resource(s) to fetch - - :returns: twilio.rest.api.v2010.account.queue.member.MemberContext - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ - super(MemberContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, queue_sid: str, call_sid: str): + # TODO: needs autogenerated docs + super(MemberContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'queue_sid': queue_sid, 'call_sid': call_sid, } - self._uri = '/Accounts/{account_sid}/Queues/{queue_sid}/Members/{call_sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the MemberInstance - - :returns: The fetched MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MemberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=self._solution['call_sid'], - ) - - def update(self, url, method=values.unset): - """ - Update the MemberInstance - - :param unicode url: The absolute URL of the Queue resource - :param unicode method: How to pass the update request data - - :returns: The updated MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - data = values.of({'Url': url, 'Method': method, }) + self._solution = { account_sid, queue_sid, call_sid, } + self._uri = '/Accounts/${account_sid}/Queues/${queue_sid}/Members/${call_sid}.json' + + + def fetch(self): + + """ + Fetch the MemberInstance + + :returns: The fetched MemberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MemberInstance( + self._version, + payload, + account_sidqueue_sidcall_sid=self._solution['account_sid''queue_sid''call_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return MemberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=self._solution['call_sid'], - ) + return MemberInstance(self._version, payload, account_sid=self._solution['account_sid'], queue_sid=self._solution['queue_sid'], call_sid=self._solution['call_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class MemberInstance(InstanceResource): - def __init__(self, version, payload, account_sid, queue_sid, call_sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.api.v2010.account.queue.member.MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ +class MemberInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, queue_sid: str, call_sid: str): super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'call_sid': payload.get('call_sid'), - 'date_enqueued': deserialize.rfc2822_datetime(payload.get('date_enqueued')), - 'position': deserialize.integer(payload.get('position')), - 'uri': payload.get('uri'), - 'wait_time': deserialize.integer(payload.get('wait_time')), - 'queue_sid': payload.get('queue_sid'), + self._properties = { + 'call_sid' = payload.get('call_sid'), + 'date_enqueued' = payload.get('date_enqueued'), + 'position' = payload.get('position'), + 'uri' = payload.get('uri'), + 'wait_time' = payload.get('wait_time'), + 'queue_sid' = payload.get('queue_sid'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'queue_sid': queue_sid, - 'call_sid': call_sid or self._properties['call_sid'], + 'account_sid': account_sid or self._properties['account_sid']'queue_sid': queue_sid or self._properties['queue_sid']'call_sid': call_sid or self._properties['call_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberContext - """ if self._context is None: self._context = MemberContext( self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['queue_sid'], - call_sid=self._solution['call_sid'], + account_sid=self._solution['account_sid'],queue_sid=self._solution['queue_sid'],call_sid=self._solution['call_sid'], ) return self._context - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] + - @property - def date_enqueued(self): - """ - :returns: The date the member was enqueued - :rtype: datetime - """ - return self._properties['date_enqueued'] - - @property - def position(self): - """ - :returns: This member's current position in the queue. - :rtype: unicode - """ - return self._properties['position'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def wait_time(self): + def __repr__(self): """ - :returns: The number of seconds the member has been in the queue. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['wait_time'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def queue_sid(self): - """ - :returns: The SID of the Queue the member is in - :rtype: unicode - """ - return self._properties['queue_sid'] - def fetch(self): - """ - Fetch the MemberInstance - :returns: The fetched MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - return self._proxy.fetch() +class MemberListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, queue_sid: str): + # TODO: needs autogenerated docs + super(MemberListInstanceList, self).__init__(version) - def update(self, url, method=values.unset): - """ - Update the MemberInstance + # Path Solution + self._solution = { account_sid, queue_sid, } + self._uri = '/Accounts/${account_sid}/Queues/${queue_sid}/Members.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param unicode url: The absolute URL of the Queue resource - :param unicode method: How to pass the update request data + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated MemberInstance - :rtype: twilio.rest.api.v2010.account.queue.member.MemberInstance - """ - return self._proxy.update(url, method=method, ) + return MemberPage(self._version, payload, account_sid=self._solution['account_sid']queue_sid=self._solution['queue_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/recording.py b/twilio/rest/api/v2010/account/recording.py new file mode 100644 index 0000000000..b8aa1998d6 --- /dev/null +++ b/twilio/rest/api/v2010/account/recording.py @@ -0,0 +1,165 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.recording.add_on_result import AddOnResultListInstancefrom twilio.rest.recording.transcription import TranscriptionListInstance + + +class RecordingContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RecordingContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${sid}.json' + + self._add_on_results = None + self._transcriptions = None + + def delete(self): + + + """ + Deletes the RecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self, include_soft_deleted): + + """ + Fetch the RecordingInstance + + :returns: The fetched RecordingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RecordingInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RecordingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(RecordingInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'call_sid' = payload.get('call_sid'), + 'conference_sid' = payload.get('conference_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'start_time' = payload.get('start_time'), + 'duration' = payload.get('duration'), + 'sid' = payload.get('sid'), + 'price' = payload.get('price'), + 'price_unit' = payload.get('price_unit'), + 'status' = payload.get('status'), + 'channels' = payload.get('channels'), + 'source' = payload.get('source'), + 'error_code' = payload.get('error_code'), + 'uri' = payload.get('uri'), + 'encryption_details' = payload.get('encryption_details'), + 'subresource_uris' = payload.get('subresource_uris'), + 'media_url' = payload.get('media_url'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RecordingContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def add_on_results(self): + return self._proxy.add_on_results + @property + def transcriptions(self): + return self._proxy.transcriptions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RecordingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(RecordingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Recordings.json' + + + def page(self, date_created, date_created, date_created, call_sid, conference_sid, include_soft_deleted, page_size): + + data = values.of({ + 'date_created': date_created,'date_created': date_created,'date_created': date_created,'call_sid': call_sid,'conference_sid': conference_sid,'include_soft_deleted': include_soft_deleted,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RecordingPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/recording/add_on_result.py b/twilio/rest/api/v2010/account/recording/add_on_result.py new file mode 100644 index 0000000000..5f015e2b5b --- /dev/null +++ b/twilio/rest/api/v2010/account/recording/add_on_result.py @@ -0,0 +1,152 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.add_on_result.payload import PayloadListInstance + + +class AddOnResultContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, reference_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AddOnResultContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, reference_sid, sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults/${sid}.json' + + self._payloads = None + + def delete(self): + + + """ + Deletes the AddOnResultInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AddOnResultInstance + + :returns: The fetched AddOnResultInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AddOnResultInstance( + self._version, + payload, + account_sidreference_sidsid=self._solution['account_sid''reference_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AddOnResultInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, reference_sid: str, sid: str): + super(AddOnResultInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'status' = payload.get('status'), + 'add_on_sid' = payload.get('add_on_sid'), + 'add_on_configuration_sid' = payload.get('add_on_configuration_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'date_completed' = payload.get('date_completed'), + 'reference_sid' = payload.get('reference_sid'), + 'subresource_uris' = payload.get('subresource_uris'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'reference_sid': reference_sid or self._properties['reference_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AddOnResultContext( + self._version, + account_sid=self._solution['account_sid'],reference_sid=self._solution['reference_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def payloads(self): + return self._proxy.payloads + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AddOnResultListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, reference_sid: str): + # TODO: needs autogenerated docs + super(AddOnResultListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, reference_sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AddOnResultPage(self._version, payload, account_sid=self._solution['account_sid']reference_sid=self._solution['reference_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload.py new file mode 100644 index 0000000000..728047cb73 --- /dev/null +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload.py @@ -0,0 +1,149 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class PayloadContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, reference_sid: str, add_on_result_sid: str, sid: str): + # TODO: needs autogenerated docs + super(PayloadContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, reference_sid, add_on_result_sid, sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults/${add_on_result_sid}/Payloads/${sid}.json' + + + def delete(self): + + + """ + Deletes the PayloadInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the PayloadInstance + + :returns: The fetched PayloadInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PayloadInstance( + self._version, + payload, + account_sidreference_sidadd_on_result_sidsid=self._solution['account_sid''reference_sid''add_on_result_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class PayloadInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, reference_sid: str, add_on_result_sid: str, sid: str): + super(PayloadInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'add_on_result_sid' = payload.get('add_on_result_sid'), + 'account_sid' = payload.get('account_sid'), + 'label' = payload.get('label'), + 'add_on_sid' = payload.get('add_on_sid'), + 'add_on_configuration_sid' = payload.get('add_on_configuration_sid'), + 'content_type' = payload.get('content_type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'reference_sid' = payload.get('reference_sid'), + 'subresource_uris' = payload.get('subresource_uris'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'reference_sid': reference_sid or self._properties['reference_sid']'add_on_result_sid': add_on_result_sid or self._properties['add_on_result_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = PayloadContext( + self._version, + account_sid=self._solution['account_sid'],reference_sid=self._solution['reference_sid'],add_on_result_sid=self._solution['add_on_result_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class PayloadListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, reference_sid: str, add_on_result_sid: str): + # TODO: needs autogenerated docs + super(PayloadListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, reference_sid, add_on_result_sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults/${add_on_result_sid}/Payloads.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PayloadPage(self._version, payload, account_sid=self._solution['account_sid']reference_sid=self._solution['reference_sid']add_on_result_sid=self._solution['add_on_result_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/recording/transcription.py b/twilio/rest/api/v2010/account/recording/transcription.py index 6f96d0db65..4904d74928 100644 --- a/twilio/rest/api/v2010/account/recording/transcription.py +++ b/twilio/rest/api/v2010/account/recording/transcription.py @@ -1,446 +1,151 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TranscriptionList(ListResource): - - def __init__(self, version, account_sid, recording_sid): - """ - Initialize the TranscriptionList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param recording_sid: The SID that identifies the transcription's recording - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - """ - super(TranscriptionList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'recording_sid': recording_sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{recording_sid}/Transcriptions.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TranscriptionInstance 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 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.recording.transcription.TranscriptionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TranscriptionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.recording.transcription.TranscriptionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TranscriptionInstance records from the API. - Request is executed immediately - - :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 TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TranscriptionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TranscriptionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TranscriptionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: The unique string that identifies the resource - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ - return TranscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ - return TranscriptionContext( - self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TranscriptionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TranscriptionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param recording_sid: The SID that identifies the transcription's recording - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionPage - """ - super(TranscriptionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TranscriptionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ - return TranscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class TranscriptionContext(InstanceContext): - - def __init__(self, version, account_sid, recording_sid, sid): - """ - Initialize the TranscriptionContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param recording_sid: The SID of the recording that created the transcriptions to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ - super(TranscriptionContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, recording_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TranscriptionContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'recording_sid': recording_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{recording_sid}/Transcriptions/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the TranscriptionInstance - - :returns: The fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TranscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TranscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { account_sid, recording_sid, sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${recording_sid}/Transcriptions/${sid}.json' + + + def delete(self): + + + """ + Deletes the TranscriptionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TranscriptionInstance + + :returns: The fetched TranscriptionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TranscriptionInstance( + self._version, + payload, + account_sidrecording_sidsid=self._solution['account_sid''recording_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TranscriptionInstance(InstanceResource): - class Status(object): - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - - def __init__(self, version, payload, account_sid, recording_sid, sid=None): - """ - Initialize the TranscriptionInstance - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ +class TranscriptionInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, recording_sid: str, sid: str): super(TranscriptionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'duration': payload.get('duration'), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'recording_sid': payload.get('recording_sid'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'transcription_text': payload.get('transcription_text'), - 'type': payload.get('type'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'duration' = payload.get('duration'), + 'price' = payload.get('price'), + 'price_unit' = payload.get('price_unit'), + 'recording_sid' = payload.get('recording_sid'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'transcription_text' = payload.get('transcription_text'), + 'type' = payload.get('type'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'recording_sid': recording_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'recording_sid': recording_sid or self._properties['recording_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TranscriptionContext for this TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionContext - """ if self._context is None: self._context = TranscriptionContext( self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['recording_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],recording_sid=self._solution['recording_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def api_version(self): - """ - :returns: The API version used to create the transcription - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def duration(self): - """ - :returns: The duration of the transcribed audio in seconds. - :rtype: unicode - """ - return self._properties['duration'] - - @property - def price(self): - """ - :returns: The charge for the transcription - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which price is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def recording_sid(self): - """ - :returns: The SID that identifies the transcription's recording - :rtype: unicode - """ - return self._properties['recording_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the transcription - :rtype: TranscriptionInstance.Status - """ - return self._properties['status'] - - @property - def transcription_text(self): + def __repr__(self): """ - :returns: The text content of the transcription. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['transcription_text'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def type(self): - """ - :returns: The transcription type - :rtype: unicode - """ - return self._properties['type'] - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - def fetch(self): - """ - Fetch the TranscriptionInstance +class TranscriptionListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, recording_sid: str): + # TODO: needs autogenerated docs + super(TranscriptionListInstanceList, self).__init__(version) - :returns: The fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { account_sid, recording_sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${recording_sid}/Transcriptions.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def delete(self): - """ - Deletes the TranscriptionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return TranscriptionPage(self._version, payload, account_sid=self._solution['account_sid']recording_sid=self._solution['recording_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/short_code.py b/twilio/rest/api/v2010/account/short_code.py index d78b53f6b2..bb96750b18 100644 --- a/twilio/rest/api/v2010/account/short_code.py +++ b/twilio/rest/api/v2010/account/short_code.py @@ -1,469 +1,150 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ShortCodeList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the ShortCodeList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeList - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - super(ShortCodeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SMS/ShortCodes.json'.format(**self._solution) - - def stream(self, friendly_name=values.unset, short_code=values.unset, - limit=None, page_size=None): - """ - Streams ShortCodeInstance 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 friendly_name: The string that identifies the ShortCode resources to read - :param unicode short_code: Filter by ShortCode - :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.short_code.ShortCodeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, short_code=short_code, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, short_code=values.unset, limit=None, - page_size=None): - """ - Lists ShortCodeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The string that identifies the ShortCode resources to read - :param unicode short_code: Filter by ShortCode - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.short_code.ShortCodeInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - short_code=short_code, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, short_code=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ShortCodeInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The string that identifies the ShortCode resources to read - :param unicode short_code: Filter by ShortCode - :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 ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ShortCode': short_code, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ShortCodePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ShortCodeContext - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ShortCodePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ShortCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodePage - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage - """ - super(ShortCodePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ShortCodeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - return ShortCodeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ShortCodeContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the ShortCodeContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource(s) to fetch - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ - super(ShortCodeContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ShortCodeContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SMS/ShortCodes/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the ShortCodeInstance - - :returns: The fetched ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ShortCodeInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, api_version=values.unset, - sms_url=values.unset, sms_method=values.unset, - sms_fallback_url=values.unset, sms_fallback_method=values.unset): - """ - Update the ShortCodeInstance - - :param unicode friendly_name: A string to describe this resource - :param unicode api_version: The API version to use to start a new TwiML session - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode sms_method: HTTP method to use when requesting the sms url - :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode sms_fallback_method: HTTP method Twilio will use with sms_fallback_url - - :returns: The updated ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ApiVersion': api_version, - 'SmsUrl': sms_url, - 'SmsMethod': sms_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsFallbackMethod': sms_fallback_method, - }) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/SMS/ShortCodes/${sid}.json' + + + def fetch(self): + + """ + Fetch the ShortCodeInstance + + :returns: The fetched ShortCodeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ShortCodeInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ShortCodeInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return ShortCodeInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ShortCodeInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ShortCodeInstance - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ +class ShortCodeInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(ShortCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'short_code': payload.get('short_code'), - 'sid': payload.get('sid'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'short_code' = payload.get('short_code'), + 'sid' = payload.get('sid'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'uri' = payload.get('uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ShortCodeContext for this ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext - """ if self._context is None: self._context = ShortCodeContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A string that you assigned to describe this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def short_code(self): - """ - :returns: The short code. e.g., 894546. - :rtype: unicode - """ - return self._properties['short_code'] + - @property - def sid(self): - """ - :returns: The unique string that identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_fallback_method(self): - """ - :returns: HTTP method we use to call the sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: URL Twilio will request if an error occurs in executing TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: HTTP method to use when requesting the sms url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): + def __repr__(self): """ - :returns: URL we call when receiving an incoming SMS message to this short code - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['sms_url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def uri(self): - """ - :returns: The URI of this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - def fetch(self): - """ - Fetch the ShortCodeInstance - :returns: The fetched ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - return self._proxy.fetch() +class ShortCodeListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(ShortCodeListInstanceList, self).__init__(version) - def update(self, friendly_name=values.unset, api_version=values.unset, - sms_url=values.unset, sms_method=values.unset, - sms_fallback_url=values.unset, sms_fallback_method=values.unset): - """ - Update the ShortCodeInstance + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/SMS/ShortCodes.json' + + + def page(self, friendly_name, short_code, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'short_code': short_code,'page_size': page_size, + }) - :param unicode friendly_name: A string to describe this resource - :param unicode api_version: The API version to use to start a new TwiML session - :param unicode sms_url: URL Twilio will request when receiving an SMS - :param unicode sms_method: HTTP method to use when requesting the sms url - :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML - :param unicode sms_fallback_method: HTTP method Twilio will use with sms_fallback_url + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated ShortCodeInstance - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - api_version=api_version, - sms_url=sms_url, - sms_method=sms_method, - sms_fallback_url=sms_fallback_url, - sms_fallback_method=sms_fallback_method, - ) + return ShortCodePage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/signing_key.py b/twilio/rest/api/v2010/account/signing_key.py index c0baa5cd40..46b286eb0c 100644 --- a/twilio/rest/api/v2010/account/signing_key.py +++ b/twilio/rest/api/v2010/account/signing_key.py @@ -1,367 +1,153 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SigningKeyList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the SigningKeyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyList - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - super(SigningKeyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SigningKeys.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SigningKeyInstance 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 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.signing_key.SigningKeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SigningKeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.signing_key.SigningKeyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SigningKeyInstance records from the API. - Request is executed immediately - - :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 SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SigningKeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SigningKeyInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SigningKeyPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SigningKeyContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ - return SigningKeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SigningKeyContext - - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ - return SigningKeyContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SigningKeyPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SigningKeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyPage - """ - super(SigningKeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SigningKeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - return SigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class SigningKeyContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the SigningKeyContext - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param sid: The sid - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ - super(SigningKeyContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SigningKeyContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SigningKeys/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the SigningKeyInstance - - :returns: The fetched SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SigningKeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the SigningKeyInstance - - :param unicode friendly_name: The friendly_name - - :returns: The updated SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/SigningKeys/${sid}.json' + + + def delete(self): + + + """ + Deletes the SigningKeyInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SigningKeyInstance + + :returns: The fetched SigningKeyInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SigningKeyInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - return SigningKeyInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the SigningKeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return SigningKeyInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SigningKeyInstance(InstanceResource): - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the SigningKeyInstance - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ +class SigningKeyInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(SigningKeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SigningKeyContext for this SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyContext - """ if self._context is None: self._context = SigningKeyContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime + def __repr__(self): """ - return self._properties['date_updated'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the SigningKeyInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - return self._proxy.fetch() - def update(self, friendly_name=values.unset): - """ - Update the SigningKeyInstance - :param unicode friendly_name: The friendly_name +class SigningKeyListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(SigningKeyListInstanceList, self).__init__(version) - :returns: The updated SigningKeyInstance - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/SigningKeys.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def delete(self): - """ - Deletes the SigningKeyInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return SigningKeyPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/sip.py b/twilio/rest/api/v2010/account/sip.py new file mode 100644 index 0000000000..d50d303e8f --- /dev/null +++ b/twilio/rest/api/v2010/account/sip.py @@ -0,0 +1,49 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.sip.credential_list import CredentialListListInstancefrom twilio.rest.sip.domain import DomainListInstancefrom twilio.rest.sip.ip_access_control_list import IpAccessControlListListInstance + + + + +class SipListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(SipListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/SIP.json' + + self._credential_lists = None + self._domains = None + self._ip_access_control_lists = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/credential_list.py b/twilio/rest/api/v2010/account/sip/credential_list.py new file mode 100644 index 0000000000..20e085af04 --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/credential_list.py @@ -0,0 +1,170 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.credential_list.credential import CredentialListInstance + + +class CredentialListContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CredentialListContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/CredentialLists/${sid}.json' + + self._credentials = None + + def delete(self): + + + """ + Deletes the CredentialListInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialListInstance + + :returns: The fetched CredentialListInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialListInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CredentialListInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(CredentialListInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'subresource_uris' = payload.get('subresource_uris'), + 'uri' = payload.get('uri'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CredentialListContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def credentials(self): + return self._proxy.credentials + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CredentialListListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(CredentialListListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/SIP/CredentialLists.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialListPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/credential_list/credential.py b/twilio/rest/api/v2010/account/sip/credential_list/credential.py index ac7aba0557..3de893d71e 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -1,445 +1,166 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CredentialList(ListResource): - - def __init__(self, version, account_sid, credential_list_sid): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account that is responsible for this resource. - :param credential_list_sid: The unique id that identifies the credential list that includes this credential - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'credential_list_sid': credential_list_sid, } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists/{credential_list_sid}/Credentials.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance 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 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.sip.credential_list.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sip.credential_list.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :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 CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, username, password): - """ - Create the CredentialInstance - - :param unicode username: The username for this credential. - :param unicode password: The password will not be returned in the response. - - :returns: The created CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - data = values.of({'Username': username, 'Password': password, }) - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - ) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The unique id that identifies the resource to fetch. - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ - return CredentialContext( - self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The unique id that identifies the resource to fetch. - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ - return CredentialContext( - self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique id of the Account that is responsible for this resource. - :param credential_list_sid: The unique id that identifies the credential list that includes this credential - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class CredentialContext(InstanceContext): - - def __init__(self, version, account_sid, credential_list_sid, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account that is responsible for this resource. - :param credential_list_sid: The unique id that identifies the credential list that contains the desired credential - :param sid: The unique id that identifies the resource to fetch. - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, credential_list_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CredentialContextList, self).__init__(version) # Path Solution - self._solution = { - 'account_sid': account_sid, - 'credential_list_sid': credential_list_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists/{credential_list_sid}/Credentials/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=self._solution['sid'], - ) - - def update(self, password=values.unset): - """ - Update the CredentialInstance - - :param unicode password: The password will not be returned in the response - - :returns: The updated CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - data = values.of({'Password': password, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=self._solution['sid'], - ) + self._solution = { account_sid, credential_list_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/CredentialLists/${credential_list_sid}/Credentials/${sid}.json' + + + def delete(self): + + + """ + Deletes the CredentialInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialInstance + + :returns: The fetched CredentialInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialInstance( + self._version, + payload, + account_sidcredential_list_sidsid=self._solution['account_sid''credential_list_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the CredentialInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return CredentialInstance(self._version, payload, account_sid=self._solution['account_sid'], credential_list_sid=self._solution['credential_list_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CredentialInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, credential_list_sid, - sid=None): - """ - Initialize the CredentialInstance - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ +class CredentialInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, credential_list_sid: str, sid: str): super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'credential_list_sid': payload.get('credential_list_sid'), - 'username': payload.get('username'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'uri': payload.get('uri'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'credential_list_sid' = payload.get('credential_list_sid'), + 'username' = payload.get('username'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'credential_list_sid': credential_list_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'credential_list_sid': credential_list_sid or self._properties['credential_list_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialContext - """ if self._context is None: self._context = CredentialContext( self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['credential_list_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],credential_list_sid=self._solution['credential_list_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique id of the Account that is responsible for this resource. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def credential_list_sid(self): - """ - :returns: The unique id that identifies the credential list that includes this credential - :rtype: unicode - """ - return self._properties['credential_list_sid'] - - @property - def username(self): - """ - :returns: The username for this credential. - :rtype: unicode - """ - return self._properties['username'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def uri(self): - """ - :returns: The URI for this resource, relative to https://api.twilio.com - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, password=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the CredentialInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode password: The password will not be returned in the response - :returns: The updated CredentialInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialInstance - """ - return self._proxy.update(password=password, ) - def delete(self): - """ - Deletes the CredentialInstance +class CredentialListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, credential_list_sid: str): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, credential_list_sid, } + self._uri = '/Accounts/${account_sid}/SIP/CredentialLists/${credential_list_sid}/Credentials.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, account_sid=self._solution['account_sid']credential_list_sid=self._solution['credential_list_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialPage(self._version, payload, account_sid=self._solution['account_sid']credential_list_sid=self._solution['credential_list_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain.py b/twilio/rest/api/v2010/account/sip/domain.py new file mode 100644 index 0000000000..c082271bf5 --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/domain.py @@ -0,0 +1,192 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.domain.auth_types import AuthTypesListInstancefrom twilio.rest.domain.credential_list_mapping import CredentialListMappingListInstancefrom twilio.rest.domain.ip_access_control_list_mapping import IpAccessControlListMappingListInstance + + +class DomainContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DomainContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${sid}.json' + + self._auth = None + self._credential_list_mappings = None + self._ip_access_control_list_mappings = None + + def delete(self): + + + """ + Deletes the DomainInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DomainInstance + + :returns: The fetched DomainInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DomainInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class DomainInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(DomainInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'auth_type' = payload.get('auth_type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'domain_name' = payload.get('domain_name'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'uri' = payload.get('uri'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_status_callback_method' = payload.get('voice_status_callback_method'), + 'voice_status_callback_url' = payload.get('voice_status_callback_url'), + 'voice_url' = payload.get('voice_url'), + 'subresource_uris' = payload.get('subresource_uris'), + 'sip_registration' = payload.get('sip_registration'), + 'emergency_calling_enabled' = payload.get('emergency_calling_enabled'), + 'secure' = payload.get('secure'), + 'byoc_trunk_sid' = payload.get('byoc_trunk_sid'), + 'emergency_caller_sid' = payload.get('emergency_caller_sid'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = DomainContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def auth(self): + return self._proxy.auth + @property + def credential_list_mappings(self): + return self._proxy.credential_list_mappings + @property + def ip_access_control_list_mappings(self): + return self._proxy.ip_access_control_list_mappings + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class DomainListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(DomainListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DomainInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DomainPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types.py b/twilio/rest/api/v2010/account/sip/domain/auth_types.py new file mode 100644 index 0000000000..d27730b170 --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types.py @@ -0,0 +1,48 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.auth_types.auth_type_calls import AuthTypeCallsListInstancefrom twilio.rest.auth_types.auth_type_registrations import AuthTypeRegistrationsListInstance + + + + +class AuthTypesListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(AuthTypesListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth.json' + + self._calls = None + self._registrations = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.py new file mode 100644 index 0000000000..b57016304f --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.py @@ -0,0 +1,48 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.auth_type_calls.auth_calls_credential_list_mapping import AuthCallsCredentialListMappingListInstancefrom twilio.rest.auth_type_calls.auth_calls_ip_access_control_list_mapping import AuthCallsIpAccessControlListMappingListInstance + + + + +class AuthTypeCallsListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(AuthTypeCallsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Calls.json' + + self._credential_list_mappings = None + self._ip_access_control_list_mappings = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py new file mode 100644 index 0000000000..35072c5ea5 --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py @@ -0,0 +1,153 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class AuthCallsCredentialListMappingContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, domain_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AuthCallsCredentialListMappingContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Calls/CredentialListMappings/${sid}.json' + + + def delete(self): + + + """ + Deletes the AuthCallsCredentialListMappingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AuthCallsCredentialListMappingInstance + + :returns: The fetched AuthCallsCredentialListMappingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AuthCallsCredentialListMappingInstance( + self._version, + payload, + account_siddomain_sidsid=self._solution['account_sid''domain_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AuthCallsCredentialListMappingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, domain_sid: str, sid: str): + super(AuthCallsCredentialListMappingInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'domain_sid': domain_sid or self._properties['domain_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AuthCallsCredentialListMappingContext( + self._version, + account_sid=self._solution['account_sid'],domain_sid=self._solution['domain_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AuthCallsCredentialListMappingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(AuthCallsCredentialListMappingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Calls/CredentialListMappings.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AuthCallsCredentialListMappingInstance(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AuthCallsCredentialListMappingPage(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py new file mode 100644 index 0000000000..34c57efddc --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py @@ -0,0 +1,153 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class AuthCallsIpAccessControlListMappingContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, domain_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AuthCallsIpAccessControlListMappingContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Calls/IpAccessControlListMappings/${sid}.json' + + + def delete(self): + + + """ + Deletes the AuthCallsIpAccessControlListMappingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AuthCallsIpAccessControlListMappingInstance + + :returns: The fetched AuthCallsIpAccessControlListMappingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AuthCallsIpAccessControlListMappingInstance( + self._version, + payload, + account_siddomain_sidsid=self._solution['account_sid''domain_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AuthCallsIpAccessControlListMappingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, domain_sid: str, sid: str): + super(AuthCallsIpAccessControlListMappingInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'domain_sid': domain_sid or self._properties['domain_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AuthCallsIpAccessControlListMappingContext( + self._version, + account_sid=self._solution['account_sid'],domain_sid=self._solution['domain_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AuthCallsIpAccessControlListMappingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(AuthCallsIpAccessControlListMappingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Calls/IpAccessControlListMappings.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AuthCallsIpAccessControlListMappingInstance(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AuthCallsIpAccessControlListMappingPage(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.py new file mode 100644 index 0000000000..a7d1cdbdd2 --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.py @@ -0,0 +1,47 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.auth_type_registrations.auth_registrations_credential_list_mapping import AuthRegistrationsCredentialListMappingListInstance + + + + +class AuthTypeRegistrationsListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(AuthTypeRegistrationsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Registrations.json' + + self._credential_list_mappings = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py new file mode 100644 index 0000000000..a3488c3b2a --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py @@ -0,0 +1,153 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class AuthRegistrationsCredentialListMappingContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, domain_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AuthRegistrationsCredentialListMappingContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Registrations/CredentialListMappings/${sid}.json' + + + def delete(self): + + + """ + Deletes the AuthRegistrationsCredentialListMappingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AuthRegistrationsCredentialListMappingInstance + + :returns: The fetched AuthRegistrationsCredentialListMappingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AuthRegistrationsCredentialListMappingInstance( + self._version, + payload, + account_siddomain_sidsid=self._solution['account_sid''domain_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AuthRegistrationsCredentialListMappingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, domain_sid: str, sid: str): + super(AuthRegistrationsCredentialListMappingInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'domain_sid': domain_sid or self._properties['domain_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AuthRegistrationsCredentialListMappingContext( + self._version, + account_sid=self._solution['account_sid'],domain_sid=self._solution['domain_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AuthRegistrationsCredentialListMappingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(AuthRegistrationsCredentialListMappingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth/Registrations/CredentialListMappings.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AuthRegistrationsCredentialListMappingInstance(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AuthRegistrationsCredentialListMappingPage(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py index 74e3471bdc..86404925e6 100644 --- a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py @@ -1,407 +1,155 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CredentialListMappingList(ListResource): - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the CredentialListMappingList - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account that is responsible for this resource. - :param domain_sid: The unique string that identifies the SipDomain resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - """ - super(CredentialListMappingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/CredentialListMappings.json'.format(**self._solution) - - def create(self, credential_list_sid): - """ - Create the CredentialListMappingInstance - - :param unicode credential_list_sid: A string that identifies the CredentialList resource to map to the SIP domain - - :returns: The created CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - data = values.of({'CredentialListSid': credential_list_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialListMappingInstance 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 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.sip.domain.credential_list_mapping.CredentialListMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialListMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sip.domain.credential_list_mapping.CredentialListMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialListMappingInstance records from the API. - Request is executed immediately - - :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 CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialListMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialListMappingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialListMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CredentialListMappingContext - - :param sid: A string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ - return CredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a CredentialListMappingContext - - :param sid: A string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ - return CredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialListMappingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CredentialListMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique id of the Account that is responsible for this resource. - :param domain_sid: The unique string that identifies the SipDomain resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingPage - """ - super(CredentialListMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialListMappingInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - return CredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CredentialListMappingContext(InstanceContext): - - def __init__(self, version, account_sid, domain_sid, sid): - """ - Initialize the CredentialListMappingContext - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param domain_sid: A string that identifies the SIP Domain that includes the resource to fetch - :param sid: A string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ - super(CredentialListMappingContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, domain_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CredentialListMappingContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/CredentialListMappings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the CredentialListMappingInstance - - :returns: The fetched CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CredentialListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { account_sid, domain_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/CredentialListMappings/${sid}.json' + + + def delete(self): + + + """ + Deletes the CredentialListMappingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialListMappingInstance + + :returns: The fetched CredentialListMappingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialListMappingInstance( + self._version, + payload, + account_siddomain_sidsid=self._solution['account_sid''domain_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CredentialListMappingInstance(InstanceResource): - def __init__(self, version, payload, account_sid, domain_sid, sid=None): - """ - Initialize the CredentialListMappingInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ +class CredentialListMappingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, domain_sid: str, sid: str): super(CredentialListMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'domain_sid': payload.get('domain_sid'), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'domain_sid' = payload.get('domain_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'domain_sid': domain_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'domain_sid': domain_sid or self._properties['domain_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialListMappingContext for this CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingContext - """ if self._context is None: self._context = CredentialListMappingContext( self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],domain_sid=self._solution['domain_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique id of the Account that is responsible for this resource. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def domain_sid(self): - """ - :returns: The unique string that identifies the SipDomain resource. - :rtype: unicode - """ - return self._properties['domain_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable descriptive text for this resource, up to 64 characters long. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): + def __repr__(self): """ - :returns: The URI for this resource, relative to https://api.twilio.com - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['uri'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the CredentialListMappingInstance - :returns: The fetched CredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the CredentialListMappingInstance +class CredentialListMappingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(CredentialListMappingListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/CredentialListMappings.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialListMappingInstance(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialListMappingPage(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py index 0745a8c56f..bfd6b7a347 100644 --- a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py @@ -1,407 +1,155 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class IpAccessControlListMappingList(ListResource): - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the IpAccessControlListMappingList - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account that is responsible for this resource. - :param domain_sid: The unique string that identifies the SipDomain resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - """ - super(IpAccessControlListMappingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/IpAccessControlListMappings.json'.format(**self._solution) - - def create(self, ip_access_control_list_sid): - """ - Create the IpAccessControlListMappingInstance - - :param unicode ip_access_control_list_sid: The unique id of the IP access control list to map to the SIP domain - - :returns: The created IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - data = values.of({'IpAccessControlListSid': ip_access_control_list_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return IpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAccessControlListMappingInstance 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 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.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAccessControlListMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAccessControlListMappingInstance records from the API. - Request is executed immediately - - :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 IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return IpAccessControlListMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAccessControlListMappingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAccessControlListMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a IpAccessControlListMappingContext - - :param sid: A 34 character string that uniquely identifies the resource to fetch. - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ - return IpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a IpAccessControlListMappingContext - - :param sid: A 34 character string that uniquely identifies the resource to fetch. - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ - return IpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class IpAccessControlListMappingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the IpAccessControlListMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique id of the Account that is responsible for this resource. - :param domain_sid: The unique string that identifies the SipDomain resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingPage - """ - super(IpAccessControlListMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAccessControlListMappingInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - return IpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class IpAccessControlListMappingContext(InstanceContext): - - def __init__(self, version, account_sid, domain_sid, sid): - """ - Initialize the IpAccessControlListMappingContext - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account that is responsible for this resource. - :param domain_sid: A string that uniquely identifies the SIP Domain - :param sid: A 34 character string that uniquely identifies the resource to fetch. - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ - super(IpAccessControlListMappingContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, domain_sid: str, sid: str): + # TODO: needs autogenerated docs + super(IpAccessControlListMappingContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/IpAccessControlListMappings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the IpAccessControlListMappingInstance - - :returns: The fetched IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return IpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IpAccessControlListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { account_sid, domain_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/IpAccessControlListMappings/${sid}.json' + + + def delete(self): + + + """ + Deletes the IpAccessControlListMappingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the IpAccessControlListMappingInstance + + :returns: The fetched IpAccessControlListMappingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return IpAccessControlListMappingInstance( + self._version, + payload, + account_siddomain_sidsid=self._solution['account_sid''domain_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class IpAccessControlListMappingInstance(InstanceResource): - def __init__(self, version, payload, account_sid, domain_sid, sid=None): - """ - Initialize the IpAccessControlListMappingInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ +class IpAccessControlListMappingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, domain_sid: str, sid: str): super(IpAccessControlListMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'domain_sid': payload.get('domain_sid'), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'domain_sid' = payload.get('domain_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'domain_sid': domain_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'domain_sid': domain_sid or self._properties['domain_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAccessControlListMappingContext for this IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingContext - """ if self._context is None: self._context = IpAccessControlListMappingContext( self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],domain_sid=self._solution['domain_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique id of the Account that is responsible for this resource. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def domain_sid(self): - """ - :returns: The unique string that identifies the SipDomain resource. - :rtype: unicode - """ - return self._properties['domain_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable descriptive text for this resource, up to 64 characters long. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): + def __repr__(self): """ - :returns: The URI for this resource, relative to https://api.twilio.com - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['uri'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the IpAccessControlListMappingInstance - :returns: The fetched IpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the IpAccessControlListMappingInstance +class IpAccessControlListMappingListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super(IpAccessControlListMappingListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/IpAccessControlListMappings.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IpAccessControlListMappingInstance(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IpAccessControlListMappingPage(self._version, payload, account_sid=self._solution['account_sid']domain_sid=self._solution['domain_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list.py new file mode 100644 index 0000000000..1d941d63b0 --- /dev/null +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list.py @@ -0,0 +1,170 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.ip_access_control_list.ip_address import IpAddressListInstance + + +class IpAccessControlListContext(InstanceContext): + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(IpAccessControlListContextList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists/${sid}.json' + + self._ip_addresses = None + + def delete(self): + + + """ + Deletes the IpAccessControlListInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the IpAccessControlListInstance + + :returns: The fetched IpAccessControlListInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return IpAccessControlListInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class IpAccessControlListInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super(IpAccessControlListInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'subresource_uris' = payload.get('subresource_uris'), + 'uri' = payload.get('uri'), + } + + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = IpAccessControlListContext( + self._version, + account_sid=self._solution['account_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def ip_addresses(self): + return self._proxy.ip_addresses + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class IpAccessControlListListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(IpAccessControlListListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IpAccessControlListPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py index 6c65c58870..fbce87e55c 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py @@ -1,485 +1,168 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class IpAddressList(ListResource): - - def __init__(self, version, account_sid, ip_access_control_list_sid): - """ - Initialize the IpAddressList - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account that is responsible for this resource. - :param ip_access_control_list_sid: The unique id of the IpAccessControlList resource that includes this resource. - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - """ - super(IpAddressList, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'ip_access_control_list_sid': ip_access_control_list_sid, - } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists/{ip_access_control_list_sid}/IpAddresses.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAddressInstance 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 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.sip.ip_access_control_list.ip_address.IpAddressInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAddressInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sip.ip_access_control_list.ip_address.IpAddressInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAddressInstance records from the API. - Request is executed immediately - - :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 IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return IpAddressPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAddressInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAddressPage(self._version, response, self._solution) - - def create(self, friendly_name, ip_address, cidr_prefix_length=values.unset): - """ - Create the IpAddressInstance - - :param unicode friendly_name: A human readable descriptive text for this resource, up to 255 characters long. - :param unicode ip_address: An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. - :param unicode cidr_prefix_length: An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. - :returns: The created IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'IpAddress': ip_address, - 'CidrPrefixLength': cidr_prefix_length, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - ) - - def get(self, sid): - """ - Constructs a IpAddressContext - - :param sid: A string that identifies the IpAddress resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ - return IpAddressContext( - self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a IpAddressContext - - :param sid: A string that identifies the IpAddress resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ - return IpAddressContext( - self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class IpAddressPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the IpAddressPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The unique id of the Account that is responsible for this resource. - :param ip_access_control_list_sid: The unique id of the IpAccessControlList resource that includes this resource. - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressPage - """ - super(IpAddressPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAddressInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class IpAddressContext(InstanceContext): - - def __init__(self, version, account_sid, ip_access_control_list_sid, sid): - """ - Initialize the IpAddressContext - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param ip_access_control_list_sid: The IpAccessControlList Sid that identifies the IpAddress resources to fetch - :param sid: A string that identifies the IpAddress resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ - super(IpAddressContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, ip_access_control_list_sid: str, sid: str): + # TODO: needs autogenerated docs + super(IpAddressContextList, self).__init__(version) # Path Solution - self._solution = { - 'account_sid': account_sid, - 'ip_access_control_list_sid': ip_access_control_list_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists/{ip_access_control_list_sid}/IpAddresses/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the IpAddressInstance - - :returns: The fetched IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=self._solution['sid'], - ) - - def update(self, ip_address=values.unset, friendly_name=values.unset, - cidr_prefix_length=values.unset): - """ - Update the IpAddressInstance - - :param unicode ip_address: An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. - :param unicode friendly_name: A human readable descriptive text for this resource, up to 255 characters long. - :param unicode cidr_prefix_length: An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. + self._solution = { account_sid, ip_access_control_list_sid, sid, } + self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists/${ip_access_control_list_sid}/IpAddresses/${sid}.json' + + + def delete(self): + + + """ + Deletes the IpAddressInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the IpAddressInstance + + :returns: The fetched IpAddressInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return IpAddressInstance( + self._version, + payload, + account_sidip_access_control_list_sidsid=self._solution['account_sid''ip_access_control_list_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The updated IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - data = values.of({ - 'IpAddress': ip_address, - 'FriendlyName': friendly_name, - 'CidrPrefixLength': cidr_prefix_length, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return IpAddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IpAddressInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return IpAddressInstance(self._version, payload, account_sid=self._solution['account_sid'], ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class IpAddressInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, ip_access_control_list_sid, - sid=None): - """ - Initialize the IpAddressInstance - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ +class IpAddressInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, ip_access_control_list_sid: str, sid: str): super(IpAddressInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'ip_address': payload.get('ip_address'), - 'cidr_prefix_length': deserialize.integer(payload.get('cidr_prefix_length')), - 'ip_access_control_list_sid': payload.get('ip_access_control_list_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'uri': payload.get('uri'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'ip_address' = payload.get('ip_address'), + 'cidr_prefix_length' = payload.get('cidr_prefix_length'), + 'ip_access_control_list_sid' = payload.get('ip_access_control_list_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'uri' = payload.get('uri'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'ip_access_control_list_sid': ip_access_control_list_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid']'ip_access_control_list_sid': ip_access_control_list_sid or self._properties['ip_access_control_list_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAddressContext for this IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressContext - """ if self._context is None: self._context = IpAddressContext( self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['ip_access_control_list_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],ip_access_control_list_sid=self._solution['ip_access_control_list_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique id of the Account that is responsible for this resource. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable descriptive text for this resource, up to 255 characters long. - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def ip_address(self): - """ - :returns: An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. - :rtype: unicode - """ - return self._properties['ip_address'] - - @property - def cidr_prefix_length(self): - """ - :returns: An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. - :rtype: unicode - """ - return self._properties['cidr_prefix_length'] - - @property - def ip_access_control_list_sid(self): - """ - :returns: The unique id of the IpAccessControlList resource that includes this resource. - :rtype: unicode - """ - return self._properties['ip_access_control_list_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated, given as GMT in RFC 2822 format. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The URI for this resource, relative to https://api.twilio.com - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch the IpAddressInstance - - :returns: The fetched IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, ip_address=values.unset, friendly_name=values.unset, - cidr_prefix_length=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the IpAddressInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode ip_address: An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. - :param unicode friendly_name: A human readable descriptive text for this resource, up to 255 characters long. - :param unicode cidr_prefix_length: An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. - :returns: The updated IpAddressInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressInstance - """ - return self._proxy.update( - ip_address=ip_address, - friendly_name=friendly_name, - cidr_prefix_length=cidr_prefix_length, - ) - def delete(self): - """ - Deletes the IpAddressInstance +class IpAddressListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str, ip_access_control_list_sid: str): + # TODO: needs autogenerated docs + super(IpAddressListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, ip_access_control_list_sid, } + self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists/${ip_access_control_list_sid}/IpAddresses.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IpAddressInstance(self._version, payload, account_sid=self._solution['account_sid']ip_access_control_list_sid=self._solution['ip_access_control_list_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IpAddressPage(self._version, payload, account_sid=self._solution['account_sid']ip_access_control_list_sid=self._solution['ip_access_control_list_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/token.py b/twilio/rest/api/v2010/account/token.py index 381e72ff47..4b6eacc286 100644 --- a/twilio/rest/api/v2010/account/token.py +++ b/twilio/rest/api/v2010/account/token.py @@ -1,187 +1,95 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class TokenList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the TokenList - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :returns: twilio.rest.api.v2010.account.token.TokenList - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - super(TokenList, self).__init__(version) - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Tokens.json'.format(**self._solution) - - def create(self, ttl=values.unset): - """ - Create the TokenInstance - - :param unicode ttl: The duration in seconds the credentials are valid +class TokenInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(TokenInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'ice_servers' = payload.get('ice_servers'), + 'password' = payload.get('password'), + 'ttl' = payload.get('ttl'), + 'username' = payload.get('username'), + } - :returns: The created TokenInstance - :rtype: twilio.rest.api.v2010.account.token.TokenInstance - """ - data = values.of({'Ttl': ttl, }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = TokenContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return TokenInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class TokenPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the TokenPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.token.TokenPage - :rtype: twilio.rest.api.v2010.account.token.TokenPage - """ - super(TokenPage, self).__init__(version, response) +class TokenListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(TokenListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Tokens.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def get_instance(self, payload): - """ - Build an instance of TokenInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.token.TokenInstance - :rtype: twilio.rest.api.v2010.account.token.TokenInstance - """ - return TokenInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return TokenInstance(self._version, payload, account_sid=self._solution['account_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class TokenInstance(InstanceResource): - - def __init__(self, version, payload, account_sid): - """ - Initialize the TokenInstance - - :returns: twilio.rest.api.v2010.account.token.TokenInstance - :rtype: twilio.rest.api.v2010.account.token.TokenInstance - """ - super(TokenInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'ice_servers': payload.get('ice_servers'), - 'password': payload.get('password'), - 'ttl': payload.get('ttl'), - 'username': payload.get('username'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + return '' - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def ice_servers(self): - """ - :returns: An array representing the ephemeral credentials - :rtype: list[unicode] - """ - return self._properties['ice_servers'] - - @property - def password(self): - """ - :returns: The temporary password used for authenticating - :rtype: unicode - """ - return self._properties['password'] - - @property - def ttl(self): - """ - :returns: The duration in seconds the credentials are valid - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def username(self): - """ - :returns: The temporary username that uniquely identifies a Token - :rtype: unicode - """ - return self._properties['username'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/transcription.py b/twilio/rest/api/v2010/account/transcription.py index 49bc6549fb..cc4fe33aa5 100644 --- a/twilio/rest/api/v2010/account/transcription.py +++ b/twilio/rest/api/v2010/account/transcription.py @@ -1,422 +1,151 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TranscriptionList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the TranscriptionList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - super(TranscriptionList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Transcriptions.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TranscriptionInstance 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 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.transcription.TranscriptionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TranscriptionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.transcription.TranscriptionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TranscriptionInstance records from the API. - Request is executed immediately - - :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 TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TranscriptionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TranscriptionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TranscriptionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: The unique string that identifies the resource - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ - return TranscriptionContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TranscriptionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ - return TranscriptionContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TranscriptionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TranscriptionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionPage - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionPage - """ - super(TranscriptionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of TranscriptionInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ - return TranscriptionInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TranscriptionContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the TranscriptionContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionContext - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ - super(TranscriptionContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TranscriptionContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Transcriptions/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the TranscriptionInstance - - :returns: The fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TranscriptionInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TranscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Transcriptions/${sid}.json' + + + def delete(self): + + + """ + Deletes the TranscriptionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TranscriptionInstance + + :returns: The fetched TranscriptionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TranscriptionInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TranscriptionInstance(InstanceResource): - - class Status(object): - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the TranscriptionInstance - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ +class TranscriptionInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(TranscriptionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'duration': payload.get('duration'), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'recording_sid': payload.get('recording_sid'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'transcription_text': payload.get('transcription_text'), - 'type': payload.get('type'), - 'uri': payload.get('uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'duration' = payload.get('duration'), + 'price' = payload.get('price'), + 'price_unit' = payload.get('price_unit'), + 'recording_sid' = payload.get('recording_sid'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'transcription_text' = payload.get('transcription_text'), + 'type' = payload.get('type'), + 'uri' = payload.get('uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TranscriptionContext for this TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionContext - """ if self._context is None: self._context = TranscriptionContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def api_version(self): - """ - :returns: The API version used to create the transcription - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def duration(self): - """ - :returns: The duration of the transcribed audio in seconds. - :rtype: unicode - """ - return self._properties['duration'] - - @property - def price(self): - """ - :returns: The charge for the transcription - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which price is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def recording_sid(self): - """ - :returns: The SID that identifies the transcription's recording - :rtype: unicode - """ - return self._properties['recording_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the transcription - :rtype: TranscriptionInstance.Status - """ - return self._properties['status'] - - @property - def transcription_text(self): + def __repr__(self): """ - :returns: The text content of the transcription. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['transcription_text'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def type(self): - """ - :returns: The transcription type - :rtype: unicode - """ - return self._properties['type'] - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - def fetch(self): - """ - Fetch the TranscriptionInstance +class TranscriptionListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(TranscriptionListInstanceList, self).__init__(version) - :returns: The fetched TranscriptionInstance - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Transcriptions.json' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def delete(self): - """ - Deletes the TranscriptionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return TranscriptionPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/usage.py b/twilio/rest/api/v2010/account/usage.py new file mode 100644 index 0000000000..e564311102 --- /dev/null +++ b/twilio/rest/api/v2010/account/usage.py @@ -0,0 +1,48 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.usage.record import RecordListInstancefrom twilio.rest.usage.trigger import TriggerListInstance + + + + +class UsageListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(UsageListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage.json' + + self._records = None + self._triggers = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/usage/record.py b/twilio/rest/api/v2010/account/usage/record.py new file mode 100644 index 0000000000..330585b38e --- /dev/null +++ b/twilio/rest/api/v2010/account/usage/record.py @@ -0,0 +1,66 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.record.all_time import AllTimeListInstancefrom twilio.rest.record.daily import DailyListInstancefrom twilio.rest.record.last_month import LastMonthListInstancefrom twilio.rest.record.monthly import MonthlyListInstancefrom twilio.rest.record.this_month import ThisMonthListInstancefrom twilio.rest.record.today import TodayListInstancefrom twilio.rest.record.yearly import YearlyListInstancefrom twilio.rest.record.yesterday import YesterdayListInstance + + + + +class RecordListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(RecordListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records.json' + + self._all_time = None + self._daily = None + self._last_month = None + self._monthly = None + self._this_month = None + self._today = None + self._yearly = None + self._yesterday = None + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RecordPage(self._version, payload, account_sid=self._solution['account_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index 731e396b5c..b09ce4ee53 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AllTimeList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the AllTimeList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - """ - super(AllTimeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/AllTime.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams AllTimeInstance 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 AllTimeInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.all_time.AllTimeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists AllTimeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param AllTimeInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.all_time.AllTimeInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AllTimeInstance records from the API. - Request is executed immediately - - :param AllTimeInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AllTimePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AllTimeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AllTimePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class AllTimePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the AllTimePage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimePage - """ - super(AllTimePage, self).__init__(version, response) +class AllTimeListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(AllTimeListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AllTimeInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/AllTime.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - """ - return AllTimeInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return AllTimePage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class AllTimeInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the AllTimeInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeInstance - """ - super(AllTimeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: AllTimeInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index fde0e764d4..5413dfd857 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DailyList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the DailyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyList - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyList - """ - super(DailyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Daily.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams DailyInstance 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 DailyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.daily.DailyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists DailyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param DailyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.daily.DailyInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DailyInstance records from the API. - Request is executed immediately - - :param DailyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DailyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DailyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DailyPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class DailyPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the DailyPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyPage - """ - super(DailyPage, self).__init__(version, response) +class DailyListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(DailyListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DailyInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/Daily.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - """ - return DailyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return DailyPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class DailyInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the DailyInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyInstance - """ - super(DailyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: DailyInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index 06d8ea79ea..5e554913e9 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class LastMonthList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the LastMonthList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - """ - super(LastMonthList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/LastMonth.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams LastMonthInstance 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 LastMonthInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.last_month.LastMonthInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists LastMonthInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param LastMonthInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.last_month.LastMonthInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of LastMonthInstance records from the API. - Request is executed immediately - - :param LastMonthInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return LastMonthPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of LastMonthInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return LastMonthPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class LastMonthPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the LastMonthPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthPage - """ - super(LastMonthPage, self).__init__(version, response) +class LastMonthListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(LastMonthListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of LastMonthInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/LastMonth.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - """ - return LastMonthInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return LastMonthPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class LastMonthInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the LastMonthInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthInstance - """ - super(LastMonthInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: LastMonthInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index df29d273be..8b2f59c48a 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MonthlyList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the MonthlyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - """ - super(MonthlyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Monthly.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams MonthlyInstance 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 MonthlyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.monthly.MonthlyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists MonthlyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MonthlyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.monthly.MonthlyInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MonthlyInstance records from the API. - Request is executed immediately - - :param MonthlyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MonthlyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MonthlyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MonthlyPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class MonthlyPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the MonthlyPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyPage - """ - super(MonthlyPage, self).__init__(version, response) +class MonthlyListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(MonthlyListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MonthlyInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/Monthly.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - """ - return MonthlyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return MonthlyPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class MonthlyInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the MonthlyInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyInstance - """ - super(MonthlyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: MonthlyInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index beaf46dc2e..7c78ab0245 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ThisMonthList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the ThisMonthList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - """ - super(ThisMonthList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/ThisMonth.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams ThisMonthInstance 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 ThisMonthInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.this_month.ThisMonthInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists ThisMonthInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ThisMonthInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.this_month.ThisMonthInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ThisMonthInstance records from the API. - Request is executed immediately - - :param ThisMonthInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ThisMonthPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ThisMonthInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ThisMonthPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class ThisMonthPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the ThisMonthPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthPage - """ - super(ThisMonthPage, self).__init__(version, response) +class ThisMonthListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(ThisMonthListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ThisMonthInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/ThisMonth.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - """ - return ThisMonthInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return ThisMonthPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class ThisMonthInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the ThisMonthInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthInstance - """ - super(ThisMonthInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: ThisMonthInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index 2939161df3..34ac416db1 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TodayList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the TodayList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayList - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayList - """ - super(TodayList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Today.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams TodayInstance 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 TodayInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.today.TodayInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists TodayInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param TodayInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.today.TodayInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TodayInstance records from the API. - Request is executed immediately - - :param TodayInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayPage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TodayPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TodayInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TodayPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class TodayPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the TodayPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayPage - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayPage - """ - super(TodayPage, self).__init__(version, response) +class TodayListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(TodayListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TodayInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/Today.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - """ - return TodayInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return TodayPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class TodayInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the TodayInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayInstance - """ - super(TodayInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: TodayInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index 563fda9206..aa2c2c0d51 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class YearlyList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the YearlyList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - """ - super(YearlyList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Yearly.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams YearlyInstance 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 YearlyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.yearly.YearlyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists YearlyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param YearlyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.yearly.YearlyInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of YearlyInstance records from the API. - Request is executed immediately - - :param YearlyInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return YearlyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of YearlyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return YearlyPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class YearlyPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the YearlyPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyPage - """ - super(YearlyPage, self).__init__(version, response) +class YearlyListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(YearlyListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of YearlyInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/Yearly.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - """ - return YearlyInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return YearlyPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class YearlyInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the YearlyInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyInstance - """ - super(YearlyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: YearlyInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index ad1703ea46..e7ad860e50 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -1,608 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class YesterdayList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the YesterdayList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - """ - super(YesterdayList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records/Yesterday.json'.format(**self._solution) - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams YesterdayInstance 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 YesterdayInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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.usage.record.yesterday.YesterdayInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists YesterdayInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param YesterdayInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.record.yesterday.YesterdayInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of YesterdayInstance records from the API. - Request is executed immediately - - :param YesterdayInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :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 YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - """ - data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return YesterdayPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of YesterdayInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return YesterdayPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class YesterdayPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the YesterdayPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayPage - """ - super(YesterdayPage, self).__init__(version, response) +class YesterdayListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(YesterdayListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of YesterdayInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records/Yesterday.json' + + + def page(self, category, start_date, end_date, include_subaccounts, page_size): + + data = values.of({ + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - """ - return YesterdayInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return YesterdayPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class YesterdayInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the YesterdayInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayInstance - """ - super(YesterdayInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: YesterdayInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index 9f4190f089..8f655e9b57 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -1,808 +1,175 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TriggerList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the TriggerList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerList - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerList - """ - super(TriggerList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Triggers.json'.format(**self._solution) - - def create(self, callback_url, trigger_value, usage_category, - callback_method=values.unset, friendly_name=values.unset, - recurring=values.unset, trigger_by=values.unset): - """ - Create the TriggerInstance - - :param unicode callback_url: The URL we call when the trigger fires - :param unicode trigger_value: The usage value at which the trigger should fire - :param TriggerInstance.UsageCategory usage_category: The usage category the trigger watches - :param unicode callback_method: The HTTP method to use to call callback_url - :param unicode friendly_name: A string to describe the resource - :param TriggerInstance.Recurring recurring: The frequency of a recurring UsageTrigger - :param TriggerInstance.TriggerField trigger_by: The field in the UsageRecord resource that fires the trigger - - :returns: The created TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - data = values.of({ - 'CallbackUrl': callback_url, - 'TriggerValue': trigger_value, - 'UsageCategory': usage_category, - 'CallbackMethod': callback_method, - 'FriendlyName': friendly_name, - 'Recurring': recurring, - 'TriggerBy': trigger_by, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TriggerInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, recurring=values.unset, trigger_by=values.unset, - usage_category=values.unset, limit=None, page_size=None): - """ - Streams TriggerInstance 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 TriggerInstance.Recurring recurring: The frequency of recurring UsageTriggers to read - :param TriggerInstance.TriggerField trigger_by: The trigger field of the UsageTriggers to read - :param TriggerInstance.UsageCategory usage_category: The usage category of the UsageTriggers to read - :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.usage.trigger.TriggerInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - recurring=recurring, - trigger_by=trigger_by, - usage_category=usage_category, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, recurring=values.unset, trigger_by=values.unset, - usage_category=values.unset, limit=None, page_size=None): - """ - Lists TriggerInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param TriggerInstance.Recurring recurring: The frequency of recurring UsageTriggers to read - :param TriggerInstance.TriggerField trigger_by: The trigger field of the UsageTriggers to read - :param TriggerInstance.UsageCategory usage_category: The usage category of the UsageTriggers to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.usage.trigger.TriggerInstance] - """ - return list(self.stream( - recurring=recurring, - trigger_by=trigger_by, - usage_category=usage_category, - limit=limit, - page_size=page_size, - )) - - def page(self, recurring=values.unset, trigger_by=values.unset, - usage_category=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TriggerInstance records from the API. - Request is executed immediately - - :param TriggerInstance.Recurring recurring: The frequency of recurring UsageTriggers to read - :param TriggerInstance.TriggerField trigger_by: The trigger field of the UsageTriggers to read - :param TriggerInstance.UsageCategory usage_category: The usage category of the UsageTriggers to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - """ - data = values.of({ - 'Recurring': recurring, - 'TriggerBy': trigger_by, - 'UsageCategory': usage_category, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TriggerPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TriggerInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TriggerPage(self._version, response, self._solution) - def get(self, sid): - """ - Constructs a TriggerContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ - return TriggerContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TriggerContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ - return TriggerContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TriggerPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TriggerPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerPage - """ - super(TriggerPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of TriggerInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - return TriggerInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TriggerContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the TriggerContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ - super(TriggerContext, self).__init__(version) + def __init__(self, version: V2010, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TriggerContextList, self).__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Usage/Triggers/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the TriggerInstance - - :returns: The fetched TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TriggerInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, callback_method=values.unset, callback_url=values.unset, - friendly_name=values.unset): - """ - Update the TriggerInstance - - :param unicode callback_method: The HTTP method to use to call callback_url - :param unicode callback_url: The URL we call when the trigger fires - :param unicode friendly_name: A string to describe the resource + self._solution = { account_sid, sid, } + self._uri = '/Accounts/${account_sid}/Usage/Triggers/${sid}.json' + + + def delete(self): + + + """ + Deletes the TriggerInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TriggerInstance + + :returns: The fetched TriggerInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TriggerInstance( + self._version, + payload, + account_sidsid=self._solution['account_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The updated TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - data = values.of({ - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'FriendlyName': friendly_name, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return TriggerInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TriggerInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return TriggerInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TriggerInstance(InstanceResource): - class UsageCategory(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - class Recurring(object): - DAILY = "daily" - MONTHLY = "monthly" - YEARLY = "yearly" - ALLTIME = "alltime" - - class TriggerField(object): - COUNT = "count" - USAGE = "usage" - PRICE = "price" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the TriggerInstance - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ +class TriggerInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): super(TriggerInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'callback_method': payload.get('callback_method'), - 'callback_url': payload.get('callback_url'), - 'current_value': payload.get('current_value'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_fired': deserialize.rfc2822_datetime(payload.get('date_fired')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'recurring': payload.get('recurring'), - 'sid': payload.get('sid'), - 'trigger_by': payload.get('trigger_by'), - 'trigger_value': payload.get('trigger_value'), - 'uri': payload.get('uri'), - 'usage_category': payload.get('usage_category'), - 'usage_record_uri': payload.get('usage_record_uri'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'api_version' = payload.get('api_version'), + 'callback_method' = payload.get('callback_method'), + 'callback_url' = payload.get('callback_url'), + 'current_value' = payload.get('current_value'), + 'date_created' = payload.get('date_created'), + 'date_fired' = payload.get('date_fired'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'recurring' = payload.get('recurring'), + 'sid' = payload.get('sid'), + 'trigger_by' = payload.get('trigger_by'), + 'trigger_value' = payload.get('trigger_value'), + 'uri' = payload.get('uri'), + 'usage_category' = payload.get('usage_category'), + 'usage_record_uri' = payload.get('usage_record_uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TriggerContext for this TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerContext - """ if self._context is None: self._context = TriggerContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that this trigger monitors - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def callback_method(self): - """ - :returns: The HTTP method we use to call callback_url - :rtype: unicode - """ - return self._properties['callback_method'] - - @property - def callback_url(self): - """ - :returns: he URL we call when the trigger fires - :rtype: unicode - """ - return self._properties['callback_url'] - - @property - def current_value(self): - """ - :returns: The current value of the field the trigger is watching - :rtype: unicode - """ - return self._properties['current_value'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_fired(self): - """ - :returns: The RFC 2822 date and time in GMT that the trigger was last fired - :rtype: datetime - """ - return self._properties['date_fired'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the trigger - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def recurring(self): - """ - :returns: The frequency of a recurring UsageTrigger - :rtype: TriggerInstance.Recurring - """ - return self._properties['recurring'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trigger_by(self): - """ - :returns: The field in the UsageRecord resource that fires the trigger - :rtype: TriggerInstance.TriggerField - """ - return self._properties['trigger_by'] - - @property - def trigger_value(self): - """ - :returns: The value at which the trigger will fire - :rtype: unicode - """ - return self._properties['trigger_value'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage_category(self): - """ - :returns: The usage category the trigger watches - :rtype: TriggerInstance.UsageCategory - """ - return self._properties['usage_category'] - - @property - def usage_record_uri(self): - """ - :returns: The URI of the UsageRecord resource this trigger watches - :rtype: unicode - """ - return self._properties['usage_record_uri'] - - def fetch(self): - """ - Fetch the TriggerInstance - - :returns: The fetched TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, callback_method=values.unset, callback_url=values.unset, - friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the TriggerInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode callback_method: The HTTP method to use to call callback_url - :param unicode callback_url: The URL we call when the trigger fires - :param unicode friendly_name: A string to describe the resource - :returns: The updated TriggerInstance - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerInstance - """ - return self._proxy.update( - callback_method=callback_method, - callback_url=callback_url, - friendly_name=friendly_name, - ) - def delete(self): - """ - Deletes the TriggerInstance +class TriggerListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(TriggerListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Triggers.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TriggerInstance(self._version, payload, account_sid=self._solution['account_sid']) + + + def page(self, recurring, trigger_by, usage_category, page_size): + + data = values.of({ + 'recurring': recurring,'trigger_by': trigger_by,'usage_category': usage_category,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TriggerPage(self._version, payload, account_sid=self._solution['account_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/validation_request.py b/twilio/rest/api/v2010/account/validation_request.py index 489fbcd460..5c1fdf34ec 100644 --- a/twilio/rest/api/v2010/account/validation_request.py +++ b/twilio/rest/api/v2010/account/validation_request.py @@ -1,182 +1,93 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Api + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class ValidationRequestList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the ValidationRequestList - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - super(ValidationRequestList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/OutgoingCallerIds.json'.format(**self._solution) - def create(self, phone_number, friendly_name=values.unset, - call_delay=values.unset, extension=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Create the ValidationRequestInstance - - :param unicode phone_number: The phone number to verify in E.164 format - :param unicode friendly_name: A string to describe the resource - :param unicode call_delay: The number of seconds to delay before initiating the verification call - :param unicode extension: The digits to dial after connecting the verification call - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback +class ValidationRequestInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str): + super(ValidationRequestInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'phone_number' = payload.get('phone_number'), + 'validation_code' = payload.get('validation_code'), + } - :returns: The created ValidationRequestInstance - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'FriendlyName': friendly_name, - 'CallDelay': call_delay, - 'Extension': extension, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - }) + self._context = None + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = ValidationRequestContext( + self._version, + account_sid=self._solution['account_sid'], + ) + return self._context - return ValidationRequestInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class ValidationRequestPage(Page): + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def __init__(self, version, response, solution): - """ - Initialize the ValidationRequestPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestPage - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestPage - """ - super(ValidationRequestPage, self).__init__(version, response) +class ValidationRequestListInstance(ListResource): + def __init__(self, version: V2010, account_sid: str): + # TODO: needs autogenerated docs + super(ValidationRequestListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ValidationRequestInstance + self._solution = { account_sid, } + self._uri = '/Accounts/${account_sid}/OutgoingCallerIds.json' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - """ - return ValidationRequestInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + return ValidationRequestInstance(self._version, payload, account_sid=self._solution['account_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class ValidationRequestInstance(InstanceResource): - - def __init__(self, version, payload, account_sid): - """ - Initialize the ValidationRequestInstance - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestInstance - """ - super(ValidationRequestInstance, self).__init__(version) + return '' - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'validation_code': payload.get('validation_code'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number to verify in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def validation_code(self): - """ - :returns: The 6 digit validation code that someone must enter to validate the Caller ID when `phone_number` is called - :rtype: unicode - """ - return self._properties['validation_code'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/autopilot/__init__.py b/twilio/rest/autopilot/__init__.py index 1fdb011a8a..4af4533ccd 100644 --- a/twilio/rest/autopilot/__init__.py +++ b/twilio/rest/autopilot/__init__.py @@ -1,59 +1,62 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.autopilot.v1 import V1 + Twilio - Autopilot + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Autopilot(Domain): +from twilio.base.domain import Domain +from twilio.rest.Autopilot.v1 import V1 +class Autopilot(Domain): def __init__(self, twilio): """ Initialize the Autopilot Domain :returns: Domain for Autopilot - :rtype: twilio.rest.autopilot.Autopilot + :rtype: twilio.rest.v1.Autopilot """ super(Autopilot, self).__init__(twilio) - - self.base_url = 'https://autopilot.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Autopilot.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of autopilot - :rtype: twilio.rest.autopilot.v1.V1 + :returns: Versions v1 of Autopilot + :rtype: twilio.rest.Autopilot.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def assistants(self): """ - :rtype: twilio.rest.autopilot.v1.assistant.AssistantList + :rtype: twilio.rest.v1.assistants """ return self.v1.assistants + @property def restore_assistant(self): """ - :rtype: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantList + :rtype: twilio.rest.v1.restore_assistant """ return self.v1.restore_assistant + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/autopilot/v1/.openapi-generator-ignore b/twilio/rest/autopilot/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/autopilot/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/autopilot/v1/.openapi-generator/FILES b/twilio/rest/autopilot/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..485c117f24 --- /dev/null +++ b/twilio/rest/autopilot/v1/.openapi-generator/FILES @@ -0,0 +1,31 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +assistant.py +assistant/defaults.py +assistant/dialogue.py +assistant/field_type.py +assistant/field_type/field_value.py +assistant/model_build.py +assistant/query.py +assistant/style_sheet.py +assistant/task.py +assistant/task/field.py +assistant/task/sample.py +assistant/task/task_actions.py +assistant/task/task_statistics.py +assistant/webhook.py +restore_assistant.py diff --git a/twilio/rest/autopilot/v1/.openapi-generator/VERSION b/twilio/rest/autopilot/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/autopilot/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/autopilot/v1/assistant.py b/twilio/rest/autopilot/v1/assistant.py new file mode 100644 index 0000000000..3ee63e3014 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant.py @@ -0,0 +1,205 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.assistant.defaults import DefaultsListInstancefrom twilio.rest.assistant.dialogue import DialogueListInstancefrom twilio.rest.assistant.field_type import FieldTypeListInstancefrom twilio.rest.assistant.model_build import ModelBuildListInstancefrom twilio.rest.assistant.query import QueryListInstancefrom twilio.rest.assistant.style_sheet import StyleSheetListInstancefrom twilio.rest.assistant.task import TaskListInstancefrom twilio.rest.assistant.webhook import WebhookListInstance + + +class AssistantContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(AssistantContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Assistants/${sid}' + + self._defaults = None + self._dialogues = None + self._field_types = None + self._model_builds = None + self._queries = None + self._style_sheet = None + self._tasks = None + self._webhooks = None + + def delete(self): + + + """ + Deletes the AssistantInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AssistantInstance + + :returns: The fetched AssistantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssistantInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AssistantInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(AssistantInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'latest_model_build_sid' = payload.get('latest_model_build_sid'), + 'links' = payload.get('links'), + 'log_queries' = payload.get('log_queries'), + 'development_stage' = payload.get('development_stage'), + 'needs_model_build' = payload.get('needs_model_build'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + 'callback_url' = payload.get('callback_url'), + 'callback_events' = payload.get('callback_events'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AssistantContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def defaults(self): + return self._proxy.defaults + @property + def dialogues(self): + return self._proxy.dialogues + @property + def field_types(self): + return self._proxy.field_types + @property + def model_builds(self): + return self._proxy.model_builds + @property + def queries(self): + return self._proxy.queries + @property + def style_sheet(self): + return self._proxy.style_sheet + @property + def tasks(self): + return self._proxy.tasks + @property + def webhooks(self): + return self._proxy.webhooks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AssistantListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AssistantListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Assistants' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssistantInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssistantPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/defaults.py b/twilio/rest/autopilot/v1/assistant/defaults.py index 708a71b8ae..3d0c2fb6fc 100644 --- a/twilio/rest/autopilot/v1/assistant/defaults.py +++ b/twilio/rest/autopilot/v1/assistant/defaults.py @@ -1,264 +1,130 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DefaultsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the DefaultsList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsList - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsList - """ - super(DefaultsList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - - def get(self): - """ - Constructs a DefaultsContext - - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsContext - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsContext - """ - return DefaultsContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __call__(self): - """ - Constructs a DefaultsContext - - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsContext - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsContext - """ - return DefaultsContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DefaultsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DefaultsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsPage - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsPage - """ - super(DefaultsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DefaultsInstance - :param dict payload: Payload response from the API - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - """ - return DefaultsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DefaultsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the DefaultsContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsContext - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsContext - """ - super(DefaultsContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(DefaultsContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/Defaults'.format(**self._solution) - - def fetch(self): - """ - Fetch the DefaultsInstance - - :returns: The fetched DefaultsInstance - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DefaultsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def update(self, defaults=values.unset): - """ - Update the DefaultsInstance - - :param dict defaults: A JSON string that describes the default task links. - - :returns: The updated DefaultsInstance - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - """ - data = values.of({'Defaults': serialize.object(defaults), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return DefaultsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Defaults' + + + def fetch(self): + + """ + Fetch the DefaultsInstance + + :returns: The fetched DefaultsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DefaultsInstance( + self._version, + payload, + assistant_sid=self._solution['assistant_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return DefaultsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DefaultsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid): - """ - Initialize the DefaultsInstance - - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - """ +class DefaultsInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str): super(DefaultsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'url': payload.get('url'), - 'data': payload.get('data'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'url' = payload.get('url'), + 'data' = payload.get('data'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DefaultsContext for this DefaultsInstance - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsContext - """ if self._context is None: - self._context = DefaultsContext(self._version, assistant_sid=self._solution['assistant_sid'], ) + self._context = DefaultsContext( + self._version, + assistant_sid=self._solution['assistant_sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def url(self): - """ - :returns: The absolute URL of the Defaults resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def data(self): - """ - :returns: The JSON string that describes the default task links - :rtype: dict + def __repr__(self): """ - return self._properties['data'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the DefaultsInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched DefaultsInstance - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - """ - return self._proxy.fetch() - def update(self, defaults=values.unset): - """ - Update the DefaultsInstance - :param dict defaults: A JSON string that describes the default task links. +class DefaultsListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(DefaultsListInstanceList, self).__init__(version) - :returns: The updated DefaultsInstance - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance - """ - return self._proxy.update(defaults=defaults, ) + # Path Solution + self._solution = { assistant_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/dialogue.py b/twilio/rest/autopilot/v1/assistant/dialogue.py index 464ba35d2e..c21ce4c666 100644 --- a/twilio/rest/autopilot/v1/assistant/dialogue.py +++ b/twilio/rest/autopilot/v1/assistant/dialogue.py @@ -1,260 +1,120 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DialogueList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the DialogueList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueList - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueList - """ - super(DialogueList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - - def get(self, sid): - """ - Constructs a DialogueContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueContext - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueContext - """ - return DialogueContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DialogueContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueContext - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueContext - """ - return DialogueContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - -class DialoguePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, response, solution): - """ - Initialize the DialoguePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialoguePage - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialoguePage - """ - super(DialoguePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DialogueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueInstance - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueInstance - """ - return DialogueInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DialogueContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the DialogueContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueContext - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueContext - """ - super(DialogueContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DialogueContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Dialogues/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DialogueInstance - - :returns: The fetched DialogueInstance - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DialogueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Dialogues/${sid}' + + + def fetch(self): + + """ + Fetch the DialogueInstance + + :returns: The fetched DialogueInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DialogueInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DialogueInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the DialogueInstance - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueInstance - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueInstance - """ +class DialogueInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): super(DialogueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'data': payload.get('data'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'data' = payload.get('data'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DialogueContext for this DialogueInstance - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueContext - """ if self._context is None: self._context = DialogueContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def assistant_sid(self): + def __repr__(self): """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['assistant_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - @property - def data(self): - """ - :returns: The JSON string that describes the dialogue session object - :rtype: dict - """ - return self._properties['data'] - - @property - def url(self): - """ - :returns: The absolute URL of the Dialogue resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the DialogueInstance +class DialogueListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(DialogueListInstanceList, self).__init__(version) - :returns: The fetched DialogueInstance - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { assistant_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/field_type.py b/twilio/rest/autopilot/v1/assistant/field_type.py new file mode 100644 index 0000000000..cd1d326bea --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/field_type.py @@ -0,0 +1,172 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.field_type.field_value import FieldValueListInstance + + +class FieldTypeContext(InstanceContext): + def __init__(self, version: V1, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FieldTypeContextList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${sid}' + + self._field_values = None + + def delete(self): + + + """ + Deletes the FieldTypeInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FieldTypeInstance + + :returns: The fetched FieldTypeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FieldTypeInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FieldTypeInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super(FieldTypeInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'links' = payload.get('links'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FieldTypeContext( + self._version, + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def field_values(self): + return self._proxy.field_values + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FieldTypeListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(FieldTypeListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldTypePage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/field_type/field_value.py b/twilio/rest/autopilot/v1/assistant/field_type/field_value.py index 151d1357dc..cde3c6caec 100644 --- a/twilio/rest/autopilot/v1/assistant/field_type/field_value.py +++ b/twilio/rest/autopilot/v1/assistant/field_type/field_value.py @@ -1,456 +1,158 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FieldValueList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, field_type_sid): - """ - Initialize the FieldValueList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the FieldType associated with the resource - :param field_type_sid: The SID of the Field Type associated with the Field Value - - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList - """ - super(FieldValueList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'field_type_sid': field_type_sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues'.format(**self._solution) - - def stream(self, language=values.unset, limit=None, page_size=None): - """ - Streams FieldValueInstance 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 language: The ISO language-country tag that identifies the language of the value - :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.autopilot.v1.assistant.field_type.field_value.FieldValueInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(language=language, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, language=values.unset, limit=None, page_size=None): - """ - Lists FieldValueInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: The ISO language-country tag that identifies the language of the value - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.autopilot.v1.assistant.field_type.field_value.FieldValueInstance] - """ - return list(self.stream(language=language, limit=limit, page_size=page_size, )) - - def page(self, language=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of FieldValueInstance records from the API. - Request is executed immediately - - :param unicode language: The ISO language-country tag that identifies the language of the value - :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 FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValuePage - """ - data = values.of({ - 'Language': language, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FieldValuePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldValueInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValuePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldValuePage(self._version, response, self._solution) - - def create(self, language, value, synonym_of=values.unset): - """ - Create the FieldValueInstance - - :param unicode language: The ISO language-country tag that identifies the language of the value - :param unicode value: The Field Value data - :param unicode synonym_of: The string value that indicates which word the field value is a synonym of - - :returns: The created FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance - """ - data = values.of({'Language': language, 'Value': value, 'SynonymOf': synonym_of, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FieldValueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - ) - - def get(self, sid): - """ - Constructs a FieldValueContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext - """ - return FieldValueContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FieldValueContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext - """ - return FieldValueContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldValuePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FieldValuePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the FieldType associated with the resource - :param field_type_sid: The SID of the Field Type associated with the Field Value - - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValuePage - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValuePage - """ - super(FieldValuePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldValueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance - """ - return FieldValueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class FieldValueContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, field_type_sid, sid): - """ - Initialize the FieldValueContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the FieldType associated with the resource to fetch - :param field_type_sid: The SID of the Field Type associated with the Field Value to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext - """ - super(FieldValueContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, field_type_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FieldValueContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'field_type_sid': field_type_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the FieldValueInstance - - :returns: The fetched FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FieldValueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldValueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { assistant_sid, field_type_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${field_type_sid}/FieldValues/${sid}' + + + def delete(self): + + + """ + Deletes the FieldValueInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FieldValueInstance + + :returns: The fetched FieldValueInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FieldValueInstance( + self._version, + payload, + assistant_sidfield_type_sidsid=self._solution['assistant_sid''field_type_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FieldValueInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, assistant_sid, field_type_sid, sid=None): - """ - Initialize the FieldValueInstance - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance - """ +class FieldValueInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, field_type_sid: str, sid: str): super(FieldValueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'field_type_sid': payload.get('field_type_sid'), - 'language': payload.get('language'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'value': payload.get('value'), - 'url': payload.get('url'), - 'synonym_of': payload.get('synonym_of'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'field_type_sid' = payload.get('field_type_sid'), + 'language' = payload.get('language'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'value' = payload.get('value'), + 'url' = payload.get('url'), + 'synonym_of' = payload.get('synonym_of'), } - # Context self._context = None self._solution = { - 'assistant_sid': assistant_sid, - 'field_type_sid': field_type_sid, - 'sid': sid or self._properties['sid'], + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'field_type_sid': field_type_sid or self._properties['field_type_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldValueContext for this FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueContext - """ if self._context is None: self._context = FieldValueContext( self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],field_type_sid=self._solution['field_type_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def field_type_sid(self): - """ - :returns: The SID of the Field Type associated with the Field Value - :rtype: unicode - """ - return self._properties['field_type_sid'] - - @property - def language(self): - """ - :returns: The ISO language-country tag that identifies the language of the value - :rtype: unicode - """ - return self._properties['language'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the FieldType associated with the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def value(self): - """ - :returns: The Field Value data - :rtype: unicode - """ - return self._properties['value'] - - @property - def url(self): - """ - :returns: The absolute URL of the FieldValue resource - :rtype: unicode - """ - return self._properties['url'] + - @property - def synonym_of(self): + def __repr__(self): """ - :returns: The word for which the field value is a synonym of - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['synonym_of'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the FieldValueInstance - :returns: The fetched FieldValueInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the FieldValueInstance +class FieldValueListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str, field_type_sid: str): + # TODO: needs autogenerated docs + super(FieldValueListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, field_type_sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${field_type_sid}/FieldValues' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldValueInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']field_type_sid=self._solution['field_type_sid']) + + + def page(self, language, page_size): + + data = values.of({ + 'language': language,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldValuePage(self._version, payload, assistant_sid=self._solution['assistant_sid']field_type_sid=self._solution['field_type_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/model_build.py b/twilio/rest/autopilot/v1/assistant/model_build.py index e37da63355..aeca1c0a5a 100644 --- a/twilio/rest/autopilot/v1/assistant/model_build.py +++ b/twilio/rest/autopilot/v1/assistant/model_build.py @@ -1,456 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ModelBuildList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the ModelBuildList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildList - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildList - """ - super(ModelBuildList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/ModelBuilds'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ModelBuildInstance 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 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.autopilot.v1.assistant.model_build.ModelBuildInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ModelBuildInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.autopilot.v1.assistant.model_build.ModelBuildInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ModelBuildInstance records from the API. - Request is executed immediately - - :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 ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ModelBuildPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ModelBuildInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ModelBuildPage(self._version, response, self._solution) - - def create(self, status_callback=values.unset, unique_name=values.unset): - """ - Create the ModelBuildInstance - - :param unicode status_callback: The URL we should call using a POST method to send status information to your application - :param unicode unique_name: An application-defined string that uniquely identifies the new resource - - :returns: The created ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - """ - data = values.of({'StatusCallback': status_callback, 'UniqueName': unique_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - def get(self, sid): - """ - Constructs a ModelBuildContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildContext - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildContext - """ - return ModelBuildContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ModelBuildContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildContext - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildContext - """ - return ModelBuildContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ModelBuildPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ModelBuildPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildPage - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildPage - """ - super(ModelBuildPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ModelBuildInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - """ - return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ModelBuildContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the ModelBuildContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildContext - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildContext - """ - super(ModelBuildContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ModelBuildContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/ModelBuilds/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ModelBuildInstance - - :returns: The fetched ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ModelBuildInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def update(self, unique_name=values.unset): - """ - Update the ModelBuildInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - - :returns: The updated ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ModelBuildInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/ModelBuilds/${sid}' + + + def delete(self): + + + """ + Deletes the ModelBuildInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ModelBuildInstance + + :returns: The fetched ModelBuildInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ModelBuildInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the ModelBuildInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ModelBuildInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - ENQUEUED = "enqueued" - BUILDING = "building" - COMPLETED = "completed" - FAILED = "failed" - CANCELED = "canceled" - - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the ModelBuildInstance - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - """ +class ModelBuildInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): super(ModelBuildInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), - 'build_duration': deserialize.integer(payload.get('build_duration')), - 'error_code': deserialize.integer(payload.get('error_code')), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + 'build_duration' = payload.get('build_duration'), + 'error_code' = payload.get('error_code'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ModelBuildContext for this ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildContext - """ if self._context is None: self._context = ModelBuildContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the model build process - :rtype: ModelBuildInstance.Status - """ - return self._properties['status'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The absolute URL of the ModelBuild resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def build_duration(self): - """ - :returns: The time in seconds it took to build the model - :rtype: unicode - """ - return self._properties['build_duration'] - - @property - def error_code(self): - """ - :returns: More information about why the model build failed, if `status` is `failed` - :rtype: unicode - """ - return self._properties['error_code'] - - def fetch(self): - """ - Fetch the ModelBuildInstance - - :returns: The fetched ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ModelBuildInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :returns: The updated ModelBuildInstance - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildInstance - """ - return self._proxy.update(unique_name=unique_name, ) - def delete(self): - """ - Deletes the ModelBuildInstance +class ModelBuildListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(ModelBuildListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/ModelBuilds' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ModelBuildPage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/query.py b/twilio/rest/autopilot/v1/assistant/query.py index a6b01b8a9e..81fb6d8f11 100644 --- a/twilio/rest/autopilot/v1/assistant/query.py +++ b/twilio/rest/autopilot/v1/assistant/query.py @@ -1,528 +1,173 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class QueryList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the QueryList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryList - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryList - """ - super(QueryList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/Queries'.format(**self._solution) - - def stream(self, language=values.unset, model_build=values.unset, - status=values.unset, dialogue_sid=values.unset, limit=None, - page_size=None): - """ - Streams QueryInstance 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 language: The ISO language-country string that specifies the language used by the Query resources to read - :param unicode model_build: The SID or unique name of the Model Build to be queried - :param unicode status: The status of the resources to read - :param unicode dialogue_sid: The SID of the `Dialogue `_. - :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.autopilot.v1.assistant.query.QueryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - language=language, - model_build=model_build, - status=status, - dialogue_sid=dialogue_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, language=values.unset, model_build=values.unset, - status=values.unset, dialogue_sid=values.unset, limit=None, - page_size=None): - """ - Lists QueryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: The ISO language-country string that specifies the language used by the Query resources to read - :param unicode model_build: The SID or unique name of the Model Build to be queried - :param unicode status: The status of the resources to read - :param unicode dialogue_sid: The SID of the `Dialogue `_. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.autopilot.v1.assistant.query.QueryInstance] - """ - return list(self.stream( - language=language, - model_build=model_build, - status=status, - dialogue_sid=dialogue_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, language=values.unset, model_build=values.unset, - status=values.unset, dialogue_sid=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of QueryInstance records from the API. - Request is executed immediately - - :param unicode language: The ISO language-country string that specifies the language used by the Query resources to read - :param unicode model_build: The SID or unique name of the Model Build to be queried - :param unicode status: The status of the resources to read - :param unicode dialogue_sid: The SID of the `Dialogue `_. - :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 QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryPage - """ - data = values.of({ - 'Language': language, - 'ModelBuild': model_build, - 'Status': status, - 'DialogueSid': dialogue_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return QueryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of QueryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return QueryPage(self._version, response, self._solution) - - def create(self, language, query, tasks=values.unset, model_build=values.unset): - """ - Create the QueryInstance - - :param unicode language: The ISO language-country string that specifies the language used for the new query - :param unicode query: The end-user's natural language input - :param unicode tasks: The list of tasks to limit the new query to - :param unicode model_build: The SID or unique name of the Model Build to be queried - - :returns: The created QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance - """ - data = values.of({'Language': language, 'Query': query, 'Tasks': tasks, 'ModelBuild': model_build, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def get(self, sid): - """ - Constructs a QueryContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryContext - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext - """ - return QueryContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a QueryContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryContext - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext - """ - return QueryContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class QueryPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the QueryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryPage - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryPage - """ - super(QueryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of QueryInstance - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.autopilot.v1.assistant.query.QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance - """ - return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class QueryContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the QueryContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryContext - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext - """ - super(QueryContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(QueryContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Queries/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the QueryInstance - - :returns: The fetched QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return QueryInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def update(self, sample_sid=values.unset, status=values.unset): - """ - Update the QueryInstance - - :param unicode sample_sid: The SID of an optional reference to the Sample created from the query - :param unicode status: The new status of the resource - - :returns: The updated QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance - """ - data = values.of({'SampleSid': sample_sid, 'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return QueryInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Queries/${sid}' + + + def delete(self): + + + """ + Deletes the QueryInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the QueryInstance + + :returns: The fetched QueryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return QueryInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the QueryInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class QueryInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the QueryInstance - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance - """ +class QueryInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): super(QueryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'results': payload.get('results'), - 'language': payload.get('language'), - 'model_build_sid': payload.get('model_build_sid'), - 'query': payload.get('query'), - 'sample_sid': payload.get('sample_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'url': payload.get('url'), - 'source_channel': payload.get('source_channel'), - 'dialogue_sid': payload.get('dialogue_sid'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'results' = payload.get('results'), + 'language' = payload.get('language'), + 'model_build_sid' = payload.get('model_build_sid'), + 'query' = payload.get('query'), + 'sample_sid' = payload.get('sample_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'url' = payload.get('url'), + 'source_channel' = payload.get('source_channel'), + 'dialogue_sid' = payload.get('dialogue_sid'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: QueryContext for this QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext - """ if self._context is None: self._context = QueryContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def results(self): - """ - :returns: The natural language analysis results that include the Task recognized and a list of identified Fields - :rtype: dict - """ - return self._properties['results'] - - @property - def language(self): - """ - :returns: The ISO language-country string that specifies the language used by the Query - :rtype: unicode - """ - return self._properties['language'] - - @property - def model_build_sid(self): - """ - :returns: The SID of the `Model Build `_ queried - :rtype: unicode - """ - return self._properties['model_build_sid'] - - @property - def query(self): - """ - :returns: The end-user's natural language input - :rtype: unicode - """ - return self._properties['query'] - - @property - def sample_sid(self): - """ - :returns: The SID of an optional reference to the Sample created from the query - :rtype: unicode - """ - return self._properties['sample_sid'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the Query - :rtype: unicode - """ - return self._properties['status'] - - @property - def url(self): - """ - :returns: The absolute URL of the Query resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def source_channel(self): - """ - :returns: The communication channel from where the end-user input came - :rtype: unicode - """ - return self._properties['source_channel'] - - @property - def dialogue_sid(self): - """ - :returns: The SID of the `Dialogue `_. - :rtype: unicode - """ - return self._properties['dialogue_sid'] - - def fetch(self): - """ - Fetch the QueryInstance - - :returns: The fetched QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, sample_sid=values.unset, status=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the QueryInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode sample_sid: The SID of an optional reference to the Sample created from the query - :param unicode status: The new status of the resource - :returns: The updated QueryInstance - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance - """ - return self._proxy.update(sample_sid=sample_sid, status=status, ) - def delete(self): - """ - Deletes the QueryInstance +class QueryListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(QueryListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Queries' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, language, model_build, status, dialogue_sid, page_size): + + data = values.of({ + 'language': language,'model_build': model_build,'status': status,'dialogue_sid': dialogue_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return QueryPage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/style_sheet.py b/twilio/rest/autopilot/v1/assistant/style_sheet.py index 20f894fd5a..6a4826dd2f 100644 --- a/twilio/rest/autopilot/v1/assistant/style_sheet.py +++ b/twilio/rest/autopilot/v1/assistant/style_sheet.py @@ -1,264 +1,130 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class StyleSheetList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the StyleSheetList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetList - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetList - """ - super(StyleSheetList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - - def get(self): - """ - Constructs a StyleSheetContext - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext - """ - return StyleSheetContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __call__(self): - """ - Constructs a StyleSheetContext - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext - """ - return StyleSheetContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class StyleSheetPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the StyleSheetPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetPage - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetPage - """ - super(StyleSheetPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StyleSheetInstance - :param dict payload: Payload response from the API - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - """ - return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class StyleSheetContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the StyleSheetContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant with the StyleSheet resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext - """ - super(StyleSheetContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(StyleSheetContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/StyleSheet'.format(**self._solution) - - def fetch(self): - """ - Fetch the StyleSheetInstance - - :returns: The fetched StyleSheetInstance - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return StyleSheetInstance(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 string that describes the style sheet object - - :returns: The updated StyleSheetInstance - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - """ - data = values.of({'StyleSheet': serialize.object(style_sheet), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/StyleSheet' + + + def fetch(self): + + """ + Fetch the StyleSheetInstance + + :returns: The fetched StyleSheetInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return StyleSheetInstance( + self._version, + payload, + assistant_sid=self._solution['assistant_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class StyleSheetInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid): - """ - Initialize the StyleSheetInstance - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - """ +class StyleSheetInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str): super(StyleSheetInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'url': payload.get('url'), - 'data': payload.get('data'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'url' = payload.get('url'), + 'data' = payload.get('data'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: StyleSheetContext for this StyleSheetInstance - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetContext - """ if self._context is None: - self._context = StyleSheetContext(self._version, assistant_sid=self._solution['assistant_sid'], ) + self._context = StyleSheetContext( + self._version, + assistant_sid=self._solution['assistant_sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def url(self): - """ - :returns: The absolute URL of the StyleSheet resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def data(self): - """ - :returns: The JSON string that describes the style sheet object - :rtype: dict + def __repr__(self): """ - return self._properties['data'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the StyleSheetInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched StyleSheetInstance - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - """ - return self._proxy.fetch() - def update(self, style_sheet=values.unset): - """ - Update the StyleSheetInstance - :param dict style_sheet: The JSON string that describes the style sheet object +class StyleSheetListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(StyleSheetListInstanceList, self).__init__(version) - :returns: The updated StyleSheetInstance - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetInstance - """ - return self._proxy.update(style_sheet=style_sheet, ) + # Path Solution + self._solution = { assistant_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/task.py b/twilio/rest/autopilot/v1/assistant/task.py new file mode 100644 index 0000000000..f026d0b5b2 --- /dev/null +++ b/twilio/rest/autopilot/v1/assistant/task.py @@ -0,0 +1,185 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.task.field import FieldListInstancefrom twilio.rest.task.sample import SampleListInstancefrom twilio.rest.task.task_actions import TaskActionsListInstancefrom twilio.rest.task.task_statistics import TaskStatisticsListInstance + + +class TaskContext(InstanceContext): + def __init__(self, version: V1, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TaskContextList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${sid}' + + self._fields = None + self._samples = None + self._task_actions = None + self._statistics = None + + def delete(self): + + + """ + Deletes the TaskInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TaskInstance + + :returns: The fetched TaskInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + 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 __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class TaskInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super(TaskInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'links' = payload.get('links'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'actions_url' = payload.get('actions_url'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = TaskContext( + self._version, + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def fields(self): + return self._proxy.fields + @property + def samples(self): + return self._proxy.samples + @property + def task_actions(self): + return self._proxy.task_actions + @property + def statistics(self): + return self._proxy.statistics + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class TaskListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(TaskListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TaskPage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/task/field.py b/twilio/rest/autopilot/v1/assistant/task/field.py index 2cbc867988..fbadcf6c17 100644 --- a/twilio/rest/autopilot/v1/assistant/task/field.py +++ b/twilio/rest/autopilot/v1/assistant/task/field.py @@ -1,438 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FieldList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the FieldList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the `Task `_ resource associated with this Field - - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldList - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldList - """ - super(FieldList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FieldInstance 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 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.autopilot.v1.assistant.task.field.FieldInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FieldInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.autopilot.v1.assistant.task.field.FieldInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FieldInstance records from the API. - Request is executed immediately - - :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 FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FieldPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldPage(self._version, response, self._solution) - def create(self, field_type, unique_name): - """ - Create the FieldInstance - - :param unicode field_type: The Field Type of this field - :param unicode unique_name: An application-defined string that uniquely identifies the new resource - - :returns: The created FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldInstance - """ - data = values.of({'FieldType': field_type, 'UniqueName': unique_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FieldInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def get(self, sid): - """ - Constructs a FieldContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldContext - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldContext - """ - return FieldContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FieldContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldContext - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldContext - """ - return FieldContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FieldPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the `Task `_ resource associated with this Field - - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldPage - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldPage - """ - super(FieldPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldInstance - """ - return FieldInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class FieldContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid, sid): - """ - Initialize the FieldContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource to fetch - :param task_sid: The SID of the `Task `_ resource associated with the Field resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldContext - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldContext - """ - super(FieldContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, task_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FieldContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the FieldInstance - - :returns: The fetched FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FieldInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { assistant_sid, task_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Fields/${sid}' + + + def delete(self): + + + """ + Deletes the FieldInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FieldInstance + + :returns: The fetched FieldInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FieldInstance( + self._version, + payload, + assistant_sidtask_sidsid=self._solution['assistant_sid''task_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class FieldInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, task_sid, sid=None): - """ - Initialize the FieldInstance - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldInstance - """ +class FieldInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str, sid: str): super(FieldInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'field_type': payload.get('field_type'), - 'task_sid': payload.get('task_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'field_type' = payload.get('field_type'), + 'task_sid' = payload.get('task_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'assistant_sid': assistant_sid, - 'task_sid': task_sid, - 'sid': sid or self._properties['sid'], + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldContext for this FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldContext - """ if self._context is None: self._context = FieldContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def field_type(self): - """ - :returns: The Field Type of the field - :rtype: unicode - """ - return self._properties['field_type'] - - @property - def task_sid(self): - """ - :returns: The SID of the `Task `_ resource associated with this Field - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the Task associated with the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Field resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the FieldInstance - :returns: The fetched FieldInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the FieldInstance +class FieldListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(FieldListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Fields' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldPage(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/task/sample.py b/twilio/rest/autopilot/v1/assistant/task/sample.py index 88609e478c..a16397f99a 100644 --- a/twilio/rest/autopilot/v1/assistant/task/sample.py +++ b/twilio/rest/autopilot/v1/assistant/task/sample.py @@ -1,494 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SampleList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the SampleList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the Task associated with the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleList - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleList - """ - super(SampleList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples'.format(**self._solution) - - def stream(self, language=values.unset, limit=None, page_size=None): - """ - Streams SampleInstance 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 language: The ISO language-country string that specifies the language used for the sample - :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.autopilot.v1.assistant.task.sample.SampleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(language=language, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, language=values.unset, limit=None, page_size=None): - """ - Lists SampleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: The ISO language-country string that specifies the language used for the sample - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.autopilot.v1.assistant.task.sample.SampleInstance] - """ - return list(self.stream(language=language, limit=limit, page_size=page_size, )) - - def page(self, language=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SampleInstance records from the API. - Request is executed immediately - - :param unicode language: The ISO language-country string that specifies the language used for the sample - :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 SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SamplePage - """ - data = values.of({ - 'Language': language, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SamplePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SampleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SamplePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SamplePage(self._version, response, self._solution) - - def create(self, language, tagged_text, source_channel=values.unset): - """ - Create the SampleInstance - - :param unicode language: The ISO language-country string that specifies the language used for the new sample - :param unicode tagged_text: The text example of how end users might express the task - :param unicode source_channel: The communication channel from which the new sample was captured - - :returns: The created SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - """ - data = values.of({'Language': language, 'TaggedText': tagged_text, 'SourceChannel': source_channel, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def get(self, sid): - """ - Constructs a SampleContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleContext - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleContext - """ - return SampleContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a SampleContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleContext - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleContext - """ - return SampleContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SamplePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SamplePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the Task associated with the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SamplePage - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SamplePage - """ - super(SamplePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SampleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - """ - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class SampleContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid, sid): - """ - Initialize the SampleContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource to fetch - :param task_sid: The SID of the Task associated with the Sample resource to create - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleContext - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleContext - """ - super(SampleContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, task_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SampleContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SampleInstance - - :returns: The fetched SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - - def update(self, language=values.unset, tagged_text=values.unset, - source_channel=values.unset): - """ - Update the SampleInstance - - :param unicode language: The ISO language-country string that specifies the language used for the sample - :param unicode tagged_text: The text example of how end users might express the task - :param unicode source_channel: The communication channel from which the sample was captured - - :returns: The updated SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - """ - data = values.of({'Language': language, 'TaggedText': tagged_text, 'SourceChannel': source_channel, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + self._solution = { assistant_sid, task_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Samples/${sid}' + + + def delete(self): + + + """ + Deletes the SampleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SampleInstance + + :returns: The fetched SampleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SampleInstance( + self._version, + payload, + assistant_sidtask_sidsid=self._solution['assistant_sid''task_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the SampleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return SampleInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], task_sid=self._solution['task_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SampleInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, assistant_sid, task_sid, sid=None): - """ - Initialize the SampleInstance - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - """ +class SampleInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str, sid: str): super(SampleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'task_sid': payload.get('task_sid'), - 'language': payload.get('language'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'tagged_text': payload.get('tagged_text'), - 'url': payload.get('url'), - 'source_channel': payload.get('source_channel'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'task_sid' = payload.get('task_sid'), + 'language' = payload.get('language'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'tagged_text' = payload.get('tagged_text'), + 'url' = payload.get('url'), + 'source_channel' = payload.get('source_channel'), } - # Context self._context = None self._solution = { - 'assistant_sid': assistant_sid, - 'task_sid': task_sid, - 'sid': sid or self._properties['sid'], + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SampleContext for this SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleContext - """ if self._context is None: self._context = SampleContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def task_sid(self): - """ - :returns: The SID of the Task associated with the resource - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def language(self): - """ - :returns: An ISO language-country string that specifies the language used for the sample - :rtype: unicode - """ - return self._properties['language'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the Task associated with the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def tagged_text(self): - """ - :returns: The text example of how end users might express the task - :rtype: unicode - """ - return self._properties['tagged_text'] - - @property - def url(self): - """ - :returns: The absolute URL of the Sample resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def source_channel(self): - """ - :returns: The communication channel from which the sample was captured - :rtype: unicode - """ - return self._properties['source_channel'] - - def fetch(self): - """ - Fetch the SampleInstance - - :returns: The fetched SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, language=values.unset, tagged_text=values.unset, - source_channel=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the SampleInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode language: The ISO language-country string that specifies the language used for the sample - :param unicode tagged_text: The text example of how end users might express the task - :param unicode source_channel: The communication channel from which the sample was captured - :returns: The updated SampleInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleInstance - """ - return self._proxy.update(language=language, tagged_text=tagged_text, source_channel=source_channel, ) - def delete(self): - """ - Deletes the SampleInstance +class SampleListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(SampleListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Samples' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SampleInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + + + def page(self, language, page_size): + + data = values.of({ + 'language': language,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SamplePage(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/task/task_actions.py b/twilio/rest/autopilot/v1/assistant/task/task_actions.py index b5aa150618..f923c2870d 100644 --- a/twilio/rest/autopilot/v1/assistant/task/task_actions.py +++ b/twilio/rest/autopilot/v1/assistant/task/task_actions.py @@ -1,303 +1,131 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskActionsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskActionsList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the Task associated with the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsList - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsList - """ - super(TaskActionsList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - - def get(self): - """ - Constructs a TaskActionsContext - - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsContext - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsContext - """ - return TaskActionsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __call__(self): - """ - Constructs a TaskActionsContext - - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsContext - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsContext - """ - return TaskActionsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskActionsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskActionsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the Task associated with the resource - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsPage - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsPage - """ - super(TaskActionsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of TaskActionsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - """ - return TaskActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskActionsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskActionsContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the Task for which the task actions to fetch were defined - :param task_sid: The SID of the Task for which the task actions to fetch were defined - - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsContext - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsContext - """ - super(TaskActionsContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskActionsContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Actions'.format(**self._solution) - - def fetch(self): - """ - Fetch the TaskActionsInstance - - :returns: The fetched TaskActionsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - 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: The updated TaskActionsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - """ - data = values.of({'Actions': serialize.object(actions), }) + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Actions' + + + def fetch(self): + + """ + Fetch the TaskActionsInstance + + :returns: The fetched TaskActionsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskActionsInstance( + self._version, + payload, + assistant_sidtask_sid=self._solution['assistant_sid''task_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return TaskActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) + return TaskActionsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], task_sid=self._solution['task_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TaskActionsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, assistant_sid, task_sid): - """ - Initialize the TaskActionsInstance - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - """ +class TaskActionsInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str): super(TaskActionsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'task_sid': payload.get('task_sid'), - 'url': payload.get('url'), - 'data': payload.get('data'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'task_sid' = payload.get('task_sid'), + 'url' = payload.get('url'), + 'data' = payload.get('data'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskActionsContext for this TaskActionsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsContext - """ if self._context is None: self._context = TaskActionsContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the Task associated with the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def task_sid(self): - """ - :returns: The SID of the Task associated with the resource - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the TaskActions resource - :rtype: unicode - """ - return self._properties['url'] + - @property - def data(self): - """ - :returns: The JSON string that specifies the actions that instruct the Assistant on how to perform the task - :rtype: dict + def __repr__(self): """ - return self._properties['data'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the TaskActionsInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched TaskActionsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - """ - return self._proxy.fetch() - 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 +class TaskActionsListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskActionsListInstanceList, self).__init__(version) - :returns: The updated TaskActionsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance - """ - return self._proxy.update(actions=actions, ) + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/task/task_statistics.py b/twilio/rest/autopilot/v1/assistant/task/task_statistics.py index 1eafecee75..d18b0cb70d 100644 --- a/twilio/rest/autopilot/v1/assistant/task/task_statistics.py +++ b/twilio/rest/autopilot/v1/assistant/task/task_statistics.py @@ -1,281 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskStatisticsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskStatisticsList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the Task for which the statistics were collected - - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsList - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsList - """ - super(TaskStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - def get(self): - """ - Constructs a TaskStatisticsContext - - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsContext - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsContext - """ - return TaskStatisticsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - def __call__(self): - """ - Constructs a TaskStatisticsContext - - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsContext - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsContext - """ - return TaskStatisticsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskStatisticsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the Task associated with the resource - :param task_sid: The SID of the Task for which the statistics were collected - - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsPage - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsPage - """ - super(TaskStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsInstance - """ - return TaskStatisticsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskStatisticsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskStatisticsContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - :param task_sid: The SID of the Task that is associated with the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsContext - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsContext - """ - super(TaskStatisticsContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Statistics'.format(**self._solution) - - def fetch(self): - """ - Fetch the TaskStatisticsInstance - - :returns: The fetched TaskStatisticsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskStatisticsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Statistics' + + + def fetch(self): + + """ + Fetch the TaskStatisticsInstance + + :returns: The fetched TaskStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskStatisticsInstance( + self._version, + payload, + assistant_sidtask_sid=self._solution['assistant_sid''task_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TaskStatisticsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, task_sid): - """ - Initialize the TaskStatisticsInstance - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsInstance - """ +class TaskStatisticsInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str): super(TaskStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'task_sid': payload.get('task_sid'), - 'samples_count': deserialize.integer(payload.get('samples_count')), - 'fields_count': deserialize.integer(payload.get('fields_count')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'task_sid' = payload.get('task_sid'), + 'samples_count' = payload.get('samples_count'), + 'fields_count' = payload.get('fields_count'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskStatisticsContext for this TaskStatisticsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsContext - """ if self._context is None: self._context = TaskStatisticsContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def assistant_sid(self): + def __repr__(self): """ - :returns: The SID of the Assistant that is the parent of the Task associated with the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['assistant_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def task_sid(self): - """ - :returns: The SID of the Task for which the statistics were collected - :rtype: unicode - """ - return self._properties['task_sid'] - @property - def samples_count(self): - """ - :returns: The total number of Samples associated with the Task - :rtype: unicode - """ - return self._properties['samples_count'] - @property - def fields_count(self): - """ - :returns: The total number of Fields associated with the Task - :rtype: unicode - """ - return self._properties['fields_count'] - - @property - def url(self): - """ - :returns: The absolute URL of the TaskStatistics resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the TaskStatisticsInstance +class TaskStatisticsListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskStatisticsListInstanceList, self).__init__(version) - :returns: The fetched TaskStatisticsInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/webhook.py b/twilio/rest/autopilot/v1/assistant/webhook.py index 6b593857fb..5ce0e4653d 100644 --- a/twilio/rest/autopilot/v1/assistant/webhook.py +++ b/twilio/rest/autopilot/v1/assistant/webhook.py @@ -1,474 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WebhookList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the WebhookList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookList - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookList - """ - super(WebhookList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/Webhooks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams WebhookInstance 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 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.autopilot.v1.assistant.webhook.WebhookInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists WebhookInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.autopilot.v1.assistant.webhook.WebhookInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WebhookInstance records from the API. - Request is executed immediately - - :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 WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WebhookPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WebhookInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WebhookPage(self._version, response, self._solution) - - def create(self, unique_name, events, webhook_url, webhook_method=values.unset): - """ - Create the WebhookInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode events: The list of space-separated events that this Webhook will subscribe to. - :param unicode webhook_url: The URL associated with this Webhook. - :param unicode webhook_method: The method to be used when calling the webhook's URL. - - :returns: The created WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'Events': events, - 'WebhookUrl': webhook_url, - 'WebhookMethod': webhook_method, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - return WebhookInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def get(self, sid): - """ - Constructs a WebhookContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext - """ - return WebhookContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WebhookContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext - """ - return WebhookContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WebhookPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the WebhookPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookPage - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookPage - """ - super(WebhookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WebhookInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - """ - return WebhookInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class WebhookContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the WebhookContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext - """ - super(WebhookContext, self).__init__(version) + def __init__(self, version: V1, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Webhooks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the WebhookInstance - - :returns: The fetched WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WebhookInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def update(self, unique_name=values.unset, events=values.unset, - webhook_url=values.unset, webhook_method=values.unset): - """ - Update the WebhookInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode events: The list of space-separated events that this Webhook will subscribe to. - :param unicode webhook_url: The URL associated with this Webhook. - :param unicode webhook_method: The method to be used when calling the webhook's URL. + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Webhooks/${sid}' + + + def delete(self): + + + """ + Deletes the WebhookInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The updated WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'Events': events, - 'WebhookUrl': webhook_url, - 'WebhookMethod': webhook_method, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WebhookInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return WebhookInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WebhookInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the WebhookInstance - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - """ +class WebhookInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): super(WebhookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'url': payload.get('url'), - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'events': payload.get('events'), - 'webhook_url': payload.get('webhook_url'), - 'webhook_method': payload.get('webhook_method'), + self._properties = { + 'url' = payload.get('url'), + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'events' = payload.get('events'), + 'webhook_url' = payload.get('webhook_url'), + 'webhook_method' = payload.get('webhook_method'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WebhookContext for this WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext - """ if self._context is None: self._context = WebhookContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context - @property - def url(self): - """ - :returns: The absolute URL of the Webhook resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def events(self): - """ - :returns: The list of space-separated events that this Webhook is subscribed to. - :rtype: unicode - """ - return self._properties['events'] - - @property - def webhook_url(self): - """ - :returns: The URL associated with this Webhook. - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The method used when calling the webhook's URL. - :rtype: unicode - """ - return self._properties['webhook_method'] - - def fetch(self): + def __repr__(self): """ - Fetch the WebhookInstance - - :returns: The fetched WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, unique_name=values.unset, events=values.unset, - webhook_url=values.unset, webhook_method=values.unset): - """ - Update the WebhookInstance - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode events: The list of space-separated events that this Webhook will subscribe to. - :param unicode webhook_url: The URL associated with this Webhook. - :param unicode webhook_method: The method to be used when calling the webhook's URL. - :returns: The updated WebhookInstance - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance - """ - return self._proxy.update( - unique_name=unique_name, - events=events, - webhook_url=webhook_url, - webhook_method=webhook_method, - ) - - def delete(self): - """ - Deletes the WebhookInstance +class WebhookListInstance(ListResource): + def __init__(self, version: V1, assistant_sid: str): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Webhooks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WebhookPage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/restore_assistant.py b/twilio/rest/autopilot/v1/restore_assistant.py index f61848ca59..3a33f315e4 100644 --- a/twilio/rest/autopilot/v1/restore_assistant.py +++ b/twilio/rest/autopilot/v1/restore_assistant.py @@ -1,239 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class RestoreAssistantList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the RestoreAssistantList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantList - :rtype: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantList - """ - super(RestoreAssistantList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Assistants/Restore'.format(**self._solution) - - def update(self, assistant): - """ - Update the RestoreAssistantInstance - :param unicode assistant: The unique string that identifies the resource - - :returns: The updated RestoreAssistantInstance - :rtype: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantInstance - """ - data = values.of({'Assistant': assistant, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RestoreAssistantInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RestoreAssistantPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the RestoreAssistantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantPage - :rtype: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantPage - """ - super(RestoreAssistantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RestoreAssistantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantInstance - :rtype: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantInstance - """ - return RestoreAssistantInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class RestoreAssistantInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload): - """ - Initialize the RestoreAssistantInstance - - :returns: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantInstance - :rtype: twilio.rest.autopilot.v1.restore_assistant.RestoreAssistantInstance - """ super(RestoreAssistantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'unique_name': payload.get('unique_name'), - 'friendly_name': payload.get('friendly_name'), - 'needs_model_build': payload.get('needs_model_build'), - 'latest_model_build_sid': payload.get('latest_model_build_sid'), - 'log_queries': payload.get('log_queries'), - 'development_stage': payload.get('development_stage'), - 'callback_url': payload.get('callback_url'), - 'callback_events': payload.get('callback_events'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'unique_name' = payload.get('unique_name'), + 'friendly_name' = payload.get('friendly_name'), + 'needs_model_build' = payload.get('needs_model_build'), + 'latest_model_build_sid' = payload.get('latest_model_build_sid'), + 'log_queries' = payload.get('log_queries'), + 'development_stage' = payload.get('development_stage'), + 'callback_url' = payload.get('callback_url'), + 'callback_events' = payload.get('callback_events'), } - # Context self._context = None - self._solution = {} - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + self._solution = { + + } @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] + def _proxy(self): + if self._context is None: + self._context = RestoreAssistantContext( + self._version, + + ) + return self._context - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def needs_model_build(self): - """ - :returns: Whether model needs to be rebuilt - :rtype: bool - """ - return self._properties['needs_model_build'] - - @property - def latest_model_build_sid(self): + def __repr__(self): """ - :returns: Reserved - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['latest_model_build_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def log_queries(self): - """ - :returns: Whether queries should be logged and kept after training - :rtype: bool - """ - return self._properties['log_queries'] - @property - def development_stage(self): - """ - :returns: A string describing the state of the assistant. - :rtype: unicode - """ - return self._properties['development_stage'] - @property - def callback_url(self): - """ - :returns: Reserved - :rtype: unicode - """ - return self._properties['callback_url'] +class RestoreAssistantListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RestoreAssistantListInstanceList, self).__init__(version) - @property - def callback_events(self): - """ - :returns: Reserved - :rtype: unicode - """ - return self._properties['callback_events'] + # Path Solution + self._solution = { } + self._uri = '/Assistants/Restore' + + + def update(self, body): + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' + diff --git a/twilio/rest/bulkexports/__init__.py b/twilio/rest/bulkexports/__init__.py index 876febf040..7fd5481e9a 100644 --- a/twilio/rest/bulkexports/__init__.py +++ b/twilio/rest/bulkexports/__init__.py @@ -1,59 +1,62 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.bulkexports.v1 import V1 + Twilio - Bulkexports + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Bulkexports(Domain): +from twilio.base.domain import Domain +from twilio.rest.Bulkexports.v1 import V1 +class Bulkexports(Domain): def __init__(self, twilio): """ Initialize the Bulkexports Domain :returns: Domain for Bulkexports - :rtype: twilio.rest.bulkexports.Bulkexports + :rtype: twilio.rest.v1.Bulkexports """ super(Bulkexports, self).__init__(twilio) - - self.base_url = 'https://bulkexports.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Bulkexports.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of bulkexports - :rtype: twilio.rest.bulkexports.v1.V1 + :returns: Versions v1 of Bulkexports + :rtype: twilio.rest.Bulkexports.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def exports(self): """ - :rtype: twilio.rest.bulkexports.v1.export.ExportList + :rtype: twilio.rest.v1.exports """ return self.v1.exports + @property def export_configuration(self): """ - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationList + :rtype: twilio.rest.v1.export_configuration """ return self.v1.export_configuration + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/bulkexports/v1/.openapi-generator-ignore b/twilio/rest/bulkexports/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/bulkexports/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/bulkexports/v1/.openapi-generator/FILES b/twilio/rest/bulkexports/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..f0e59c535c --- /dev/null +++ b/twilio/rest/bulkexports/v1/.openapi-generator/FILES @@ -0,0 +1,11 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +export.py +export/day.py +export/export_custom_job.py +export/job.py +export_configuration.py diff --git a/twilio/rest/bulkexports/v1/.openapi-generator/VERSION b/twilio/rest/bulkexports/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/bulkexports/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/bulkexports/v1/export.py b/twilio/rest/bulkexports/v1/export.py new file mode 100644 index 0000000000..17d8287e52 --- /dev/null +++ b/twilio/rest/bulkexports/v1/export.py @@ -0,0 +1,127 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Bulkexports + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.export.day import DayListInstancefrom twilio.rest.export.export_custom_job import ExportCustomJobListInstancefrom twilio.rest.export.job import JobListInstance + + +class ExportContext(InstanceContext): + def __init__(self, version: V1, resource_type: str): + # TODO: needs autogenerated docs + super(ExportContextList, self).__init__(version) + + # Path Solution + self._solution = { resource_type, } + self._uri = '/Exports/${resource_type}' + + self._days = None + self._export_custom_jobs = None + + def fetch(self): + + """ + Fetch the ExportInstance + + :returns: The fetched ExportInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExportInstance( + self._version, + payload, + resource_type=self._solution['resource_type'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ExportInstance(InstanceResource): + def __init__(self, version, payload, resource_type: str): + super(ExportInstance, self).__init__(version) + self._properties = { + 'resource_type' = payload.get('resource_type'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'resource_type': resource_type or self._properties['resource_type'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ExportContext( + self._version, + resource_type=self._solution['resource_type'], + ) + return self._context + + @property + def days(self): + return self._proxy.days + @property + def export_custom_jobs(self): + return self._proxy.export_custom_jobs + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ExportListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ExportListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Exports' + + self._jobs = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/bulkexports/v1/export/day.py b/twilio/rest/bulkexports/v1/export/day.py index 0160f15839..271954feef 100644 --- a/twilio/rest/bulkexports/v1/export/day.py +++ b/twilio/rest/bulkexports/v1/export/day.py @@ -1,336 +1,128 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Bulkexports + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DayList(ListResource): - - def __init__(self, version, resource_type): - """ - Initialize the DayList - - :param Version version: Version that contains the resource - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export.day.DayList - :rtype: twilio.rest.bulkexports.v1.export.day.DayList - """ - super(DayList, self).__init__(version) - - # Path Solution - self._solution = {'resource_type': resource_type, } - self._uri = '/Exports/{resource_type}/Days'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DayInstance 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 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.bulkexports.v1.export.day.DayInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DayInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.bulkexports.v1.export.day.DayInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DayInstance records from the API. - Request is executed immediately - - :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 DayInstance - :rtype: twilio.rest.bulkexports.v1.export.day.DayPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DayPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DayInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DayInstance - :rtype: twilio.rest.bulkexports.v1.export.day.DayPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DayPage(self._version, response, self._solution) - - def get(self, day): - """ - Constructs a DayContext - - :param day: The date of the data in the file - - :returns: twilio.rest.bulkexports.v1.export.day.DayContext - :rtype: twilio.rest.bulkexports.v1.export.day.DayContext - """ - return DayContext(self._version, resource_type=self._solution['resource_type'], day=day, ) - - def __call__(self, day): - """ - Constructs a DayContext - - :param day: The date of the data in the file - - :returns: twilio.rest.bulkexports.v1.export.day.DayContext - :rtype: twilio.rest.bulkexports.v1.export.day.DayContext - """ - return DayContext(self._version, resource_type=self._solution['resource_type'], day=day, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DayPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DayPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export.day.DayPage - :rtype: twilio.rest.bulkexports.v1.export.day.DayPage - """ - super(DayPage, self).__init__(version, response) - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DayInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.bulkexports.v1.export.day.DayInstance - :rtype: twilio.rest.bulkexports.v1.export.day.DayInstance - """ - return DayInstance(self._version, payload, resource_type=self._solution['resource_type'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class DayContext(InstanceContext): - - def __init__(self, version, resource_type, day): - """ - Initialize the DayContext - - :param Version version: Version that contains the resource - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - :param day: The date of the data in the file - - :returns: twilio.rest.bulkexports.v1.export.day.DayContext - :rtype: twilio.rest.bulkexports.v1.export.day.DayContext - """ - super(DayContext, self).__init__(version) + def __init__(self, version: V1, resource_type: str, day: str): + # TODO: needs autogenerated docs + super(DayContextList, self).__init__(version) # Path Solution - self._solution = {'resource_type': resource_type, 'day': day, } - self._uri = '/Exports/{resource_type}/Days/{day}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DayInstance - - :returns: The fetched DayInstance - :rtype: twilio.rest.bulkexports.v1.export.day.DayInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DayInstance( - self._version, - payload, - resource_type=self._solution['resource_type'], - day=self._solution['day'], - ) + self._solution = { resource_type, day, } + self._uri = '/Exports/${resource_type}/Days/${day}' + + + def fetch(self): + + """ + Fetch the DayInstance + + :returns: The fetched DayInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DayInstance( + self._version, + payload, + resource_typeday=self._solution['resource_type''day'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DayInstance(InstanceResource): - def __init__(self, version, payload, resource_type, day=None): - """ - Initialize the DayInstance - :returns: twilio.rest.bulkexports.v1.export.day.DayInstance - :rtype: twilio.rest.bulkexports.v1.export.day.DayInstance - """ +class DayInstance(InstanceResource): + def __init__(self, version, payload, resource_type: str, day: str): super(DayInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'redirect_to': payload.get('redirect_to'), - 'day': payload.get('day'), - 'size': deserialize.integer(payload.get('size')), - 'create_date': payload.get('create_date'), - 'friendly_name': payload.get('friendly_name'), - 'resource_type': payload.get('resource_type'), + self._properties = { + 'redirect_to' = payload.get('redirect_to'), } - # Context self._context = None - self._solution = {'resource_type': resource_type, 'day': day or self._properties['day'], } + self._solution = { + 'resource_type': resource_type or self._properties['resource_type']'day': day or self._properties['day'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DayContext for this DayInstance - :rtype: twilio.rest.bulkexports.v1.export.day.DayContext - """ if self._context is None: self._context = DayContext( self._version, - resource_type=self._solution['resource_type'], - day=self._solution['day'], + resource_type=self._solution['resource_type'],day=self._solution['day'], ) return self._context - @property - def redirect_to(self): - """ - :returns: The redirect_to - :rtype: unicode - """ - return self._properties['redirect_to'] + - @property - def day(self): + def __repr__(self): """ - :returns: The date of the data in the file - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['day'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def size(self): - """ - :returns: Size of the file in bytes - :rtype: unicode - """ - return self._properties['size'] - @property - def create_date(self): - """ - :returns: The date when resource is created - :rtype: unicode - """ - return self._properties['create_date'] - @property - def friendly_name(self): - """ - :returns: The friendly name specified when creating the job - :rtype: unicode - """ - return self._properties['friendly_name'] +class DayListInstance(ListResource): + def __init__(self, version: V1, resource_type: str): + # TODO: needs autogenerated docs + super(DayListInstanceList, self).__init__(version) - @property - def resource_type(self): - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - :rtype: unicode - """ - return self._properties['resource_type'] + # Path Solution + self._solution = { resource_type, } + self._uri = '/Exports/${resource_type}/Days' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the DayInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched DayInstance - :rtype: twilio.rest.bulkexports.v1.export.day.DayInstance - """ - return self._proxy.fetch() + return DayPage(self._version, payload, resource_type=self._solution['resource_type']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index 148f9abca7..5198299967 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -1,330 +1,111 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ExportCustomJobList(ListResource): - - def __init__(self, version, resource_type): - """ - Initialize the ExportCustomJobList - - :param Version version: Version that contains the resource - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobList - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobList - """ - super(ExportCustomJobList, self).__init__(version) - - # Path Solution - self._solution = {'resource_type': resource_type, } - self._uri = '/Exports/{resource_type}/Jobs'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ExportCustomJobInstance 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. + Twilio - Bulkexports + This is the public Twilio REST API. - :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.bulkexports.v1.export.export_custom_job.ExportCustomJobInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ExportCustomJobInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.bulkexports.v1.export.export_custom_job.ExportCustomJobInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ExportCustomJobInstance records from the API. - Request is executed immediately - - :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 ExportCustomJobInstance - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - response = self._version.page(method='GET', uri=self._uri, params=data, ) - return ExportCustomJobPage(self._version, response, self._solution) +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - def get_page(self, target_url): - """ - Retrieve a specific page of ExportCustomJobInstance records from the API. - Request is executed immediately +from twilio.base.page import Page - :param str target_url: API-generated URL for the requested results page - :returns: Page of ExportCustomJobInstance - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return ExportCustomJobPage(self._version, response, self._solution) - def create(self, start_day, end_day, friendly_name, webhook_url=values.unset, - webhook_method=values.unset, email=values.unset): - """ - Create the ExportCustomJobInstance - :param unicode start_day: The start day for the custom export specified as a string in the format of yyyy-mm-dd - :param unicode end_day: The end day for the custom export specified as a string in the format of yyyy-mm-dd. End day is inclusive and must be 2 days earlier than the current UTC day. - :param unicode friendly_name: The friendly name specified when creating the job - :param unicode webhook_url: The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. - :param unicode webhook_method: This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. - :param unicode email: The optional email to send the completion notification to +class ExportCustomJobInstance(InstanceResource): + def __init__(self, version, payload, resource_type: str): + super(ExportCustomJobInstance, self).__init__(version) + self._properties = { + 'friendly_name' = payload.get('friendly_name'), + 'resource_type' = payload.get('resource_type'), + 'start_day' = payload.get('start_day'), + 'end_day' = payload.get('end_day'), + 'webhook_url' = payload.get('webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'email' = payload.get('email'), + 'job_sid' = payload.get('job_sid'), + 'details' = payload.get('details'), + 'job_queue_position' = payload.get('job_queue_position'), + 'estimated_completion_time' = payload.get('estimated_completion_time'), + } - :returns: The created ExportCustomJobInstance - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobInstance - """ - data = values.of({ - 'StartDay': start_day, - 'EndDay': end_day, - 'FriendlyName': friendly_name, - 'WebhookUrl': webhook_url, - 'WebhookMethod': webhook_method, - 'Email': email, - }) + self._context = None + self._solution = { + 'resource_type': resource_type or self._properties['resource_type'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = ExportCustomJobContext( + self._version, + resource_type=self._solution['resource_type'], + ) + return self._context - return ExportCustomJobInstance( - self._version, - payload, - resource_type=self._solution['resource_type'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class ExportCustomJobPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the ExportCustomJobPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobPage - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobPage - """ - super(ExportCustomJobPage, self).__init__(version, response) +class ExportCustomJobListInstance(ListResource): + def __init__(self, version: V1, resource_type: str): + # TODO: needs autogenerated docs + super(ExportCustomJobListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExportCustomJobInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobInstance - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobInstance - """ - return ExportCustomJobInstance( - self._version, - payload, - resource_type=self._solution['resource_type'], - ) + self._solution = { resource_type, } + self._uri = '/Exports/${resource_type}/Jobs' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ExportCustomJobInstance(self._version, payload, resource_type=self._solution['resource_type']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ExportCustomJobPage(self._version, payload, resource_type=self._solution['resource_type']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class ExportCustomJobInstance(InstanceResource): - - class Status(object): - ERRORDURINGRUN = "ErrorDuringRun" - SUBMITTED = "Submitted" - RUNNING = "Running" - COMPLETEDEMPTYRECORDS = "CompletedEmptyRecords" - COMPLETED = "Completed" - FAILED = "Failed" - RUNNINGTOBEDELETED = "RunningToBeDeleted" - DELETEDBYUSERREQUEST = "DeletedByUserRequest" - - def __init__(self, version, payload, resource_type): - """ - Initialize the ExportCustomJobInstance - - :returns: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobInstance - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobInstance - """ - super(ExportCustomJobInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'resource_type': payload.get('resource_type'), - 'start_day': payload.get('start_day'), - 'end_day': payload.get('end_day'), - 'webhook_url': payload.get('webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'email': payload.get('email'), - 'job_sid': payload.get('job_sid'), - 'details': payload.get('details'), - 'job_queue_position': payload.get('job_queue_position'), - 'estimated_completion_time': payload.get('estimated_completion_time'), - } - - # Context - self._context = None - self._solution = {'resource_type': resource_type, } - - @property - def friendly_name(self): - """ - :returns: The friendly name specified when creating the job - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def resource_type(self): - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def start_day(self): - """ - :returns: The start day for the custom export specified as a string in the format of yyyy-MM-dd - :rtype: unicode - """ - return self._properties['start_day'] - - @property - def end_day(self): - """ - :returns: The end day for the custom export specified as a string in the format of yyyy-MM-dd. This will be the last day exported. For instance, to export a single day, choose the same day for start and end day. To export the first 4 days of July, you would set the start date to 2020-07-01 and the end date to 2020-07-04. The end date must be the UTC day before yesterday. - :rtype: unicode - """ - return self._properties['end_day'] - - @property - def webhook_url(self): - """ - :returns: The optional webhook url called on completion - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def webhook_method(self): - """ - :returns: This is the method used to call the webhook - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def email(self): - """ - :returns: The optional email to send the completion notification to - :rtype: unicode - """ - return self._properties['email'] - - @property - def job_sid(self): - """ - :returns: The unique job_sid returned when the custom export was created. This can be used to look up the status of the job. - :rtype: unicode - """ - return self._properties['job_sid'] - - @property - def details(self): - """ - :returns: The details of a job state which is an object that contains a `status` string, a day count integer, and list of days in the job - :rtype: dict - """ - return self._properties['details'] - - @property - def job_queue_position(self): - """ - :returns: This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease - :rtype: unicode - """ - return self._properties['job_queue_position'] - - @property - def estimated_completion_time(self): - """ - :returns: this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position - :rtype: unicode - """ - return self._properties['estimated_completion_time'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/bulkexports/v1/export/job.py b/twilio/rest/bulkexports/v1/export/job.py index 745d01f6ca..b24a105277 100644 --- a/twilio/rest/bulkexports/v1/export/job.py +++ b/twilio/rest/bulkexports/v1/export/job.py @@ -1,327 +1,138 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Bulkexports + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class JobList(ListResource): - - def __init__(self, version): - """ - Initialize the JobList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.bulkexports.v1.export.job.JobList - :rtype: twilio.rest.bulkexports.v1.export.job.JobList - """ - super(JobList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, job_sid): - """ - Constructs a JobContext - - :param job_sid: The unique string that that we created to identify the Bulk Export job - - :returns: twilio.rest.bulkexports.v1.export.job.JobContext - :rtype: twilio.rest.bulkexports.v1.export.job.JobContext - """ - return JobContext(self._version, job_sid=job_sid, ) - - def __call__(self, job_sid): - """ - Constructs a JobContext - - :param job_sid: The unique string that that we created to identify the Bulk Export job - - :returns: twilio.rest.bulkexports.v1.export.job.JobContext - :rtype: twilio.rest.bulkexports.v1.export.job.JobContext - """ - return JobContext(self._version, job_sid=job_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class JobPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the JobPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.bulkexports.v1.export.job.JobPage - :rtype: twilio.rest.bulkexports.v1.export.job.JobPage - """ - super(JobPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of JobInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.bulkexports.v1.export.job.JobInstance - :rtype: twilio.rest.bulkexports.v1.export.job.JobInstance - """ - return JobInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class JobContext(InstanceContext): - - def __init__(self, version, job_sid): - """ - Initialize the JobContext - - :param Version version: Version that contains the resource - :param job_sid: The unique string that that we created to identify the Bulk Export job - - :returns: twilio.rest.bulkexports.v1.export.job.JobContext - :rtype: twilio.rest.bulkexports.v1.export.job.JobContext - """ - super(JobContext, self).__init__(version) + def __init__(self, version: V1, job_sid: str): + # TODO: needs autogenerated docs + super(JobContextList, self).__init__(version) # Path Solution - self._solution = {'job_sid': job_sid, } - self._uri = '/Exports/Jobs/{job_sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the JobInstance - - :returns: The fetched JobInstance - :rtype: twilio.rest.bulkexports.v1.export.job.JobInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return JobInstance(self._version, payload, job_sid=self._solution['job_sid'], ) - - def delete(self): - """ - Deletes the JobInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { job_sid, } + self._uri = '/Exports/Jobs/${job_sid}' + + + def delete(self): + + + """ + Deletes the JobInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the JobInstance + + :returns: The fetched JobInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return JobInstance( + self._version, + payload, + job_sid=self._solution['job_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class JobInstance(InstanceResource): - class Status(object): - ERRORDURINGRUN = "ErrorDuringRun" - SUBMITTED = "Submitted" - RUNNING = "Running" - COMPLETEDEMPTYRECORDS = "CompletedEmptyRecords" - COMPLETED = "Completed" - FAILED = "Failed" - RUNNINGTOBEDELETED = "RunningToBeDeleted" - DELETEDBYUSERREQUEST = "DeletedByUserRequest" - - def __init__(self, version, payload, job_sid=None): - """ - Initialize the JobInstance - - :returns: twilio.rest.bulkexports.v1.export.job.JobInstance - :rtype: twilio.rest.bulkexports.v1.export.job.JobInstance - """ +class JobInstance(InstanceResource): + def __init__(self, version, payload, job_sid: str): super(JobInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'resource_type': payload.get('resource_type'), - 'friendly_name': payload.get('friendly_name'), - 'details': payload.get('details'), - 'start_day': payload.get('start_day'), - 'end_day': payload.get('end_day'), - 'job_sid': payload.get('job_sid'), - 'webhook_url': payload.get('webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'email': payload.get('email'), - 'url': payload.get('url'), - 'job_queue_position': payload.get('job_queue_position'), - 'estimated_completion_time': payload.get('estimated_completion_time'), + self._properties = { + 'resource_type' = payload.get('resource_type'), + 'friendly_name' = payload.get('friendly_name'), + 'details' = payload.get('details'), + 'start_day' = payload.get('start_day'), + 'end_day' = payload.get('end_day'), + 'job_sid' = payload.get('job_sid'), + 'webhook_url' = payload.get('webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'email' = payload.get('email'), + 'url' = payload.get('url'), + 'job_queue_position' = payload.get('job_queue_position'), + 'estimated_completion_time' = payload.get('estimated_completion_time'), } - # Context self._context = None - self._solution = {'job_sid': job_sid or self._properties['job_sid'], } + self._solution = { + 'job_sid': job_sid or self._properties['job_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: JobContext for this JobInstance - :rtype: twilio.rest.bulkexports.v1.export.job.JobContext - """ if self._context is None: - self._context = JobContext(self._version, job_sid=self._solution['job_sid'], ) + self._context = JobContext( + self._version, + job_sid=self._solution['job_sid'], + ) return self._context - @property - def resource_type(self): - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def friendly_name(self): - """ - :returns: The friendly name specified when creating the job - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def details(self): - """ - :returns: The details of a job state which is an object that contains a `status` string, a day count integer, and list of days in the job - :rtype: dict - """ - return self._properties['details'] + - @property - def start_day(self): - """ - :returns: The start time for the export specified when creating the job - :rtype: unicode - """ - return self._properties['start_day'] - - @property - def end_day(self): - """ - :returns: The end time for the export specified when creating the job - :rtype: unicode - """ - return self._properties['end_day'] - - @property - def job_sid(self): - """ - :returns: The job_sid returned when the export was created - :rtype: unicode - """ - return self._properties['job_sid'] - - @property - def webhook_url(self): - """ - :returns: The optional webhook url called on completion - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def webhook_method(self): - """ - :returns: This is the method used to call the webhook - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def email(self): - """ - :returns: The optional email to send the completion notification to - :rtype: unicode - """ - return self._properties['email'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def job_queue_position(self): - """ - :returns: This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease - :rtype: unicode - """ - return self._properties['job_queue_position'] - - @property - def estimated_completion_time(self): + def __repr__(self): """ - :returns: this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['estimated_completion_time'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the JobInstance - :returns: The fetched JobInstance - :rtype: twilio.rest.bulkexports.v1.export.job.JobInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the JobInstance +class JobListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(JobListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/bulkexports/v1/export_configuration.py b/twilio/rest/bulkexports/v1/export_configuration.py index 2b263f3ccb..3ebb83fe51 100644 --- a/twilio/rest/bulkexports/v1/export_configuration.py +++ b/twilio/rest/bulkexports/v1/export_configuration.py @@ -1,203 +1,95 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Bulkexports + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ExportConfigurationList(ListResource): - - def __init__(self, version): - """ - Initialize the ExportConfigurationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationList - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationList - """ - super(ExportConfigurationList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, resource_type): - """ - Constructs a ExportConfigurationContext - - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationContext - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationContext - """ - return ExportConfigurationContext(self._version, resource_type=resource_type, ) - - def __call__(self, resource_type): - """ - Constructs a ExportConfigurationContext - - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationContext - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationContext - """ - return ExportConfigurationContext(self._version, resource_type=resource_type, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExportConfigurationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExportConfigurationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationPage - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationPage - """ - super(ExportConfigurationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExportConfigurationInstance - :param dict payload: Payload response from the API - :returns: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - """ - return ExportConfigurationInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ExportConfigurationContext(InstanceContext): - - def __init__(self, version, resource_type): - """ - Initialize the ExportConfigurationContext - - :param Version version: Version that contains the resource - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationContext - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationContext - """ - super(ExportConfigurationContext, self).__init__(version) + def __init__(self, version: V1, resource_type: str): + # TODO: needs autogenerated docs + super(ExportConfigurationContextList, self).__init__(version) # Path Solution - self._solution = {'resource_type': resource_type, } - self._uri = '/Exports/{resource_type}/Configuration'.format(**self._solution) - - def fetch(self): - """ - Fetch the ExportConfigurationInstance - - :returns: The fetched ExportConfigurationInstance - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExportConfigurationInstance( - self._version, - payload, - resource_type=self._solution['resource_type'], - ) - - def update(self, enabled=values.unset, webhook_url=values.unset, - webhook_method=values.unset): - """ - Update the ExportConfigurationInstance - - :param bool enabled: Whether files are automatically generated - :param unicode webhook_url: URL targeted at export - :param unicode webhook_method: Whether to GET or POST to the webhook url - - :returns: The updated ExportConfigurationInstance - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - """ - data = values.of({'Enabled': enabled, 'WebhookUrl': webhook_url, 'WebhookMethod': webhook_method, }) + self._solution = { resource_type, } + self._uri = '/Exports/${resource_type}/Configuration' + + + def fetch(self): + + """ + Fetch the ExportConfigurationInstance + + :returns: The fetched ExportConfigurationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExportConfigurationInstance( + self._version, + payload, + resource_type=self._solution['resource_type'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ExportConfigurationInstance( - self._version, - payload, - resource_type=self._solution['resource_type'], - ) + return ExportConfigurationInstance(self._version, payload, resource_type=self._solution['resource_type'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ExportConfigurationInstance(InstanceResource): - def __init__(self, version, payload, resource_type=None): - """ - Initialize the ExportConfigurationInstance - :returns: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - """ +class ExportConfigurationInstance(InstanceResource): + def __init__(self, version, payload, resource_type: str): super(ExportConfigurationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'enabled': payload.get('enabled'), - 'webhook_url': payload.get('webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'resource_type': payload.get('resource_type'), - 'url': payload.get('url'), + self._properties = { + 'enabled' = payload.get('enabled'), + 'webhook_url' = payload.get('webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'resource_type' = payload.get('resource_type'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'resource_type': resource_type or self._properties['resource_type'], } + self._solution = { + 'resource_type': resource_type or self._properties['resource_type'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExportConfigurationContext for this ExportConfigurationInstance - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationContext - """ if self._context is None: self._context = ExportConfigurationContext( self._version, @@ -205,75 +97,35 @@ def _proxy(self): ) return self._context - @property - def enabled(self): - """ - :returns: Whether files are automatically generated - :rtype: bool - """ - return self._properties['enabled'] + - @property - def webhook_url(self): - """ - :returns: URL targeted at export - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def webhook_method(self): - """ - :returns: Whether to GET or POST to the webhook url - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def resource_type(self): - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the ExportConfigurationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched ExportConfigurationInstance - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - """ - return self._proxy.fetch() - def update(self, enabled=values.unset, webhook_url=values.unset, - webhook_method=values.unset): - """ - Update the ExportConfigurationInstance - :param bool enabled: Whether files are automatically generated - :param unicode webhook_url: URL targeted at export - :param unicode webhook_method: Whether to GET or POST to the webhook url +class ExportConfigurationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ExportConfigurationListInstanceList, self).__init__(version) - :returns: The updated ExportConfigurationInstance - :rtype: twilio.rest.bulkexports.v1.export_configuration.ExportConfigurationInstance - """ - return self._proxy.update(enabled=enabled, webhook_url=webhook_url, webhook_method=webhook_method, ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/__init__.py b/twilio/rest/chat/__init__.py index 43ab832c07..5f0de8d5b2 100644 --- a/twilio/rest/chat/__init__.py +++ b/twilio/rest/chat/__init__.py @@ -1,90 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.chat.v1 import V1 -from twilio.rest.chat.v2 import V2 -from twilio.rest.chat.v3 import V3 + Twilio - Chat + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Chat(Domain): +from twilio.base.domain import Domain +from twilio.rest.Chat.v3 import V3 +class Chat(Domain): def __init__(self, twilio): """ Initialize the Chat Domain :returns: Domain for Chat - :rtype: twilio.rest.chat.Chat + :rtype: twilio.rest.v3.Chat """ super(Chat, self).__init__(twilio) - - self.base_url = 'https://chat.twilio.com' - - # Versions - self._v1 = None - self._v2 = None - self._v3 = None - - @property - def v1(self): - """ - :returns: Version v1 of chat - :rtype: twilio.rest.chat.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 - - @property - def v2(self): - """ - :returns: Version v2 of chat - :rtype: twilio.rest.chat.v2.V2 - """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 - - @property - def v3(self): - """ - :returns: Version v3 of chat - :rtype: twilio.rest.chat.v3.V3 - """ - if self._v3 is None: - self._v3 = V3(self) - return self._v3 - - @property - def credentials(self): - """ - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - return self.v2.credentials + self.base_url = 'https://Chat.twilio.com' + self._V3 = None @property - def services(self): + def V3(self): """ - :rtype: twilio.rest.chat.v2.service.ServiceList + :returns: Versions v3 of Chat + :rtype: twilio.rest.Chat.v3 """ - return self.v2.services + if self._V3 is None: + self._V3 = V3(self) + return self._V3 + @property def channels(self): """ - :rtype: twilio.rest.chat.v3.channel.ChannelList + :rtype: twilio.rest.v3.channels """ return self.v3.channels + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/chat/v1/.openapi-generator-ignore b/twilio/rest/chat/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/chat/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/chat/v1/.openapi-generator/FILES b/twilio/rest/chat/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..11ccc08c44 --- /dev/null +++ b/twilio/rest/chat/v1/.openapi-generator/FILES @@ -0,0 +1,19 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +credential.py +service.py +service/channel.py +service/channel/invite.py +service/channel/member.py +service/channel/message.py +service/role.py +service/user.py +service/user/user_channel.py diff --git a/twilio/rest/chat/v1/.openapi-generator/VERSION b/twilio/rest/chat/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/chat/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index d09d274cea..0cdb5141cd 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -1,450 +1,167 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CredentialList(ListResource): - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v1.credential.CredentialList - :rtype: twilio.rest.chat.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance 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 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.chat.v1.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v1.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :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 CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create the CredentialInstance - - :param CredentialInstance.PushService type: The type of push-notification service the credential is for - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate - :param unicode private_key: [APN only] The URL encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential - :param unicode secret: [FCM only] The Server key of your project from Firebase console - - :returns: The created CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, ) - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v1.credential.CredentialPage - :rtype: twilio.rest.chat.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.credential.CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CredentialContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.credential.CredentialContext - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CredentialContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate - :param unicode private_key: [APN only] The URL encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential - :param unicode secret: [FCM only] The Server key of your project from Firebase console - - :returns: The updated CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Credentials/${sid}' + + + def delete(self): + + + """ + Deletes the CredentialInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialInstance + + :returns: The fetched CredentialInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CredentialInstance(InstanceResource): + return '' - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - :returns: twilio.rest.chat.v1.credential.CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ +class CredentialInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'sandbox': payload.get('sandbox'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'sandbox' = payload.get('sandbox'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialContext - """ if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) + self._context = CredentialContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type of push-notification service the credential is for - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: [APN only] Whether to send the credential to sandbox APNs - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Credential resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): + def __repr__(self): """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate - :param unicode private_key: [APN only] The URL encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential - :param unicode secret: [FCM only] The Server key of your project from Firebase console - :returns: The updated CredentialInstance - :rtype: twilio.rest.chat.v1.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance +class CredentialListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/Credentials' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service.py b/twilio/rest/chat/v1/service.py new file mode 100644 index 0000000000..a390746ce1 --- /dev/null +++ b/twilio/rest/chat/v1/service.py @@ -0,0 +1,192 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._channels = None + self._roles = None + self._users = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'default_service_role_sid' = payload.get('default_service_role_sid'), + 'default_channel_role_sid' = payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' = payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' = payload.get('read_status_enabled'), + 'reachability_enabled' = payload.get('reachability_enabled'), + 'typing_indicator_timeout' = payload.get('typing_indicator_timeout'), + 'consumption_report_interval' = payload.get('consumption_report_interval'), + 'limits' = payload.get('limits'), + 'webhooks' = payload.get('webhooks'), + 'pre_webhook_url' = payload.get('pre_webhook_url'), + 'post_webhook_url' = payload.get('post_webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'webhook_filters' = payload.get('webhook_filters'), + 'notifications' = payload.get('notifications'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def channels(self): + return self._proxy.channels + @property + def roles(self): + return self._proxy.roles + @property + def users(self): + return self._proxy.users + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/chat/v1/service/channel.py b/twilio/rest/chat/v1/service/channel.py new file mode 100644 index 0000000000..e276c464d6 --- /dev/null +++ b/twilio/rest/chat/v1/service/channel.py @@ -0,0 +1,185 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstance + + +class ChannelContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None + self._members = None + self._messages = None + + def delete(self): + + + """ + Deletes the ChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ChannelInstance + + :returns: The fetched ChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ChannelInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(ChannelInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'attributes' = payload.get('attributes'), + 'type' = payload.get('type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + 'members_count' = payload.get('members_count'), + 'messages_count' = payload.get('messages_count'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ChannelContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def invites(self): + return self._proxy.invites + @property + def members(self): + return self._proxy.members + @property + def messages(self): + return self._proxy.messages + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ChannelListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(ChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py index d569c62cdb..9eeb5e2fef 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,433 +19,140 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class InviteList(ListResource): - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the InviteList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel the new resource belongs to - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - super(InviteList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create the InviteInstance - - :param unicode identity: The `identity` value that identifies the new resource's User - :param unicode role_sid: The Role assigned to the new member - - :returns: The created InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams InviteInstance 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 list[unicode] identity: The `identity` value of the resources to read - :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.chat.v1.service.channel.invite.InviteInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists InviteInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[unicode] identity: The `identity` value of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v1.service.channel.invite.InviteInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - 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 list[unicode] identity: The `identity` value of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - data = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return InvitePage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of InviteInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InvitePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InviteContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InviteContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class InvitePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the InvitePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel the new resource belongs to - - :returns: twilio.rest.chat.v1.service.channel.invite.InvitePage - :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage - """ - super(InvitePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InviteInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class InviteContext(InstanceContext): - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the InviteContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param channel_sid: The SID of the Channel the resource to fetch belongs to - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ - super(InviteContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InviteContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the InviteInstance - - :returns: The fetched InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites/${sid}' + + + def delete(self): + + + """ + Deletes the InviteInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the InviteInstance + + :returns: The fetched InviteInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InviteInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class InviteInstance(InstanceResource): - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the InviteInstance - :returns: twilio.rest.chat.v1.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ +class InviteInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): super(InviteInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'channel_sid': payload.get('channel_sid'), - 'service_sid': payload.get('service_sid'), - 'identity': payload.get('identity'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'role_sid': payload.get('role_sid'), - 'created_by': payload.get('created_by'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'created_by' = payload.get('created_by'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InviteContext for this InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteContext - """ if self._context is None: self._context = InviteContext( self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The SID of the Channel the new resource belongs to - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The SID of the Role assigned to the member - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def created_by(self): - """ - :returns: The identity of the User that created the invite - :rtype: unicode - """ - return self._properties['created_by'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Invite resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the InviteInstance - :returns: The fetched InviteInstance - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the InviteInstance +class InviteListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(InviteListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InviteInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InvitePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py index 727642c0bd..285083351f 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,481 +19,152 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MemberList(ListResource): - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The unique ID of the Channel for the member - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create the MemberInstance - - :param unicode identity: The `identity` value that identifies the new resource's User - :param unicode role_sid: The SID of the Role to assign to the member - :returns: The created MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams MemberInstance 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 list[unicode] identity: The `identity` value of the resources to read - :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.chat.v1.service.channel.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[unicode] identity: The `identity` value of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v1.service.channel.member.MemberInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :param list[unicode] identity: The `identity` value of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - data = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MemberContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MemberContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MemberPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The unique ID of the Channel for the member - - :returns: twilio.rest.chat.v1.service.channel.member.MemberPage - :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of MemberInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class MemberContext(InstanceContext): - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param channel_sid: The unique ID of the channel the member belongs to - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ - super(MemberContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MemberContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the MemberInstance - - :returns: The fetched MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MemberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The SID of the Role to assign to the member - :param unicode last_consumed_message_index: The index of the last consumed Message for the Channel for the Member - - :returns: The updated MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - data = values.of({'RoleSid': role_sid, 'LastConsumedMessageIndex': last_consumed_message_index, }) + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members/${sid}' + + + def delete(self): + + + """ + Deletes the MemberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MemberInstance + + :returns: The fetched MemberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MemberInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class MemberInstance(InstanceResource): - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.chat.v1.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ +class MemberInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'channel_sid': payload.get('channel_sid'), - 'service_sid': payload.get('service_sid'), - 'identity': payload.get('identity'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'role_sid': payload.get('role_sid'), - 'last_consumed_message_index': deserialize.integer(payload.get('last_consumed_message_index')), - 'last_consumption_timestamp': deserialize.iso8601_datetime(payload.get('last_consumption_timestamp')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'last_consumed_message_index' = payload.get('last_consumed_message_index'), + 'last_consumption_timestamp' = payload.get('last_consumption_timestamp'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext - """ if self._context is None: self._context = MemberContext( self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The unique ID of the Channel for the member - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The SID of the Role assigned to the member - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def last_consumed_message_index(self): - """ - :returns: The index of the last Message that the Member has read within the Channel - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def last_consumption_timestamp(self): - """ - :returns: The ISO 8601 based timestamp string that represents the date-time of the last Message read event for the Member within the Channel - :rtype: datetime - """ - return self._properties['last_consumption_timestamp'] - - @property - def url(self): - """ - :returns: The absolute URL of the Member resource - :rtype: unicode - """ - return self._properties['url'] + - def fetch(self): - """ - Fetch the MemberInstance - - :returns: The fetched MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the MemberInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset): - """ - Update the MemberInstance - :param unicode role_sid: The SID of the Role to assign to the member - :param unicode last_consumed_message_index: The index of the last consumed Message for the Channel for the Member +class MemberListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MemberListInstanceList, self).__init__(version) - :returns: The updated MemberInstance - :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance - """ - return self._proxy.update( - role_sid=role_sid, - last_consumed_message_index=last_consumed_message_index, - ) + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MemberPage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py index e365d1d1f7..dd609b7641 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -1,509 +1,172 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MessageList(ListResource): - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The unique ID of the Channel the Message resource belongs to - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages'.format(**self._solution) - - def create(self, body, from_=values.unset, attributes=values.unset): - """ - Create the MessageInstance - - :param unicode body: The message to send to the channel - :param unicode from_: The identity of the new message's author - :param unicode attributes: A valid JSON string that contains application-specific data - - :returns: The created MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - data = values.of({'Body': body, 'From': from_, 'Attributes': attributes, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance 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 MessageInstance.OrderType order: The sort order of the returned messages - :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.chat.v1.service.channel.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The sort order of the returned messages - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v1.service.channel.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The sort order of the returned messages - :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 MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - data = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: The unique string that identifies the resource - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MessagePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The unique ID of the Channel the Message resource belongs to - - :returns: twilio.rest.chat.v1.service.channel.message.MessagePage - :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class MessageContext(InstanceContext): - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param channel_sid: The unique ID of the Channel the message to fetch belongs to - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ - super(MessageContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the MessageInstance - - :returns: The fetched MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, body=values.unset, attributes=values.unset): - """ - Update the MessageInstance - - :param unicode body: The message to send to the channel - :param unicode attributes: A valid JSON string that contains application-specific data - - :returns: The updated MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - data = values.of({'Body': body, 'Attributes': attributes, }) + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages/${sid}' + + + def delete(self): + + + """ + Deletes the MessageInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessageInstance + + :returns: The fetched MessageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class MessageInstance(InstanceResource): + return '' - class OrderType(object): - ASC = "asc" - DESC = "desc" - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MessageInstance - :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ +class MessageInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'attributes': payload.get('attributes'), - 'service_sid': payload.get('service_sid'), - 'to': payload.get('to'), - 'channel_sid': payload.get('channel_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'was_edited': payload.get('was_edited'), - 'from_': payload.get('from'), - 'body': payload.get('body'), - 'index': deserialize.integer(payload.get('index')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'attributes' = payload.get('attributes'), + 'service_sid' = payload.get('service_sid'), + 'to' = payload.get('to'), + 'channel_sid' = payload.get('channel_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'was_edited' = payload.get('was_edited'), + '_from' = payload.get('from'), + 'body' = payload.get('body'), + 'index' = payload.get('index'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext - """ if self._context is None: self._context = MessageContext( self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] + - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def to(self): - """ - :returns: The SID of the Channel that the message was sent to - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel_sid(self): - """ - :returns: The unique ID of the Channel the Message resource belongs to - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def was_edited(self): - """ - :returns: Whether the message has been edited since it was created - :rtype: bool - """ - return self._properties['was_edited'] - - @property - def from_(self): - """ - :returns: The identity of the message's author - :rtype: unicode - """ - return self._properties['from_'] - - @property - def body(self): - """ - :returns: The content of the message - :rtype: unicode - """ - return self._properties['body'] - - @property - def index(self): - """ - :returns: The index of the message within the Channel - :rtype: unicode - """ - return self._properties['index'] - - @property - def url(self): - """ - :returns: The absolute URL of the Message resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the MessageInstance - - :returns: The fetched MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the MessageInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, body=values.unset, attributes=values.unset): - """ - Update the MessageInstance - :param unicode body: The message to send to the channel - :param unicode attributes: A valid JSON string that contains application-specific data +class MessageListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MessageListInstanceList, self).__init__(version) - :returns: The updated MessageInstance - :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance - """ - return self._proxy.update(body=body, attributes=attributes, ) + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py index dcfa524d4a..e05030daf3 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,427 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RoleList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create the RoleInstance - - :param unicode friendly_name: A string to describe the new resource - :param RoleInstance.RoleType type: The type of role - :param list[unicode] permission: A permission the role should have - - :returns: The created RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Permission': serialize.map(permission, lambda e: e), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance 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 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.chat.v1.service.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v1.service.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :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 RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RolePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v1.service.role.RolePage - :rtype: twilio.rest.chat.v1.service.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.role.RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RoleContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.role.RoleContext - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ - super(RoleContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RoleContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Roles/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the RoleInstance - - :returns: The fetched RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, permission): - """ - Update the RoleInstance - - :param list[unicode] permission: A permission the role should have - - :returns: The updated RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Roles/${sid}' + + + def delete(self): + + + """ + Deletes the RoleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RoleInstance + + :returns: The fetched RoleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoleInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RoleInstance(InstanceResource): - - class RoleType(object): - CHANNEL = "channel" - DEPLOYMENT = "deployment" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.chat.v1.service.role.RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ +class RoleInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'permissions': payload.get('permissions'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'permissions' = payload.get('permissions'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleContext - """ if self._context is None: self._context = RoleContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def type(self): - """ - :returns: The type of role - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: An array of the permissions the role has been granted - :rtype: list[unicode] - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Role resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the RoleInstance - - :returns: The fetched RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the RoleInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, permission): - """ - Update the RoleInstance - :param list[unicode] permission: A permission the role should have +class RoleListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(RoleListInstanceList, self).__init__(version) - :returns: The updated RoleInstance - :rtype: twilio.rest.chat.v1.service.role.RoleInstance - """ - return self._proxy.update(permission, ) + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Roles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RolePage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service/user.py b/twilio/rest/chat/v1/service/user.py new file mode 100644 index 0000000000..4f87bf86ec --- /dev/null +++ b/twilio/rest/chat/v1/service/user.py @@ -0,0 +1,177 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.user.user_channel import UserChannelListInstance + + +class UserContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + + self._user_channels = None + + def delete(self): + + + """ + Deletes the UserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserInstance + + :returns: The fetched UserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(UserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'attributes' = payload.get('attributes'), + 'friendly_name' = payload.get('friendly_name'), + 'role_sid' = payload.get('role_sid'), + 'identity' = payload.get('identity'), + 'is_online' = payload.get('is_online'), + 'is_notifiable' = payload.get('is_notifiable'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'joined_channels_count' = payload.get('joined_channels_count'), + 'links' = payload.get('links'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def user_channels(self): + return self._proxy.user_channels + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(UserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/chat/v1/service/user/user_channel.py b/twilio/rest/chat/v1/service/user/user_channel.py index aa2aa505b2..1fef58cab0 100644 --- a/twilio/rest/chat/v1/service/user/user_channel.py +++ b/twilio/rest/chat/v1/service/user/user_channel.py @@ -1,270 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserChannelList(ListResource): - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserChannelList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param user_sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - super(UserChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserChannelInstance 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 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.chat.v1.service.user.user_channel.UserChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v1.service.user.user_channel.UserChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserChannelInstance records from the API. - Request is executed immediately - - :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 UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserChannelPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class UserChannelPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the UserChannelPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param user_sid: The unique string that identifies the resource - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelPage - """ - super(UserChannelPage, self).__init__(version, response) +class UserChannelListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, user_sid: str): + # TODO: needs autogenerated docs + super(UserChannelListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserChannelInstance + self._solution = { service_sid, user_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Channels' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - """ - return UserChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) + return UserChannelPage(self._version, payload, service_sid=self._solution['service_sid']user_sid=self._solution['user_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class UserChannelInstance(InstanceResource): - - class ChannelStatus(object): - JOINED = "joined" - INVITED = "invited" - NOT_PARTICIPATING = "not_participating" - - def __init__(self, version, payload, service_sid, user_sid): - """ - Initialize the UserChannelInstance - - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelInstance - """ - super(UserChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'channel_sid': payload.get('channel_sid'), - 'member_sid': payload.get('member_sid'), - 'status': payload.get('status'), - 'last_consumed_message_index': deserialize.integer(payload.get('last_consumed_message_index')), - 'unread_messages_count': deserialize.integer(payload.get('unread_messages_count')), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def channel_sid(self): - """ - :returns: The SID of the Channel the resource belongs to - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def member_sid(self): - """ - :returns: The SID of the User as a Member in the Channel - :rtype: unicode - """ - return self._properties['member_sid'] - - @property - def status(self): - """ - :returns: The status of the User on the Channel - :rtype: UserChannelInstance.ChannelStatus - """ - return self._properties['status'] - - @property - def last_consumed_message_index(self): - """ - :returns: The index of the last Message in the Channel the Member has read - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] + return '' - @property - def unread_messages_count(self): - """ - :returns: The number of unread Messages in the Channel for the User - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def links(self): - """ - :returns: Absolute URLs to access the Members, Messages , Invites and, if it exists, the last Message for the Channel - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/chat/v2/.openapi-generator-ignore b/twilio/rest/chat/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/chat/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/chat/v2/.openapi-generator/FILES b/twilio/rest/chat/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..ed711e785d --- /dev/null +++ b/twilio/rest/chat/v2/.openapi-generator/FILES @@ -0,0 +1,25 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +credential.py +service.py +service/binding.py +service/channel.py +service/channel/invite.py +service/channel/member.py +service/channel/message.py +service/channel/webhook.py +service/role.py +service/user.py +service/user/user_binding.py +service/user/user_channel.py diff --git a/twilio/rest/chat/v2/.openapi-generator/VERSION b/twilio/rest/chat/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/chat/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index 03d7cc3616..1822479087 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -1,450 +1,167 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CredentialList(ListResource): - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v2.credential.CredentialList - :rtype: twilio.rest.chat.v2.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance 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 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.chat.v2.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :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 CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create the CredentialInstance - - :param CredentialInstance.PushService type: The type of push-notification service the credential is for - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate - :param unicode private_key: [APN only] The URL encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential - :param unicode secret: [FCM only] The Server key of your project from Firebase console - - :returns: The created CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, ) - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The SID of the Credential resource to fetch - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The SID of the Credential resource to fetch - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v2.credential.CredentialPage - :rtype: twilio.rest.chat.v2.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.credential.CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CredentialContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The SID of the Credential resource to fetch - - :returns: twilio.rest.chat.v2.credential.CredentialContext - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(CredentialContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate - :param unicode private_key: [APN only] The URL encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential - :param unicode secret: [FCM only] The Server key of your project from Firebase console - - :returns: The updated CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Credentials/${sid}' + + + def delete(self): + + + """ + Deletes the CredentialInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialInstance + + :returns: The fetched CredentialInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CredentialInstance(InstanceResource): + return '' - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - :returns: twilio.rest.chat.v2.credential.CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ +class CredentialInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'sandbox': payload.get('sandbox'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'sandbox' = payload.get('sandbox'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialContext - """ if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) + self._context = CredentialContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type of push-notification service the credential is for - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: [APN only] Whether to send the credential to sandbox APNs - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Credential resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): + def __repr__(self): """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate - :param unicode private_key: [APN only] The URL encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential - :param unicode secret: [FCM only] The Server key of your project from Firebase console - :returns: The updated CredentialInstance - :rtype: twilio.rest.chat.v2.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance +class CredentialListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/Credentials' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service.py b/twilio/rest/chat/v2/service.py new file mode 100644 index 0000000000..8417e3a85b --- /dev/null +++ b/twilio/rest/chat/v2/service.py @@ -0,0 +1,198 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._bindings = None + self._channels = None + self._roles = None + self._users = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'default_service_role_sid' = payload.get('default_service_role_sid'), + 'default_channel_role_sid' = payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' = payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' = payload.get('read_status_enabled'), + 'reachability_enabled' = payload.get('reachability_enabled'), + 'typing_indicator_timeout' = payload.get('typing_indicator_timeout'), + 'consumption_report_interval' = payload.get('consumption_report_interval'), + 'limits' = payload.get('limits'), + 'pre_webhook_url' = payload.get('pre_webhook_url'), + 'post_webhook_url' = payload.get('post_webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'webhook_filters' = payload.get('webhook_filters'), + 'pre_webhook_retry_count' = payload.get('pre_webhook_retry_count'), + 'post_webhook_retry_count' = payload.get('post_webhook_retry_count'), + 'notifications' = payload.get('notifications'), + 'media' = payload.get('media'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def bindings(self): + return self._proxy.bindings + @property + def channels(self): + return self._proxy.channels + @property + def roles(self): + return self._proxy.roles + @property + def users(self): + return self._proxy.users + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/chat/v2/service/binding.py b/twilio/rest/chat/v2/service/binding.py index 91b8c35108..1cfaf29ffa 100644 --- a/twilio/rest/chat/v2/service/binding.py +++ b/twilio/rest/chat/v2/service/binding.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,423 +19,132 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BindingList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the BindingList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Binding resource is associated with - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - super(BindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Bindings'.format(**self._solution) - - def stream(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Streams BindingInstance 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 list[BindingInstance.BindingType] binding_type: The push technology used by the Binding resources to read - :param list[unicode] identity: The `identity` value of the resources to read - :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.chat.v2.service.binding.BindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(binding_type=binding_type, identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Lists BindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[BindingInstance.BindingType] binding_type: The push technology used by the Binding resources to read - :param list[unicode] identity: The `identity` value of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.binding.BindingInstance] - """ - return list(self.stream( - binding_type=binding_type, - identity=identity, - limit=limit, - page_size=page_size, - )) - - def page(self, binding_type=values.unset, identity=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BindingInstance records from the API. - Request is executed immediately - - :param list[BindingInstance.BindingType] binding_type: The push technology used by the Binding resources to read - :param list[unicode] identity: The `identity` value of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - data = values.of({ - 'BindingType': serialize.map(binding_type, lambda e: e), - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BindingContext - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BindingContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BindingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the BindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Binding resource is associated with - - :returns: twilio.rest.chat.v2.service.binding.BindingPage - :rtype: twilio.rest.chat.v2.service.binding.BindingPage - """ - super(BindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.binding.BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class BindingContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the BindingContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.chat.v2.service.binding.BindingContext - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ - super(BindingContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BindingContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the BindingInstance - - :returns: The fetched BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Bindings/${sid}' + + + def delete(self): + + + """ + Deletes the BindingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the BindingInstance + + :returns: The fetched BindingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BindingInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class BindingInstance(InstanceResource): - - class BindingType(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the BindingInstance - :returns: twilio.rest.chat.v2.service.binding.BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ +class BindingInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(BindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'endpoint': payload.get('endpoint'), - 'identity': payload.get('identity'), - 'credential_sid': payload.get('credential_sid'), - 'binding_type': payload.get('binding_type'), - 'message_types': payload.get('message_types'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'endpoint' = payload.get('endpoint'), + 'identity' = payload.get('identity'), + 'credential_sid' = payload.get('credential_sid'), + 'binding_type' = payload.get('binding_type'), + 'message_types' = payload.get('message_types'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BindingContext for this BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingContext - """ if self._context is None: self._context = BindingContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Binding resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def endpoint(self): - """ - :returns: The unique endpoint identifier for the Binding - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def credential_sid(self): - """ - :returns: The SID of the Credential for the binding - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def binding_type(self): - """ - :returns: The push technology to use for the binding - :rtype: BindingInstance.BindingType - """ - return self._properties['binding_type'] + - @property - def message_types(self): + def __repr__(self): """ - :returns: The Programmable Chat message types the binding is subscribed to - :rtype: list[unicode] + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['message_types'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Binding resource - :rtype: unicode - """ - return self._properties['url'] - @property - def links(self): - """ - :returns: The absolute URLs of the Binding's User - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the BindingInstance +class BindingListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(BindingListInstanceList, self).__init__(version) - :returns: The fetched BindingInstance - :rtype: twilio.rest.chat.v2.service.binding.BindingInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Bindings' + + + def page(self, binding_type, identity, page_size): + + data = values.of({ + 'binding_type': binding_type,'identity': identity,'page_size': page_size, + }) - def delete(self): - """ - Deletes the BindingInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return BindingPage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/channel.py b/twilio/rest/chat/v2/service/channel.py new file mode 100644 index 0000000000..10ff18f7f1 --- /dev/null +++ b/twilio/rest/chat/v2/service/channel.py @@ -0,0 +1,189 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstancefrom twilio.rest.channel.webhook import WebhookListInstance + + +class ChannelContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None + self._members = None + self._messages = None + self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the ChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ChannelInstance + + :returns: The fetched ChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ChannelInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(ChannelInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'attributes' = payload.get('attributes'), + 'type' = payload.get('type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + 'members_count' = payload.get('members_count'), + 'messages_count' = payload.get('messages_count'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ChannelContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def invites(self): + return self._proxy.invites + @property + def members(self): + return self._proxy.members + @property + def messages(self): + return self._proxy.messages + @property + def webhooks(self): + return self._proxy.webhooks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ChannelListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(ChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py index 24026e69c0..3778c651f3 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,433 +19,140 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class InviteList(ListResource): - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the InviteList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel the new resource belongs to - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - super(InviteList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites'.format(**self._solution) - - def create(self, identity, role_sid=values.unset): - """ - Create the InviteInstance - - :param unicode identity: The `identity` value that identifies the new resource's User - :param unicode role_sid: The Role assigned to the new member - - :returns: The created InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - data = values.of({'Identity': identity, 'RoleSid': role_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams InviteInstance 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 list[unicode] identity: The `identity` value of the resources to read - :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.chat.v2.service.channel.invite.InviteInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists InviteInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[unicode] identity: The `identity` value of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.channel.invite.InviteInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - 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 list[unicode] identity: The `identity` value of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - data = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return InvitePage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of InviteInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InvitePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InviteContext - - :param sid: The SID of the Invite resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InviteContext - - :param sid: The SID of the Invite resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - return InviteContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class InvitePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the InvitePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel the new resource belongs to - - :returns: twilio.rest.chat.v2.service.channel.invite.InvitePage - :rtype: twilio.rest.chat.v2.service.channel.invite.InvitePage - """ - super(InvitePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InviteInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class InviteContext(InstanceContext): - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the InviteContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param channel_sid: The SID of the Channel the resource to fetch belongs to - :param sid: The SID of the Invite resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteContext - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ - super(InviteContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InviteContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Invites/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the InviteInstance - - :returns: The fetched InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return InviteInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InviteInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites/${sid}' + + + def delete(self): + + + """ + Deletes the InviteInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the InviteInstance + + :returns: The fetched InviteInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InviteInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class InviteInstance(InstanceResource): - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the InviteInstance - :returns: twilio.rest.chat.v2.service.channel.invite.InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ +class InviteInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): super(InviteInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'channel_sid': payload.get('channel_sid'), - 'service_sid': payload.get('service_sid'), - 'identity': payload.get('identity'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'role_sid': payload.get('role_sid'), - 'created_by': payload.get('created_by'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'created_by' = payload.get('created_by'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InviteContext for this InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteContext - """ if self._context is None: self._context = InviteContext( self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The SID of the Channel the new resource belongs to - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The SID of the Role assigned to the member - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def created_by(self): - """ - :returns: The identity of the User that created the invite - :rtype: unicode - """ - return self._properties['created_by'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Invite resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the InviteInstance - :returns: The fetched InviteInstance - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the InviteInstance +class InviteListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(InviteListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InviteInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InvitePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py index 79aae83986..2c1f166ff8 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,548 +19,153 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MemberList(ListResource): - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MemberList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel for the member - - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - super(MemberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset, attributes=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Create the MemberInstance - - :param unicode identity: The `identity` value that identifies the new resource's User - :param unicode role_sid: The SID of the Role to assign to the member - :param unicode last_consumed_message_index: The index of the last Message in the Channel the Member has read - :param datetime last_consumption_timestamp: The ISO 8601 based timestamp string representing the datetime of the last Message read event for the member within the Channel - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode attributes: A valid JSON string that contains application-specific data - :param MemberInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'LastConsumedMessageIndex': last_consumed_message_index, - 'LastConsumptionTimestamp': serialize.iso8601_datetime(last_consumption_timestamp), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, identity=values.unset, limit=None, page_size=None): - """ - Streams MemberInstance 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 list[unicode] identity: The `identity` value of the resources to read - :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.chat.v2.service.channel.member.MemberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, identity=values.unset, limit=None, page_size=None): - """ - Lists MemberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[unicode] identity: The `identity` value of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.channel.member.MemberInstance] - """ - return list(self.stream(identity=identity, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MemberInstance records from the API. - Request is executed immediately - - :param list[unicode] identity: The `identity` value of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - data = values.of({ - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MemberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MemberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MemberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MemberContext - - :param sid: The SID of the Member resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MemberContext - :param sid: The SID of the Member resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - return MemberContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MemberPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MemberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel for the member - - :returns: twilio.rest.chat.v2.service.channel.member.MemberPage - :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage - """ - super(MemberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MemberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class MemberContext(InstanceContext): - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MemberContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param channel_sid: The SID of the channel the member belongs to - :param sid: The SID of the Member resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.member.MemberContext - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ - super(MemberContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MemberContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Members/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the MemberInstance - - :returns: The fetched MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the MemberInstance - - :param MemberInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members/${sid}' + + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the MemberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MemberInstance + + :returns: The fetched MemberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MemberInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset, attributes=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The SID of the Role to assign to the member - :param unicode last_consumed_message_index: The index of the last consumed Message for the Channel for the Member - :param datetime last_consumption_timestamp: The ISO 8601 based timestamp string representing the datetime of the last Message read event for the Member within the Channel - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode attributes: A valid JSON string that contains application-specific data - :param MemberInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - data = values.of({ - 'RoleSid': role_sid, - 'LastConsumedMessageIndex': last_consumed_message_index, - 'LastConsumptionTimestamp': serialize.iso8601_datetime(last_consumption_timestamp), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MemberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class MemberInstance(InstanceResource): - - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MemberInstance - - :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ +class MemberInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): super(MemberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'channel_sid': payload.get('channel_sid'), - 'service_sid': payload.get('service_sid'), - 'identity': payload.get('identity'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'role_sid': payload.get('role_sid'), - 'last_consumed_message_index': deserialize.integer(payload.get('last_consumed_message_index')), - 'last_consumption_timestamp': deserialize.iso8601_datetime(payload.get('last_consumption_timestamp')), - 'url': payload.get('url'), - 'attributes': payload.get('attributes'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'last_consumed_message_index' = payload.get('last_consumed_message_index'), + 'last_consumption_timestamp' = payload.get('last_consumption_timestamp'), + 'url' = payload.get('url'), + 'attributes' = payload.get('attributes'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MemberContext for this MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext - """ if self._context is None: self._context = MemberContext( self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_sid(self): - """ - :returns: The SID of the Channel for the member - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def role_sid(self): - """ - :returns: The SID of the Role assigned to the member - :rtype: unicode - """ - return self._properties['role_sid'] + - @property - def last_consumed_message_index(self): - """ - :returns: The index of the last Message that the Member has read within the Channel - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def last_consumption_timestamp(self): - """ - :returns: The ISO 8601 based timestamp string that represents the datetime of the last Message read event for the Member within the Channel - :rtype: datetime - """ - return self._properties['last_consumption_timestamp'] - - @property - def url(self): - """ - :returns: The absolute URL of the Member resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - def fetch(self): + def __repr__(self): """ - Fetch the MemberInstance - - :returns: The fetched MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the MemberInstance - :param MemberInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) +class MemberListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MemberListInstanceList, self).__init__(version) - def update(self, role_sid=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset, date_created=values.unset, - date_updated=values.unset, attributes=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the MemberInstance - - :param unicode role_sid: The SID of the Role to assign to the member - :param unicode last_consumed_message_index: The index of the last consumed Message for the Channel for the Member - :param datetime last_consumption_timestamp: The ISO 8601 based timestamp string representing the datetime of the last Message read event for the Member within the Channel - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode attributes: A valid JSON string that contains application-specific data - :param MemberInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated MemberInstance - :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance - """ - return self._proxy.update( - role_sid=role_sid, - last_consumed_message_index=last_consumed_message_index, - last_consumption_timestamp=last_consumption_timestamp, - date_created=date_created, - date_updated=date_updated, - attributes=attributes, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MemberPage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py index a3292315d6..79a6bb902d 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,585 +19,157 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MessageList(ListResource): - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel the Message resource belongs to - - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages'.format(**self._solution) - - def create(self, from_=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset, body=values.unset, - media_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the MessageInstance - - :param unicode from_: The Identity of the new message's author - :param unicode attributes: A valid JSON string that contains application-specific data - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode last_updated_by: The Identity of the User who last updated the Message - :param unicode body: The message to send to the channel - :param unicode media_sid: The Media Sid to be attached to the new Message - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - data = values.of({ - 'From': from_, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'LastUpdatedBy': last_updated_by, - 'Body': body, - 'MediaSid': media_sid, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance 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 MessageInstance.OrderType order: The sort order of the returned messages - :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.chat.v2.service.channel.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The sort order of the returned messages - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.channel.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The sort order of the returned messages - :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 MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - data = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: The SID of the Message resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: The SID of the Message resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - return MessageContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MessagePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param channel_sid: The SID of the Channel the Message resource belongs to - - :returns: twilio.rest.chat.v2.service.channel.message.MessagePage - :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class MessageContext(InstanceContext): - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param channel_sid: The SID of the Channel the message to fetch belongs to - :param sid: The SID of the Message resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.message.MessageContext - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ - super(MessageContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the MessageInstance - - :returns: The fetched MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the MessageInstance - - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages/${sid}' + + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the MessageInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessageInstance + + :returns: The fetched MessageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, body=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset, from_=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the MessageInstance - - :param unicode body: The message to send to the channel - :param unicode attributes: A valid JSON string that contains application-specific data - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode last_updated_by: The Identity of the User who last updated the Message, if applicable - :param unicode from_: The Identity of the message's author - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - data = values.of({ - 'Body': body, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'LastUpdatedBy': last_updated_by, - 'From': from_, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class MessageInstance(InstanceResource): + return '' - class OrderType(object): - ASC = "asc" - DESC = "desc" - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the MessageInstance - - :returns: twilio.rest.chat.v2.service.channel.message.MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ +class MessageInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'attributes': payload.get('attributes'), - 'service_sid': payload.get('service_sid'), - 'to': payload.get('to'), - 'channel_sid': payload.get('channel_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'last_updated_by': payload.get('last_updated_by'), - 'was_edited': payload.get('was_edited'), - 'from_': payload.get('from'), - 'body': payload.get('body'), - 'index': deserialize.integer(payload.get('index')), - 'type': payload.get('type'), - 'media': payload.get('media'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'attributes' = payload.get('attributes'), + 'service_sid' = payload.get('service_sid'), + 'to' = payload.get('to'), + 'channel_sid' = payload.get('channel_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'last_updated_by' = payload.get('last_updated_by'), + 'was_edited' = payload.get('was_edited'), + '_from' = payload.get('from'), + 'body' = payload.get('body'), + 'index' = payload.get('index'), + 'type' = payload.get('type'), + 'media' = payload.get('media'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext - """ if self._context is None: self._context = MessageContext( self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def to(self): - """ - :returns: The SID of the Channel that the message was sent to - :rtype: unicode - """ - return self._properties['to'] + - @property - def channel_sid(self): - """ - :returns: The SID of the Channel the Message resource belongs to - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def last_updated_by(self): - """ - :returns: The Identity of the User who last updated the Message - :rtype: unicode - """ - return self._properties['last_updated_by'] - - @property - def was_edited(self): - """ - :returns: Whether the message has been edited since it was created - :rtype: bool - """ - return self._properties['was_edited'] - - @property - def from_(self): - """ - :returns: The Identity of the message's author - :rtype: unicode - """ - return self._properties['from_'] - - @property - def body(self): - """ - :returns: The content of the message - :rtype: unicode - """ - return self._properties['body'] - - @property - def index(self): - """ - :returns: The index of the message within the Channel - :rtype: unicode - """ - return self._properties['index'] - - @property - def type(self): - """ - :returns: The Message type - :rtype: unicode - """ - return self._properties['type'] - - @property - def media(self): - """ - :returns: A Media object that describes the Message's media if attached; otherwise, null - :rtype: dict - """ - return self._properties['media'] - - @property - def url(self): - """ - :returns: The absolute URL of the Message resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): + def __repr__(self): """ - Fetch the MessageInstance - - :returns: The fetched MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the MessageInstance - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) +class MessageListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MessageListInstanceList, self).__init__(version) - def update(self, body=values.unset, attributes=values.unset, - date_created=values.unset, date_updated=values.unset, - last_updated_by=values.unset, from_=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the MessageInstance - - :param unicode body: The message to send to the channel - :param unicode attributes: A valid JSON string that contains application-specific data - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode last_updated_by: The Identity of the User who last updated the Message, if applicable - :param unicode from_: The Identity of the message's author - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated MessageInstance - :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance - """ - return self._proxy.update( - body=body, - attributes=attributes, - date_created=date_created, - date_updated=date_updated, - last_updated_by=last_updated_by, - from_=from_, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/channel/webhook.py b/twilio/rest/chat/v2/service/channel/webhook.py index 5543d7a0b5..0b87897781 100644 --- a/twilio/rest/chat/v2/service/channel/webhook.py +++ b/twilio/rest/chat/v2/service/channel/webhook.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,509 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WebhookList(ListResource): - - def __init__(self, version, service_sid, channel_sid): - """ - Initialize the WebhookList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Channel Webhook resource is associated with - :param channel_sid: The SID of the Channel the Channel Webhook resource belongs to - - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookList - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookList - """ - super(WebhookList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Webhooks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams WebhookInstance 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 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.chat.v2.service.channel.webhook.WebhookInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists WebhookInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.channel.webhook.WebhookInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WebhookInstance records from the API. - Request is executed immediately - - :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 WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WebhookPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WebhookInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WebhookPage(self._version, response, self._solution) - - def create(self, type, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset, - configuration_retry_count=values.unset): - """ - Create the WebhookInstance - - :param WebhookInstance.Type type: The type of webhook - :param unicode configuration_url: The URL of the webhook to call - :param WebhookInstance.Method configuration_method: The HTTP method used to call `configuration.url` - :param list[unicode] configuration_filters: The events that cause us to call the Channel Webhook - :param list[unicode] configuration_triggers: A string that will cause us to call the webhook when it is found in a message body - :param unicode configuration_flow_sid: The SID of the Studio Flow to call when an event occurs - :param unicode configuration_retry_count: The number of times to retry the webhook if the first attempt fails - - :returns: The created WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - """ - data = values.of({ - 'Type': type, - 'Configuration.Url': configuration_url, - 'Configuration.Method': configuration_method, - 'Configuration.Filters': serialize.map(configuration_filters, lambda e: e), - 'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e), - 'Configuration.FlowSid': configuration_flow_sid, - 'Configuration.RetryCount': configuration_retry_count, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def get(self, sid): - """ - Constructs a WebhookContext - - :param sid: The SID of the Channel Webhook resource to fetch - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookContext - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookContext - """ - return WebhookContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a WebhookContext - - :param sid: The SID of the Channel Webhook resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookContext - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookContext - """ - return WebhookContext( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WebhookPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WebhookPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Channel Webhook resource is associated with - :param channel_sid: The SID of the Channel the Channel Webhook resource belongs to - - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookPage - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookPage - """ - super(WebhookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WebhookInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - """ - return WebhookInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class WebhookContext(InstanceContext): - - def __init__(self, version, service_sid, channel_sid, sid): - """ - Initialize the WebhookContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service with the Channel to fetch the Webhook resource from - :param channel_sid: The SID of the Channel the resource to fetch belongs to - :param sid: The SID of the Channel Webhook resource to fetch - - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookContext - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookContext - """ - super(WebhookContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'channel_sid': channel_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{channel_sid}/Webhooks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the WebhookInstance + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Webhooks/${sid}' + + + def delete(self): + + + """ + Deletes the WebhookInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WebhookInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def update(self, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset, - configuration_retry_count=values.unset): - """ - Update the WebhookInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :param unicode configuration_url: The URL of the webhook to call - :param WebhookInstance.Method configuration_method: The HTTP method used to call `configuration.url` - :param list[unicode] configuration_filters: The events that cause us to call the Channel Webhook - :param list[unicode] configuration_triggers: A string that will cause us to call the webhook when it is found in a message body - :param unicode configuration_flow_sid: The SID of the Studio Flow to call when an event occurs - :param unicode configuration_retry_count: The number of times to retry the webhook if the first attempt fails - - :returns: The updated WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - """ - data = values.of({ - 'Configuration.Url': configuration_url, - 'Configuration.Method': configuration_method, - 'Configuration.Filters': serialize.map(configuration_filters, lambda e: e), - 'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e), - 'Configuration.FlowSid': configuration_flow_sid, - 'Configuration.RetryCount': configuration_retry_count, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WebhookInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WebhookInstance(InstanceResource): - - class Type(object): - WEBHOOK = "webhook" - TRIGGER = "trigger" - STUDIO = "studio" - class Method(object): - GET = "GET" - POST = "POST" - - def __init__(self, version, payload, service_sid, channel_sid, sid=None): - """ - Initialize the WebhookInstance - - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - """ +class WebhookInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): super(WebhookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'channel_sid': payload.get('channel_sid'), - 'type': payload.get('type'), - 'url': payload.get('url'), - 'configuration': payload.get('configuration'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'type' = payload.get('type'), + 'url' = payload.get('url'), + 'configuration' = payload.get('configuration'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'channel_sid': channel_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WebhookContext for this WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookContext - """ if self._context is None: self._context = WebhookContext( self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['channel_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Channel Webhook resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def channel_sid(self): - """ - :returns: The SID of the Channel the Channel Webhook resource belongs to - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def type(self): - """ - :returns: The type of webhook - :rtype: unicode - """ - return self._properties['type'] + - @property - def url(self): - """ - :returns: The absolute URL of the Channel Webhook resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def configuration(self): - """ - :returns: The JSON string that describes the configuration object for the channel webhook - :rtype: dict - """ - return self._properties['configuration'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime + def __repr__(self): """ - return self._properties['date_updated'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the WebhookInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - """ - return self._proxy.fetch() - - def update(self, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset, - configuration_retry_count=values.unset): - """ - Update the WebhookInstance - :param unicode configuration_url: The URL of the webhook to call - :param WebhookInstance.Method configuration_method: The HTTP method used to call `configuration.url` - :param list[unicode] configuration_filters: The events that cause us to call the Channel Webhook - :param list[unicode] configuration_triggers: A string that will cause us to call the webhook when it is found in a message body - :param unicode configuration_flow_sid: The SID of the Studio Flow to call when an event occurs - :param unicode configuration_retry_count: The number of times to retry the webhook if the first attempt fails - :returns: The updated WebhookInstance - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance - """ - return self._proxy.update( - configuration_url=configuration_url, - configuration_method=configuration_method, - configuration_filters=configuration_filters, - configuration_triggers=configuration_triggers, - configuration_flow_sid=configuration_flow_sid, - configuration_retry_count=configuration_retry_count, - ) - - def delete(self): - """ - Deletes the WebhookInstance +class WebhookListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Webhooks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WebhookPage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py index 92d6df2f45..b22185e4ca 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,427 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RoleList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create the RoleInstance - - :param unicode friendly_name: A string to describe the new resource - :param RoleInstance.RoleType type: The type of role - :param list[unicode] permission: A permission the role should have - - :returns: The 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(method='POST', uri=self._uri, data=data, ) - - return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance 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 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.chat.v2.service.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :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 RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The SID of the Role resource to fetch - - :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, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The SID of the Role resource to fetch - - :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, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RolePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v2.service.role.RolePage - :rtype: twilio.rest.chat.v2.service.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RoleContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The SID of the Role resource to fetch - - :returns: twilio.rest.chat.v2.service.role.RoleContext - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ - super(RoleContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RoleContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Roles/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the RoleInstance - - :returns: The fetched RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, permission): - """ - Update the RoleInstance - - :param list[unicode] permission: A permission the role should have - - :returns: The updated RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Roles/${sid}' + + + def delete(self): + + + """ + Deletes the RoleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RoleInstance + + :returns: The fetched RoleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoleInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return RoleInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RoleInstance(InstanceResource): - - class RoleType(object): - CHANNEL = "channel" - DEPLOYMENT = "deployment" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.chat.v2.service.role.RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ +class RoleInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'permissions': payload.get('permissions'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'permissions' = payload.get('permissions'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleContext - """ if self._context is None: self._context = RoleContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def type(self): - """ - :returns: The type of role - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: An array of the permissions the role has been granted - :rtype: list[unicode] - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Role resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the RoleInstance - - :returns: The fetched RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the RoleInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, permission): - """ - Update the RoleInstance - :param list[unicode] permission: A permission the role should have +class RoleListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(RoleListInstanceList, self).__init__(version) - :returns: The updated RoleInstance - :rtype: twilio.rest.chat.v2.service.role.RoleInstance - """ - return self._proxy.update(permission, ) + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Roles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RolePage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/user.py b/twilio/rest/chat/v2/service/user.py new file mode 100644 index 0000000000..7702af5821 --- /dev/null +++ b/twilio/rest/chat/v2/service/user.py @@ -0,0 +1,181 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.user.user_binding import UserBindingListInstancefrom twilio.rest.user.user_channel import UserChannelListInstance + + +class UserContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + + self._user_bindings = None + self._user_channels = None + + def delete(self): + + + """ + Deletes the UserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserInstance + + :returns: The fetched UserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(UserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'attributes' = payload.get('attributes'), + 'friendly_name' = payload.get('friendly_name'), + 'role_sid' = payload.get('role_sid'), + 'identity' = payload.get('identity'), + 'is_online' = payload.get('is_online'), + 'is_notifiable' = payload.get('is_notifiable'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'joined_channels_count' = payload.get('joined_channels_count'), + 'links' = payload.get('links'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def user_bindings(self): + return self._proxy.user_bindings + @property + def user_channels(self): + return self._proxy.user_channels + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(UserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/chat/v2/service/user/user_binding.py b/twilio/rest/chat/v2/service/user/user_binding.py index bc51e3ab51..7fed56faad 100644 --- a/twilio/rest/chat/v2/service/user/user_binding.py +++ b/twilio/rest/chat/v2/service/user/user_binding.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,435 +19,132 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserBindingList(ListResource): - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserBindingList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param user_sid: The SID of the User with the binding - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - super(UserBindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Bindings'.format(**self._solution) - - def stream(self, binding_type=values.unset, limit=None, page_size=None): - """ - Streams UserBindingInstance 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 list[UserBindingInstance.BindingType] binding_type: The push technology used by the User Binding resources to read - :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.chat.v2.service.user.user_binding.UserBindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(binding_type=binding_type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, binding_type=values.unset, limit=None, page_size=None): - """ - Lists UserBindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[UserBindingInstance.BindingType] binding_type: The push technology used by the User Binding resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.user.user_binding.UserBindingInstance] - """ - return list(self.stream(binding_type=binding_type, limit=limit, page_size=page_size, )) - - def page(self, binding_type=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 list[UserBindingInstance.BindingType] binding_type: The push technology used by the User Binding resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - data = values.of({ - 'BindingType': serialize.map(binding_type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserBindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserBindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserBindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The SID of the User Binding resource to fetch - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a UserBindingContext - - :param sid: The SID of the User Binding resource to fetch - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - return UserBindingContext( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserBindingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserBindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param user_sid: The SID of the User with the binding - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingPage - """ - super(UserBindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserBindingInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class UserBindingContext(InstanceContext): - - def __init__(self, version, service_sid, user_sid, sid): - """ - Initialize the UserBindingContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param user_sid: The SID of the User with the binding - :param sid: The SID of the User Binding resource to fetch - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ - super(UserBindingContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, user_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserBindingContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the UserBindingInstance - - :returns: The fetched UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserBindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the UserBindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { service_sid, user_sid, sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Bindings/${sid}' + + + def delete(self): + + + """ + Deletes the UserBindingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserBindingInstance + + :returns: The fetched UserBindingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserBindingInstance( + self._version, + payload, + service_siduser_sidsid=self._solution['service_sid''user_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserBindingInstance(InstanceResource): - - class BindingType(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - def __init__(self, version, payload, service_sid, user_sid, sid=None): - """ - Initialize the UserBindingInstance - - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ +class UserBindingInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, user_sid: str, sid: str): super(UserBindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'endpoint': payload.get('endpoint'), - 'identity': payload.get('identity'), - 'user_sid': payload.get('user_sid'), - 'credential_sid': payload.get('credential_sid'), - 'binding_type': payload.get('binding_type'), - 'message_types': payload.get('message_types'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'endpoint' = payload.get('endpoint'), + 'identity' = payload.get('identity'), + 'user_sid' = payload.get('user_sid'), + 'credential_sid' = payload.get('credential_sid'), + 'binding_type' = payload.get('binding_type'), + 'message_types' = payload.get('message_types'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'user_sid': user_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'user_sid': user_sid or self._properties['user_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserBindingContext for this UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingContext - """ if self._context is None: self._context = UserBindingContext( self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],user_sid=self._solution['user_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def endpoint(self): - """ - :returns: The unique endpoint identifier for the User Binding - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def user_sid(self): - """ - :returns: The SID of the User with the binding - :rtype: unicode - """ - return self._properties['user_sid'] - - @property - def credential_sid(self): - """ - :returns: The SID of the Credential for the binding - :rtype: unicode - """ - return self._properties['credential_sid'] + - @property - def binding_type(self): + def __repr__(self): """ - :returns: The push technology to use for the binding - :rtype: UserBindingInstance.BindingType + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['binding_type'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def message_types(self): - """ - :returns: The Programmable Chat message types the binding is subscribed to - :rtype: list[unicode] - """ - return self._properties['message_types'] - @property - def url(self): - """ - :returns: The absolute URL of the User Binding resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the UserBindingInstance +class UserBindingListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, user_sid: str): + # TODO: needs autogenerated docs + super(UserBindingListInstanceList, self).__init__(version) - :returns: The fetched UserBindingInstance - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, user_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Bindings' + + + def page(self, binding_type, page_size): + + data = values.of({ + 'binding_type': binding_type,'page_size': page_size, + }) - def delete(self): - """ - Deletes the UserBindingInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return UserBindingPage(self._version, payload, service_sid=self._solution['service_sid']user_sid=self._solution['user_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/user/user_channel.py b/twilio/rest/chat/v2/service/user/user_channel.py index 0dd06fa272..dfd24838ba 100644 --- a/twilio/rest/chat/v2/service/user/user_channel.py +++ b/twilio/rest/chat/v2/service/user/user_channel.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,480 +19,142 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserChannelList(ListResource): - - def __init__(self, version, service_sid, user_sid): - """ - Initialize the UserChannelList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param user_sid: The SID of the User the User Channel belongs to - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - super(UserChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserChannelInstance 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 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.chat.v2.service.user.user_channel.UserChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.chat.v2.service.user.user_channel.UserChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserChannelInstance records from the API. - Request is executed immediately - - :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 UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserChannelPage(self._version, response, self._solution) - - 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, - ) - - def __call__(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, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.page import Page -class UserChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param user_sid: The SID of the User the User Channel belongs to - - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelPage - """ - super(UserChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class UserChannelContext(InstanceContext): - - def __init__(self, version, service_sid, user_sid, channel_sid): - """ - Initialize the UserChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the User Channel resource from - :param user_sid: The SID of the User to fetch the User Channel resource from - :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 - """ - super(UserChannelContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, user_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(UserChannelContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'user_sid': user_sid, 'channel_sid': channel_sid, } - self._uri = '/Services/{service_sid}/Users/{user_sid}/Channels/{channel_sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the UserChannelInstance - - :returns: The fetched UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - channel_sid=self._solution['channel_sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the UserChannelInstance - - :param UserChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, notification_level=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset): - """ - Update the UserChannelInstance - - :param UserChannelInstance.NotificationLevel notification_level: The push notification level to assign to the User Channel - :param unicode last_consumed_message_index: The index of the last Message that the Member has read within the Channel - :param datetime last_consumption_timestamp: The ISO 8601 based timestamp string that represents the datetime of the last Message read event for the Member within the Channel - - :returns: The updated UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ - data = values.of({ - 'NotificationLevel': notification_level, - 'LastConsumedMessageIndex': last_consumed_message_index, - 'LastConsumptionTimestamp': serialize.iso8601_datetime(last_consumption_timestamp), - }) + self._solution = { service_sid, user_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Channels/${channel_sid}' + + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the UserChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserChannelInstance + + :returns: The fetched UserChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserChannelInstance( + self._version, + payload, + service_siduser_sidchannel_sid=self._solution['service_sid''user_sid''channel_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=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'], - ) + return UserChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], user_sid=self._solution['user_sid'], channel_sid=self._solution['channel_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserChannelInstance(InstanceResource): - - class ChannelStatus(object): - JOINED = "joined" - INVITED = "invited" - NOT_PARTICIPATING = "not_participating" - - class NotificationLevel(object): - DEFAULT = "default" - MUTED = "muted" - - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - - def __init__(self, version, payload, service_sid, user_sid, channel_sid=None): - """ - Initialize the UserChannelInstance - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ +class UserChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, user_sid: str, channel_sid: str): super(UserChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'channel_sid': payload.get('channel_sid'), - 'user_sid': payload.get('user_sid'), - 'member_sid': payload.get('member_sid'), - 'status': payload.get('status'), - 'last_consumed_message_index': deserialize.integer(payload.get('last_consumed_message_index')), - 'unread_messages_count': deserialize.integer(payload.get('unread_messages_count')), - 'links': payload.get('links'), - 'url': payload.get('url'), - 'notification_level': payload.get('notification_level'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'user_sid' = payload.get('user_sid'), + 'member_sid' = payload.get('member_sid'), + 'status' = payload.get('status'), + 'last_consumed_message_index' = payload.get('last_consumed_message_index'), + 'unread_messages_count' = payload.get('unread_messages_count'), + 'links' = payload.get('links'), + 'url' = payload.get('url'), + 'notification_level' = payload.get('notification_level'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'user_sid': user_sid, - 'channel_sid': channel_sid or self._properties['channel_sid'], + 'service_sid': service_sid or self._properties['service_sid']'user_sid': user_sid or self._properties['user_sid']'channel_sid': channel_sid or self._properties['channel_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserChannelContext for this UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelContext - """ if self._context is None: self._context = UserChannelContext( self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['user_sid'], - channel_sid=self._solution['channel_sid'], + service_sid=self._solution['service_sid'],user_sid=self._solution['user_sid'],channel_sid=self._solution['channel_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def channel_sid(self): - """ - :returns: The SID of the Channel the resource belongs to - :rtype: unicode - """ - return self._properties['channel_sid'] - - @property - def user_sid(self): - """ - :returns: The SID of the User the User Channel belongs to - :rtype: unicode - """ - return self._properties['user_sid'] + - @property - def member_sid(self): - """ - :returns: The SID of the User as a Member in the Channel - :rtype: unicode - """ - return self._properties['member_sid'] - - @property - def status(self): - """ - :returns: The status of the User on the Channel - :rtype: UserChannelInstance.ChannelStatus - """ - return self._properties['status'] - - @property - def last_consumed_message_index(self): - """ - :returns: The index of the last Message in the Channel the Member has read - :rtype: unicode - """ - return self._properties['last_consumed_message_index'] - - @property - def unread_messages_count(self): - """ - :returns: The number of unread Messages in the Channel for the User - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def links(self): - """ - :returns: Absolute URLs to access the Members, Messages , Invites and, if it exists, the last Message for the Channel - :rtype: unicode - """ - return self._properties['links'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def notification_level(self): - """ - :returns: The push notification level of the User for the Channel - :rtype: UserChannelInstance.NotificationLevel - """ - return self._properties['notification_level'] - - def fetch(self): + def __repr__(self): """ - Fetch the UserChannelInstance - - :returns: The fetched UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the UserChannelInstance - :param UserChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) +class UserChannelListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, user_sid: str): + # TODO: needs autogenerated docs + super(UserChannelListInstanceList, self).__init__(version) - def update(self, notification_level=values.unset, - last_consumed_message_index=values.unset, - last_consumption_timestamp=values.unset): - """ - Update the UserChannelInstance + # Path Solution + self._solution = { service_sid, user_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Channels' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param UserChannelInstance.NotificationLevel notification_level: The push notification level to assign to the User Channel - :param unicode last_consumed_message_index: The index of the last Message that the Member has read within the Channel - :param datetime last_consumption_timestamp: The ISO 8601 based timestamp string that represents the datetime of the last Message read event for the Member within the Channel + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated UserChannelInstance - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance - """ - return self._proxy.update( - notification_level=notification_level, - last_consumed_message_index=last_consumed_message_index, - last_consumption_timestamp=last_consumption_timestamp, - ) + return UserChannelPage(self._version, payload, service_sid=self._solution['service_sid']user_sid=self._solution['user_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v3/.openapi-generator-ignore b/twilio/rest/chat/v3/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/chat/v3/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/chat/v3/.openapi-generator/FILES b/twilio/rest/chat/v3/.openapi-generator/FILES new file mode 100644 index 0000000000..82edc8be4e --- /dev/null +++ b/twilio/rest/chat/v3/.openapi-generator/FILES @@ -0,0 +1,3 @@ +../__init__.py +.openapi-generator-ignore +channel.py diff --git a/twilio/rest/chat/v3/.openapi-generator/VERSION b/twilio/rest/chat/v3/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/chat/v3/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/chat/v3/channel.py b/twilio/rest/chat/v3/channel.py index 41180c828a..fb2dd3c7f0 100644 --- a/twilio/rest/chat/v3/channel.py +++ b/twilio/rest/chat/v3/channel.py @@ -1,358 +1,123 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ChannelList(ListResource): - - def __init__(self, version): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :returns: twilio.rest.chat.v3.channel.ChannelList - :rtype: twilio.rest.chat.v3.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, service_sid, sid): - """ - Constructs a ChannelContext - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Channel. - - :returns: twilio.rest.chat.v3.channel.ChannelContext - :rtype: twilio.rest.chat.v3.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=service_sid, sid=sid, ) - - def __call__(self, service_sid, sid): - """ - Constructs a ChannelContext - - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Channel. - - :returns: twilio.rest.chat.v3.channel.ChannelContext - :rtype: twilio.rest.chat.v3.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=service_sid, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v3.channel.ChannelPage - :rtype: twilio.rest.chat.v3.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v3.channel.ChannelInstance - :rtype: twilio.rest.chat.v3.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ChannelContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Channel. - - :returns: twilio.rest.chat.v3.channel.ChannelContext - :rtype: twilio.rest.chat.v3.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) + def __init__(self, version: V3, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ChannelContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - def update(self, type=values.unset, messaging_service_sid=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ChannelInstance - - :param ChannelInstance.ChannelType type: The Type for this Channel to migrate to. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this channel belongs to. - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ChannelInstance - :rtype: twilio.rest.chat.v3.channel.ChannelInstance - """ - data = values.of({'Type': type, 'MessagingServiceSid': messaging_service_sid, }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ChannelInstance(InstanceResource): - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" + return '' - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, service_sid=None, sid=None): - """ - Initialize the ChannelInstance - :returns: twilio.rest.chat.v3.channel.ChannelInstance - :rtype: twilio.rest.chat.v3.channel.ChannelInstance - """ +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'attributes': payload.get('attributes'), - 'type': payload.get('type'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), - 'members_count': deserialize.integer(payload.get('members_count')), - 'messages_count': deserialize.integer(payload.get('messages_count')), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'attributes' = payload.get('attributes'), + 'type' = payload.get('type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + 'members_count' = payload.get('members_count'), + 'messages_count' = payload.get('messages_count'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid or self._properties['service_sid'], - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.chat.v3.channel.ChannelContext - """ if self._context is None: self._context = ChannelContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] + - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The visibility of the channel. Can be: `public` or `private` - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The identity of the User that created the channel - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The number of Members in the Channel - :rtype: unicode - """ - return self._properties['members_count'] - - @property - def messages_count(self): - """ - :returns: The number of Messages that have been passed in the Channel - :rtype: unicode - """ - return self._properties['messages_count'] - - @property - def messaging_service_sid(self): + def __repr__(self): """ - :returns: The unique ID of the Messaging Service this channel belongs to. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['messaging_service_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Channel resource - :rtype: unicode - """ - return self._properties['url'] - def update(self, type=values.unset, messaging_service_sid=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ChannelInstance - :param ChannelInstance.ChannelType type: The Type for this Channel to migrate to. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this channel belongs to. - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header +class ChannelListInstance(ListResource): + def __init__(self, version: V3): + # TODO: needs autogenerated docs + super(ChannelListInstanceList, self).__init__(version) - :returns: The updated ChannelInstance - :rtype: twilio.rest.chat.v3.channel.ChannelInstance - """ - return self._proxy.update( - type=type, - messaging_service_sid=messaging_service_sid, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/content/__init__.py b/twilio/rest/content/__init__.py index c5b83823bc..83d64e1810 100644 --- a/twilio/rest/content/__init__.py +++ b/twilio/rest/content/__init__.py @@ -1,52 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.content.v1 import V1 + Twilio - Content + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Content(Domain): +from twilio.base.domain import Domain +from twilio.rest.Content.v1 import V1 +class Content(Domain): def __init__(self, twilio): """ Initialize the Content Domain :returns: Domain for Content - :rtype: twilio.rest.content.Content + :rtype: twilio.rest.v1.Content """ super(Content, self).__init__(twilio) - - self.base_url = 'https://content.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Content.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of content - :rtype: twilio.rest.content.v1.V1 + :returns: Versions v1 of Content + :rtype: twilio.rest.Content.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def contents(self): """ - :rtype: twilio.rest.content.v1.content.ContentList + :rtype: twilio.rest.v1.contents """ return self.v1.contents + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/content/v1/.openapi-generator-ignore b/twilio/rest/content/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/content/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/content/v1/.openapi-generator/FILES b/twilio/rest/content/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..8d10b33c89 --- /dev/null +++ b/twilio/rest/content/v1/.openapi-generator/FILES @@ -0,0 +1,5 @@ +../__init__.py +../__init__.py +.openapi-generator-ignore +content.py +content/approval_fetch.py diff --git a/twilio/rest/content/v1/.openapi-generator/VERSION b/twilio/rest/content/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/content/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/content/v1/content.py b/twilio/rest/content/v1/content.py new file mode 100644 index 0000000000..0118b14d8a --- /dev/null +++ b/twilio/rest/content/v1/content.py @@ -0,0 +1,152 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Content + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.content.approval_fetch import ApprovalFetchListInstance + + +class ContentContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ContentContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Content/${sid}' + + self._approval_fetch = None + + def delete(self): + + + """ + Deletes the ContentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ContentInstance + + :returns: The fetched ContentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ContentInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ContentInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ContentInstance, self).__init__(version) + self._properties = { + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'language' = payload.get('language'), + 'variables' = payload.get('variables'), + 'types' = payload.get('types'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ContentContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def approval_fetch(self): + return self._proxy.approval_fetch + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ContentListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ContentListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Content' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ContentPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index c16838048e..4e1d576378 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -1,237 +1,119 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Content + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ApprovalFetchList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the ApprovalFetchList - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the Content resource - - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchList - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchList - """ - super(ApprovalFetchList, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - - def get(self): - """ - Constructs a ApprovalFetchContext - - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchContext - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchContext - """ - return ApprovalFetchContext(self._version, sid=self._solution['sid'], ) - - def __call__(self): - """ - Constructs a ApprovalFetchContext - - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchContext - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchContext - """ - return ApprovalFetchContext(self._version, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' -class ApprovalFetchPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ApprovalFetchPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sid: The unique string that identifies the Content resource - - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchPage - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchPage - """ - super(ApprovalFetchPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ApprovalFetchInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchInstance - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchInstance - """ - return ApprovalFetchInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ApprovalFetchContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the ApprovalFetchContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the Content resource - - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchContext - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchContext - """ - super(ApprovalFetchContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ApprovalFetchContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Content/{sid}/ApprovalRequests'.format(**self._solution) - - def fetch(self): - """ - Fetch the ApprovalFetchInstance - - :returns: The fetched ApprovalFetchInstance - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ApprovalFetchInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Content/${sid}/ApprovalRequests' + + + def fetch(self): + + """ + Fetch the ApprovalFetchInstance + + :returns: The fetched ApprovalFetchInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ApprovalFetchInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ApprovalFetchInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid): - """ - Initialize the ApprovalFetchInstance - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchInstance - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchInstance - """ +class ApprovalFetchInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(ApprovalFetchInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'whatsapp': payload.get('whatsapp'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'whatsapp' = payload.get('whatsapp'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid, } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ApprovalFetchContext for this ApprovalFetchInstance - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchContext - """ if self._context is None: - self._context = ApprovalFetchContext(self._version, sid=self._solution['sid'], ) + self._context = ApprovalFetchContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Content resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): + def __repr__(self): """ - :returns: The SID of the Account that created the Content resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['account_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def whatsapp(self): - """ - :returns: Contains the whatsapp approval information for the Content resource - :rtype: dict - """ - return self._properties['whatsapp'] - @property - def url(self): - """ - :returns: The URL of the resource, relative to `https://content.twilio.com` - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the ApprovalFetchInstance +class ApprovalFetchListInstance(ListResource): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ApprovalFetchListInstanceList, self).__init__(version) - :returns: The fetched ApprovalFetchInstance - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/__init__.py b/twilio/rest/conversations/__init__.py index 348df71343..fd1ef65b86 100644 --- a/twilio/rest/conversations/__init__.py +++ b/twilio/rest/conversations/__init__.py @@ -1,101 +1,110 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.conversations.v1 import V1 + Twilio - Conversations + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Conversations(Domain): +from twilio.base.domain import Domain +from twilio.rest.Conversations.v1 import V1 +class Conversations(Domain): def __init__(self, twilio): """ Initialize the Conversations Domain :returns: Domain for Conversations - :rtype: twilio.rest.conversations.Conversations + :rtype: twilio.rest.v1.Conversations """ super(Conversations, self).__init__(twilio) - - self.base_url = 'https://conversations.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Conversations.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of conversations - :rtype: twilio.rest.conversations.v1.V1 + :returns: Versions v1 of Conversations + :rtype: twilio.rest.Conversations.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property - def configuration(self): + def address_configurations(self): """ - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationList + :rtype: twilio.rest.v1.address_configurations """ - return self.v1.configuration + return self.v1.address_configurations + @property - def address_configurations(self): + def configuration(self): """ - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationList + :rtype: twilio.rest.v1.configuration """ - return self.v1.address_configurations + return self.v1.configuration + @property def conversations(self): """ - :rtype: twilio.rest.conversations.v1.conversation.ConversationList + :rtype: twilio.rest.v1.conversations """ return self.v1.conversations + @property def credentials(self): """ - :rtype: twilio.rest.conversations.v1.credential.CredentialList + :rtype: twilio.rest.v1.credentials """ return self.v1.credentials + @property def participant_conversations(self): """ - :rtype: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationList + :rtype: twilio.rest.v1.participant_conversations """ return self.v1.participant_conversations + @property def roles(self): """ - :rtype: twilio.rest.conversations.v1.role.RoleList + :rtype: twilio.rest.v1.roles """ return self.v1.roles + @property def services(self): """ - :rtype: twilio.rest.conversations.v1.service.ServiceList + :rtype: twilio.rest.v1.services """ return self.v1.services + @property def users(self): """ - :rtype: twilio.rest.conversations.v1.user.UserList + :rtype: twilio.rest.v1.users """ return self.v1.users + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/conversations/v1/.openapi-generator-ignore b/twilio/rest/conversations/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/conversations/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/conversations/v1/.openapi-generator/FILES b/twilio/rest/conversations/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..b95e47fba0 --- /dev/null +++ b/twilio/rest/conversations/v1/.openapi-generator/FILES @@ -0,0 +1,55 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +address_configuration.py +configuration.py +configuration/webhook.py +conversation.py +conversation/message.py +conversation/message/delivery_receipt.py +conversation/participant.py +conversation/webhook.py +credential.py +participant_conversation.py +role.py +service.py +service/binding.py +service/configuration.py +service/configuration/notification.py +service/configuration/webhook.py +service/conversation.py +service/conversation/message.py +service/conversation/message/delivery_receipt.py +service/conversation/participant.py +service/conversation/webhook.py +service/participant_conversation.py +service/role.py +service/user.py +service/user/user_conversation.py +user.py +user/user_conversation.py diff --git a/twilio/rest/conversations/v1/.openapi-generator/VERSION b/twilio/rest/conversations/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/conversations/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index 6caf13ee7b..ae2bf34090 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,502 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AddressConfigurationList(ListResource): - - def __init__(self, version): - """ - Initialize the AddressConfigurationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.address_configuration.AddressConfigurationList - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationList - """ - super(AddressConfigurationList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Configuration/Addresses'.format(**self._solution) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams AddressConfigurationInstance 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 type: The type of address configuration. - :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.conversations.v1.address_configuration.AddressConfigurationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists AddressConfigurationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode type: The type of address configuration. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.address_configuration.AddressConfigurationInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) - - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AddressConfigurationInstance records from the API. - Request is executed immediately - - :param unicode type: The type of address configuration. - :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 AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationPage - """ - data = values.of({ - 'Type': type, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AddressConfigurationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AddressConfigurationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AddressConfigurationPage(self._version, response, self._solution) - - def create(self, type, address, friendly_name=values.unset, - auto_creation_enabled=values.unset, auto_creation_type=values.unset, - auto_creation_conversation_service_sid=values.unset, - auto_creation_webhook_url=values.unset, - auto_creation_webhook_method=values.unset, - auto_creation_webhook_filters=values.unset, - auto_creation_studio_flow_sid=values.unset, - auto_creation_studio_retry_count=values.unset): - """ - Create the AddressConfigurationInstance - - :param AddressConfigurationInstance.Type type: Type of Address. - :param unicode address: The unique address to be configured. - :param unicode friendly_name: The human-readable name of this configuration. - :param bool auto_creation_enabled: Enable/Disable auto-creating conversations for messages to this address - :param AddressConfigurationInstance.AutoCreationType auto_creation_type: Type of Auto Creation. - :param unicode auto_creation_conversation_service_sid: Conversation Service for the auto-created conversation. - :param unicode auto_creation_webhook_url: For type `webhook`, the url for the webhook request. - :param AddressConfigurationInstance.Method auto_creation_webhook_method: For type `webhook`, the HTTP method to be used when sending a webhook request. - :param list[unicode] auto_creation_webhook_filters: The list of events, firing webhook event for this Conversation. - :param unicode auto_creation_studio_flow_sid: For type `studio`, the studio flow SID where the webhook should be sent to. - :param unicode auto_creation_studio_retry_count: For type `studio`, number of times to retry the webhook request - - :returns: The created AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - """ - data = values.of({ - 'Type': type, - 'Address': address, - 'FriendlyName': friendly_name, - 'AutoCreation.Enabled': auto_creation_enabled, - 'AutoCreation.Type': auto_creation_type, - 'AutoCreation.ConversationServiceSid': auto_creation_conversation_service_sid, - 'AutoCreation.WebhookUrl': auto_creation_webhook_url, - 'AutoCreation.WebhookMethod': auto_creation_webhook_method, - 'AutoCreation.WebhookFilters': serialize.map(auto_creation_webhook_filters, lambda e: e), - 'AutoCreation.StudioFlowSid': auto_creation_studio_flow_sid, - 'AutoCreation.StudioRetryCount': auto_creation_studio_retry_count, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AddressConfigurationInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a AddressConfigurationContext - :param sid: The SID or Address of the Configuration. - - :returns: twilio.rest.conversations.v1.address_configuration.AddressConfigurationContext - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationContext - """ - return AddressConfigurationContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AddressConfigurationContext - - :param sid: The SID or Address of the Configuration. - - :returns: twilio.rest.conversations.v1.address_configuration.AddressConfigurationContext - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationContext - """ - return AddressConfigurationContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AddressConfigurationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AddressConfigurationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.address_configuration.AddressConfigurationPage - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationPage - """ - super(AddressConfigurationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AddressConfigurationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - """ - return AddressConfigurationInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class AddressConfigurationContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the AddressConfigurationContext - - :param Version version: Version that contains the resource - :param sid: The SID or Address of the Configuration. - - :returns: twilio.rest.conversations.v1.address_configuration.AddressConfigurationContext - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationContext - """ - super(AddressConfigurationContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(AddressConfigurationContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Configuration/Addresses/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AddressConfigurationInstance - - :returns: The fetched AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AddressConfigurationInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, auto_creation_enabled=values.unset, - auto_creation_type=values.unset, - auto_creation_conversation_service_sid=values.unset, - auto_creation_webhook_url=values.unset, - auto_creation_webhook_method=values.unset, - auto_creation_webhook_filters=values.unset, - auto_creation_studio_flow_sid=values.unset, - auto_creation_studio_retry_count=values.unset): - """ - Update the AddressConfigurationInstance - - :param unicode friendly_name: The human-readable name of this configuration. - :param bool auto_creation_enabled: Enable/Disable auto-creating conversations for messages to this address - :param AddressConfigurationInstance.AutoCreationType auto_creation_type: Type of Auto Creation. - :param unicode auto_creation_conversation_service_sid: Conversation Service for the auto-created conversation. - :param unicode auto_creation_webhook_url: For type `webhook`, the url for the webhook request. - :param AddressConfigurationInstance.Method auto_creation_webhook_method: For type `webhook`, the HTTP method to be used when sending a webhook request. - :param list[unicode] auto_creation_webhook_filters: The list of events, firing webhook event for this Conversation. - :param unicode auto_creation_studio_flow_sid: For type `studio`, the studio flow SID where the webhook should be sent to. - :param unicode auto_creation_studio_retry_count: For type `studio`, number of times to retry the webhook request - - :returns: The updated AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'AutoCreation.Enabled': auto_creation_enabled, - 'AutoCreation.Type': auto_creation_type, - 'AutoCreation.ConversationServiceSid': auto_creation_conversation_service_sid, - 'AutoCreation.WebhookUrl': auto_creation_webhook_url, - 'AutoCreation.WebhookMethod': auto_creation_webhook_method, - 'AutoCreation.WebhookFilters': serialize.map(auto_creation_webhook_filters, lambda e: e), - 'AutoCreation.StudioFlowSid': auto_creation_studio_flow_sid, - 'AutoCreation.StudioRetryCount': auto_creation_studio_retry_count, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return AddressConfigurationInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the AddressConfigurationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Configuration/Addresses/${sid}' + + + def delete(self): + + + """ + Deletes the AddressConfigurationInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AddressConfigurationInstance + + :returns: The fetched AddressConfigurationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AddressConfigurationInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AddressConfigurationInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AddressConfigurationInstance(InstanceResource): - - class Type(object): - SMS = "sms" - WHATSAPP = "whatsapp" - MESSENGER = "messenger" - GBM = "gbm" + return '' - class AutoCreationType(object): - WEBHOOK = "webhook" - STUDIO = "studio" - DEFAULT = "default" - class Method(object): - GET = "GET" - POST = "POST" - def __init__(self, version, payload, sid=None): - """ - Initialize the AddressConfigurationInstance - - :returns: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - """ +class AddressConfigurationInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(AddressConfigurationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'type': payload.get('type'), - 'address': payload.get('address'), - 'friendly_name': payload.get('friendly_name'), - 'auto_creation': payload.get('auto_creation'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'type' = payload.get('type'), + 'address' = payload.get('address'), + 'friendly_name' = payload.get('friendly_name'), + 'auto_creation' = payload.get('auto_creation'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AddressConfigurationContext for this AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationContext - """ if self._context is None: - self._context = AddressConfigurationContext(self._version, sid=self._solution['sid'], ) + self._context = AddressConfigurationContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique ID of the Account the address belongs to. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def type(self): - """ - :returns: Type of Address. - :rtype: unicode - """ - return self._properties['type'] - - @property - def address(self): - """ - :returns: The unique address to be configured. - :rtype: unicode - """ - return self._properties['address'] - - @property - def friendly_name(self): - """ - :returns: The human-readable name of this configuration. - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def auto_creation(self): - """ - :returns: Auto Creation configuration for the address. - :rtype: dict - """ - return self._properties['auto_creation'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): + def __repr__(self): """ - :returns: The date that this resource was last updated. - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_updated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: An absolute URL for this address configuration. - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the AddressConfigurationInstance - :returns: The fetched AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, auto_creation_enabled=values.unset, - auto_creation_type=values.unset, - auto_creation_conversation_service_sid=values.unset, - auto_creation_webhook_url=values.unset, - auto_creation_webhook_method=values.unset, - auto_creation_webhook_filters=values.unset, - auto_creation_studio_flow_sid=values.unset, - auto_creation_studio_retry_count=values.unset): - """ - Update the AddressConfigurationInstance - - :param unicode friendly_name: The human-readable name of this configuration. - :param bool auto_creation_enabled: Enable/Disable auto-creating conversations for messages to this address - :param AddressConfigurationInstance.AutoCreationType auto_creation_type: Type of Auto Creation. - :param unicode auto_creation_conversation_service_sid: Conversation Service for the auto-created conversation. - :param unicode auto_creation_webhook_url: For type `webhook`, the url for the webhook request. - :param AddressConfigurationInstance.Method auto_creation_webhook_method: For type `webhook`, the HTTP method to be used when sending a webhook request. - :param list[unicode] auto_creation_webhook_filters: The list of events, firing webhook event for this Conversation. - :param unicode auto_creation_studio_flow_sid: For type `studio`, the studio flow SID where the webhook should be sent to. - :param unicode auto_creation_studio_retry_count: For type `studio`, number of times to retry the webhook request - - :returns: The updated AddressConfigurationInstance - :rtype: twilio.rest.conversations.v1.address_configuration.AddressConfigurationInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - auto_creation_enabled=auto_creation_enabled, - auto_creation_type=auto_creation_type, - auto_creation_conversation_service_sid=auto_creation_conversation_service_sid, - auto_creation_webhook_url=auto_creation_webhook_url, - auto_creation_webhook_method=auto_creation_webhook_method, - auto_creation_webhook_filters=auto_creation_webhook_filters, - auto_creation_studio_flow_sid=auto_creation_studio_flow_sid, - auto_creation_studio_retry_count=auto_creation_studio_retry_count, - ) - - def delete(self): - """ - Deletes the AddressConfigurationInstance +class AddressConfigurationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AddressConfigurationListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/Configuration/Addresses' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AddressConfigurationInstance(self._version, payload, ) + + + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AddressConfigurationPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/configuration.py b/twilio/rest/conversations/v1/configuration.py new file mode 100644 index 0000000000..8076a67128 --- /dev/null +++ b/twilio/rest/conversations/v1/configuration.py @@ -0,0 +1,134 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.configuration.webhook import WebhookListInstance + + +class ConfigurationContext(InstanceContext): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ConfigurationContextList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Configuration' + + + def fetch(self): + + """ + Fetch the ConfigurationInstance + + :returns: The fetched ConfigurationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConfigurationInstance( + self._version, + payload, + =self._solution[], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ConfigurationInstance(self._version, payload, ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConfigurationInstance(InstanceResource): + def __init__(self, version, payload): + super(ConfigurationInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'default_chat_service_sid' = payload.get('default_chat_service_sid'), + 'default_messaging_service_sid' = payload.get('default_messaging_service_sid'), + 'default_inactive_timer' = payload.get('default_inactive_timer'), + 'default_closed_timer' = payload.get('default_closed_timer'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConfigurationContext( + self._version, + + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConfigurationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ConfigurationListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + self._webhooks = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/configuration/webhook.py b/twilio/rest/conversations/v1/configuration/webhook.py index 40d3110329..e5017d1516 100644 --- a/twilio/rest/conversations/v1/configuration/webhook.py +++ b/twilio/rest/conversations/v1/configuration/webhook.py @@ -1,308 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WebhookList(ListResource): - - def __init__(self, version): - """ - Initialize the WebhookList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookList - """ - super(WebhookList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a WebhookContext - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookContext - """ - return WebhookContext(self._version, ) - - def __call__(self): - """ - Constructs a WebhookContext - - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookContext - """ - return WebhookContext(self._version, ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WebhookPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WebhookPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookPage - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookPage - """ - super(WebhookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WebhookInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - """ - return WebhookInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WebhookContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the WebhookContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookContext - """ - super(WebhookContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/Configuration/Webhooks'.format(**self._solution) - - def fetch(self): - """ - Fetch the WebhookInstance - - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WebhookInstance(self._version, payload, ) - - def update(self, method=values.unset, filters=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - target=values.unset): - """ - Update the WebhookInstance - - :param unicode method: The HTTP method to be used when sending a webhook request. - :param list[unicode] 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 WebhookInstance.Target target: The routing target of the webhook. - - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - """ - data = values.of({ - 'Method': method, - 'Filters': serialize.map(filters, lambda e: e), - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'Target': target, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Configuration/Webhooks' + + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + =self._solution[], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class WebhookInstance(InstanceResource): + return '' - class Target(object): - WEBHOOK = "webhook" - FLEX = "flex" - class Method(object): - GET = "GET" - POST = "POST" +class WebhookInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the WebhookInstance - - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - """ super(WebhookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'method': payload.get('method'), - 'filters': payload.get('filters'), - 'pre_webhook_url': payload.get('pre_webhook_url'), - 'post_webhook_url': payload.get('post_webhook_url'), - 'target': payload.get('target'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'method' = payload.get('method'), + 'filters' = payload.get('filters'), + 'pre_webhook_url' = payload.get('pre_webhook_url'), + 'post_webhook_url' = payload.get('post_webhook_url'), + 'target' = payload.get('target'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WebhookContext for this WebhookInstance - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookContext - """ if self._context is None: - self._context = WebhookContext(self._version, ) + self._context = WebhookContext( + self._version, + + ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def method(self): - """ - :returns: The HTTP method to be used when sending a webhook request. - :rtype: WebhookInstance.Method - """ - return self._properties['method'] - - @property - def filters(self): - """ - :returns: The list of webhook event triggers that are enabled for this Service. - :rtype: list[unicode] - """ - return self._properties['filters'] - - @property - def pre_webhook_url(self): - """ - :returns: The absolute url the pre-event webhook request should be sent to. - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The absolute url the post-event webhook request should be sent to. - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def target(self): - """ - :returns: The routing target of the webhook. - :rtype: WebhookInstance.Target - """ - return self._properties['target'] - - @property - def url(self): - """ - :returns: An absolute URL for this webhook. - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the WebhookInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - """ - return self._proxy.fetch() - def update(self, method=values.unset, filters=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - target=values.unset): - """ - Update the WebhookInstance - :param unicode method: The HTTP method to be used when sending a webhook request. - :param list[unicode] 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 WebhookInstance.Target target: The routing target of the webhook. +class WebhookListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookInstance - """ - return self._proxy.update( - method=method, - filters=filters, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - target=target, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/conversation.py b/twilio/rest/conversations/v1/conversation.py new file mode 100644 index 0000000000..9ff1d8ab1c --- /dev/null +++ b/twilio/rest/conversations/v1/conversation.py @@ -0,0 +1,185 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.conversation.message import MessageListInstancefrom twilio.rest.conversation.participant import ParticipantListInstancefrom twilio.rest.conversation.webhook import WebhookListInstance + + +class ConversationContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ConversationContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Conversations/${sid}' + + self._messages = None + self._participants = None + self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the ConversationInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ConversationInstance + + :returns: The fetched ConversationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConversationInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ConversationInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConversationInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ConversationInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'attributes' = payload.get('attributes'), + 'state' = payload.get('state'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'timers' = payload.get('timers'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'bindings' = payload.get('bindings'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConversationContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def messages(self): + return self._proxy.messages + @property + def participants(self): + return self._proxy.participants + @property + def webhooks(self): + return self._proxy.webhooks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConversationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ConversationListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Conversations' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ConversationInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ConversationPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/conversation/message.py b/twilio/rest/conversations/v1/conversation/message.py new file mode 100644 index 0000000000..23bc83ddb9 --- /dev/null +++ b/twilio/rest/conversations/v1/conversation/message.py @@ -0,0 +1,177 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.message.delivery_receipt import DeliveryReceiptListInstance + + +class MessageContext(InstanceContext): + def __init__(self, version: V1, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageContextList, self).__init__(version) + + # Path Solution + self._solution = { conversation_sid, sid, } + self._uri = '/Conversations/${conversation_sid}/Messages/${sid}' + + self._delivery_receipts = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the MessageInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessageInstance + + :returns: The fetched MessageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInstance( + self._version, + payload, + conversation_sidsid=self._solution['conversation_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MessageInstance(InstanceResource): + def __init__(self, version, payload, conversation_sid: str, sid: str): + super(MessageInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'sid' = payload.get('sid'), + 'index' = payload.get('index'), + 'author' = payload.get('author'), + 'body' = payload.get('body'), + 'media' = payload.get('media'), + 'attributes' = payload.get('attributes'), + 'participant_sid' = payload.get('participant_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'delivery' = payload.get('delivery'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'conversation_sid': conversation_sid or self._properties['conversation_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MessageContext( + self._version, + conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def delivery_receipts(self): + return self._proxy.delivery_receipts + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MessageListInstance(ListResource): + def __init__(self, version: V1, conversation_sid: str): + # TODO: needs autogenerated docs + super(MessageListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { conversation_sid, } + self._uri = '/Conversations/${conversation_sid}/Messages' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid']) + + + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagePage(self._version, payload, conversation_sid=self._solution['conversation_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py index 74d0e148d3..c8dc7e6707 100644 --- a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py @@ -1,412 +1,138 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DeliveryReceiptList(ListResource): - - def __init__(self, version, conversation_sid, message_sid): - """ - Initialize the DeliveryReceiptList - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this message. - :param message_sid: The SID of the message the delivery receipt belongs to - - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptList - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptList - """ - super(DeliveryReceiptList, self).__init__(version) - - # Path Solution - self._solution = {'conversation_sid': conversation_sid, 'message_sid': message_sid, } - self._uri = '/Conversations/{conversation_sid}/Messages/{message_sid}/Receipts'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DeliveryReceiptInstance 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 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.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DeliveryReceiptInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DeliveryReceiptInstance records from the API. - Request is executed immediately - - :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 DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DeliveryReceiptPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeliveryReceiptInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DeliveryReceiptPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DeliveryReceiptContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptContext - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptContext - """ - return DeliveryReceiptContext( - self._version, - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a DeliveryReceiptContext - - :param sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptContext - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptContext - """ - return DeliveryReceiptContext( - self._version, - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DeliveryReceiptPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DeliveryReceiptPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param conversation_sid: The unique ID of the Conversation for this message. - :param message_sid: The SID of the message the delivery receipt belongs to - - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptPage - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptPage - """ - super(DeliveryReceiptPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeliveryReceiptInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ - return DeliveryReceiptInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class DeliveryReceiptContext(InstanceContext): - - def __init__(self, version, conversation_sid, message_sid, sid): - """ - Initialize the DeliveryReceiptContext - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this delivery receipt. - :param message_sid: The SID of the message the delivery receipt belongs to. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptContext - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptContext - """ - super(DeliveryReceiptContext, self).__init__(version) + def __init__(self, version: V1, conversation_sid: str, message_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DeliveryReceiptContextList, self).__init__(version) # Path Solution - self._solution = {'conversation_sid': conversation_sid, 'message_sid': message_sid, 'sid': sid, } - self._uri = '/Conversations/{conversation_sid}/Messages/{message_sid}/Receipts/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DeliveryReceiptInstance - - :returns: The fetched DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DeliveryReceiptInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], - ) + self._solution = { conversation_sid, message_sid, sid, } + self._uri = '/Conversations/${conversation_sid}/Messages/${message_sid}/Receipts/${sid}' + + + def fetch(self): + + """ + Fetch the DeliveryReceiptInstance + + :returns: The fetched DeliveryReceiptInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DeliveryReceiptInstance( + self._version, + payload, + conversation_sidmessage_sidsid=self._solution['conversation_sid''message_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DeliveryReceiptInstance(InstanceResource): - - class DeliveryStatus(object): - READ = "read" - FAILED = "failed" - DELIVERED = "delivered" - UNDELIVERED = "undelivered" - SENT = "sent" - def __init__(self, version, payload, conversation_sid, message_sid, sid=None): - """ - Initialize the DeliveryReceiptInstance - - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ +class DeliveryReceiptInstance(InstanceResource): + def __init__(self, version, payload, conversation_sid: str, message_sid: str, sid: str): super(DeliveryReceiptInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'sid': payload.get('sid'), - 'message_sid': payload.get('message_sid'), - 'channel_message_sid': payload.get('channel_message_sid'), - 'participant_sid': payload.get('participant_sid'), - 'status': payload.get('status'), - 'error_code': deserialize.integer(payload.get('error_code')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'sid' = payload.get('sid'), + 'message_sid' = payload.get('message_sid'), + 'channel_message_sid' = payload.get('channel_message_sid'), + 'participant_sid' = payload.get('participant_sid'), + 'status' = payload.get('status'), + 'error_code' = payload.get('error_code'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'conversation_sid': conversation_sid, - 'message_sid': message_sid, - 'sid': sid or self._properties['sid'], + 'conversation_sid': conversation_sid or self._properties['conversation_sid']'message_sid': message_sid or self._properties['message_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeliveryReceiptContext for this DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptContext - """ if self._context is None: self._context = DeliveryReceiptContext( self._version, - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], + conversation_sid=self._solution['conversation_sid'],message_sid=self._solution['message_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this participant. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this message. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def message_sid(self): - """ - :returns: The SID of the message the delivery receipt belongs to - :rtype: unicode - """ - return self._properties['message_sid'] + - @property - def channel_message_sid(self): + def __repr__(self): """ - :returns: A messaging channel-specific identifier for the message delivered to participant - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['channel_message_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def participant_sid(self): - """ - :returns: The unique ID of the participant the delivery receipt belongs to. - :rtype: unicode - """ - return self._properties['participant_sid'] - @property - def status(self): - """ - :returns: The message delivery status - :rtype: DeliveryReceiptInstance.DeliveryStatus - """ - return self._properties['status'] - @property - def error_code(self): - """ - :returns: The message `delivery error code `_ for a `failed` status - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] +class DeliveryReceiptListInstance(ListResource): + def __init__(self, version: V1, conversation_sid: str, message_sid: str): + # TODO: needs autogenerated docs + super(DeliveryReceiptListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: An absolute URL for this delivery receipt. - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { conversation_sid, message_sid, } + self._uri = '/Conversations/${conversation_sid}/Messages/${message_sid}/Receipts' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the DeliveryReceiptInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ - return self._proxy.fetch() + return DeliveryReceiptPage(self._version, payload, conversation_sid=self._solution['conversation_sid']message_sid=self._solution['message_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/conversation/participant.py b/twilio/rest/conversations/v1/conversation/participant.py index cb27c9b8c4..2b87aa35f1 100644 --- a/twilio/rest/conversations/v1/conversation/participant.py +++ b/twilio/rest/conversations/v1/conversation/participant.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,545 +19,153 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ParticipantList(ListResource): - - def __init__(self, version, conversation_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this participant. - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantList - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'conversation_sid': conversation_sid, } - self._uri = '/Conversations/{conversation_sid}/Participants'.format(**self._solution) - - def create(self, identity=values.unset, messaging_binding_address=values.unset, - messaging_binding_proxy_address=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, - messaging_binding_projected_address=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the ParticipantInstance - - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode messaging_binding_address: The address of the participant's device. - :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. - :param unicode role_sid: The SID of a conversation-level Role to assign to the participant - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - """ - data = values.of({ - 'Identity': identity, - 'MessagingBinding.Address': messaging_binding_address, - 'MessagingBinding.ProxyAddress': messaging_binding_proxy_address, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - 'MessagingBinding.ProjectedAddress': messaging_binding_projected_address, - 'RoleSid': role_sid, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ParticipantInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - ) - - def stream(self, 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 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.conversations.v1.conversation.participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.conversation.participant.ParticipantInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :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 ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ParticipantContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantContext - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) - def __call__(self, sid): - """ - Constructs a ParticipantContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantContext - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param conversation_sid: The unique ID of the Conversation for this participant. - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantPage - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - """ - return ParticipantInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ParticipantContext(InstanceContext): - - def __init__(self, version, conversation_sid, sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this participant. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantContext - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) + def __init__(self, version: V1, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ParticipantContextList, self).__init__(version) # Path Solution - self._solution = {'conversation_sid': conversation_sid, 'sid': sid, } - self._uri = '/Conversations/{conversation_sid}/Participants/{sid}'.format(**self._solution) - - def update(self, date_created=values.unset, date_updated=values.unset, - attributes=values.unset, role_sid=values.unset, - messaging_binding_proxy_address=values.unset, - messaging_binding_projected_address=values.unset, - identity=values.unset, last_read_message_index=values.unset, - last_read_timestamp=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ParticipantInstance - - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode role_sid: The SID of a conversation-level Role to assign to the participant - :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. - :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode last_read_message_index: Index of last “read” message in the Conversation for the Participant. - :param unicode last_read_timestamp: Timestamp of last “read” message in the Conversation for the Participant. - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - """ - data = values.of({ - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - 'RoleSid': role_sid, - 'MessagingBinding.ProxyAddress': messaging_binding_proxy_address, - 'MessagingBinding.ProjectedAddress': messaging_binding_projected_address, - 'Identity': identity, - 'LastReadMessageIndex': last_read_message_index, - 'LastReadTimestamp': last_read_timestamp, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ParticipantInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the ParticipantInstance - - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def fetch(self): - """ - Fetch the ParticipantInstance + self._solution = { conversation_sid, sid, } + self._uri = '/Conversations/${conversation_sid}/Participants/${sid}' + + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the ParticipantInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ParticipantInstance + + :returns: The fetched ParticipantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ParticipantInstance( + self._version, + payload, + conversation_sidsid=self._solution['conversation_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ParticipantInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) + return ParticipantInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ParticipantInstance(InstanceResource): - - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, conversation_sid, sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - """ +class ParticipantInstance(InstanceResource): + def __init__(self, version, payload, conversation_sid: str, sid: str): super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'sid': payload.get('sid'), - 'identity': payload.get('identity'), - 'attributes': payload.get('attributes'), - 'messaging_binding': payload.get('messaging_binding'), - 'role_sid': payload.get('role_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'last_read_message_index': deserialize.integer(payload.get('last_read_message_index')), - 'last_read_timestamp': payload.get('last_read_timestamp'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'sid' = payload.get('sid'), + 'identity' = payload.get('identity'), + 'attributes' = payload.get('attributes'), + 'messaging_binding' = payload.get('messaging_binding'), + 'role_sid' = payload.get('role_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'last_read_message_index' = payload.get('last_read_message_index'), + 'last_read_timestamp' = payload.get('last_read_timestamp'), } - # Context self._context = None - self._solution = {'conversation_sid': conversation_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'conversation_sid': conversation_sid or self._properties['conversation_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantContext - """ if self._context is None: self._context = ParticipantContext( self._version, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], + conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this participant. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this participant. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def identity(self): - """ - :returns: A unique string identifier for the conversation participant as Conversation User. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] + - @property - def messaging_binding(self): - """ - :returns: Information about how this participant exchanges messages with the conversation. - :rtype: dict - """ - return self._properties['messaging_binding'] - - @property - def role_sid(self): - """ - :returns: The SID of a conversation-level Role to assign to the participant - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: An absolute URL for this participant. - :rtype: unicode - """ - return self._properties['url'] - - @property - def last_read_message_index(self): - """ - :returns: Index of last “read” message in the Conversation for the Participant. - :rtype: unicode - """ - return self._properties['last_read_message_index'] - - @property - def last_read_timestamp(self): - """ - :returns: Timestamp of last “read” message in the Conversation for the Participant. - :rtype: unicode - """ - return self._properties['last_read_timestamp'] - - def update(self, date_created=values.unset, date_updated=values.unset, - attributes=values.unset, role_sid=values.unset, - messaging_binding_proxy_address=values.unset, - messaging_binding_projected_address=values.unset, - identity=values.unset, last_read_message_index=values.unset, - last_read_timestamp=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ParticipantInstance - - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode role_sid: The SID of a conversation-level Role to assign to the participant - :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. - :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode last_read_message_index: Index of last “read” message in the Conversation for the Participant. - :param unicode last_read_timestamp: Timestamp of last “read” message in the Conversation for the Participant. - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance + def __repr__(self): """ - return self._proxy.update( - date_created=date_created, - date_updated=date_updated, - attributes=attributes, - role_sid=role_sid, - messaging_binding_proxy_address=messaging_binding_proxy_address, - messaging_binding_projected_address=messaging_binding_projected_address, - identity=identity, - last_read_message_index=last_read_message_index, - last_read_timestamp=last_read_timestamp, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the ParticipantInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) - def fetch(self): - """ - Fetch the ParticipantInstance +class ParticipantListInstance(ListResource): + def __init__(self, version: V1, conversation_sid: str): + # TODO: needs autogenerated docs + super(ParticipantListInstanceList, self).__init__(version) - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { conversation_sid, } + self._uri = '/Conversations/${conversation_sid}/Participants' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ParticipantInstance(self._version, payload, conversation_sid=self._solution['conversation_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ParticipantPage(self._version, payload, conversation_sid=self._solution['conversation_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/conversation/webhook.py b/twilio/rest/conversations/v1/conversation/webhook.py index 411a51b68d..5b1d74f127 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,464 +19,149 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WebhookList(ListResource): - - def __init__(self, version, conversation_sid): - """ - Initialize the WebhookList - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this webhook. - - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookList - """ - super(WebhookList, self).__init__(version) - - # Path Solution - self._solution = {'conversation_sid': conversation_sid, } - self._uri = '/Conversations/{conversation_sid}/Webhooks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams WebhookInstance 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 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.conversations.v1.conversation.webhook.WebhookInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists WebhookInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.conversation.webhook.WebhookInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WebhookInstance records from the API. - Request is executed immediately - - :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 WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WebhookPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WebhookInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WebhookPage(self._version, response, self._solution) - - def create(self, target, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset, - configuration_replay_after=values.unset): - """ - Create the WebhookInstance - - :param WebhookInstance.Target target: The target of this webhook. - :param unicode configuration_url: The absolute url the webhook request should be sent to. - :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request. - :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation. - :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation. - :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to. - :param unicode configuration_replay_after: The message index for which and it's successors the webhook will be replayed. - - :returns: The created WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - """ - data = values.of({ - 'Target': target, - 'Configuration.Url': configuration_url, - 'Configuration.Method': configuration_method, - 'Configuration.Filters': serialize.map(configuration_filters, lambda e: e), - 'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e), - 'Configuration.FlowSid': configuration_flow_sid, - 'Configuration.ReplayAfter': configuration_replay_after, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], ) - def get(self, sid): - """ - Constructs a WebhookContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext - """ - return WebhookContext(self._version, conversation_sid=self._solution['conversation_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WebhookContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext - """ - return WebhookContext(self._version, conversation_sid=self._solution['conversation_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WebhookPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WebhookPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param conversation_sid: The unique ID of the Conversation for this webhook. - - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookPage - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookPage - """ - super(WebhookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WebhookInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - """ - return WebhookInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WebhookContext(InstanceContext): - - def __init__(self, version, conversation_sid, sid): - """ - Initialize the WebhookContext - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this webhook. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext - """ - super(WebhookContext, self).__init__(version) + def __init__(self, version: V1, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) # Path Solution - self._solution = {'conversation_sid': conversation_sid, 'sid': sid, } - self._uri = '/Conversations/{conversation_sid}/Webhooks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the WebhookInstance - - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WebhookInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) - - def update(self, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset): - """ - Update the WebhookInstance + self._solution = { conversation_sid, sid, } + self._uri = '/Conversations/${conversation_sid}/Webhooks/${sid}' + + + def delete(self): + + + """ + Deletes the WebhookInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + conversation_sidsid=self._solution['conversation_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :param unicode configuration_url: The absolute url the webhook request should be sent to. - :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request. - :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation. - :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation. - :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to. + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - """ - data = values.of({ - 'Configuration.Url': configuration_url, - 'Configuration.Method': configuration_method, - 'Configuration.Filters': serialize.map(configuration_filters, lambda e: e), - 'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e), - 'Configuration.FlowSid': configuration_flow_sid, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WebhookInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return WebhookInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class WebhookInstance(InstanceResource): - - class Target(object): - WEBHOOK = "webhook" - TRIGGER = "trigger" - STUDIO = "studio" - class Method(object): - GET = "GET" - POST = "POST" - def __init__(self, version, payload, conversation_sid, sid=None): - """ - Initialize the WebhookInstance - - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - """ +class WebhookInstance(InstanceResource): + def __init__(self, version, payload, conversation_sid: str, sid: str): super(WebhookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'target': payload.get('target'), - 'url': payload.get('url'), - 'configuration': payload.get('configuration'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'target' = payload.get('target'), + 'url' = payload.get('url'), + 'configuration' = payload.get('configuration'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'conversation_sid': conversation_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'conversation_sid': conversation_sid or self._properties['conversation_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WebhookContext for this WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext - """ if self._context is None: self._context = WebhookContext( self._version, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], + conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this webhook. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def target(self): - """ - :returns: The target of this webhook. - :rtype: unicode - """ - return self._properties['target'] - - @property - def url(self): - """ - :returns: An absolute URL for this webhook. - :rtype: unicode - """ - return self._properties['url'] - - @property - def configuration(self): - """ - :returns: The configuration of this webhook. - :rtype: dict - """ - return self._properties['configuration'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): + def __repr__(self): """ - Fetch the WebhookInstance - - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset): - """ - Update the WebhookInstance - :param unicode configuration_url: The absolute url the webhook request should be sent to. - :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request. - :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation. - :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation. - :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to. - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance - """ - return self._proxy.update( - configuration_url=configuration_url, - configuration_method=configuration_method, - configuration_filters=configuration_filters, - configuration_triggers=configuration_triggers, - configuration_flow_sid=configuration_flow_sid, - ) - - def delete(self): - """ - Deletes the WebhookInstance +class WebhookListInstance(ListResource): + def __init__(self, version: V1, conversation_sid: str): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { conversation_sid, } + self._uri = '/Conversations/${conversation_sid}/Webhooks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, conversation_sid=self._solution['conversation_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WebhookPage(self._version, payload, conversation_sid=self._solution['conversation_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/credential.py b/twilio/rest/conversations/v1/credential.py index 506a955f0e..8d3640dd66 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -1,454 +1,167 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CredentialList(ListResource): - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.credential.CredentialList - :rtype: twilio.rest.conversations.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create the CredentialInstance - - :param CredentialInstance.PushType type: The type of push-notification service the credential is for. - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate. - :param unicode private_key: [APN only] The URL encoded representation of the private key. - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs. - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - :param unicode secret: [FCM only] The Server key of your project from Firebase console. - - :returns: The created CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance 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 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.conversations.v1.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :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 CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return CredentialPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.credential.CredentialContext - :rtype: twilio.rest.conversations.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.credential.CredentialContext - :rtype: twilio.rest.conversations.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.credential.CredentialPage - :rtype: twilio.rest.conversations.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.conversations.v1.credential.CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class CredentialContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.credential.CredentialContext - :rtype: twilio.rest.conversations.v1.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CredentialContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def update(self, type=values.unset, friendly_name=values.unset, - certificate=values.unset, private_key=values.unset, - sandbox=values.unset, api_key=values.unset, secret=values.unset): - """ - Update the CredentialInstance - - :param CredentialInstance.PushType type: The type of push-notification service the credential is for. - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate. - :param unicode private_key: [APN only] The URL encoded representation of the private key. - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs. - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - :param unicode secret: [FCM only] The Server key of your project from Firebase console. - - :returns: The updated CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Credentials/${sid}' + + + def delete(self): + + + """ + Deletes the CredentialInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialInstance + + :returns: The fetched CredentialInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CredentialInstance(InstanceResource): + return '' - class PushType(object): - APN = "apn" - GCM = "gcm" - FCM = "fcm" - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - :returns: twilio.rest.conversations.v1.credential.CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialInstance - """ +class CredentialInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'sandbox': payload.get('sandbox'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'sandbox' = payload.get('sandbox'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialContext - """ if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) + self._context = CredentialContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this credential. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The human-readable name of this credential. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type of push-notification service the credential is for. - :rtype: CredentialInstance.PushType - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: [APN only] Whether to send the credential to sandbox APNs. - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def url(self): + def __repr__(self): """ - :returns: An absolute URL for this credential. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, type=values.unset, friendly_name=values.unset, - certificate=values.unset, private_key=values.unset, - sandbox=values.unset, api_key=values.unset, secret=values.unset): - """ - Update the CredentialInstance - - :param CredentialInstance.PushType type: The type of push-notification service the credential is for. - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL encoded representation of the certificate. - :param unicode private_key: [APN only] The URL encoded representation of the private key. - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs. - :param unicode api_key: [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - :param unicode secret: [FCM only] The Server key of your project from Firebase console. - - :returns: The updated CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialInstance - """ - return self._proxy.update( - type=type, - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the CredentialInstance +class CredentialListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) - :returns: The fetched CredentialInstance - :rtype: twilio.rest.conversations.v1.credential.CredentialInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Credentials' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/participant_conversation.py b/twilio/rest/conversations/v1/participant_conversation.py index 89206daaf5..a4448d610b 100644 --- a/twilio/rest/conversations/v1/participant_conversation.py +++ b/twilio/rest/conversations/v1/participant_conversation.py @@ -1,348 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ParticipantConversationList(ListResource): - - def __init__(self, version): - """ - Initialize the ParticipantConversationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationList - :rtype: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationList - """ - super(ParticipantConversationList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/ParticipantConversations'.format(**self._solution) - - def stream(self, identity=values.unset, address=values.unset, limit=None, - page_size=None): - """ - Streams ParticipantConversationInstance 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 identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode address: A unique string identifier for the conversation participant who's not a Conversation User. - :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.conversations.v1.participant_conversation.ParticipantConversationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, address=address, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, identity=values.unset, address=values.unset, limit=None, - page_size=None): - """ - Lists ParticipantConversationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode address: A unique string identifier for the conversation participant who's not a Conversation User. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.participant_conversation.ParticipantConversationInstance] - """ - return list(self.stream(identity=identity, address=address, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, address=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantConversationInstance records from the API. - Request is executed immediately - - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode address: A unique string identifier for the conversation participant who's not a Conversation User. - :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 ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationPage - """ - data = values.of({ - 'Identity': identity, - 'Address': address, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) +from twilio.base.page import Page - return ParticipantConversationPage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantConversationInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - :returns: Page of ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return ParticipantConversationPage(self._version, response, self._solution) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantConversationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantConversationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationPage - :rtype: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationPage - """ - super(ParticipantConversationPage, self).__init__(version, response) +class ParticipantConversationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ParticipantConversationListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { } + self._uri = '/ParticipantConversations' + + + def page(self, identity, address, page_size): + + data = values.of({ + 'identity': identity,'address': address,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of ParticipantConversationInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationInstance - """ - return ParticipantConversationInstance(self._version, payload, ) + return ParticipantConversationPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class ParticipantConversationInstance(InstanceResource): - - class State(object): - INACTIVE = "inactive" - ACTIVE = "active" - CLOSED = "closed" - - def __init__(self, version, payload): - """ - Initialize the ParticipantConversationInstance - - :returns: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.participant_conversation.ParticipantConversationInstance - """ - super(ParticipantConversationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'participant_sid': payload.get('participant_sid'), - 'participant_user_sid': payload.get('participant_user_sid'), - 'participant_identity': payload.get('participant_identity'), - 'participant_messaging_binding': payload.get('participant_messaging_binding'), - 'conversation_sid': payload.get('conversation_sid'), - 'conversation_unique_name': payload.get('conversation_unique_name'), - 'conversation_friendly_name': payload.get('conversation_friendly_name'), - 'conversation_attributes': payload.get('conversation_attributes'), - 'conversation_date_created': deserialize.iso8601_datetime(payload.get('conversation_date_created')), - 'conversation_date_updated': deserialize.iso8601_datetime(payload.get('conversation_date_updated')), - 'conversation_created_by': payload.get('conversation_created_by'), - 'conversation_state': payload.get('conversation_state'), - 'conversation_timers': payload.get('conversation_timers'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {} - - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The unique ID of the Conversation Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def participant_sid(self): - """ - :returns: The unique ID of the Participant. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def participant_user_sid(self): - """ - :returns: The unique ID for the conversation participant as Conversation User. - :rtype: unicode - """ - return self._properties['participant_user_sid'] - - @property - def participant_identity(self): - """ - :returns: A unique string identifier for the conversation participant as Conversation User. - :rtype: unicode - """ - return self._properties['participant_identity'] - - @property - def participant_messaging_binding(self): - """ - :returns: Information about how this participant exchanges messages with the conversation. - :rtype: dict - """ - return self._properties['participant_messaging_binding'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation this Participant belongs to. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def conversation_unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the Conversation resource - :rtype: unicode - """ - return self._properties['conversation_unique_name'] - - @property - def conversation_friendly_name(self): - """ - :returns: The human-readable name of this conversation. - :rtype: unicode - """ - return self._properties['conversation_friendly_name'] - - @property - def conversation_attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['conversation_attributes'] + return '' - @property - def conversation_date_created(self): - """ - :returns: The date that this conversation was created. - :rtype: datetime - """ - return self._properties['conversation_date_created'] - - @property - def conversation_date_updated(self): - """ - :returns: The date that this conversation was last updated. - :rtype: datetime - """ - return self._properties['conversation_date_updated'] - - @property - def conversation_created_by(self): - """ - :returns: Creator of this conversation. - :rtype: unicode - """ - return self._properties['conversation_created_by'] - - @property - def conversation_state(self): - """ - :returns: The current state of this User Conversation - :rtype: ParticipantConversationInstance.State - """ - return self._properties['conversation_state'] - - @property - def conversation_timers(self): - """ - :returns: Timer date values for this conversation. - :rtype: dict - """ - return self._properties['conversation_timers'] - - @property - def links(self): - """ - :returns: Absolute URLs to access the participant and conversation of this Participant Conversation. - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/conversations/v1/role.py b/twilio/rest/conversations/v1/role.py index 7a0fe1cc36..f46d98e29f 100644 --- a/twilio/rest/conversations/v1/role.py +++ b/twilio/rest/conversations/v1/role.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,410 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RoleList(ListResource): - - def __init__(self, version): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.role.RoleList - :rtype: twilio.rest.conversations.v1.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create the RoleInstance - - :param unicode friendly_name: A string to describe the new resource - :param RoleInstance.RoleType type: The type of role - :param list[unicode] permission: A permission the role should have - - :returns: The created RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Permission': serialize.map(permission, lambda e: e), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RoleInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance 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 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.conversations.v1.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :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 RoleInstance - :rtype: twilio.rest.conversations.v1.role.RolePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.conversations.v1.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The SID of the Role resource to fetch - - :returns: twilio.rest.conversations.v1.role.RoleContext - :rtype: twilio.rest.conversations.v1.role.RoleContext - """ - return RoleContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The SID of the Role resource to fetch - - :returns: twilio.rest.conversations.v1.role.RoleContext - :rtype: twilio.rest.conversations.v1.role.RoleContext - """ - return RoleContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RolePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.role.RolePage - :rtype: twilio.rest.conversations.v1.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.role.RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleInstance - """ - return RoleInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RoleContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param sid: The SID of the Role resource to fetch - - :returns: twilio.rest.conversations.v1.role.RoleContext - :rtype: twilio.rest.conversations.v1.role.RoleContext - """ - super(RoleContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(RoleContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Roles/{sid}'.format(**self._solution) - - def update(self, permission): - """ - Update the RoleInstance - - :param list[unicode] permission: A permission the role should have - - :returns: The updated RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RoleInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the RoleInstance - - :returns: The fetched RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RoleInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Roles/${sid}' + + + def delete(self): + + + """ + Deletes the RoleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RoleInstance + + :returns: The fetched RoleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoleInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RoleInstance(InstanceResource): - - class RoleType(object): - CONVERSATION = "conversation" - SERVICE = "service" - def __init__(self, version, payload, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.conversations.v1.role.RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleInstance - """ +class RoleInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'permissions': payload.get('permissions'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'permissions' = payload.get('permissions'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleContext - """ if self._context is None: - self._context = RoleContext(self._version, sid=self._solution['sid'], ) + self._context = RoleContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def type(self): - """ - :returns: The type of role - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: An array of the permissions the role has been granted - :rtype: list[unicode] - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: An absolute URL for this user role. - :rtype: unicode - """ - return self._properties['url'] - - def update(self, permission): + def __repr__(self): """ - Update the RoleInstance - - :param list[unicode] permission: A permission the role should have - - :returns: The updated RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(permission, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the RoleInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the RoleInstance +class RoleListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RoleListInstanceList, self).__init__(version) - :returns: The fetched RoleInstance - :rtype: twilio.rest.conversations.v1.role.RoleInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Roles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RolePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service.py b/twilio/rest/conversations/v1/service.py new file mode 100644 index 0000000000..253145c944 --- /dev/null +++ b/twilio/rest/conversations/v1/service.py @@ -0,0 +1,179 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.configuration import ConfigurationListInstancefrom twilio.rest.service.conversation import ConversationListInstancefrom twilio.rest.service.participant_conversation import ParticipantConversationListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._bindings = None + self._configuration = None + self._conversations = None + self._participant_conversations = None + self._roles = None + self._users = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def bindings(self): + return self._proxy.bindings + @property + def configuration(self): + return self._proxy.configuration + @property + def conversations(self): + return self._proxy.conversations + @property + def participant_conversations(self): + return self._proxy.participant_conversations + @property + def roles(self): + return self._proxy.roles + @property + def users(self): + return self._proxy.users + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/service/binding.py b/twilio/rest/conversations/v1/service/binding.py index 1b16efff99..8d24240c84 100644 --- a/twilio/rest/conversations/v1/service/binding.py +++ b/twilio/rest/conversations/v1/service/binding.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,414 +19,131 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BindingList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the BindingList - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - - :returns: twilio.rest.conversations.v1.service.binding.BindingList - :rtype: twilio.rest.conversations.v1.service.binding.BindingList - """ - super(BindingList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/Bindings'.format(**self._solution) - - def stream(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Streams BindingInstance 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 list[BindingInstance.BindingType] binding_type: The push technology used by the Binding resources to read. - :param list[unicode] identity: The identity of Conversation User associated with this binding. - :param 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.conversations.v1.service.binding.BindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(binding_type=binding_type, identity=identity, page_size=limits['page_size'], ) - return self._version.stream(page, limits['limit']) - - def list(self, binding_type=values.unset, identity=values.unset, limit=None, - page_size=None): - """ - Lists BindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[BindingInstance.BindingType] binding_type: The push technology used by the Binding resources to read. - :param list[unicode] identity: The identity of Conversation User associated with this binding. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.service.binding.BindingInstance] - """ - return list(self.stream( - binding_type=binding_type, - identity=identity, - limit=limit, - page_size=page_size, - )) - - def page(self, binding_type=values.unset, identity=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BindingInstance records from the API. - Request is executed immediately - - :param list[BindingInstance.BindingType] binding_type: The push technology used by the Binding resources to read. - :param list[unicode] identity: The identity of Conversation User associated with this binding. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BindingInstance - :rtype: twilio.rest.conversations.v1.service.binding.BindingPage - """ - data = values.of({ - 'BindingType': serialize.map(binding_type, lambda e: e), - 'Identity': serialize.map(identity, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BindingInstance - :rtype: twilio.rest.conversations.v1.service.binding.BindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BindingContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.binding.BindingContext - :rtype: twilio.rest.conversations.v1.service.binding.BindingContext - """ - return BindingContext(self._version, chat_service_sid=self._solution['chat_service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BindingContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.binding.BindingContext - :rtype: twilio.rest.conversations.v1.service.binding.BindingContext - """ - return BindingContext(self._version, chat_service_sid=self._solution['chat_service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BindingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the BindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - - :returns: twilio.rest.conversations.v1.service.binding.BindingPage - :rtype: twilio.rest.conversations.v1.service.binding.BindingPage - """ - super(BindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.binding.BindingInstance - :rtype: twilio.rest.conversations.v1.service.binding.BindingInstance - """ - return BindingInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class BindingContext(InstanceContext): - - def __init__(self, version, chat_service_sid, sid): - """ - Initialize the BindingContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.binding.BindingContext - :rtype: twilio.rest.conversations.v1.service.binding.BindingContext - """ - super(BindingContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BindingContextList, self).__init__(version) # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid, } - self._uri = '/Services/{chat_service_sid}/Bindings/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the BindingInstance - - :returns: The fetched BindingInstance - :rtype: twilio.rest.conversations.v1.service.binding.BindingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BindingInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], - ) + self._solution = { chat_service_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Bindings/${sid}' + + + def delete(self): + + + """ + Deletes the BindingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the BindingInstance + + :returns: The fetched BindingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BindingInstance( + self._version, + payload, + chat_service_sidsid=self._solution['chat_service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class BindingInstance(InstanceResource): - class BindingType(object): - APN = "apn" - GCM = "gcm" - FCM = "fcm" - - def __init__(self, version, payload, chat_service_sid, sid=None): - """ - Initialize the BindingInstance - :returns: twilio.rest.conversations.v1.service.binding.BindingInstance - :rtype: twilio.rest.conversations.v1.service.binding.BindingInstance - """ +class BindingInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, sid: str): super(BindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'credential_sid': payload.get('credential_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'endpoint': payload.get('endpoint'), - 'identity': payload.get('identity'), - 'binding_type': payload.get('binding_type'), - 'message_types': payload.get('message_types'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'credential_sid' = payload.get('credential_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'endpoint' = payload.get('endpoint'), + 'identity' = payload.get('identity'), + 'binding_type' = payload.get('binding_type'), + 'message_types' = payload.get('message_types'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BindingContext for this BindingInstance - :rtype: twilio.rest.conversations.v1.service.binding.BindingContext - """ if self._context is None: self._context = BindingContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this binding. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def credential_sid(self): - """ - :returns: The SID of the Credential for the binding. - :rtype: unicode - """ - return self._properties['credential_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def endpoint(self): - """ - :returns: The unique endpoint identifier for the Binding. - :rtype: unicode - """ - return self._properties['endpoint'] + - @property - def identity(self): - """ - :returns: The identity of Conversation User associated with this binding. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def binding_type(self): + def __repr__(self): """ - :returns: The push technology to use for the binding. - :rtype: BindingInstance.BindingType + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['binding_type'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def message_types(self): - """ - :returns: The Conversation message types the binding is subscribed to. - :rtype: list[unicode] - """ - return self._properties['message_types'] - @property - def url(self): - """ - :returns: An absolute URL for this binding. - :rtype: unicode - """ - return self._properties['url'] - def delete(self): - """ - Deletes the BindingInstance +class BindingListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(BindingListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Bindings' + + + def page(self, binding_type, identity, page_size): + + data = values.of({ + 'binding_type': binding_type,'identity': identity,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the BindingInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched BindingInstance - :rtype: twilio.rest.conversations.v1.service.binding.BindingInstance - """ - return self._proxy.fetch() + return BindingPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/configuration.py b/twilio/rest/conversations/v1/service/configuration.py new file mode 100644 index 0000000000..eeef699e64 --- /dev/null +++ b/twilio/rest/conversations/v1/service/configuration.py @@ -0,0 +1,135 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.configuration.notification import NotificationListInstancefrom twilio.rest.configuration.webhook import WebhookListInstance + + +class ConfigurationContext(InstanceContext): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(ConfigurationContextList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Configuration' + + + def fetch(self): + + """ + Fetch the ConfigurationInstance + + :returns: The fetched ConfigurationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConfigurationInstance( + self._version, + payload, + chat_service_sid=self._solution['chat_service_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ConfigurationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConfigurationInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str): + super(ConfigurationInstance, self).__init__(version) + self._properties = { + 'chat_service_sid' = payload.get('chat_service_sid'), + 'default_conversation_creator_role_sid' = payload.get('default_conversation_creator_role_sid'), + 'default_conversation_role_sid' = payload.get('default_conversation_role_sid'), + 'default_chat_service_role_sid' = payload.get('default_chat_service_role_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'reachability_enabled' = payload.get('reachability_enabled'), + } + + self._context = None + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConfigurationContext( + self._version, + chat_service_sid=self._solution['chat_service_sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConfigurationListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(ConfigurationListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '' + + self._notifications = None + self._webhooks = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/service/configuration/notification.py b/twilio/rest/conversations/v1/service/configuration/notification.py index b41c1514e7..1cda1cd7c7 100644 --- a/twilio/rest/conversations/v1/service/configuration/notification.py +++ b/twilio/rest/conversations/v1/service/configuration/notification.py @@ -1,240 +1,97 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NotificationList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the NotificationList - - :param Version version: Version that contains the resource - :param chat_service_sid: The unique string that identifies the resource - - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationList - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - - def get(self): - """ - Constructs a NotificationContext - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationContext - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationContext - """ - return NotificationContext(self._version, chat_service_sid=self._solution['chat_service_sid'], ) - - def __call__(self): - """ - Constructs a NotificationContext - - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationContext - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationContext - """ - return NotificationContext(self._version, chat_service_sid=self._solution['chat_service_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NotificationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The unique string that identifies the resource - - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationPage - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NotificationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - """ - return NotificationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class NotificationContext(InstanceContext): - - def __init__(self, version, chat_service_sid): - """ - Initialize the NotificationContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the Configuration applies to. - - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationContext - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationContext - """ - super(NotificationContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(NotificationContextList, self).__init__(version) # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/Configuration/Notifications'.format(**self._solution) - - def update(self, log_enabled=values.unset, new_message_enabled=values.unset, - new_message_template=values.unset, new_message_sound=values.unset, - new_message_badge_count_enabled=values.unset, - added_to_conversation_enabled=values.unset, - added_to_conversation_template=values.unset, - added_to_conversation_sound=values.unset, - removed_from_conversation_enabled=values.unset, - removed_from_conversation_template=values.unset, - removed_from_conversation_sound=values.unset, - new_message_with_media_enabled=values.unset, - new_message_with_media_template=values.unset): - """ - Update the NotificationInstance - - :param bool log_enabled: Weather the notification logging is enabled. - :param bool new_message_enabled: Whether to send a notification when a new message is added to a conversation. - :param unicode new_message_template: The template to use to create the notification text displayed when a new message is added to a conversation. - :param unicode new_message_sound: The name of the sound to play when a new message is added to a conversation. - :param bool new_message_badge_count_enabled: Whether the new message badge is enabled. - :param bool added_to_conversation_enabled: Whether to send a notification when a participant is added to a conversation. - :param unicode added_to_conversation_template: The template to use to create the notification text displayed when a participant is added to a conversation. - :param unicode added_to_conversation_sound: The name of the sound to play when a participant is added to a conversation. - :param bool removed_from_conversation_enabled: Whether to send a notification to a user when they are removed from a conversation. - :param unicode removed_from_conversation_template: The template to use to create the notification text displayed to a user when they are removed. - :param unicode removed_from_conversation_sound: The name of the sound to play to a user when they are removed from a conversation. - :param bool new_message_with_media_enabled: Whether to send a notification when a new message with media/file attachments is added to a conversation. - :param unicode new_message_with_media_template: The template to use to create the notification text displayed when a new message with media/file attachments is added to a conversation. - - :returns: The updated NotificationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - """ - data = values.of({ - 'LogEnabled': log_enabled, - 'NewMessage.Enabled': new_message_enabled, - 'NewMessage.Template': new_message_template, - 'NewMessage.Sound': new_message_sound, - 'NewMessage.BadgeCountEnabled': new_message_badge_count_enabled, - 'AddedToConversation.Enabled': added_to_conversation_enabled, - 'AddedToConversation.Template': added_to_conversation_template, - 'AddedToConversation.Sound': added_to_conversation_sound, - 'RemovedFromConversation.Enabled': removed_from_conversation_enabled, - 'RemovedFromConversation.Template': removed_from_conversation_template, - 'RemovedFromConversation.Sound': removed_from_conversation_sound, - 'NewMessage.WithMedia.Enabled': new_message_with_media_enabled, - 'NewMessage.WithMedia.Template': new_message_with_media_template, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return NotificationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) - - def fetch(self): - """ - Fetch the NotificationInstance + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Configuration/Notifications' + + + def fetch(self): + + """ + Fetch the NotificationInstance + + :returns: The fetched NotificationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NotificationInstance( + self._version, + payload, + chat_service_sid=self._solution['chat_service_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched NotificationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return NotificationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) + return NotificationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NotificationInstance(InstanceResource): - def __init__(self, version, payload, chat_service_sid): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - """ +class NotificationInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str): super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'new_message': payload.get('new_message'), - 'added_to_conversation': payload.get('added_to_conversation'), - 'removed_from_conversation': payload.get('removed_from_conversation'), - 'log_enabled': payload.get('log_enabled'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'new_message' = payload.get('new_message'), + 'added_to_conversation' = payload.get('added_to_conversation'), + 'removed_from_conversation' = payload.get('removed_from_conversation'), + 'log_enabled' = payload.get('log_enabled'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'chat_service_sid': chat_service_sid, } + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NotificationContext for this NotificationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationContext - """ if self._context is None: self._context = NotificationContext( self._version, @@ -242,124 +99,35 @@ def _proxy(self): ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this configuration. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the Configuration applies to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def new_message(self): - """ - :returns: The Push Notification configuration for New Messages. - :rtype: dict - """ - return self._properties['new_message'] - - @property - def added_to_conversation(self): - """ - :returns: The Push Notification configuration for being added to a Conversation. - :rtype: dict - """ - return self._properties['added_to_conversation'] + - @property - def removed_from_conversation(self): - """ - :returns: The Push Notification configuration for being removed from a Conversation. - :rtype: dict - """ - return self._properties['removed_from_conversation'] - - @property - def log_enabled(self): - """ - :returns: Weather the notification logging is enabled. - :rtype: bool - """ - return self._properties['log_enabled'] - - @property - def url(self): - """ - :returns: An absolute URL for this configuration. - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def update(self, log_enabled=values.unset, new_message_enabled=values.unset, - new_message_template=values.unset, new_message_sound=values.unset, - new_message_badge_count_enabled=values.unset, - added_to_conversation_enabled=values.unset, - added_to_conversation_template=values.unset, - added_to_conversation_sound=values.unset, - removed_from_conversation_enabled=values.unset, - removed_from_conversation_template=values.unset, - removed_from_conversation_sound=values.unset, - new_message_with_media_enabled=values.unset, - new_message_with_media_template=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the NotificationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param bool log_enabled: Weather the notification logging is enabled. - :param bool new_message_enabled: Whether to send a notification when a new message is added to a conversation. - :param unicode new_message_template: The template to use to create the notification text displayed when a new message is added to a conversation. - :param unicode new_message_sound: The name of the sound to play when a new message is added to a conversation. - :param bool new_message_badge_count_enabled: Whether the new message badge is enabled. - :param bool added_to_conversation_enabled: Whether to send a notification when a participant is added to a conversation. - :param unicode added_to_conversation_template: The template to use to create the notification text displayed when a participant is added to a conversation. - :param unicode added_to_conversation_sound: The name of the sound to play when a participant is added to a conversation. - :param bool removed_from_conversation_enabled: Whether to send a notification to a user when they are removed from a conversation. - :param unicode removed_from_conversation_template: The template to use to create the notification text displayed to a user when they are removed. - :param unicode removed_from_conversation_sound: The name of the sound to play to a user when they are removed from a conversation. - :param bool new_message_with_media_enabled: Whether to send a notification when a new message with media/file attachments is added to a conversation. - :param unicode new_message_with_media_template: The template to use to create the notification text displayed when a new message with media/file attachments is added to a conversation. - :returns: The updated NotificationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - """ - return self._proxy.update( - log_enabled=log_enabled, - new_message_enabled=new_message_enabled, - new_message_template=new_message_template, - new_message_sound=new_message_sound, - new_message_badge_count_enabled=new_message_badge_count_enabled, - added_to_conversation_enabled=added_to_conversation_enabled, - added_to_conversation_template=added_to_conversation_template, - added_to_conversation_sound=added_to_conversation_sound, - removed_from_conversation_enabled=removed_from_conversation_enabled, - removed_from_conversation_template=removed_from_conversation_template, - removed_from_conversation_sound=removed_from_conversation_sound, - new_message_with_media_enabled=new_message_with_media_enabled, - new_message_with_media_template=new_message_with_media_template, - ) - def fetch(self): - """ - Fetch the NotificationInstance +class NotificationListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(NotificationListInstanceList, self).__init__(version) - :returns: The fetched NotificationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/configuration/webhook.py b/twilio/rest/conversations/v1/service/configuration/webhook.py index dfa1d593cd..35b1c04f91 100644 --- a/twilio/rest/conversations/v1/service/configuration/webhook.py +++ b/twilio/rest/conversations/v1/service/configuration/webhook.py @@ -1,301 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WebhookList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the WebhookList - - :param Version version: Version that contains the resource - :param chat_service_sid: The unique string that identifies the resource - - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookList - """ - super(WebhookList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - - def get(self): - """ - Constructs a WebhookContext - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookContext - """ - return WebhookContext(self._version, chat_service_sid=self._solution['chat_service_sid'], ) - - def __call__(self): - """ - Constructs a WebhookContext - - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookContext - """ - return WebhookContext(self._version, chat_service_sid=self._solution['chat_service_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WebhookPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WebhookPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The unique string that identifies the resource - - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookPage - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookPage - """ - super(WebhookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WebhookInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - """ - return WebhookInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WebhookContext(InstanceContext): - - def __init__(self, version, chat_service_sid): - """ - Initialize the WebhookContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The unique ID of the `Conversation Service `_ this conversation belongs to. - - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookContext - """ - super(WebhookContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/Configuration/Webhooks'.format(**self._solution) - - def update(self, pre_webhook_url=values.unset, post_webhook_url=values.unset, - filters=values.unset, method=values.unset): - """ - Update the WebhookInstance - - :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 list[unicode] filters: The list of events that your configured webhook targets will receive. Events not configured here will not fire. - :param unicode method: The HTTP method to be used when sending a webhook request - - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - """ - data = values.of({ - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'Filters': serialize.map(filters, lambda e: e), - 'Method': method, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - - def fetch(self): - """ - Fetch the WebhookInstance - - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WebhookInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Configuration/Webhooks' + + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + chat_service_sid=self._solution['chat_service_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class WebhookInstance(InstanceResource): - class Method(object): - GET = "GET" - POST = "POST" - def __init__(self, version, payload, chat_service_sid): - """ - Initialize the WebhookInstance - - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - """ +class WebhookInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str): super(WebhookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'pre_webhook_url': payload.get('pre_webhook_url'), - 'post_webhook_url': payload.get('post_webhook_url'), - 'filters': payload.get('filters'), - 'method': payload.get('method'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'pre_webhook_url' = payload.get('pre_webhook_url'), + 'post_webhook_url' = payload.get('post_webhook_url'), + 'filters' = payload.get('filters'), + 'method' = payload.get('method'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'chat_service_sid': chat_service_sid, } + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WebhookContext for this WebhookInstance - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookContext - """ if self._context is None: - self._context = WebhookContext(self._version, chat_service_sid=self._solution['chat_service_sid'], ) + self._context = WebhookContext( + self._version, + chat_service_sid=self._solution['chat_service_sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this service. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The unique ID of the `Conversation Service `_ this conversation belongs to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def pre_webhook_url(self): - """ - :returns: The absolute url the pre-event webhook request should be sent to. - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The absolute url the post-event webhook request should be sent to. - :rtype: unicode - """ - return self._properties['post_webhook_url'] + - @property - def filters(self): - """ - :returns: The list of events that your configured webhook targets will receive. Events not configured here will not fire. - :rtype: list[unicode] - """ - return self._properties['filters'] - - @property - def method(self): - """ - :returns: The HTTP method to be used when sending a webhook request - :rtype: WebhookInstance.Method - """ - return self._properties['method'] - - @property - def url(self): - """ - :returns: An absolute URL for this webhook. - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def update(self, pre_webhook_url=values.unset, post_webhook_url=values.unset, - filters=values.unset, method=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the WebhookInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :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 list[unicode] filters: The list of events that your configured webhook targets will receive. Events not configured here will not fire. - :param unicode method: The HTTP method to be used when sending a webhook request - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - """ - return self._proxy.update( - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - filters=filters, - method=method, - ) - def fetch(self): - """ - Fetch the WebhookInstance +class WebhookListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/conversation.py b/twilio/rest/conversations/v1/service/conversation.py new file mode 100644 index 0000000000..94aea411bf --- /dev/null +++ b/twilio/rest/conversations/v1/service/conversation.py @@ -0,0 +1,185 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.conversation.message import MessageListInstancefrom twilio.rest.conversation.participant import ParticipantListInstancefrom twilio.rest.conversation.webhook import WebhookListInstance + + +class ConversationContext(InstanceContext): + def __init__(self, version: V1, chat_service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ConversationContextList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${sid}' + + self._messages = None + self._participants = None + self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the ConversationInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ConversationInstance + + :returns: The fetched ConversationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConversationInstance( + self._version, + payload, + chat_service_sidsid=self._solution['chat_service_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConversationInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, sid: str): + super(ConversationInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'attributes' = payload.get('attributes'), + 'state' = payload.get('state'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'timers' = payload.get('timers'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'bindings' = payload.get('bindings'), + } + + self._context = None + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConversationContext( + self._version, + chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def messages(self): + return self._proxy.messages + @property + def participants(self): + return self._proxy.participants + @property + def webhooks(self): + return self._proxy.webhooks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConversationListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(ConversationListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Conversations' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ConversationPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/service/conversation/message.py b/twilio/rest/conversations/v1/service/conversation/message.py new file mode 100644 index 0000000000..dd2a11ee65 --- /dev/null +++ b/twilio/rest/conversations/v1/service/conversation/message.py @@ -0,0 +1,178 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.message.delivery_receipt import DeliveryReceiptListInstance + + +class MessageContext(InstanceContext): + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageContextList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, conversation_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages/${sid}' + + self._delivery_receipts = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the MessageInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessageInstance + + :returns: The fetched MessageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInstance( + self._version, + payload, + chat_service_sidconversation_sidsid=self._solution['chat_service_sid''conversation_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MessageInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, conversation_sid: str, sid: str): + super(MessageInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'sid' = payload.get('sid'), + 'index' = payload.get('index'), + 'author' = payload.get('author'), + 'body' = payload.get('body'), + 'media' = payload.get('media'), + 'attributes' = payload.get('attributes'), + 'participant_sid' = payload.get('participant_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'delivery' = payload.get('delivery'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'conversation_sid': conversation_sid or self._properties['conversation_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MessageContext( + self._version, + chat_service_sid=self._solution['chat_service_sid'],conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def delivery_receipts(self): + return self._proxy.delivery_receipts + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MessageListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str): + # TODO: needs autogenerated docs + super(MessageListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, conversation_sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) + + + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagePage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py index b444eeb250..f3b7419197 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py @@ -1,441 +1,139 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DeliveryReceiptList(ListResource): - - def __init__(self, version, chat_service_sid, conversation_sid, message_sid): - """ - Initialize the DeliveryReceiptList - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this message. - :param message_sid: The SID of the message the delivery receipt belongs to - - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptList - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptList - """ - super(DeliveryReceiptList, self).__init__(version) - - # Path Solution - self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'message_sid': message_sid, - } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Messages/{message_sid}/Receipts'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DeliveryReceiptInstance 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 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.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DeliveryReceiptInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DeliveryReceiptInstance records from the API. - Request is executed immediately - - :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 DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DeliveryReceiptPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeliveryReceiptInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DeliveryReceiptPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DeliveryReceiptContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptContext - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptContext - """ - return DeliveryReceiptContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a DeliveryReceiptContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptContext - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptContext - """ - return DeliveryReceiptContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.page import Page -class DeliveryReceiptPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DeliveryReceiptPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this message. - :param message_sid: The SID of the message the delivery receipt belongs to - - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptPage - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptPage - """ - super(DeliveryReceiptPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeliveryReceiptInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ - return DeliveryReceiptInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DeliveryReceiptContext(InstanceContext): - - def __init__(self, version, chat_service_sid, conversation_sid, message_sid, - sid): - """ - Initialize the DeliveryReceiptContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this delivery receipt. - :param message_sid: The SID of the message the delivery receipt belongs to. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptContext - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptContext - """ - super(DeliveryReceiptContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str, message_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DeliveryReceiptContextList, self).__init__(version) # Path Solution - self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'message_sid': message_sid, - 'sid': sid, - } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Messages/{message_sid}/Receipts/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DeliveryReceiptInstance - - :returns: The fetched DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DeliveryReceiptInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], - ) + self._solution = { chat_service_sid, conversation_sid, message_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages/${message_sid}/Receipts/${sid}' + + + def fetch(self): + + """ + Fetch the DeliveryReceiptInstance + + :returns: The fetched DeliveryReceiptInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DeliveryReceiptInstance( + self._version, + payload, + chat_service_sidconversation_sidmessage_sidsid=self._solution['chat_service_sid''conversation_sid''message_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DeliveryReceiptInstance(InstanceResource): - class DeliveryStatus(object): - READ = "read" - FAILED = "failed" - DELIVERED = "delivered" - UNDELIVERED = "undelivered" - SENT = "sent" - - def __init__(self, version, payload, chat_service_sid, conversation_sid, - message_sid, sid=None): - """ - Initialize the DeliveryReceiptInstance - - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ +class DeliveryReceiptInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, conversation_sid: str, message_sid: str, sid: str): super(DeliveryReceiptInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'message_sid': payload.get('message_sid'), - 'sid': payload.get('sid'), - 'channel_message_sid': payload.get('channel_message_sid'), - 'participant_sid': payload.get('participant_sid'), - 'status': payload.get('status'), - 'error_code': deserialize.integer(payload.get('error_code')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'message_sid' = payload.get('message_sid'), + 'sid' = payload.get('sid'), + 'channel_message_sid' = payload.get('channel_message_sid'), + 'participant_sid' = payload.get('participant_sid'), + 'status' = payload.get('status'), + 'error_code' = payload.get('error_code'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'message_sid': message_sid, - 'sid': sid or self._properties['sid'], + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'conversation_sid': conversation_sid or self._properties['conversation_sid']'message_sid': message_sid or self._properties['message_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeliveryReceiptContext for this DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptContext - """ if self._context is None: self._context = DeliveryReceiptContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['message_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],conversation_sid=self._solution['conversation_sid'],message_sid=self._solution['message_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this participant. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this message. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def message_sid(self): - """ - :returns: The SID of the message the delivery receipt belongs to - :rtype: unicode - """ - return self._properties['message_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def channel_message_sid(self): - """ - :returns: A messaging channel-specific identifier for the message delivered to participant - :rtype: unicode - """ - return self._properties['channel_message_sid'] - - @property - def participant_sid(self): - """ - :returns: The unique ID of the participant the delivery receipt belongs to. - :rtype: unicode - """ - return self._properties['participant_sid'] + - @property - def status(self): + def __repr__(self): """ - :returns: The message delivery status - :rtype: DeliveryReceiptInstance.DeliveryStatus + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['status'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def error_code(self): - """ - :returns: The message `delivery error code `_ for a `failed` status - :rtype: unicode - """ - return self._properties['error_code'] - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] +class DeliveryReceiptListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str, message_sid: str): + # TODO: needs autogenerated docs + super(DeliveryReceiptListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: An absolute URL for this delivery receipt. - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { chat_service_sid, conversation_sid, message_sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages/${message_sid}/Receipts' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the DeliveryReceiptInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched DeliveryReceiptInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptInstance - """ - return self._proxy.fetch() + return DeliveryReceiptPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']message_sid=self._solution['message_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/conversation/participant.py b/twilio/rest/conversations/v1/service/conversation/participant.py index 24aca7e7c5..58e055b3f4 100644 --- a/twilio/rest/conversations/v1/service/conversation/participant.py +++ b/twilio/rest/conversations/v1/service/conversation/participant.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,573 +19,154 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ParticipantList(ListResource): - - def __init__(self, version, chat_service_sid, conversation_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this participant. - - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'conversation_sid': conversation_sid, } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Participants'.format(**self._solution) - - def create(self, identity=values.unset, messaging_binding_address=values.unset, - messaging_binding_proxy_address=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, - messaging_binding_projected_address=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the ParticipantInstance - - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode messaging_binding_address: The address of the participant's device. - :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. - :param unicode role_sid: The SID of a conversation-level Role to assign to the participant - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - """ - data = values.of({ - 'Identity': identity, - 'MessagingBinding.Address': messaging_binding_address, - 'MessagingBinding.ProxyAddress': messaging_binding_proxy_address, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - 'MessagingBinding.ProjectedAddress': messaging_binding_projected_address, - 'RoleSid': role_sid, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ParticipantInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def stream(self, 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 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.conversations.v1.service.conversation.participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.service.conversation.participant.ParticipantInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :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 ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ParticipantContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ParticipantContext - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this participant. - - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantPage - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - """ - return ParticipantInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ParticipantContext(InstanceContext): - - def __init__(self, version, chat_service_sid, conversation_sid, sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this participant. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ParticipantContextList, self).__init__(version) # Path Solution - self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'sid': sid, - } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Participants/{sid}'.format(**self._solution) - - def update(self, date_created=values.unset, date_updated=values.unset, - identity=values.unset, attributes=values.unset, - role_sid=values.unset, messaging_binding_proxy_address=values.unset, - messaging_binding_projected_address=values.unset, - last_read_message_index=values.unset, - last_read_timestamp=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ParticipantInstance - - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode role_sid: The SID of a conversation-level Role to assign to the participant - :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. - :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. - :param unicode last_read_message_index: Index of last “read” message in the Conversation for the Participant. - :param unicode last_read_timestamp: Timestamp of last “read” message in the Conversation for the Participant. - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - """ - data = values.of({ - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Identity': identity, - 'Attributes': attributes, - 'RoleSid': role_sid, - 'MessagingBinding.ProxyAddress': messaging_binding_proxy_address, - 'MessagingBinding.ProjectedAddress': messaging_binding_projected_address, - 'LastReadMessageIndex': last_read_message_index, - 'LastReadTimestamp': last_read_timestamp, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ParticipantInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the ParticipantInstance - - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def fetch(self): - """ - Fetch the ParticipantInstance + self._solution = { chat_service_sid, conversation_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Participants/${sid}' + + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the ParticipantInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ParticipantInstance + + :returns: The fetched ParticipantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ParticipantInstance( + self._version, + payload, + chat_service_sidconversation_sidsid=self._solution['chat_service_sid''conversation_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ParticipantInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) + return ParticipantInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ParticipantInstance(InstanceResource): - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - - def __init__(self, version, payload, chat_service_sid, conversation_sid, - sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - """ +class ParticipantInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, conversation_sid: str, sid: str): super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'sid': payload.get('sid'), - 'identity': payload.get('identity'), - 'attributes': payload.get('attributes'), - 'messaging_binding': payload.get('messaging_binding'), - 'role_sid': payload.get('role_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'last_read_message_index': deserialize.integer(payload.get('last_read_message_index')), - 'last_read_timestamp': payload.get('last_read_timestamp'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'sid' = payload.get('sid'), + 'identity' = payload.get('identity'), + 'attributes' = payload.get('attributes'), + 'messaging_binding' = payload.get('messaging_binding'), + 'role_sid' = payload.get('role_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'last_read_message_index' = payload.get('last_read_message_index'), + 'last_read_timestamp' = payload.get('last_read_timestamp'), } - # Context self._context = None self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'sid': sid or self._properties['sid'], + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'conversation_sid': conversation_sid or self._properties['conversation_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext - """ if self._context is None: self._context = ParticipantContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this participant. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with. - :rtype: unicode - """ - return self._properties['chat_service_sid'] + - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this participant. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def identity(self): - """ - :returns: A unique string identifier for the conversation participant as Conversation User. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def messaging_binding(self): - """ - :returns: Information about how this participant exchanges messages with the conversation. - :rtype: dict - """ - return self._properties['messaging_binding'] - - @property - def role_sid(self): - """ - :returns: The SID of a conversation-level Role to assign to the participant - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: An absolute URL for this participant. - :rtype: unicode - """ - return self._properties['url'] - - @property - def last_read_message_index(self): - """ - :returns: Index of last “read” message in the Conversation for the Participant. - :rtype: unicode - """ - return self._properties['last_read_message_index'] - - @property - def last_read_timestamp(self): - """ - :returns: Timestamp of last “read” message in the Conversation for the Participant. - :rtype: unicode - """ - return self._properties['last_read_timestamp'] - - def update(self, date_created=values.unset, date_updated=values.unset, - identity=values.unset, attributes=values.unset, - role_sid=values.unset, messaging_binding_proxy_address=values.unset, - messaging_binding_projected_address=values.unset, - last_read_message_index=values.unset, - last_read_timestamp=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ParticipantInstance - - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode role_sid: The SID of a conversation-level Role to assign to the participant - :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. - :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. - :param unicode last_read_message_index: Index of last “read” message in the Conversation for the Participant. - :param unicode last_read_timestamp: Timestamp of last “read” message in the Conversation for the Participant. - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance + def __repr__(self): """ - return self._proxy.update( - date_created=date_created, - date_updated=date_updated, - identity=identity, - attributes=attributes, - role_sid=role_sid, - messaging_binding_proxy_address=messaging_binding_proxy_address, - messaging_binding_projected_address=messaging_binding_projected_address, - last_read_message_index=last_read_message_index, - last_read_timestamp=last_read_timestamp, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the ParticipantInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) - def fetch(self): - """ - Fetch the ParticipantInstance +class ParticipantListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str): + # TODO: needs autogenerated docs + super(ParticipantListInstanceList, self).__init__(version) - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { chat_service_sid, conversation_sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Participants' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ParticipantInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ParticipantPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/conversation/webhook.py b/twilio/rest/conversations/v1/service/conversation/webhook.py index ce431ee98c..48ac9291ee 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,508 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WebhookList(ListResource): - - def __init__(self, version, chat_service_sid, conversation_sid): - """ - Initialize the WebhookList - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this webhook. - - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList - """ - super(WebhookList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'conversation_sid': conversation_sid, } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Webhooks'.format(**self._solution) - - def create(self, target, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset, - configuration_replay_after=values.unset): - """ - Create the WebhookInstance - - :param WebhookInstance.Target target: The target of this webhook. - :param unicode configuration_url: The absolute url the webhook request should be sent to. - :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request. - :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation. - :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation. - :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to. - :param unicode configuration_replay_after: The message index for which and it's successors the webhook will be replayed. - - :returns: The created WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - """ - data = values.of({ - 'Target': target, - 'Configuration.Url': configuration_url, - 'Configuration.Method': configuration_method, - 'Configuration.Filters': serialize.map(configuration_filters, lambda e: e), - 'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e), - 'Configuration.FlowSid': configuration_flow_sid, - 'Configuration.ReplayAfter': configuration_replay_after, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams WebhookInstance 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 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.conversations.v1.service.conversation.webhook.WebhookInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists WebhookInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.service.conversation.webhook.WebhookInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WebhookInstance records from the API. - Request is executed immediately - - :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 WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WebhookPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WebhookInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WebhookPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a WebhookContext - - :param sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext - """ - return WebhookContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a WebhookContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext - """ - return WebhookContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WebhookPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WebhookPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this webhook. - - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookPage - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookPage - """ - super(WebhookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WebhookInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - """ - return WebhookInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WebhookContext(InstanceContext): - - def __init__(self, version, chat_service_sid, conversation_sid, sid): - """ - Initialize the WebhookContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this webhook. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext - """ - super(WebhookContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) # Path Solution - self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'sid': sid, - } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Webhooks/{sid}'.format(**self._solution) - - def update(self, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset): - """ - Update the WebhookInstance - - :param unicode configuration_url: The absolute url the webhook request should be sent to. - :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request. - :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation. - :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation. - :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to. - - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - """ - data = values.of({ - 'Configuration.Url': configuration_url, - 'Configuration.Method': configuration_method, - 'Configuration.Filters': serialize.map(configuration_filters, lambda e: e), - 'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e), - 'Configuration.FlowSid': configuration_flow_sid, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WebhookInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the WebhookInstance + self._solution = { chat_service_sid, conversation_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Webhooks/${sid}' + + + def delete(self): + + + """ + Deletes the WebhookInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + chat_service_sidconversation_sidsid=self._solution['chat_service_sid''conversation_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return WebhookInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) + return WebhookInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class WebhookInstance(InstanceResource): + return '' - class Target(object): - WEBHOOK = "webhook" - TRIGGER = "trigger" - STUDIO = "studio" - class Method(object): - GET = "GET" - POST = "POST" - def __init__(self, version, payload, chat_service_sid, conversation_sid, - sid=None): - """ - Initialize the WebhookInstance - - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - """ +class WebhookInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, conversation_sid: str, sid: str): super(WebhookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'target': payload.get('target'), - 'url': payload.get('url'), - 'configuration': payload.get('configuration'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'target' = payload.get('target'), + 'url' = payload.get('url'), + 'configuration' = payload.get('configuration'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'sid': sid or self._properties['sid'], + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'conversation_sid': conversation_sid or self._properties['conversation_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WebhookContext for this WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext - """ if self._context is None: self._context = WebhookContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with. - :rtype: unicode - """ - return self._properties['chat_service_sid'] + - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this webhook. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def target(self): - """ - :returns: The target of this webhook. - :rtype: unicode - """ - return self._properties['target'] - - @property - def url(self): - """ - :returns: An absolute URL for this webhook. - :rtype: unicode - """ - return self._properties['url'] - - @property - def configuration(self): - """ - :returns: The configuration of this webhook. - :rtype: dict - """ - return self._properties['configuration'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): + def __repr__(self): """ - :returns: The date that this resource was last updated. - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_updated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, configuration_url=values.unset, - configuration_method=values.unset, - configuration_filters=values.unset, - configuration_triggers=values.unset, - configuration_flow_sid=values.unset): - """ - Update the WebhookInstance - :param unicode configuration_url: The absolute url the webhook request should be sent to. - :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request. - :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation. - :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation. - :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to. - :returns: The updated WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - """ - return self._proxy.update( - configuration_url=configuration_url, - configuration_method=configuration_method, - configuration_filters=configuration_filters, - configuration_triggers=configuration_triggers, - configuration_flow_sid=configuration_flow_sid, - ) - - def delete(self): - """ - Deletes the WebhookInstance +class WebhookListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str, conversation_sid: str): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch the WebhookInstance - - :returns: The fetched WebhookInstance - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { chat_service_sid, conversation_sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Webhooks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WebhookPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/participant_conversation.py b/twilio/rest/conversations/v1/service/participant_conversation.py index b764cf8264..ad8cc6a6d0 100644 --- a/twilio/rest/conversations/v1/service/participant_conversation.py +++ b/twilio/rest/conversations/v1/service/participant_conversation.py @@ -1,354 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ParticipantConversationList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the ParticipantConversationList - - :param Version version: Version that contains the resource - :param chat_service_sid: The unique ID of the Conversation Service this conversation belongs to. - - :returns: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationList - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationList - """ - super(ParticipantConversationList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/ParticipantConversations'.format(**self._solution) - - def stream(self, identity=values.unset, address=values.unset, limit=None, - page_size=None): - """ - Streams ParticipantConversationInstance 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 identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode address: A unique string identifier for the conversation participant who's not a Conversation User. - :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.conversations.v1.service.participant_conversation.ParticipantConversationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(identity=identity, address=address, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, identity=values.unset, address=values.unset, limit=None, - page_size=None): - """ - Lists ParticipantConversationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode address: A unique string identifier for the conversation participant who's not a Conversation User. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.service.participant_conversation.ParticipantConversationInstance] - """ - return list(self.stream(identity=identity, address=address, limit=limit, page_size=page_size, )) - - def page(self, identity=values.unset, address=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantConversationInstance records from the API. - Request is executed immediately - - :param unicode identity: A unique string identifier for the conversation participant as Conversation User. - :param unicode address: A unique string identifier for the conversation participant who's not a Conversation User. - :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 ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationPage - """ - data = values.of({ - 'Identity': identity, - 'Address': address, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) +from twilio.base.page import Page - return ParticipantConversationPage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantConversationInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - :returns: Page of ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return ParticipantConversationPage(self._version, response, self._solution) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantConversationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantConversationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The unique ID of the Conversation Service this conversation belongs to. - - :returns: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationPage - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationPage - """ - super(ParticipantConversationPage, self).__init__(version, response) +class ParticipantConversationListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(ParticipantConversationListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/ParticipantConversations' + + + def page(self, identity, address, page_size): + + data = values.of({ + 'identity': identity,'address': address,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of ParticipantConversationInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationInstance - """ - return ParticipantConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) + return ParticipantConversationPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class ParticipantConversationInstance(InstanceResource): - - class State(object): - INACTIVE = "inactive" - ACTIVE = "active" - CLOSED = "closed" - - def __init__(self, version, payload, chat_service_sid): - """ - Initialize the ParticipantConversationInstance - - :returns: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationInstance - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationInstance - """ - super(ParticipantConversationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'participant_sid': payload.get('participant_sid'), - 'participant_user_sid': payload.get('participant_user_sid'), - 'participant_identity': payload.get('participant_identity'), - 'participant_messaging_binding': payload.get('participant_messaging_binding'), - 'conversation_sid': payload.get('conversation_sid'), - 'conversation_unique_name': payload.get('conversation_unique_name'), - 'conversation_friendly_name': payload.get('conversation_friendly_name'), - 'conversation_attributes': payload.get('conversation_attributes'), - 'conversation_date_created': deserialize.iso8601_datetime(payload.get('conversation_date_created')), - 'conversation_date_updated': deserialize.iso8601_datetime(payload.get('conversation_date_updated')), - 'conversation_created_by': payload.get('conversation_created_by'), - 'conversation_state': payload.get('conversation_state'), - 'conversation_timers': payload.get('conversation_timers'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {'chat_service_sid': chat_service_sid, } - - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The unique ID of the Conversation Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def participant_sid(self): - """ - :returns: The unique ID of the Participant. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def participant_user_sid(self): - """ - :returns: The unique ID for the conversation participant as Conversation User. - :rtype: unicode - """ - return self._properties['participant_user_sid'] - - @property - def participant_identity(self): - """ - :returns: A unique string identifier for the conversation participant as Conversation User. - :rtype: unicode - """ - return self._properties['participant_identity'] - - @property - def participant_messaging_binding(self): - """ - :returns: Information about how this participant exchanges messages with the conversation. - :rtype: dict - """ - return self._properties['participant_messaging_binding'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation this Participant belongs to. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def conversation_unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the Conversation resource. - :rtype: unicode - """ - return self._properties['conversation_unique_name'] - - @property - def conversation_friendly_name(self): - """ - :returns: The human-readable name of this conversation. - :rtype: unicode - """ - return self._properties['conversation_friendly_name'] - - @property - def conversation_attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['conversation_attributes'] + return '' - @property - def conversation_date_created(self): - """ - :returns: The date that this conversation was created. - :rtype: datetime - """ - return self._properties['conversation_date_created'] - - @property - def conversation_date_updated(self): - """ - :returns: The date that this conversation was last updated. - :rtype: datetime - """ - return self._properties['conversation_date_updated'] - - @property - def conversation_created_by(self): - """ - :returns: Creator of this conversation. - :rtype: unicode - """ - return self._properties['conversation_created_by'] - - @property - def conversation_state(self): - """ - :returns: The current state of this User Conversation - :rtype: ParticipantConversationInstance.State - """ - return self._properties['conversation_state'] - - @property - def conversation_timers(self): - """ - :returns: Timer date values for this conversation. - :rtype: dict - """ - return self._properties['conversation_timers'] - - @property - def links(self): - """ - :returns: Absolute URLs to access the participant and conversation of this Participant Conversation. - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/conversations/v1/service/role.py b/twilio/rest/conversations/v1/service/role.py index a15056f2e4..37f50d6ffb 100644 --- a/twilio/rest/conversations/v1/service/role.py +++ b/twilio/rest/conversations/v1/service/role.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,427 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RoleList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the RoleList - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with - - :returns: twilio.rest.conversations.v1.service.role.RoleList - :rtype: twilio.rest.conversations.v1.service.role.RoleList - """ - super(RoleList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/Roles'.format(**self._solution) - - def create(self, friendly_name, type, permission): - """ - Create the RoleInstance - - :param unicode friendly_name: A string to describe the new resource - :param RoleInstance.RoleType type: The type of role - :param list[unicode] permission: A permission the role should have - - :returns: The created RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Permission': serialize.map(permission, lambda e: e), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RoleInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RoleInstance 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 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.conversations.v1.service.role.RoleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RoleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.service.role.RoleInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoleInstance records from the API. - Request is executed immediately - - :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 RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RolePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RolePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RolePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return RolePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoleContext - - :param sid: The SID of the Role resource to fetch - - :returns: twilio.rest.conversations.v1.service.role.RoleContext - :rtype: twilio.rest.conversations.v1.service.role.RoleContext - """ - return RoleContext(self._version, chat_service_sid=self._solution['chat_service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoleContext - - :param sid: The SID of the Role resource to fetch - - :returns: twilio.rest.conversations.v1.service.role.RoleContext - :rtype: twilio.rest.conversations.v1.service.role.RoleContext - """ - return RoleContext(self._version, chat_service_sid=self._solution['chat_service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RolePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RolePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with - - :returns: twilio.rest.conversations.v1.service.role.RolePage - :rtype: twilio.rest.conversations.v1.service.role.RolePage - """ - super(RolePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.role.RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleInstance - """ - return RoleInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RoleContext(InstanceContext): - - def __init__(self, version, chat_service_sid, sid): - """ - Initialize the RoleContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service to fetch the resource from - :param sid: The SID of the Role resource to fetch - - :returns: twilio.rest.conversations.v1.service.role.RoleContext - :rtype: twilio.rest.conversations.v1.service.role.RoleContext - """ - super(RoleContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RoleContextList, self).__init__(version) # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid, } - self._uri = '/Services/{chat_service_sid}/Roles/{sid}'.format(**self._solution) - - def update(self, permission): - """ - Update the RoleInstance - - :param list[unicode] permission: A permission the role should have - - :returns: The updated RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleInstance - """ - data = values.of({'Permission': serialize.map(permission, lambda e: e), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RoleInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the RoleInstance + self._solution = { chat_service_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Roles/${sid}' + + + def delete(self): + + + """ + Deletes the RoleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RoleInstance + + :returns: The fetched RoleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoleInstance( + self._version, + payload, + chat_service_sidsid=self._solution['chat_service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return RoleInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], - ) + return RoleInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RoleInstance(InstanceResource): - - class RoleType(object): - CONVERSATION = "conversation" - SERVICE = "service" - def __init__(self, version, payload, chat_service_sid, sid=None): - """ - Initialize the RoleInstance - - :returns: twilio.rest.conversations.v1.service.role.RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleInstance - """ +class RoleInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, sid: str): super(RoleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'permissions': payload.get('permissions'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'permissions' = payload.get('permissions'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoleContext for this RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleContext - """ if self._context is None: self._context = RoleContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def type(self): - """ - :returns: The type of role - :rtype: RoleInstance.RoleType - """ - return self._properties['type'] - - @property - def permissions(self): - """ - :returns: An array of the permissions the role has been granted - :rtype: list[unicode] - """ - return self._properties['permissions'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: An absolute URL for this user role. - :rtype: unicode - """ - return self._properties['url'] - - def update(self, permission): + def __repr__(self): """ - Update the RoleInstance - - :param list[unicode] permission: A permission the role should have - - :returns: The updated RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(permission, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the RoleInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the RoleInstance +class RoleListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(RoleListInstanceList, self).__init__(version) - :returns: The fetched RoleInstance - :rtype: twilio.rest.conversations.v1.service.role.RoleInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Roles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RolePage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/user.py b/twilio/rest/conversations/v1/service/user.py new file mode 100644 index 0000000000..307b3e05b9 --- /dev/null +++ b/twilio/rest/conversations/v1/service/user.py @@ -0,0 +1,176 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.user.user_conversation import UserConversationListInstance + + +class UserContext(InstanceContext): + def __init__(self, version: V1, chat_service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserContextList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, sid, } + self._uri = '/Services/${chat_service_sid}/Users/${sid}' + + self._user_conversations = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the UserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserInstance + + :returns: The fetched UserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInstance( + self._version, + payload, + chat_service_sidsid=self._solution['chat_service_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, sid: str): + super(UserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'role_sid' = payload.get('role_sid'), + 'identity' = payload.get('identity'), + 'friendly_name' = payload.get('friendly_name'), + 'attributes' = payload.get('attributes'), + 'is_online' = payload.get('is_online'), + 'is_notifiable' = payload.get('is_notifiable'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserContext( + self._version, + chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def user_conversations(self): + return self._proxy.user_conversations + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str): + # TODO: needs autogenerated docs + super(UserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Users' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/service/user/user_conversation.py b/twilio/rest/conversations/v1/service/user/user_conversation.py index f1723878d0..e9a62d7253 100644 --- a/twilio/rest/conversations/v1/service/user/user_conversation.py +++ b/twilio/rest/conversations/v1/service/user/user_conversation.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,538 +19,149 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserConversationList(ListResource): - - def __init__(self, version, chat_service_sid, user_sid): - """ - Initialize the UserConversationList - - :param Version version: Version that contains the resource - :param chat_service_sid: The unique ID of the Conversation Service this conversation belongs to. - :param user_sid: The unique ID for the User. - - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationList - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationList - """ - super(UserConversationList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'user_sid': user_sid, } - self._uri = '/Services/{chat_service_sid}/Users/{user_sid}/Conversations'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserConversationInstance 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 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.conversations.v1.service.user.user_conversation.UserConversationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserConversationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.service.user.user_conversation.UserConversationInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserConversationInstance records from the API. - Request is executed immediately - - :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 UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserConversationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserConversationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return UserConversationPage(self._version, response, self._solution) - - def get(self, conversation_sid): - """ - Constructs a UserConversationContext - - :param conversation_sid: The unique SID identifier of the Conversation. - - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationContext - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationContext - """ - return UserConversationContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - user_sid=self._solution['user_sid'], - conversation_sid=conversation_sid, - ) - - def __call__(self, conversation_sid): - """ - Constructs a UserConversationContext - - :param conversation_sid: The unique SID identifier of the Conversation. - - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationContext - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationContext - """ - return UserConversationContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - user_sid=self._solution['user_sid'], - conversation_sid=conversation_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserConversationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserConversationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The unique ID of the Conversation Service this conversation belongs to. - :param user_sid: The unique ID for the User. - - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationPage - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationPage - """ - super(UserConversationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserConversationInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - """ - return UserConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - user_sid=self._solution['user_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class UserConversationContext(InstanceContext): - - def __init__(self, version, chat_service_sid, user_sid, conversation_sid): - """ - Initialize the UserConversationContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param user_sid: The unique SID identifier of the User. - :param conversation_sid: The unique SID identifier of the Conversation. - - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationContext - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationContext - """ - super(UserConversationContext, self).__init__(version) + def __init__(self, version: V1, chat_service_sid: str, user_sid: str, conversation_sid: str): + # TODO: needs autogenerated docs + super(UserConversationContextList, self).__init__(version) # Path Solution - self._solution = { - 'chat_service_sid': chat_service_sid, - 'user_sid': user_sid, - 'conversation_sid': conversation_sid, - } - self._uri = '/Services/{chat_service_sid}/Users/{user_sid}/Conversations/{conversation_sid}'.format(**self._solution) - - def update(self, notification_level=values.unset, - last_read_timestamp=values.unset, - last_read_message_index=values.unset): - """ - Update the UserConversationInstance - - :param UserConversationInstance.NotificationLevel notification_level: The Notification Level of this User Conversation. - :param datetime last_read_timestamp: The date of the last message read in conversation by the user. - :param unicode last_read_message_index: The index of the last read Message. - - :returns: The updated UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - """ - data = values.of({ - 'NotificationLevel': notification_level, - 'LastReadTimestamp': serialize.iso8601_datetime(last_read_timestamp), - 'LastReadMessageIndex': last_read_message_index, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return UserConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - user_sid=self._solution['user_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def delete(self): - """ - Deletes the UserConversationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { chat_service_sid, user_sid, conversation_sid, } + self._uri = '/Services/${chat_service_sid}/Users/${user_sid}/Conversations/${conversation_sid}' + + + def delete(self): + + + """ + Deletes the UserConversationInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserConversationInstance + + :returns: The fetched UserConversationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserConversationInstance( + self._version, + payload, + chat_service_siduser_sidconversation_sid=self._solution['chat_service_sid''user_sid''conversation_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def fetch(self): - """ - Fetch the UserConversationInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The fetched UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - user_sid=self._solution['user_sid'], - conversation_sid=self._solution['conversation_sid'], - ) + return UserConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], user_sid=self._solution['user_sid'], conversation_sid=self._solution['conversation_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserConversationInstance(InstanceResource): - class NotificationLevel(object): - DEFAULT = "default" - MUTED = "muted" - - class State(object): - INACTIVE = "inactive" - ACTIVE = "active" - CLOSED = "closed" - - def __init__(self, version, payload, chat_service_sid, user_sid, - conversation_sid=None): - """ - Initialize the UserConversationInstance - - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - """ +class UserConversationInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, user_sid: str, conversation_sid: str): super(UserConversationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'unread_messages_count': deserialize.integer(payload.get('unread_messages_count')), - 'last_read_message_index': deserialize.integer(payload.get('last_read_message_index')), - 'participant_sid': payload.get('participant_sid'), - 'user_sid': payload.get('user_sid'), - 'friendly_name': payload.get('friendly_name'), - 'conversation_state': payload.get('conversation_state'), - 'timers': payload.get('timers'), - 'attributes': payload.get('attributes'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), - 'notification_level': payload.get('notification_level'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'unread_messages_count' = payload.get('unread_messages_count'), + 'last_read_message_index' = payload.get('last_read_message_index'), + 'participant_sid' = payload.get('participant_sid'), + 'user_sid' = payload.get('user_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'conversation_state' = payload.get('conversation_state'), + 'timers' = payload.get('timers'), + 'attributes' = payload.get('attributes'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + 'notification_level' = payload.get('notification_level'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None self._solution = { - 'chat_service_sid': chat_service_sid, - 'user_sid': user_sid, - 'conversation_sid': conversation_sid or self._properties['conversation_sid'], + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid']'user_sid': user_sid or self._properties['user_sid']'conversation_sid': conversation_sid or self._properties['conversation_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserConversationContext for this UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationContext - """ if self._context is None: self._context = UserConversationContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - user_sid=self._solution['user_sid'], - conversation_sid=self._solution['conversation_sid'], + chat_service_sid=self._solution['chat_service_sid'],user_sid=self._solution['user_sid'],conversation_sid=self._solution['conversation_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The unique ID of the Conversation Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this User Conversation. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def unread_messages_count(self): - """ - :returns: The number of unread Messages in the Conversation. - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def last_read_message_index(self): - """ - :returns: The index of the last read Message . - :rtype: unicode - """ - return self._properties['last_read_message_index'] - - @property - def participant_sid(self): - """ - :returns: Participant Sid. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def user_sid(self): - """ - :returns: The unique ID for the User. - :rtype: unicode - """ - return self._properties['user_sid'] - - @property - def friendly_name(self): - """ - :returns: The human-readable name of this conversation. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def conversation_state(self): - """ - :returns: The current state of this User Conversation - :rtype: UserConversationInstance.State - """ - return self._properties['conversation_state'] - - @property - def timers(self): - """ - :returns: Timer date values for this conversation. - :rtype: dict - """ - return self._properties['timers'] + - @property - def attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def date_created(self): - """ - :returns: The date that this conversation was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this conversation was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: Creator of this conversation. - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def notification_level(self): - """ - :returns: The Notification Level of this User Conversation. - :rtype: UserConversationInstance.NotificationLevel - """ - return self._properties['notification_level'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the Conversation resource. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Absolute URLs to access the participant and conversation of this user conversation. - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def update(self, notification_level=values.unset, - last_read_timestamp=values.unset, - last_read_message_index=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the UserConversationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param UserConversationInstance.NotificationLevel notification_level: The Notification Level of this User Conversation. - :param datetime last_read_timestamp: The date of the last message read in conversation by the user. - :param unicode last_read_message_index: The index of the last read Message. - :returns: The updated UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - """ - return self._proxy.update( - notification_level=notification_level, - last_read_timestamp=last_read_timestamp, - last_read_message_index=last_read_message_index, - ) - def delete(self): - """ - Deletes the UserConversationInstance +class UserConversationListInstance(ListResource): + def __init__(self, version: V1, chat_service_sid: str, user_sid: str): + # TODO: needs autogenerated docs + super(UserConversationListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { chat_service_sid, user_sid, } + self._uri = '/Services/${chat_service_sid}/Users/${user_sid}/Conversations' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the UserConversationInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched UserConversationInstance - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationInstance - """ - return self._proxy.fetch() + return UserConversationPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid']user_sid=self._solution['user_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/user.py b/twilio/rest/conversations/v1/user.py new file mode 100644 index 0000000000..7df8470e74 --- /dev/null +++ b/twilio/rest/conversations/v1/user.py @@ -0,0 +1,176 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.user.user_conversation import UserConversationListInstance + + +class UserContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(UserContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Users/${sid}' + + self._user_conversations = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the UserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserInstance + + :returns: The fetched UserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(UserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'role_sid' = payload.get('role_sid'), + 'identity' = payload.get('identity'), + 'friendly_name' = payload.get('friendly_name'), + 'attributes' = payload.get('attributes'), + 'is_online' = payload.get('is_online'), + 'is_notifiable' = payload.get('is_notifiable'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def user_conversations(self): + return self._proxy.user_conversations + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Users' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/conversations/v1/user/user_conversation.py b/twilio/rest/conversations/v1/user/user_conversation.py index 4ccd2b05a1..f9117d4df1 100644 --- a/twilio/rest/conversations/v1/user/user_conversation.py +++ b/twilio/rest/conversations/v1/user/user_conversation.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,519 +19,149 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserConversationList(ListResource): - - def __init__(self, version, user_sid): - """ - Initialize the UserConversationList - - :param Version version: Version that contains the resource - :param user_sid: The unique ID for the User. - - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationList - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationList - """ - super(UserConversationList, self).__init__(version) - - # Path Solution - self._solution = {'user_sid': user_sid, } - self._uri = '/Users/{user_sid}/Conversations'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams UserConversationInstance 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 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.conversations.v1.user.user_conversation.UserConversationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserConversationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.conversations.v1.user.user_conversation.UserConversationInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserConversationInstance records from the API. - Request is executed immediately - - :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 UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserConversationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserConversationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserConversationPage(self._version, response, self._solution) - - def get(self, conversation_sid): - """ - Constructs a UserConversationContext - - :param conversation_sid: The unique SID identifier of the Conversation. - - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext - """ - return UserConversationContext( - self._version, - user_sid=self._solution['user_sid'], - conversation_sid=conversation_sid, - ) - - def __call__(self, conversation_sid): - """ - Constructs a UserConversationContext - - :param conversation_sid: The unique SID identifier of the Conversation. - - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext - """ - return UserConversationContext( - self._version, - user_sid=self._solution['user_sid'], - conversation_sid=conversation_sid, - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserConversationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserConversationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param user_sid: The unique ID for the User. - - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage - """ - super(UserConversationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserConversationInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - """ - return UserConversationInstance(self._version, payload, user_sid=self._solution['user_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class UserConversationContext(InstanceContext): - - def __init__(self, version, user_sid, conversation_sid): - """ - Initialize the UserConversationContext - - :param Version version: Version that contains the resource - :param user_sid: The unique SID identifier of the User. - :param conversation_sid: The unique SID identifier of the Conversation. - - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext - """ - super(UserConversationContext, self).__init__(version) + def __init__(self, version: V1, user_sid: str, conversation_sid: str): + # TODO: needs autogenerated docs + super(UserConversationContextList, self).__init__(version) # Path Solution - self._solution = {'user_sid': user_sid, 'conversation_sid': conversation_sid, } - self._uri = '/Users/{user_sid}/Conversations/{conversation_sid}'.format(**self._solution) - - def update(self, notification_level=values.unset, - last_read_timestamp=values.unset, - last_read_message_index=values.unset): - """ - Update the UserConversationInstance - - :param UserConversationInstance.NotificationLevel notification_level: The Notification Level of this User Conversation. - :param datetime last_read_timestamp: The date of the last message read in conversation by the user. - :param unicode last_read_message_index: The index of the last read Message. - - :returns: The updated UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - """ - data = values.of({ - 'NotificationLevel': notification_level, - 'LastReadTimestamp': serialize.iso8601_datetime(last_read_timestamp), - 'LastReadMessageIndex': last_read_message_index, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return UserConversationInstance( - self._version, - payload, - user_sid=self._solution['user_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def delete(self): - """ - Deletes the UserConversationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the UserConversationInstance + self._solution = { user_sid, conversation_sid, } + self._uri = '/Users/${user_sid}/Conversations/${conversation_sid}' + + + def delete(self): + + + """ + Deletes the UserConversationInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserConversationInstance + + :returns: The fetched UserConversationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserConversationInstance( + self._version, + payload, + user_sidconversation_sid=self._solution['user_sid''conversation_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return UserConversationInstance( - self._version, - payload, - user_sid=self._solution['user_sid'], - conversation_sid=self._solution['conversation_sid'], - ) + return UserConversationInstance(self._version, payload, user_sid=self._solution['user_sid'], conversation_sid=self._solution['conversation_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserConversationInstance(InstanceResource): - - class NotificationLevel(object): - DEFAULT = "default" - MUTED = "muted" - - class State(object): - INACTIVE = "inactive" - ACTIVE = "active" - CLOSED = "closed" - - def __init__(self, version, payload, user_sid, conversation_sid=None): - """ - Initialize the UserConversationInstance - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - """ +class UserConversationInstance(InstanceResource): + def __init__(self, version, payload, user_sid: str, conversation_sid: str): super(UserConversationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'unread_messages_count': deserialize.integer(payload.get('unread_messages_count')), - 'last_read_message_index': deserialize.integer(payload.get('last_read_message_index')), - 'participant_sid': payload.get('participant_sid'), - 'user_sid': payload.get('user_sid'), - 'friendly_name': payload.get('friendly_name'), - 'conversation_state': payload.get('conversation_state'), - 'timers': payload.get('timers'), - 'attributes': payload.get('attributes'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), - 'notification_level': payload.get('notification_level'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'conversation_sid' = payload.get('conversation_sid'), + 'unread_messages_count' = payload.get('unread_messages_count'), + 'last_read_message_index' = payload.get('last_read_message_index'), + 'participant_sid' = payload.get('participant_sid'), + 'user_sid' = payload.get('user_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'conversation_state' = payload.get('conversation_state'), + 'timers' = payload.get('timers'), + 'attributes' = payload.get('attributes'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + 'notification_level' = payload.get('notification_level'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None self._solution = { - 'user_sid': user_sid, - 'conversation_sid': conversation_sid or self._properties['conversation_sid'], + 'user_sid': user_sid or self._properties['user_sid']'conversation_sid': conversation_sid or self._properties['conversation_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserConversationContext for this UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext - """ if self._context is None: self._context = UserConversationContext( self._version, - user_sid=self._solution['user_sid'], - conversation_sid=self._solution['conversation_sid'], + user_sid=self._solution['user_sid'],conversation_sid=self._solution['conversation_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The unique ID of the Conversation Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this User Conversation. - :rtype: unicode - """ - return self._properties['conversation_sid'] + - @property - def unread_messages_count(self): - """ - :returns: The number of unread Messages in the Conversation. - :rtype: unicode - """ - return self._properties['unread_messages_count'] - - @property - def last_read_message_index(self): - """ - :returns: The index of the last read Message . - :rtype: unicode - """ - return self._properties['last_read_message_index'] - - @property - def participant_sid(self): - """ - :returns: Participant Sid. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def user_sid(self): - """ - :returns: The unique ID for the User. - :rtype: unicode - """ - return self._properties['user_sid'] - - @property - def friendly_name(self): - """ - :returns: The human-readable name of this conversation. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def conversation_state(self): - """ - :returns: The current state of this User Conversation - :rtype: UserConversationInstance.State - """ - return self._properties['conversation_state'] - - @property - def timers(self): - """ - :returns: Timer date values for this conversation. - :rtype: dict - """ - return self._properties['timers'] - - @property - def attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def date_created(self): - """ - :returns: The date that this conversation was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this conversation was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: Creator of this conversation. - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def notification_level(self): - """ - :returns: The Notification Level of this User Conversation. - :rtype: UserConversationInstance.NotificationLevel - """ - return self._properties['notification_level'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the Conversation resource. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Absolute URLs to access the participant and conversation of this user conversation. - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def update(self, notification_level=values.unset, - last_read_timestamp=values.unset, - last_read_message_index=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the UserConversationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param UserConversationInstance.NotificationLevel notification_level: The Notification Level of this User Conversation. - :param datetime last_read_timestamp: The date of the last message read in conversation by the user. - :param unicode last_read_message_index: The index of the last read Message. - :returns: The updated UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - """ - return self._proxy.update( - notification_level=notification_level, - last_read_timestamp=last_read_timestamp, - last_read_message_index=last_read_message_index, - ) - def delete(self): - """ - Deletes the UserConversationInstance +class UserConversationListInstance(ListResource): + def __init__(self, version: V1, user_sid: str): + # TODO: needs autogenerated docs + super(UserConversationListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { user_sid, } + self._uri = '/Users/${user_sid}/Conversations' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the UserConversationInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched UserConversationInstance - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance - """ - return self._proxy.fetch() + return UserConversationPage(self._version, payload, user_sid=self._solution['user_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/events/__init__.py b/twilio/rest/events/__init__.py index 25e72ec26d..4eaf056f4b 100644 --- a/twilio/rest/events/__init__.py +++ b/twilio/rest/events/__init__.py @@ -1,73 +1,78 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.events.v1 import V1 + Twilio - Events + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Events(Domain): +from twilio.base.domain import Domain +from twilio.rest.Events.v1 import V1 +class Events(Domain): def __init__(self, twilio): """ Initialize the Events Domain :returns: Domain for Events - :rtype: twilio.rest.events.Events + :rtype: twilio.rest.v1.Events """ super(Events, self).__init__(twilio) - - self.base_url = 'https://events.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Events.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of events - :rtype: twilio.rest.events.v1.V1 + :returns: Versions v1 of Events + :rtype: twilio.rest.Events.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def event_types(self): """ - :rtype: twilio.rest.events.v1.event_type.EventTypeList + :rtype: twilio.rest.v1.event_types """ return self.v1.event_types + @property def schemas(self): """ - :rtype: twilio.rest.events.v1.schema.SchemaList + :rtype: twilio.rest.v1.schemas """ return self.v1.schemas + @property def sinks(self): """ - :rtype: twilio.rest.events.v1.sink.SinkList + :rtype: twilio.rest.v1.sinks """ return self.v1.sinks + @property def subscriptions(self): """ - :rtype: twilio.rest.events.v1.subscription.SubscriptionList + :rtype: twilio.rest.v1.subscriptions """ return self.v1.subscriptions + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/events/v1/.openapi-generator-ignore b/twilio/rest/events/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/events/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/events/v1/.openapi-generator/FILES b/twilio/rest/events/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..11cf9e306a --- /dev/null +++ b/twilio/rest/events/v1/.openapi-generator/FILES @@ -0,0 +1,17 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +event_type.py +schema.py +schema/schema_version.py +sink.py +sink/sink_test.py +sink/sink_validate.py +subscription.py +subscription/subscribed_event.py diff --git a/twilio/rest/events/v1/.openapi-generator/VERSION b/twilio/rest/events/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/events/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/events/v1/event_type.py b/twilio/rest/events/v1/event_type.py index cffbee2f9e..89d7103324 100644 --- a/twilio/rest/events/v1/event_type.py +++ b/twilio/rest/events/v1/event_type.py @@ -1,349 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EventTypeList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the EventTypeList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.events.v1.event_type.EventTypeList - :rtype: twilio.rest.events.v1.event_type.EventTypeList - """ - super(EventTypeList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Types'.format(**self._solution) - - def stream(self, schema_id=values.unset, limit=None, page_size=None): - """ - Streams EventTypeInstance 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 schema_id: A string to filter Event Types by schema. - :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.events.v1.event_type.EventTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(schema_id=schema_id, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, schema_id=values.unset, limit=None, page_size=None): - """ - Lists EventTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode schema_id: A string to filter Event Types by schema. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.events.v1.event_type.EventTypeInstance] - """ - return list(self.stream(schema_id=schema_id, limit=limit, page_size=page_size, )) - - def page(self, schema_id=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of EventTypeInstance records from the API. - Request is executed immediately - - :param unicode schema_id: A string to filter Event Types by schema. - :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 EventTypeInstance - :rtype: twilio.rest.events.v1.event_type.EventTypePage - """ - data = values.of({ - 'SchemaId': schema_id, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EventTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EventTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EventTypeInstance - :rtype: twilio.rest.events.v1.event_type.EventTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EventTypePage(self._version, response, self._solution) - - def get(self, type): - """ - Constructs a EventTypeContext - - :param type: A string that uniquely identifies this Event Type. - - :returns: twilio.rest.events.v1.event_type.EventTypeContext - :rtype: twilio.rest.events.v1.event_type.EventTypeContext - """ - return EventTypeContext(self._version, type=type, ) - - def __call__(self, type): - """ - Constructs a EventTypeContext - - :param type: A string that uniquely identifies this Event Type. - - :returns: twilio.rest.events.v1.event_type.EventTypeContext - :rtype: twilio.rest.events.v1.event_type.EventTypeContext - """ - return EventTypeContext(self._version, type=type, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EventTypePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the EventTypePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.events.v1.event_type.EventTypePage - :rtype: twilio.rest.events.v1.event_type.EventTypePage - """ - super(EventTypePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of EventTypeInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.events.v1.event_type.EventTypeInstance - :rtype: twilio.rest.events.v1.event_type.EventTypeInstance - """ - return EventTypeInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class EventTypeContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, type): - """ - Initialize the EventTypeContext - - :param Version version: Version that contains the resource - :param type: A string that uniquely identifies this Event Type. - - :returns: twilio.rest.events.v1.event_type.EventTypeContext - :rtype: twilio.rest.events.v1.event_type.EventTypeContext - """ - super(EventTypeContext, self).__init__(version) + def __init__(self, version: V1, type: str): + # TODO: needs autogenerated docs + super(EventTypeContextList, self).__init__(version) # Path Solution - self._solution = {'type': type, } - self._uri = '/Types/{type}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EventTypeInstance - - :returns: The fetched EventTypeInstance - :rtype: twilio.rest.events.v1.event_type.EventTypeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EventTypeInstance(self._version, payload, type=self._solution['type'], ) + self._solution = { type, } + self._uri = '/Types/${type}' + + + def fetch(self): + + """ + Fetch the EventTypeInstance + + :returns: The fetched EventTypeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EventTypeInstance( + self._version, + payload, + type=self._solution['type'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class EventTypeInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, type=None): - """ - Initialize the EventTypeInstance - :returns: twilio.rest.events.v1.event_type.EventTypeInstance - :rtype: twilio.rest.events.v1.event_type.EventTypeInstance - """ +class EventTypeInstance(InstanceResource): + def __init__(self, version, payload, type: str): super(EventTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'type': payload.get('type'), - 'schema_id': payload.get('schema_id'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'description': payload.get('description'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'type' = payload.get('type'), + 'schema_id' = payload.get('schema_id'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'description' = payload.get('description'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None - self._solution = {'type': type or self._properties['type'], } + self._solution = { + 'type': type or self._properties['type'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EventTypeContext for this EventTypeInstance - :rtype: twilio.rest.events.v1.event_type.EventTypeContext - """ if self._context is None: - self._context = EventTypeContext(self._version, type=self._solution['type'], ) + self._context = EventTypeContext( + self._version, + type=self._solution['type'], + ) return self._context - @property - def type(self): - """ - :returns: The Event Type identifier. - :rtype: unicode - """ - return self._properties['type'] - - @property - def schema_id(self): - """ - :returns: The Schema identifier for this Event Type. - :rtype: unicode - """ - return self._properties['schema_id'] + - @property - def date_created(self): + def __repr__(self): """ - :returns: The date this Event Type was created. - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The date this Event Type was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def description(self): - """ - :returns: Event Type description. - :rtype: unicode - """ - return self._properties['description'] - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] +class EventTypeListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(EventTypeListInstanceList, self).__init__(version) - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] + # Path Solution + self._solution = { } + self._uri = '/Types' + + + def page(self, schema_id, page_size): + + data = values.of({ + 'schema_id': schema_id,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the EventTypeInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched EventTypeInstance - :rtype: twilio.rest.events.v1.event_type.EventTypeInstance - """ - return self._proxy.fetch() + return EventTypePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/events/v1/schema.py b/twilio/rest/events/v1/schema.py new file mode 100644 index 0000000000..db47ed2132 --- /dev/null +++ b/twilio/rest/events/v1/schema.py @@ -0,0 +1,124 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.schema.schema_version import SchemaVersionListInstance + + +class SchemaContext(InstanceContext): + def __init__(self, version: V1, id: str): + # TODO: needs autogenerated docs + super(SchemaContextList, self).__init__(version) + + # Path Solution + self._solution = { id, } + self._uri = '/Schemas/${id}' + + self._versions = None + + def fetch(self): + + """ + Fetch the SchemaInstance + + :returns: The fetched SchemaInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SchemaInstance( + self._version, + payload, + id=self._solution['id'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SchemaInstance(InstanceResource): + def __init__(self, version, payload, id: str): + super(SchemaInstance, self).__init__(version) + self._properties = { + 'id' = payload.get('id'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'latest_version_date_created' = payload.get('latest_version_date_created'), + 'latest_version' = payload.get('latest_version'), + } + + self._context = None + self._solution = { + 'id': id or self._properties['id'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SchemaContext( + self._version, + id=self._solution['id'], + ) + return self._context + + @property + def versions(self): + return self._proxy.versions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SchemaListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SchemaListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/events/v1/schema/schema_version.py b/twilio/rest/events/v1/schema/schema_version.py new file mode 100644 index 0000000000..075b8ef9ce --- /dev/null +++ b/twilio/rest/events/v1/schema/schema_version.py @@ -0,0 +1,132 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class SchemaVersionContext(InstanceContext): + def __init__(self, version: V1, id: str, schema_version: int): + # TODO: needs autogenerated docs + super(SchemaVersionContextList, self).__init__(version) + + # Path Solution + self._solution = { id, schema_version, } + self._uri = '/Schemas/${id}/Versions/${schema_version}' + + + def fetch(self): + + """ + Fetch the SchemaVersionInstance + + :returns: The fetched SchemaVersionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SchemaVersionInstance( + self._version, + payload, + idschema_version=self._solution['id''schema_version'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SchemaVersionInstance(InstanceResource): + def __init__(self, version, payload, id: str, schema_version: int): + super(SchemaVersionInstance, self).__init__(version) + self._properties = { + 'id' = payload.get('id'), + 'schema_version' = payload.get('schema_version'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), + 'raw' = payload.get('raw'), + } + + self._context = None + self._solution = { + 'id': id or self._properties['id']'schema_version': schema_version or self._properties['schema_version'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SchemaVersionContext( + self._version, + id=self._solution['id'],schema_version=self._solution['schema_version'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SchemaVersionListInstance(ListResource): + def __init__(self, version: V1, id: str): + # TODO: needs autogenerated docs + super(SchemaVersionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { id, } + self._uri = '/Schemas/${id}/Versions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SchemaVersionPage(self._version, payload, id=self._solution['id']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/events/v1/sink.py b/twilio/rest/events/v1/sink.py new file mode 100644 index 0000000000..fe78fdd43e --- /dev/null +++ b/twilio/rest/events/v1/sink.py @@ -0,0 +1,176 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sink.sink_test import SinkTestListInstancefrom twilio.rest.sink.sink_validate import SinkValidateListInstance + + +class SinkContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SinkContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Sinks/${sid}' + + self._sink_test = None + self._sink_validate = None + + def delete(self): + + + """ + Deletes the SinkInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SinkInstance + + :returns: The fetched SinkInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SinkInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SinkInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SinkInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(SinkInstance, self).__init__(version) + self._properties = { + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'description' = payload.get('description'), + 'sid' = payload.get('sid'), + 'sink_configuration' = payload.get('sink_configuration'), + 'sink_type' = payload.get('sink_type'), + 'status' = payload.get('status'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SinkContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def sink_test(self): + return self._proxy.sink_test + @property + def sink_validate(self): + return self._proxy.sink_validate + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SinkListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SinkListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Sinks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SinkInstance(self._version, payload, ) + + + def page(self, in_use, status, page_size): + + data = values.of({ + 'in_use': in_use,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SinkPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/events/v1/sink/sink_test.py b/twilio/rest/events/v1/sink/sink_test.py index 89cb9c9fc4..693eff995f 100644 --- a/twilio/rest/events/v1/sink/sink_test.py +++ b/twilio/rest/events/v1/sink/sink_test.py @@ -1,132 +1,89 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Events + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class SinkTestList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, sid): - """ - Initialize the SinkTestList - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this Sink. - :returns: twilio.rest.events.v1.sink.sink_test.SinkTestList - :rtype: twilio.rest.events.v1.sink.sink_test.SinkTestList - """ - super(SinkTestList, self).__init__(version) - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sinks/{sid}/Test'.format(**self._solution) +class SinkTestInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(SinkTestInstance, self).__init__(version) + self._properties = { + 'result' = payload.get('result'), + } - def create(self): - """ - Create the SinkTestInstance + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } - :returns: The created SinkTestInstance - :rtype: twilio.rest.events.v1.sink.sink_test.SinkTestInstance - """ - payload = self._version.create(method='POST', uri=self._uri, ) + @property + def _proxy(self): + if self._context is None: + self._context = SinkTestContext( + self._version, + sid=self._solution['sid'], + ) + return self._context - return SinkTestInstance(self._version, payload, sid=self._solution['sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class SinkTestPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the SinkTestPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sid: A string that uniquely identifies this Sink. - - :returns: twilio.rest.events.v1.sink.sink_test.SinkTestPage - :rtype: twilio.rest.events.v1.sink.sink_test.SinkTestPage - """ - super(SinkTestPage, self).__init__(version, response) +class SinkTestListInstance(ListResource): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SinkTestListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { sid, } + self._uri = '/Sinks/${sid}/Test' + + + def create(self): + data = values.of({ + + }) - def get_instance(self, payload): - """ - Build an instance of SinkTestInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.events.v1.sink.sink_test.SinkTestInstance - :rtype: twilio.rest.events.v1.sink.sink_test.SinkTestInstance - """ - return SinkTestInstance(self._version, payload, sid=self._solution['sid'], ) + return SinkTestInstance(self._version, payload, sid=self._solution['sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class SinkTestInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, sid): - """ - Initialize the SinkTestInstance - - :returns: twilio.rest.events.v1.sink.sink_test.SinkTestInstance - :rtype: twilio.rest.events.v1.sink.sink_test.SinkTestInstance - """ - super(SinkTestInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'result': payload.get('result'), } - - # Context - self._context = None - self._solution = {'sid': sid, } - - @property - def result(self): - """ - :returns: Feedback indicating whether the test event was generated. - :rtype: unicode - """ - return self._properties['result'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/events/v1/sink/sink_validate.py b/twilio/rest/events/v1/sink/sink_validate.py index 644778060e..babc6fa091 100644 --- a/twilio/rest/events/v1/sink/sink_validate.py +++ b/twilio/rest/events/v1/sink/sink_validate.py @@ -1,136 +1,89 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page + Twilio - Events + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class SinkValidateList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, sid): - """ - Initialize the SinkValidateList +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this Sink. - :returns: twilio.rest.events.v1.sink.sink_validate.SinkValidateList - :rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateList - """ - super(SinkValidateList, self).__init__(version) - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sinks/{sid}/Validate'.format(**self._solution) - def create(self, test_id): - """ - Create the SinkValidateInstance - :param unicode test_id: A string that uniquely identifies the test event for a Sink being validated. +class SinkValidateInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(SinkValidateInstance, self).__init__(version) + self._properties = { + 'result' = payload.get('result'), + } - :returns: The created SinkValidateInstance - :rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateInstance - """ - data = values.of({'TestId': test_id, }) + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = SinkValidateContext( + self._version, + sid=self._solution['sid'], + ) + return self._context - return SinkValidateInstance(self._version, payload, sid=self._solution['sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class SinkValidatePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the SinkValidatePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sid: A string that uniquely identifies this Sink. - :returns: twilio.rest.events.v1.sink.sink_validate.SinkValidatePage - :rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidatePage - """ - super(SinkValidatePage, self).__init__(version, response) +class SinkValidateListInstance(ListResource): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SinkValidateListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { sid, } + self._uri = '/Sinks/${sid}/Validate' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def get_instance(self, payload): - """ - Build an instance of SinkValidateInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.events.v1.sink.sink_validate.SinkValidateInstance - :rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateInstance - """ - return SinkValidateInstance(self._version, payload, sid=self._solution['sid'], ) + return SinkValidateInstance(self._version, payload, sid=self._solution['sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class SinkValidateInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, sid): - """ - Initialize the SinkValidateInstance - - :returns: twilio.rest.events.v1.sink.sink_validate.SinkValidateInstance - :rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateInstance - """ - super(SinkValidateInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'result': payload.get('result'), } - - # Context - self._context = None - self._solution = {'sid': sid, } + return '' - @property - def result(self): - """ - :returns: Feedback indicating whether the given Sink was validated. - :rtype: unicode - """ - return self._properties['result'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/events/v1/subscription.py b/twilio/rest/events/v1/subscription.py new file mode 100644 index 0000000000..c4cff9b5c8 --- /dev/null +++ b/twilio/rest/events/v1/subscription.py @@ -0,0 +1,171 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.subscription.subscribed_event import SubscribedEventListInstance + + +class SubscriptionContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SubscriptionContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Subscriptions/${sid}' + + self._subscribed_events = None + + def delete(self): + + + """ + Deletes the SubscriptionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SubscriptionInstance + + :returns: The fetched SubscriptionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SubscriptionInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SubscriptionInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SubscriptionInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(SubscriptionInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'description' = payload.get('description'), + 'sink_sid' = payload.get('sink_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SubscriptionContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def subscribed_events(self): + return self._proxy.subscribed_events + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SubscriptionListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SubscriptionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Subscriptions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SubscriptionInstance(self._version, payload, ) + + + def page(self, sink_sid, page_size): + + data = values.of({ + 'sink_sid': sink_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SubscriptionPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/events/v1/subscription/subscribed_event.py b/twilio/rest/events/v1/subscription/subscribed_event.py index d7db8fbfbf..05ec70ddfd 100644 --- a/twilio/rest/events/v1/subscription/subscribed_event.py +++ b/twilio/rest/events/v1/subscription/subscribed_event.py @@ -1,416 +1,164 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SubscribedEventList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, subscription_sid): - """ - Initialize the SubscribedEventList - - :param Version version: Version that contains the resource - :param subscription_sid: Subscription SID. - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventList - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventList - """ - super(SubscribedEventList, self).__init__(version) - - # Path Solution - self._solution = {'subscription_sid': subscription_sid, } - self._uri = '/Subscriptions/{subscription_sid}/SubscribedEvents'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SubscribedEventInstance 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 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.events.v1.subscription.subscribed_event.SubscribedEventInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SubscribedEventInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.events.v1.subscription.subscribed_event.SubscribedEventInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SubscribedEventInstance records from the API. - Request is executed immediately - - :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 SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SubscribedEventPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SubscribedEventInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SubscribedEventPage(self._version, response, self._solution) - - def create(self, type, schema_version=values.unset): - """ - Create the SubscribedEventInstance - :param unicode type: Type of event being subscribed to. - :param unicode schema_version: The schema version that the subscription should use. - - :returns: The created SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - """ - data = values.of({'Type': type, 'SchemaVersion': schema_version, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SubscribedEventInstance( - self._version, - payload, - subscription_sid=self._solution['subscription_sid'], - ) - - def get(self, type): - """ - Constructs a SubscribedEventContext - - :param type: Type of event being subscribed to. - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventContext - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventContext - """ - return SubscribedEventContext( - self._version, - subscription_sid=self._solution['subscription_sid'], - type=type, - ) - - def __call__(self, type): - """ - Constructs a SubscribedEventContext - - :param type: Type of event being subscribed to. - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventContext - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventContext - """ - return SubscribedEventContext( - self._version, - subscription_sid=self._solution['subscription_sid'], - type=type, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SubscribedEventPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SubscribedEventPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param subscription_sid: Subscription SID. - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventPage - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventPage - """ - super(SubscribedEventPage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of SubscribedEventInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - """ - return SubscribedEventInstance( - self._version, - payload, - subscription_sid=self._solution['subscription_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SubscribedEventContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, subscription_sid, type): - """ - Initialize the SubscribedEventContext - - :param Version version: Version that contains the resource - :param subscription_sid: Subscription SID. - :param type: Type of event being subscribed to. - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventContext - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventContext - """ - super(SubscribedEventContext, self).__init__(version) + def __init__(self, version: V1, subscription_sid: str, type: str): + # TODO: needs autogenerated docs + super(SubscribedEventContextList, self).__init__(version) # Path Solution - self._solution = {'subscription_sid': subscription_sid, 'type': type, } - self._uri = '/Subscriptions/{subscription_sid}/SubscribedEvents/{type}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SubscribedEventInstance - - :returns: The fetched SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SubscribedEventInstance( - self._version, - payload, - subscription_sid=self._solution['subscription_sid'], - type=self._solution['type'], - ) - - def update(self, schema_version=values.unset): - """ - Update the SubscribedEventInstance - - :param unicode schema_version: The schema version that the subscription should use. - - :returns: The updated SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - """ - data = values.of({'SchemaVersion': schema_version, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SubscribedEventInstance( - self._version, - payload, - subscription_sid=self._solution['subscription_sid'], - type=self._solution['type'], - ) + self._solution = { subscription_sid, type, } + self._uri = '/Subscriptions/${subscription_sid}/SubscribedEvents/${type}' + + + def delete(self): + + + """ + Deletes the SubscribedEventInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SubscribedEventInstance + + :returns: The fetched SubscribedEventInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SubscribedEventInstance( + self._version, + payload, + subscription_sidtype=self._solution['subscription_sid''type'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the SubscribedEventInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return SubscribedEventInstance(self._version, payload, subscription_sid=self._solution['subscription_sid'], type=self._solution['type'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SubscribedEventInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, subscription_sid, type=None): - """ - Initialize the SubscribedEventInstance - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - """ +class SubscribedEventInstance(InstanceResource): + def __init__(self, version, payload, subscription_sid: str, type: str): super(SubscribedEventInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'type': payload.get('type'), - 'schema_version': deserialize.integer(payload.get('schema_version')), - 'subscription_sid': payload.get('subscription_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'type' = payload.get('type'), + 'schema_version' = payload.get('schema_version'), + 'subscription_sid' = payload.get('subscription_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'subscription_sid': subscription_sid, 'type': type or self._properties['type'], } + self._solution = { + 'subscription_sid': subscription_sid or self._properties['subscription_sid']'type': type or self._properties['type'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SubscribedEventContext for this SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventContext - """ if self._context is None: self._context = SubscribedEventContext( self._version, - subscription_sid=self._solution['subscription_sid'], - type=self._solution['type'], + subscription_sid=self._solution['subscription_sid'],type=self._solution['type'], ) return self._context - @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def type(self): - """ - :returns: Type of event being subscribed to. - :rtype: unicode - """ - return self._properties['type'] - - @property - def schema_version(self): - """ - :returns: The schema version that the subscription should use. - :rtype: unicode - """ - return self._properties['schema_version'] - - @property - def subscription_sid(self): - """ - :returns: Subscription SID. - :rtype: unicode - """ - return self._properties['subscription_sid'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the SubscribedEventInstance + - :returns: The fetched SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, schema_version=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the SubscribedEventInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode schema_version: The schema version that the subscription should use. - :returns: The updated SubscribedEventInstance - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance - """ - return self._proxy.update(schema_version=schema_version, ) - def delete(self): - """ - Deletes the SubscribedEventInstance +class SubscribedEventListInstance(ListResource): + def __init__(self, version: V1, subscription_sid: str): + # TODO: needs autogenerated docs + super(SubscribedEventListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { subscription_sid, } + self._uri = '/Subscriptions/${subscription_sid}/SubscribedEvents' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SubscribedEventInstance(self._version, payload, subscription_sid=self._solution['subscription_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SubscribedEventPage(self._version, payload, subscription_sid=self._solution['subscription_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/flexApi/__init__.py b/twilio/rest/flexApi/__init__.py new file mode 100644 index 0000000000..efc1454f45 --- /dev/null +++ b/twilio/rest/flexApi/__init__.py @@ -0,0 +1,55 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.FlexApi.v2 import V2 + +class FlexApi(Domain): + def __init__(self, twilio): + """ + Initialize the FlexApi Domain + + :returns: Domain for FlexApi + :rtype: twilio.rest.v2.FlexApi + """ + super(FlexApi, self).__init__(twilio) + self.base_url = 'https://FlexApi.twilio.com' + self._V2 = None + + @property + def V2(self): + """ + :returns: Versions v2 of FlexApi + :rtype: twilio.rest.FlexApi.v2 + """ + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + + + @property + def web_channels(self): + """ + :rtype: twilio.rest.v2.web_channels + """ + return self.v2.web_channels + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/flexApi/v1/.openapi-generator-ignore b/twilio/rest/flexApi/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/flexApi/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/flexApi/v1/.openapi-generator/FILES b/twilio/rest/flexApi/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..179bf0eeee --- /dev/null +++ b/twilio/rest/flexApi/v1/.openapi-generator/FILES @@ -0,0 +1,23 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +assessments.py +channel.py +configuration.py +flex_flow.py +good_data.py +interaction.py +interaction/interaction_channel.py +interaction/interaction_channel/interaction_channel_invite.py +interaction/interaction_channel/interaction_channel_participant.py +user_roles.py +web_channel.py diff --git a/twilio/rest/flexApi/v1/.openapi-generator/VERSION b/twilio/rest/flexApi/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/flexApi/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/flexApi/v1/assessments.py b/twilio/rest/flexApi/v1/assessments.py new file mode 100644 index 0000000000..abf36d1e3c --- /dev/null +++ b/twilio/rest/flexApi/v1/assessments.py @@ -0,0 +1,104 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class AssessmentsContext(InstanceContext): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AssessmentsContextList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Accounts/Assessments' + + + def create(self): + + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AssessmentsInstance(InstanceResource): + def __init__(self, version, payload): + super(AssessmentsInstance, self).__init__(version) + self._properties = { + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + + } + + @property + def _proxy(self): + if self._context is None: + self._context = AssessmentsContext( + self._version, + + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AssessmentsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AssessmentsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/channel.py b/twilio/rest/flexApi/v1/channel.py new file mode 100644 index 0000000000..334c3146de --- /dev/null +++ b/twilio/rest/flexApi/v1/channel.py @@ -0,0 +1,156 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class ChannelContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Channels/${sid}' + + + def delete(self): + + + """ + Deletes the ChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ChannelInstance + + :returns: The fetched ChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ChannelInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ChannelInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'flex_flow_sid' = payload.get('flex_flow_sid'), + 'sid' = payload.get('sid'), + 'user_sid' = payload.get('user_sid'), + 'task_sid' = payload.get('task_sid'), + 'url' = payload.get('url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ChannelContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ChannelListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Channels' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ChannelPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/configuration.py b/twilio/rest/flexApi/v1/configuration.py new file mode 100644 index 0000000000..91265572e8 --- /dev/null +++ b/twilio/rest/flexApi/v1/configuration.py @@ -0,0 +1,160 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class ConfigurationContext(InstanceContext): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ConfigurationContextList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Configuration' + + + def fetch(self, ui_version): + + """ + Fetch the ConfigurationInstance + + :returns: The fetched ConfigurationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConfigurationInstance( + self._version, + payload, + =self._solution[], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConfigurationInstance(InstanceResource): + def __init__(self, version, payload): + super(ConfigurationInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'attributes' = payload.get('attributes'), + 'status' = payload.get('status'), + 'taskrouter_workspace_sid' = payload.get('taskrouter_workspace_sid'), + 'taskrouter_target_workflow_sid' = payload.get('taskrouter_target_workflow_sid'), + 'taskrouter_target_taskqueue_sid' = payload.get('taskrouter_target_taskqueue_sid'), + 'taskrouter_taskqueues' = payload.get('taskrouter_taskqueues'), + 'taskrouter_skills' = payload.get('taskrouter_skills'), + 'taskrouter_worker_channels' = payload.get('taskrouter_worker_channels'), + 'taskrouter_worker_attributes' = payload.get('taskrouter_worker_attributes'), + 'taskrouter_offline_activity_sid' = payload.get('taskrouter_offline_activity_sid'), + 'runtime_domain' = payload.get('runtime_domain'), + 'messaging_service_instance_sid' = payload.get('messaging_service_instance_sid'), + 'chat_service_instance_sid' = payload.get('chat_service_instance_sid'), + 'flex_service_instance_sid' = payload.get('flex_service_instance_sid'), + 'ui_language' = payload.get('ui_language'), + 'ui_attributes' = payload.get('ui_attributes'), + 'ui_dependencies' = payload.get('ui_dependencies'), + 'ui_version' = payload.get('ui_version'), + 'service_version' = payload.get('service_version'), + 'call_recording_enabled' = payload.get('call_recording_enabled'), + 'call_recording_webhook_url' = payload.get('call_recording_webhook_url'), + 'crm_enabled' = payload.get('crm_enabled'), + 'crm_type' = payload.get('crm_type'), + 'crm_callback_url' = payload.get('crm_callback_url'), + 'crm_fallback_url' = payload.get('crm_fallback_url'), + 'crm_attributes' = payload.get('crm_attributes'), + 'public_attributes' = payload.get('public_attributes'), + 'plugin_service_enabled' = payload.get('plugin_service_enabled'), + 'plugin_service_attributes' = payload.get('plugin_service_attributes'), + 'integrations' = payload.get('integrations'), + 'outbound_call_flows' = payload.get('outbound_call_flows'), + 'serverless_service_sids' = payload.get('serverless_service_sids'), + 'queue_stats_configuration' = payload.get('queue_stats_configuration'), + 'notifications' = payload.get('notifications'), + 'markdown' = payload.get('markdown'), + 'url' = payload.get('url'), + 'flex_insights_hr' = payload.get('flex_insights_hr'), + 'flex_insights_drilldown' = payload.get('flex_insights_drilldown'), + 'flex_url' = payload.get('flex_url'), + 'channel_configs' = payload.get('channel_configs'), + 'debugger_integration' = payload.get('debugger_integration'), + 'flex_ui_status_report' = payload.get('flex_ui_status_report'), + } + + self._context = None + self._solution = { + + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConfigurationContext( + self._version, + + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConfigurationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ConfigurationListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/flex_flow.py b/twilio/rest/flexApi/v1/flex_flow.py new file mode 100644 index 0000000000..13794831c0 --- /dev/null +++ b/twilio/rest/flexApi/v1/flex_flow.py @@ -0,0 +1,173 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class FlexFlowContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(FlexFlowContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/FlexFlows/${sid}' + + + def delete(self): + + + """ + Deletes the FlexFlowInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FlexFlowInstance + + :returns: The fetched FlexFlowInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FlexFlowInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FlexFlowInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FlexFlowInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(FlexFlowInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'chat_service_sid' = payload.get('chat_service_sid'), + 'channel_type' = payload.get('channel_type'), + 'contact_identity' = payload.get('contact_identity'), + 'enabled' = payload.get('enabled'), + 'integration_type' = payload.get('integration_type'), + 'integration' = payload.get('integration'), + 'long_lived' = payload.get('long_lived'), + 'janitor_enabled' = payload.get('janitor_enabled'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FlexFlowContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FlexFlowListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(FlexFlowListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/FlexFlows' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FlexFlowInstance(self._version, payload, ) + + + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FlexFlowPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/good_data.py b/twilio/rest/flexApi/v1/good_data.py new file mode 100644 index 0000000000..948893a979 --- /dev/null +++ b/twilio/rest/flexApi/v1/good_data.py @@ -0,0 +1,108 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class GoodDataContext(InstanceContext): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(GoodDataContextList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Insights/Session' + + + def create(self, token): + + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class GoodDataInstance(InstanceResource): + def __init__(self, version, payload): + super(GoodDataInstance, self).__init__(version) + self._properties = { + 'workspace_id' = payload.get('workspace_id'), + 'session_expiry' = payload.get('session_expiry'), + 'session_id' = payload.get('session_id'), + 'base_url' = payload.get('base_url'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + + } + + @property + def _proxy(self): + if self._context is None: + self._context = GoodDataContext( + self._version, + + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class GoodDataListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(GoodDataListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/interaction.py b/twilio/rest/flexApi/v1/interaction.py new file mode 100644 index 0000000000..a8c3db83ec --- /dev/null +++ b/twilio/rest/flexApi/v1/interaction.py @@ -0,0 +1,134 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.interaction.interaction_channel import InteractionChannelListInstance + + +class InteractionContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(InteractionContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Interactions/${sid}' + + self._channels = None + + def fetch(self): + + """ + Fetch the InteractionInstance + + :returns: The fetched InteractionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InteractionInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class InteractionInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(InteractionInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'channel' = payload.get('channel'), + 'routing' = payload.get('routing'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = InteractionContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def channels(self): + return self._proxy.channels + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class InteractionListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(InteractionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Interactions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InteractionInstance(self._version, payload, ) + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/interaction/interaction_channel.py b/twilio/rest/flexApi/v1/interaction/interaction_channel.py new file mode 100644 index 0000000000..6a0736b00e --- /dev/null +++ b/twilio/rest/flexApi/v1/interaction/interaction_channel.py @@ -0,0 +1,154 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.interaction_channel.interaction_channel_invite import InteractionChannelInviteListInstancefrom twilio.rest.interaction_channel.interaction_channel_participant import InteractionChannelParticipantListInstance + + +class InteractionChannelContext(InstanceContext): + def __init__(self, version: V1, interaction_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InteractionChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { interaction_sid, sid, } + self._uri = '/Interactions/${interaction_sid}/Channels/${sid}' + + self._invites = None + self._participants = None + + def fetch(self): + + """ + Fetch the InteractionChannelInstance + + :returns: The fetched InteractionChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InteractionChannelInstance( + self._version, + payload, + interaction_sidsid=self._solution['interaction_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return InteractionChannelInstance(self._version, payload, interaction_sid=self._solution['interaction_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class InteractionChannelInstance(InstanceResource): + def __init__(self, version, payload, interaction_sid: str, sid: str): + super(InteractionChannelInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'interaction_sid' = payload.get('interaction_sid'), + 'type' = payload.get('type'), + 'status' = payload.get('status'), + 'error_code' = payload.get('error_code'), + 'error_message' = payload.get('error_message'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'interaction_sid': interaction_sid or self._properties['interaction_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = InteractionChannelContext( + self._version, + interaction_sid=self._solution['interaction_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def invites(self): + return self._proxy.invites + @property + def participants(self): + return self._proxy.participants + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class InteractionChannelListInstance(ListResource): + def __init__(self, version: V1, interaction_sid: str): + # TODO: needs autogenerated docs + super(InteractionChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { interaction_sid, } + self._uri = '/Interactions/${interaction_sid}/Channels' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InteractionChannelPage(self._version, payload, interaction_sid=self._solution['interaction_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_invite.py b/twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_invite.py new file mode 100644 index 0000000000..a83314d1ec --- /dev/null +++ b/twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_invite.py @@ -0,0 +1,105 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + +class InteractionChannelInviteInstance(InstanceResource): + def __init__(self, version, payload, interaction_sid: str, channel_sid: str): + super(InteractionChannelInviteInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'interaction_sid' = payload.get('interaction_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'routing' = payload.get('routing'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'interaction_sid': interaction_sid or self._properties['interaction_sid']'channel_sid': channel_sid or self._properties['channel_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = InteractionChannelInviteContext( + self._version, + interaction_sid=self._solution['interaction_sid'],channel_sid=self._solution['channel_sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class InteractionChannelInviteListInstance(ListResource): + def __init__(self, version: V1, interaction_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(InteractionChannelInviteListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { interaction_sid, channel_sid, } + self._uri = '/Interactions/${interaction_sid}/Channels/${channel_sid}/Invites' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InteractionChannelInviteInstance(self._version, payload, interaction_sid=self._solution['interaction_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InteractionChannelInvitePage(self._version, payload, interaction_sid=self._solution['interaction_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_participant.py b/twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_participant.py new file mode 100644 index 0000000000..186c5c8613 --- /dev/null +++ b/twilio/rest/flexApi/v1/interaction/interaction_channel/interaction_channel_participant.py @@ -0,0 +1,136 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class InteractionChannelParticipantContext(InstanceContext): + def __init__(self, version: V1, interaction_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InteractionChannelParticipantContextList, self).__init__(version) + + # Path Solution + self._solution = { interaction_sid, channel_sid, sid, } + self._uri = '/Interactions/${interaction_sid}/Channels/${channel_sid}/Participants/${sid}' + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return InteractionChannelParticipantInstance(self._version, payload, interaction_sid=self._solution['interaction_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class InteractionChannelParticipantInstance(InstanceResource): + def __init__(self, version, payload, interaction_sid: str, channel_sid: str, sid: str): + super(InteractionChannelParticipantInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'type' = payload.get('type'), + 'interaction_sid' = payload.get('interaction_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'interaction_sid': interaction_sid or self._properties['interaction_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = InteractionChannelParticipantContext( + self._version, + interaction_sid=self._solution['interaction_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class InteractionChannelParticipantListInstance(ListResource): + def __init__(self, version: V1, interaction_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(InteractionChannelParticipantListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { interaction_sid, channel_sid, } + self._uri = '/Interactions/${interaction_sid}/Channels/${channel_sid}/Participants' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InteractionChannelParticipantInstance(self._version, payload, interaction_sid=self._solution['interaction_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InteractionChannelParticipantPage(self._version, payload, interaction_sid=self._solution['interaction_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/user_roles.py b/twilio/rest/flexApi/v1/user_roles.py new file mode 100644 index 0000000000..258d06cd89 --- /dev/null +++ b/twilio/rest/flexApi/v1/user_roles.py @@ -0,0 +1,117 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class UserRolesContext(InstanceContext): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UserRolesContextList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Insights/UserRoles' + + + def fetch(self, token): + + """ + Fetch the UserRolesInstance + + :returns: The fetched UserRolesInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserRolesInstance( + self._version, + payload, + =self._solution[], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserRolesInstance(InstanceResource): + def __init__(self, version, payload): + super(UserRolesInstance, self).__init__(version) + self._properties = { + 'roles' = payload.get('roles'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserRolesContext( + self._version, + + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserRolesListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UserRolesListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v1/web_channel.py b/twilio/rest/flexApi/v1/web_channel.py new file mode 100644 index 0000000000..af286c38b4 --- /dev/null +++ b/twilio/rest/flexApi/v1/web_channel.py @@ -0,0 +1,165 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class WebChannelContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(WebChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/WebChannels/${sid}' + + + def delete(self): + + + """ + Deletes the WebChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WebChannelInstance + + :returns: The fetched WebChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebChannelInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return WebChannelInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class WebChannelInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(WebChannelInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'flex_flow_sid' = payload.get('flex_flow_sid'), + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = WebChannelContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class WebChannelListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(WebChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/WebChannels' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebChannelInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WebChannelPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/flexApi/v2/.openapi-generator-ignore b/twilio/rest/flexApi/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/flexApi/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/flexApi/v2/.openapi-generator/FILES b/twilio/rest/flexApi/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..e0a7269e6f --- /dev/null +++ b/twilio/rest/flexApi/v2/.openapi-generator/FILES @@ -0,0 +1,3 @@ +../__init__.py +.openapi-generator-ignore +web_channels.py diff --git a/twilio/rest/flexApi/v2/.openapi-generator/VERSION b/twilio/rest/flexApi/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/flexApi/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/flexApi/v2/web_channels.py b/twilio/rest/flexApi/v2/web_channels.py new file mode 100644 index 0000000000..302422732a --- /dev/null +++ b/twilio/rest/flexApi/v2/web_channels.py @@ -0,0 +1,90 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + + +class WebChannelsInstance(InstanceResource): + def __init__(self, version, payload): + super(WebChannelsInstance, self).__init__(version) + self._properties = { + 'conversation_sid' = payload.get('conversation_sid'), + 'identity' = payload.get('identity'), + } + + self._context = None + self._solution = { + + } + + @property + def _proxy(self): + if self._context is None: + self._context = WebChannelsContext( + self._version, + + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class WebChannelsListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(WebChannelsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/WebChats' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebChannelsInstance(self._version, payload, ) + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/frontlineApi/__init__.py b/twilio/rest/frontlineApi/__init__.py new file mode 100644 index 0000000000..fa6c28c32b --- /dev/null +++ b/twilio/rest/frontlineApi/__init__.py @@ -0,0 +1,55 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Frontline + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.FrontlineApi.v1 import V1 + +class FrontlineApi(Domain): + def __init__(self, twilio): + """ + Initialize the FrontlineApi Domain + + :returns: Domain for FrontlineApi + :rtype: twilio.rest.v1.FrontlineApi + """ + super(FrontlineApi, self).__init__(twilio) + self.base_url = 'https://FrontlineApi.twilio.com' + self._V1 = None + + @property + def V1(self): + """ + :returns: Versions v1 of FrontlineApi + :rtype: twilio.rest.FrontlineApi.v1 + """ + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + + + @property + def users(self): + """ + :rtype: twilio.rest.v1.users + """ + return self.v1.users + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/frontlineApi/v1/.openapi-generator-ignore b/twilio/rest/frontlineApi/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/frontlineApi/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/frontlineApi/v1/.openapi-generator/FILES b/twilio/rest/frontlineApi/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..11bd2f9f14 --- /dev/null +++ b/twilio/rest/frontlineApi/v1/.openapi-generator/FILES @@ -0,0 +1,3 @@ +../__init__.py +.openapi-generator-ignore +user.py diff --git a/twilio/rest/frontlineApi/v1/.openapi-generator/VERSION b/twilio/rest/frontlineApi/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/frontlineApi/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/frontlineApi/v1/user.py b/twilio/rest/frontlineApi/v1/user.py new file mode 100644 index 0000000000..cc7d023c9e --- /dev/null +++ b/twilio/rest/frontlineApi/v1/user.py @@ -0,0 +1,133 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Frontline + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class UserContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(UserContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Users/${sid}' + + + def fetch(self): + + """ + Fetch the UserInstance + + :returns: The fetched UserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(UserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'identity' = payload.get('identity'), + 'friendly_name' = payload.get('friendly_name'), + 'avatar' = payload.get('avatar'), + 'state' = payload.get('state'), + 'is_available' = payload.get('is_available'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/insights/__init__.py b/twilio/rest/insights/__init__.py index 798473806b..be2d5c1f79 100644 --- a/twilio/rest/insights/__init__.py +++ b/twilio/rest/insights/__init__.py @@ -1,80 +1,86 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.insights.v1 import V1 + Twilio - Insights + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Insights(Domain): +from twilio.base.domain import Domain +from twilio.rest.Insights.v1 import V1 +class Insights(Domain): def __init__(self, twilio): """ Initialize the Insights Domain :returns: Domain for Insights - :rtype: twilio.rest.insights.Insights + :rtype: twilio.rest.v1.Insights """ super(Insights, self).__init__(twilio) - - self.base_url = 'https://insights.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of insights - :rtype: twilio.rest.insights.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + self.base_url = 'https://Insights.twilio.com' + self._V1 = None @property - def settings(self): + def V1(self): """ - :rtype: twilio.rest.insights.v1.setting.SettingList + :returns: Versions v1 of Insights + :rtype: twilio.rest.Insights.v1 """ - return self.v1.settings + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def calls(self): """ - :rtype: twilio.rest.insights.v1.call.CallList + :rtype: twilio.rest.v1.calls """ return self.v1.calls + @property def call_summaries(self): """ - :rtype: twilio.rest.insights.v1.call_summaries.CallSummariesList + :rtype: twilio.rest.v1.call_summaries """ return self.v1.call_summaries + @property def conferences(self): """ - :rtype: twilio.rest.insights.v1.conference.ConferenceList + :rtype: twilio.rest.v1.conferences """ return self.v1.conferences + @property def rooms(self): """ - :rtype: twilio.rest.insights.v1.room.RoomList + :rtype: twilio.rest.v1.rooms """ return self.v1.rooms + + + @property + def settings(self): + """ + :rtype: twilio.rest.v1.settings + """ + return self.v1.settings + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/insights/v1/.openapi-generator-ignore b/twilio/rest/insights/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/insights/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/insights/v1/.openapi-generator/FILES b/twilio/rest/insights/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..273f8806dd --- /dev/null +++ b/twilio/rest/insights/v1/.openapi-generator/FILES @@ -0,0 +1,23 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +call.py +call/annotation.py +call/call_summary.py +call/event.py +call/metric.py +call_summaries.py +conference.py +conference/conference_participant.py +room.py +room/participant.py +setting.py diff --git a/twilio/rest/insights/v1/.openapi-generator/VERSION b/twilio/rest/insights/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/insights/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/insights/v1/call.py b/twilio/rest/insights/v1/call.py new file mode 100644 index 0000000000..7dbd4e2041 --- /dev/null +++ b/twilio/rest/insights/v1/call.py @@ -0,0 +1,134 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.call.annotation import AnnotationListInstancefrom twilio.rest.call.call_summary import CallSummaryListInstancefrom twilio.rest.call.event import EventListInstancefrom twilio.rest.call.metric import MetricListInstance + + +class CallContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CallContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Voice/${sid}' + + self._annotation = None + self._summary = None + self._events = None + self._metrics = None + + def fetch(self): + + """ + Fetch the CallInstance + + :returns: The fetched CallInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CallInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CallInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(CallInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CallContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def annotation(self): + return self._proxy.annotation + @property + def summary(self): + return self._proxy.summary + @property + def events(self): + return self._proxy.events + @property + def metrics(self): + return self._proxy.metrics + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CallListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CallListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/insights/v1/call/annotation.py b/twilio/rest/insights/v1/call/annotation.py index f3c3fa20f6..29f31f2472 100644 --- a/twilio/rest/insights/v1/call/annotation.py +++ b/twilio/rest/insights/v1/call/annotation.py @@ -1,372 +1,136 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AnnotationList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, call_sid): - """ - Initialize the AnnotationList - - :param Version version: Version that contains the resource - :param call_sid: Call SID. - - :returns: twilio.rest.insights.v1.call.annotation.AnnotationList - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationList - """ - super(AnnotationList, self).__init__(version) - - # Path Solution - self._solution = {'call_sid': call_sid, } - - def get(self): - """ - Constructs a AnnotationContext - - :returns: twilio.rest.insights.v1.call.annotation.AnnotationContext - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationContext - """ - return AnnotationContext(self._version, call_sid=self._solution['call_sid'], ) - - def __call__(self): - """ - Constructs a AnnotationContext - - :returns: twilio.rest.insights.v1.call.annotation.AnnotationContext - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationContext - """ - return AnnotationContext(self._version, call_sid=self._solution['call_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AnnotationPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AnnotationPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param call_sid: Call SID. - :returns: twilio.rest.insights.v1.call.annotation.AnnotationPage - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationPage - """ - super(AnnotationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AnnotationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.insights.v1.call.annotation.AnnotationInstance - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationInstance - """ - return AnnotationInstance(self._version, payload, call_sid=self._solution['call_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AnnotationContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, call_sid): - """ - Initialize the AnnotationContext - - :param Version version: Version that contains the resource - :param call_sid: Call SID. - - :returns: twilio.rest.insights.v1.call.annotation.AnnotationContext - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationContext - """ - super(AnnotationContext, self).__init__(version) + def __init__(self, version: V1, call_sid: str): + # TODO: needs autogenerated docs + super(AnnotationContextList, self).__init__(version) # Path Solution - self._solution = {'call_sid': call_sid, } - self._uri = '/Voice/{call_sid}/Annotation'.format(**self._solution) - - def update(self, answered_by=values.unset, connectivity_issue=values.unset, - quality_issues=values.unset, spam=values.unset, - call_score=values.unset, comment=values.unset, - incident=values.unset): - """ - Update the AnnotationInstance - - :param AnnotationInstance.AnsweredBy answered_by: Indicates the answering entity as determined by Answering Machine Detection. - :param AnnotationInstance.ConnectivityIssue connectivity_issue: Indicates if the call had any connectivity issue - :param unicode quality_issues: Indicates if the call had audio quality issues. - :param bool spam: Call spam indicator - :param unicode call_score: Call Score - :param unicode comment: User comments - :param unicode incident: Call tag for incidents or support ticket - - :returns: The updated AnnotationInstance - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationInstance - """ - data = values.of({ - 'AnsweredBy': answered_by, - 'ConnectivityIssue': connectivity_issue, - 'QualityIssues': quality_issues, - 'Spam': spam, - 'CallScore': call_score, - 'Comment': comment, - 'Incident': incident, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return AnnotationInstance(self._version, payload, call_sid=self._solution['call_sid'], ) - - def fetch(self): - """ - Fetch the AnnotationInstance - - :returns: The fetched AnnotationInstance - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AnnotationInstance(self._version, payload, call_sid=self._solution['call_sid'], ) + self._solution = { call_sid, } + self._uri = '/Voice/${call_sid}/Annotation' + + + def fetch(self): + + """ + Fetch the AnnotationInstance + + :returns: The fetched AnnotationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AnnotationInstance( + self._version, + payload, + call_sid=self._solution['call_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AnnotationInstance(self._version, payload, call_sid=self._solution['call_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AnnotationInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class AnsweredBy(object): - UNKNOWN_ANSWERED_BY = "unknown_answered_by" - HUMAN = "human" - MACHINE = "machine" - class ConnectivityIssue(object): - UNKNOWN_CONNECTIVITY_ISSUE = "unknown_connectivity_issue" - NO_CONNECTIVITY_ISSUE = "no_connectivity_issue" - INVALID_NUMBER = "invalid_number" - CALLER_ID = "caller_id" - DROPPED_CALL = "dropped_call" - NUMBER_REACHABILITY = "number_reachability" - class QualityIssues(object): - UNKNOWN_QUALITY_ISSUE = "unknown_quality_issue" - NO_QUALITY_ISSUE = "no_quality_issue" - LOW_VOLUME = "low_volume" - CHOPPY_ROBOTIC = "choppy_robotic" - ECHO = "echo" - DTMF = "dtmf" - LATENCY = "latency" - OWA = "owa" - STATIC_NOISE = "static_noise" - - def __init__(self, version, payload, call_sid): - """ - Initialize the AnnotationInstance - - :returns: twilio.rest.insights.v1.call.annotation.AnnotationInstance - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationInstance - """ +class AnnotationInstance(InstanceResource): + def __init__(self, version, payload, call_sid: str): super(AnnotationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'call_sid': payload.get('call_sid'), - 'account_sid': payload.get('account_sid'), - 'answered_by': payload.get('answered_by'), - 'connectivity_issue': payload.get('connectivity_issue'), - 'quality_issues': payload.get('quality_issues'), - 'spam': payload.get('spam'), - 'call_score': deserialize.integer(payload.get('call_score')), - 'comment': payload.get('comment'), - 'incident': payload.get('incident'), - 'url': payload.get('url'), + self._properties = { + 'call_sid' = payload.get('call_sid'), + 'account_sid' = payload.get('account_sid'), + 'answered_by' = payload.get('answered_by'), + 'connectivity_issue' = payload.get('connectivity_issue'), + 'quality_issues' = payload.get('quality_issues'), + 'spam' = payload.get('spam'), + 'call_score' = payload.get('call_score'), + 'comment' = payload.get('comment'), + 'incident' = payload.get('incident'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'call_sid': call_sid, } + self._solution = { + 'call_sid': call_sid or self._properties['call_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AnnotationContext for this AnnotationInstance - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationContext - """ if self._context is None: - self._context = AnnotationContext(self._version, call_sid=self._solution['call_sid'], ) + self._context = AnnotationContext( + self._version, + call_sid=self._solution['call_sid'], + ) return self._context - @property - def call_sid(self): - """ - :returns: Call SID. - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def answered_by(self): - """ - :returns: Indicates the answering entity as determined by Answering Machine Detection. - :rtype: AnnotationInstance.AnsweredBy - """ - return self._properties['answered_by'] - - @property - def connectivity_issue(self): - """ - :returns: Indicates if the call had any connectivity issue - :rtype: AnnotationInstance.ConnectivityIssue - """ - return self._properties['connectivity_issue'] + - @property - def quality_issues(self): - """ - :returns: Indicates if the call had audio quality issues. - :rtype: list[unicode] - """ - return self._properties['quality_issues'] - - @property - def spam(self): - """ - :returns: Call spam indicator - :rtype: bool - """ - return self._properties['spam'] - - @property - def call_score(self): - """ - :returns: Call Score - :rtype: unicode - """ - return self._properties['call_score'] - - @property - def comment(self): - """ - :returns: User comments - :rtype: unicode - """ - return self._properties['comment'] - - @property - def incident(self): - """ - :returns: Call tag for incidents or support ticket - :rtype: unicode - """ - return self._properties['incident'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def update(self, answered_by=values.unset, connectivity_issue=values.unset, - quality_issues=values.unset, spam=values.unset, - call_score=values.unset, comment=values.unset, - incident=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the AnnotationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param AnnotationInstance.AnsweredBy answered_by: Indicates the answering entity as determined by Answering Machine Detection. - :param AnnotationInstance.ConnectivityIssue connectivity_issue: Indicates if the call had any connectivity issue - :param unicode quality_issues: Indicates if the call had audio quality issues. - :param bool spam: Call spam indicator - :param unicode call_score: Call Score - :param unicode comment: User comments - :param unicode incident: Call tag for incidents or support ticket - :returns: The updated AnnotationInstance - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationInstance - """ - return self._proxy.update( - answered_by=answered_by, - connectivity_issue=connectivity_issue, - quality_issues=quality_issues, - spam=spam, - call_score=call_score, - comment=comment, - incident=incident, - ) - def fetch(self): - """ - Fetch the AnnotationInstance +class AnnotationListInstance(ListResource): + def __init__(self, version: V1, call_sid: str): + # TODO: needs autogenerated docs + super(AnnotationListInstanceList, self).__init__(version) - :returns: The fetched AnnotationInstance - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { call_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/insights/v1/call/call_summary.py b/twilio/rest/insights/v1/call/call_summary.py new file mode 100644 index 0000000000..2d02741dd0 --- /dev/null +++ b/twilio/rest/insights/v1/call/call_summary.py @@ -0,0 +1,138 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class CallSummaryContext(InstanceContext): + def __init__(self, version: V1, call_sid: str): + # TODO: needs autogenerated docs + super(CallSummaryContextList, self).__init__(version) + + # Path Solution + self._solution = { call_sid, } + self._uri = '/Voice/${call_sid}/Summary' + + + def fetch(self, processing_state): + + """ + Fetch the CallSummaryInstance + + :returns: The fetched CallSummaryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CallSummaryInstance( + self._version, + payload, + call_sid=self._solution['call_sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CallSummaryInstance(InstanceResource): + def __init__(self, version, payload, call_sid: str): + super(CallSummaryInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'call_sid' = payload.get('call_sid'), + 'call_type' = payload.get('call_type'), + 'call_state' = payload.get('call_state'), + 'answered_by' = payload.get('answered_by'), + 'processing_state' = payload.get('processing_state'), + 'created_time' = payload.get('created_time'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'duration' = payload.get('duration'), + 'connect_duration' = payload.get('connect_duration'), + '_from' = payload.get('from'), + 'to' = payload.get('to'), + 'carrier_edge' = payload.get('carrier_edge'), + 'client_edge' = payload.get('client_edge'), + 'sdk_edge' = payload.get('sdk_edge'), + 'sip_edge' = payload.get('sip_edge'), + 'tags' = payload.get('tags'), + 'url' = payload.get('url'), + 'attributes' = payload.get('attributes'), + 'properties' = payload.get('properties'), + 'trust' = payload.get('trust'), + 'annotation' = payload.get('annotation'), + } + + self._context = None + self._solution = { + 'call_sid': call_sid or self._properties['call_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CallSummaryContext( + self._version, + call_sid=self._solution['call_sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CallSummaryListInstance(ListResource): + def __init__(self, version: V1, call_sid: str): + # TODO: needs autogenerated docs + super(CallSummaryListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { call_sid, } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/insights/v1/call/event.py b/twilio/rest/insights/v1/call/event.py index c37352f13d..edbe9f818d 100644 --- a/twilio/rest/insights/v1/call/event.py +++ b/twilio/rest/insights/v1/call/event.py @@ -1,315 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EventList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, call_sid): - """ - Initialize the EventList - - :param Version version: Version that contains the resource - :param call_sid: The call_sid - - :returns: twilio.rest.insights.v1.call.event.EventList - :rtype: twilio.rest.insights.v1.call.event.EventList - """ - super(EventList, self).__init__(version) - - # Path Solution - self._solution = {'call_sid': call_sid, } - self._uri = '/Voice/{call_sid}/Events'.format(**self._solution) + Twilio - Insights + This is the public Twilio REST API. - def stream(self, edge=values.unset, limit=None, page_size=None): - """ - Streams EventInstance 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 EventInstance.TwilioEdge edge: The edge - :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.insights.v1.call.event.EventInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(edge=edge, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, edge=values.unset, limit=None, page_size=None): - """ - Lists EventInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param EventInstance.TwilioEdge edge: The edge - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.insights.v1.call.event.EventInstance] - """ - return list(self.stream(edge=edge, limit=limit, page_size=page_size, )) - - def page(self, edge=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of EventInstance records from the API. - Request is executed immediately - - :param EventInstance.TwilioEdge edge: The edge - :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 EventInstance - :rtype: twilio.rest.insights.v1.call.event.EventPage - """ - data = values.of({ - 'Edge': edge, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EventPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EventInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - :returns: Page of EventInstance - :rtype: twilio.rest.insights.v1.call.event.EventPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return EventPage(self._version, response, self._solution) +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class EventPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, response, solution): - """ - Initialize the EventPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param call_sid: The call_sid - :returns: twilio.rest.insights.v1.call.event.EventPage - :rtype: twilio.rest.insights.v1.call.event.EventPage - """ - super(EventPage, self).__init__(version, response) +class EventListInstance(ListResource): + def __init__(self, version: V1, call_sid: str): + # TODO: needs autogenerated docs + super(EventListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { call_sid, } + self._uri = '/Voice/${call_sid}/Events' + + + def page(self, edge, page_size): + + data = values.of({ + 'edge': edge,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of EventInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.insights.v1.call.event.EventInstance - :rtype: twilio.rest.insights.v1.call.event.EventInstance - """ - return EventInstance(self._version, payload, call_sid=self._solution['call_sid'], ) + return EventPage(self._version, payload, call_sid=self._solution['call_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class EventInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class TwilioEdge(object): - UNKNOWN_EDGE = "unknown_edge" - CARRIER_EDGE = "carrier_edge" - SIP_EDGE = "sip_edge" - SDK_EDGE = "sdk_edge" - CLIENT_EDGE = "client_edge" - - class Level(object): - UNKNOWN = "UNKNOWN" - DEBUG = "DEBUG" - INFO = "INFO" - WARNING = "WARNING" - ERROR = "ERROR" - - def __init__(self, version, payload, call_sid): - """ - Initialize the EventInstance - - :returns: twilio.rest.insights.v1.call.event.EventInstance - :rtype: twilio.rest.insights.v1.call.event.EventInstance - """ - super(EventInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'timestamp': payload.get('timestamp'), - 'call_sid': payload.get('call_sid'), - 'account_sid': payload.get('account_sid'), - 'edge': payload.get('edge'), - 'group': payload.get('group'), - 'level': payload.get('level'), - 'name': payload.get('name'), - 'carrier_edge': payload.get('carrier_edge'), - 'sip_edge': payload.get('sip_edge'), - 'sdk_edge': payload.get('sdk_edge'), - 'client_edge': payload.get('client_edge'), - } - - # Context - self._context = None - self._solution = {'call_sid': call_sid, } - - @property - def timestamp(self): - """ - :returns: The timestamp - :rtype: unicode - """ - return self._properties['timestamp'] - - @property - def call_sid(self): - """ - :returns: The call_sid - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def edge(self): - """ - :returns: The edge - :rtype: EventInstance.TwilioEdge - """ - return self._properties['edge'] - - @property - def group(self): - """ - :returns: The group - :rtype: unicode - """ - return self._properties['group'] + return '' - @property - def level(self): - """ - :returns: The level - :rtype: EventInstance.Level - """ - return self._properties['level'] - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def carrier_edge(self): - """ - :returns: The carrier_edge - :rtype: dict - """ - return self._properties['carrier_edge'] - - @property - def sip_edge(self): - """ - :returns: The sip_edge - :rtype: dict - """ - return self._properties['sip_edge'] - - @property - def sdk_edge(self): - """ - :returns: The sdk_edge - :rtype: dict - """ - return self._properties['sdk_edge'] - - @property - def client_edge(self): - """ - :returns: The client_edge - :rtype: dict - """ - return self._properties['client_edge'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/insights/v1/call/metric.py b/twilio/rest/insights/v1/call/metric.py index da5b3c24d4..890af927f2 100644 --- a/twilio/rest/insights/v1/call/metric.py +++ b/twilio/rest/insights/v1/call/metric.py @@ -1,303 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MetricList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, call_sid): - """ - Initialize the MetricList - - :param Version version: Version that contains the resource - :param call_sid: The call_sid - - :returns: twilio.rest.insights.v1.call.metric.MetricList - :rtype: twilio.rest.insights.v1.call.metric.MetricList - """ - super(MetricList, self).__init__(version) - - # Path Solution - self._solution = {'call_sid': call_sid, } - self._uri = '/Voice/{call_sid}/Metrics'.format(**self._solution) - - def stream(self, edge=values.unset, direction=values.unset, limit=None, - page_size=None): - """ - Streams MetricInstance 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 MetricInstance.TwilioEdge edge: The edge - :param MetricInstance.StreamDirection direction: The direction - :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.insights.v1.call.metric.MetricInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(edge=edge, direction=direction, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, edge=values.unset, direction=values.unset, limit=None, - page_size=None): - """ - Lists MetricInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MetricInstance.TwilioEdge edge: The edge - :param MetricInstance.StreamDirection direction: The direction - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.insights.v1.call.metric.MetricInstance] - """ - return list(self.stream(edge=edge, direction=direction, limit=limit, page_size=page_size, )) - - def page(self, edge=values.unset, direction=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MetricInstance records from the API. - Request is executed immediately - - :param MetricInstance.TwilioEdge edge: The edge - :param MetricInstance.StreamDirection direction: The direction - :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 MetricInstance - :rtype: twilio.rest.insights.v1.call.metric.MetricPage - """ - data = values.of({ - 'Edge': edge, - 'Direction': direction, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) + Twilio - Insights + This is the public Twilio REST API. - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MetricPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MetricInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - :returns: Page of MetricInstance - :rtype: twilio.rest.insights.v1.call.metric.MetricPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return MetricPage(self._version, response, self._solution) +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class MetricPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, response, solution): - """ - Initialize the MetricPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param call_sid: The call_sid - :returns: twilio.rest.insights.v1.call.metric.MetricPage - :rtype: twilio.rest.insights.v1.call.metric.MetricPage - """ - super(MetricPage, self).__init__(version, response) +class MetricListInstance(ListResource): + def __init__(self, version: V1, call_sid: str): + # TODO: needs autogenerated docs + super(MetricListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { call_sid, } + self._uri = '/Voice/${call_sid}/Metrics' + + + def page(self, edge, direction, page_size): + + data = values.of({ + 'edge': edge,'direction': direction,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of MetricInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.insights.v1.call.metric.MetricInstance - :rtype: twilio.rest.insights.v1.call.metric.MetricInstance - """ - return MetricInstance(self._version, payload, call_sid=self._solution['call_sid'], ) + return MetricPage(self._version, payload, call_sid=self._solution['call_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class MetricInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class TwilioEdge(object): - UNKNOWN_EDGE = "unknown_edge" - CARRIER_EDGE = "carrier_edge" - SIP_EDGE = "sip_edge" - SDK_EDGE = "sdk_edge" - CLIENT_EDGE = "client_edge" - - class StreamDirection(object): - UNKNOWN = "unknown" - INBOUND = "inbound" - OUTBOUND = "outbound" - BOTH = "both" - - def __init__(self, version, payload, call_sid): - """ - Initialize the MetricInstance - - :returns: twilio.rest.insights.v1.call.metric.MetricInstance - :rtype: twilio.rest.insights.v1.call.metric.MetricInstance - """ - super(MetricInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'timestamp': payload.get('timestamp'), - 'call_sid': payload.get('call_sid'), - 'account_sid': payload.get('account_sid'), - 'edge': payload.get('edge'), - 'direction': payload.get('direction'), - 'carrier_edge': payload.get('carrier_edge'), - 'sip_edge': payload.get('sip_edge'), - 'sdk_edge': payload.get('sdk_edge'), - 'client_edge': payload.get('client_edge'), - } - - # Context - self._context = None - self._solution = {'call_sid': call_sid, } - - @property - def timestamp(self): - """ - :returns: The timestamp - :rtype: unicode - """ - return self._properties['timestamp'] - - @property - def call_sid(self): - """ - :returns: The call_sid - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def edge(self): - """ - :returns: The edge - :rtype: MetricInstance.TwilioEdge - """ - return self._properties['edge'] - - @property - def direction(self): - """ - :returns: The direction - :rtype: MetricInstance.StreamDirection - """ - return self._properties['direction'] - - @property - def carrier_edge(self): - """ - :returns: The carrier_edge - :rtype: dict - """ - return self._properties['carrier_edge'] - - @property - def sip_edge(self): - """ - :returns: The sip_edge - :rtype: dict - """ - return self._properties['sip_edge'] - - @property - def sdk_edge(self): - """ - :returns: The sdk_edge - :rtype: dict - """ - return self._properties['sdk_edge'] - - @property - def client_edge(self): - """ - :returns: The client_edge - :rtype: dict - """ - return self._properties['client_edge'] - - def __repr__(self): - """ - Provide a friendly representation + return '' - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index 7124af4329..c5cc7a37e2 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -1,569 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CallSummariesList(ListResource): - - def __init__(self, version): - """ - Initialize the CallSummariesList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.insights.v1.call_summaries.CallSummariesList - :rtype: twilio.rest.insights.v1.call_summaries.CallSummariesList - """ - super(CallSummariesList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Voice/Summaries'.format(**self._solution) - - def stream(self, from_=values.unset, to=values.unset, from_carrier=values.unset, - to_carrier=values.unset, from_country_code=values.unset, - to_country_code=values.unset, branded=values.unset, - verified_caller=values.unset, has_tag=values.unset, - start_time=values.unset, end_time=values.unset, - call_type=values.unset, call_state=values.unset, - direction=values.unset, processing_state=values.unset, - sort_by=values.unset, subaccount=values.unset, - abnormal_session=values.unset, limit=None, page_size=None): - """ - Streams CallSummariesInstance 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 from_: The from - :param unicode to: The to - :param unicode from_carrier: The from_carrier - :param unicode to_carrier: The to_carrier - :param unicode from_country_code: The from_country_code - :param unicode to_country_code: The to_country_code - :param bool branded: The branded - :param bool verified_caller: The verified_caller - :param bool has_tag: The has_tag - :param unicode start_time: The start_time - :param unicode end_time: The end_time - :param unicode call_type: The call_type - :param unicode call_state: The call_state - :param unicode direction: The direction - :param CallSummariesInstance.ProcessingStateRequest processing_state: The processing_state - :param CallSummariesInstance.SortBy sort_by: The sort_by - :param unicode subaccount: The subaccount - :param bool abnormal_session: The abnormal_session - :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.insights.v1.call_summaries.CallSummariesInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - from_=from_, - to=to, - from_carrier=from_carrier, - to_carrier=to_carrier, - from_country_code=from_country_code, - to_country_code=to_country_code, - branded=branded, - verified_caller=verified_caller, - has_tag=has_tag, - start_time=start_time, - end_time=end_time, - call_type=call_type, - call_state=call_state, - direction=direction, - processing_state=processing_state, - sort_by=sort_by, - subaccount=subaccount, - abnormal_session=abnormal_session, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, from_=values.unset, to=values.unset, from_carrier=values.unset, - to_carrier=values.unset, from_country_code=values.unset, - to_country_code=values.unset, branded=values.unset, - verified_caller=values.unset, has_tag=values.unset, - start_time=values.unset, end_time=values.unset, call_type=values.unset, - call_state=values.unset, direction=values.unset, - processing_state=values.unset, sort_by=values.unset, - subaccount=values.unset, abnormal_session=values.unset, limit=None, - page_size=None): - """ - Lists CallSummariesInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode from_: The from - :param unicode to: The to - :param unicode from_carrier: The from_carrier - :param unicode to_carrier: The to_carrier - :param unicode from_country_code: The from_country_code - :param unicode to_country_code: The to_country_code - :param bool branded: The branded - :param bool verified_caller: The verified_caller - :param bool has_tag: The has_tag - :param unicode start_time: The start_time - :param unicode end_time: The end_time - :param unicode call_type: The call_type - :param unicode call_state: The call_state - :param unicode direction: The direction - :param CallSummariesInstance.ProcessingStateRequest processing_state: The processing_state - :param CallSummariesInstance.SortBy sort_by: The sort_by - :param unicode subaccount: The subaccount - :param bool abnormal_session: The abnormal_session - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.insights.v1.call_summaries.CallSummariesInstance] - """ - return list(self.stream( - from_=from_, - to=to, - from_carrier=from_carrier, - to_carrier=to_carrier, - from_country_code=from_country_code, - to_country_code=to_country_code, - branded=branded, - verified_caller=verified_caller, - has_tag=has_tag, - start_time=start_time, - end_time=end_time, - call_type=call_type, - call_state=call_state, - direction=direction, - processing_state=processing_state, - sort_by=sort_by, - subaccount=subaccount, - abnormal_session=abnormal_session, - limit=limit, - page_size=page_size, - )) - - def page(self, from_=values.unset, to=values.unset, from_carrier=values.unset, - to_carrier=values.unset, from_country_code=values.unset, - to_country_code=values.unset, branded=values.unset, - verified_caller=values.unset, has_tag=values.unset, - start_time=values.unset, end_time=values.unset, call_type=values.unset, - call_state=values.unset, direction=values.unset, - processing_state=values.unset, sort_by=values.unset, - subaccount=values.unset, abnormal_session=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CallSummariesInstance records from the API. - Request is executed immediately - - :param unicode from_: The from - :param unicode to: The to - :param unicode from_carrier: The from_carrier - :param unicode to_carrier: The to_carrier - :param unicode from_country_code: The from_country_code - :param unicode to_country_code: The to_country_code - :param bool branded: The branded - :param bool verified_caller: The verified_caller - :param bool has_tag: The has_tag - :param unicode start_time: The start_time - :param unicode end_time: The end_time - :param unicode call_type: The call_type - :param unicode call_state: The call_state - :param unicode direction: The direction - :param CallSummariesInstance.ProcessingStateRequest processing_state: The processing_state - :param CallSummariesInstance.SortBy sort_by: The sort_by - :param unicode subaccount: The subaccount - :param bool abnormal_session: The abnormal_session - :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 CallSummariesInstance - :rtype: twilio.rest.insights.v1.call_summaries.CallSummariesPage - """ - data = values.of({ - 'From': from_, - 'To': to, - 'FromCarrier': from_carrier, - 'ToCarrier': to_carrier, - 'FromCountryCode': from_country_code, - 'ToCountryCode': to_country_code, - 'Branded': branded, - 'VerifiedCaller': verified_caller, - 'HasTag': has_tag, - 'StartTime': start_time, - 'EndTime': end_time, - 'CallType': call_type, - 'CallState': call_state, - 'Direction': direction, - 'ProcessingState': processing_state, - 'SortBy': sort_by, - 'Subaccount': subaccount, - 'AbnormalSession': abnormal_session, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CallSummariesPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CallSummariesInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CallSummariesInstance - :rtype: twilio.rest.insights.v1.call_summaries.CallSummariesPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CallSummariesPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class CallSummariesPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the CallSummariesPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.insights.v1.call_summaries.CallSummariesPage - :rtype: twilio.rest.insights.v1.call_summaries.CallSummariesPage - """ - super(CallSummariesPage, self).__init__(version, response) +class CallSummariesListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CallSummariesListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { } + self._uri = '/Voice/Summaries' + + + def page(self, _from, to, from_carrier, to_carrier, from_country_code, to_country_code, branded, verified_caller, has_tag, start_time, end_time, call_type, call_state, direction, processing_state, sort_by, subaccount, abnormal_session, page_size): + + data = values.of({ + '_from': _from,'to': to,'from_carrier': from_carrier,'to_carrier': to_carrier,'from_country_code': from_country_code,'to_country_code': to_country_code,'branded': branded,'verified_caller': verified_caller,'has_tag': has_tag,'start_time': start_time,'end_time': end_time,'call_type': call_type,'call_state': call_state,'direction': direction,'processing_state': processing_state,'sort_by': sort_by,'subaccount': subaccount,'abnormal_session': abnormal_session,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of CallSummariesInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.insights.v1.call_summaries.CallSummariesInstance - :rtype: twilio.rest.insights.v1.call_summaries.CallSummariesInstance - """ - return CallSummariesInstance(self._version, payload, ) + return CallSummariesPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class CallSummariesInstance(InstanceResource): - - class AnsweredBy(object): - UNKNOWN = "unknown" - MACHINE_START = "machine_start" - MACHINE_END_BEEP = "machine_end_beep" - MACHINE_END_SILENCE = "machine_end_silence" - MACHINE_END_OTHER = "machine_end_other" - HUMAN = "human" - FAX = "fax" - - class CallType(object): - CARRIER = "carrier" - SIP = "sip" - TRUNKING = "trunking" - CLIENT = "client" - - class CallState(object): - RINGING = "ringing" - COMPLETED = "completed" - BUSY = "busy" - FAIL = "fail" - NOANSWER = "noanswer" - CANCELED = "canceled" - ANSWERED = "answered" - UNDIALED = "undialed" - - class ProcessingState(object): - COMPLETE = "complete" - PARTIAL = "partial" - - class CallDirection(object): - OUTBOUND_API = "outbound_api" - OUTBOUND_DIAL = "outbound_dial" - INBOUND = "inbound" - TRUNKING_ORIGINATING = "trunking_originating" - TRUNKING_TERMINATING = "trunking_terminating" - - class SortBy(object): - START_TIME = "start_time" - END_TIME = "end_time" - - class ProcessingStateRequest(object): - COMPLETED = "completed" - STARTED = "started" - PARTIAL = "partial" - ALL = "all" - - def __init__(self, version, payload): - """ - Initialize the CallSummariesInstance - - :returns: twilio.rest.insights.v1.call_summaries.CallSummariesInstance - :rtype: twilio.rest.insights.v1.call_summaries.CallSummariesInstance - """ - super(CallSummariesInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'answered_by': payload.get('answered_by'), - 'call_type': payload.get('call_type'), - 'call_state': payload.get('call_state'), - 'processing_state': payload.get('processing_state'), - 'created_time': deserialize.iso8601_datetime(payload.get('created_time')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'duration': deserialize.integer(payload.get('duration')), - 'connect_duration': deserialize.integer(payload.get('connect_duration')), - 'from_': payload.get('from'), - 'to': payload.get('to'), - 'carrier_edge': payload.get('carrier_edge'), - 'client_edge': payload.get('client_edge'), - 'sdk_edge': payload.get('sdk_edge'), - 'sip_edge': payload.get('sip_edge'), - 'tags': payload.get('tags'), - 'url': payload.get('url'), - 'attributes': payload.get('attributes'), - 'properties': payload.get('properties'), - 'trust': payload.get('trust'), - } - - # Context - self._context = None - self._solution = {} - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] + return '' - @property - def call_sid(self): - """ - :returns: The call_sid - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def answered_by(self): - """ - :returns: The answered_by - :rtype: CallSummariesInstance.AnsweredBy - """ - return self._properties['answered_by'] - - @property - def call_type(self): - """ - :returns: The call_type - :rtype: CallSummariesInstance.CallType - """ - return self._properties['call_type'] - - @property - def call_state(self): - """ - :returns: The call_state - :rtype: CallSummariesInstance.CallState - """ - return self._properties['call_state'] - - @property - def processing_state(self): - """ - :returns: The processing_state - :rtype: CallSummariesInstance.ProcessingState - """ - return self._properties['processing_state'] - - @property - def created_time(self): - """ - :returns: The created_time - :rtype: datetime - """ - return self._properties['created_time'] - - @property - def start_time(self): - """ - :returns: The start_time - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def connect_duration(self): - """ - :returns: The connect_duration - :rtype: unicode - """ - return self._properties['connect_duration'] - - @property - def from_(self): - """ - :returns: The from - :rtype: dict - """ - return self._properties['from_'] - - @property - def to(self): - """ - :returns: The to - :rtype: dict - """ - return self._properties['to'] - - @property - def carrier_edge(self): - """ - :returns: The carrier_edge - :rtype: dict - """ - return self._properties['carrier_edge'] - - @property - def client_edge(self): - """ - :returns: The client_edge - :rtype: dict - """ - return self._properties['client_edge'] - - @property - def sdk_edge(self): - """ - :returns: The sdk_edge - :rtype: dict - """ - return self._properties['sdk_edge'] - - @property - def sip_edge(self): - """ - :returns: The sip_edge - :rtype: dict - """ - return self._properties['sip_edge'] - - @property - def tags(self): - """ - :returns: The tags - :rtype: list[unicode] - """ - return self._properties['tags'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: dict - """ - return self._properties['attributes'] - - @property - def properties(self): - """ - :returns: The properties - :rtype: dict - """ - return self._properties['properties'] - - @property - def trust(self): - """ - :returns: The trust - :rtype: dict - """ - return self._properties['trust'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/insights/v1/conference.py b/twilio/rest/insights/v1/conference.py new file mode 100644 index 0000000000..3f51fca0de --- /dev/null +++ b/twilio/rest/insights/v1/conference.py @@ -0,0 +1,154 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.conference.conference_participant import ConferenceParticipantListInstance + + +class ConferenceContext(InstanceContext): + def __init__(self, version: V1, conference_sid: str): + # TODO: needs autogenerated docs + super(ConferenceContextList, self).__init__(version) + + # Path Solution + self._solution = { conference_sid, } + self._uri = '/Conferences/${conference_sid}' + + self._conference_participants = None + + def fetch(self): + + """ + Fetch the ConferenceInstance + + :returns: The fetched ConferenceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConferenceInstance( + self._version, + payload, + conference_sid=self._solution['conference_sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConferenceInstance(InstanceResource): + def __init__(self, version, payload, conference_sid: str): + super(ConferenceInstance, self).__init__(version) + self._properties = { + 'conference_sid' = payload.get('conference_sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'create_time' = payload.get('create_time'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'duration_seconds' = payload.get('duration_seconds'), + 'connect_duration_seconds' = payload.get('connect_duration_seconds'), + 'status' = payload.get('status'), + 'max_participants' = payload.get('max_participants'), + 'max_concurrent_participants' = payload.get('max_concurrent_participants'), + 'unique_participants' = payload.get('unique_participants'), + 'end_reason' = payload.get('end_reason'), + 'ended_by' = payload.get('ended_by'), + 'mixer_region' = payload.get('mixer_region'), + 'mixer_region_requested' = payload.get('mixer_region_requested'), + 'recording_enabled' = payload.get('recording_enabled'), + 'detected_issues' = payload.get('detected_issues'), + 'tags' = payload.get('tags'), + 'tag_info' = payload.get('tag_info'), + 'processing_state' = payload.get('processing_state'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'conference_sid': conference_sid or self._properties['conference_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConferenceContext( + self._version, + conference_sid=self._solution['conference_sid'], + ) + return self._context + + @property + def conference_participants(self): + return self._proxy.conference_participants + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConferenceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ConferenceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Conferences' + + + def page(self, conference_sid, friendly_name, status, created_after, created_before, mixer_region, tags, subaccount, detected_issues, end_reason, page_size): + + data = values.of({ + 'conference_sid': conference_sid,'friendly_name': friendly_name,'status': status,'created_after': created_after,'created_before': created_before,'mixer_region': mixer_region,'tags': tags,'subaccount': subaccount,'detected_issues': detected_issues,'end_reason': end_reason,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ConferencePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/insights/v1/conference/conference_participant.py b/twilio/rest/insights/v1/conference/conference_participant.py index 6ab8d17f33..7dfded91b0 100644 --- a/twilio/rest/insights/v1/conference/conference_participant.py +++ b/twilio/rest/insights/v1/conference/conference_participant.py @@ -1,617 +1,154 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ConferenceParticipantList(ListResource): - - def __init__(self, version, conference_sid): - """ - Initialize the ConferenceParticipantList - - :param Version version: Version that contains the resource - :param conference_sid: Conference SID. - - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantList - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantList - """ - super(ConferenceParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'conference_sid': conference_sid, } - self._uri = '/Conferences/{conference_sid}/Participants'.format(**self._solution) - - def stream(self, participant_sid=values.unset, label=values.unset, - events=values.unset, limit=None, page_size=None): - """ - Streams ConferenceParticipantInstance 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 participant_sid: Participant SID. - :param unicode label: User-specified label for a participant. - :param unicode events: Conference events generated by application or participant activity. - :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.insights.v1.conference.conference_participant.ConferenceParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - participant_sid=participant_sid, - label=label, - events=events, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, participant_sid=values.unset, label=values.unset, - events=values.unset, limit=None, page_size=None): - """ - Lists ConferenceParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode participant_sid: Participant SID. - :param unicode label: User-specified label for a participant. - :param unicode events: Conference events generated by application or participant activity. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.insights.v1.conference.conference_participant.ConferenceParticipantInstance] - """ - return list(self.stream( - participant_sid=participant_sid, - label=label, - events=events, - limit=limit, - page_size=page_size, - )) - - def page(self, participant_sid=values.unset, label=values.unset, - events=values.unset, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConferenceParticipantInstance records from the API. - Request is executed immediately - - :param unicode participant_sid: Participant SID. - :param unicode label: User-specified label for a participant. - :param unicode events: Conference events generated by application or participant activity. - :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 ConferenceParticipantInstance - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantPage - """ - data = values.of({ - 'ParticipantSid': participant_sid, - 'Label': label, - 'Events': events, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConferenceParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConferenceParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConferenceParticipantInstance - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConferenceParticipantPage(self._version, response, self._solution) - - def get(self, participant_sid): - """ - Constructs a ConferenceParticipantContext - - :param participant_sid: Participant SID. - - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantContext - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantContext - """ - return ConferenceParticipantContext( - self._version, - conference_sid=self._solution['conference_sid'], - participant_sid=participant_sid, - ) - - def __call__(self, participant_sid): - """ - Constructs a ConferenceParticipantContext - - :param participant_sid: Participant SID. - - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantContext - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantContext - """ - return ConferenceParticipantContext( - self._version, - conference_sid=self._solution['conference_sid'], - participant_sid=participant_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConferenceParticipantPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConferenceParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param conference_sid: Conference SID. - - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantPage - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantPage - """ - super(ConferenceParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConferenceParticipantInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantInstance - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantInstance - """ - return ConferenceParticipantInstance( - self._version, - payload, - conference_sid=self._solution['conference_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ConferenceParticipantContext(InstanceContext): - - def __init__(self, version, conference_sid, participant_sid): - """ - Initialize the ConferenceParticipantContext - - :param Version version: Version that contains the resource - :param conference_sid: Conference SID. - :param participant_sid: Participant SID. - - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantContext - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantContext - """ - super(ConferenceParticipantContext, self).__init__(version) + def __init__(self, version: V1, conference_sid: str, participant_sid: str): + # TODO: needs autogenerated docs + super(ConferenceParticipantContextList, self).__init__(version) # Path Solution - self._solution = {'conference_sid': conference_sid, 'participant_sid': participant_sid, } - self._uri = '/Conferences/{conference_sid}/Participants/{participant_sid}'.format(**self._solution) - - def fetch(self, events=values.unset, metrics=values.unset): - """ - Fetch the ConferenceParticipantInstance - - :param unicode events: Conference events generated by application or participant activity. - :param unicode metrics: Object. Contains call quality metrics. - - :returns: The fetched ConferenceParticipantInstance - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantInstance - """ - data = values.of({'Events': events, 'Metrics': metrics, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return ConferenceParticipantInstance( - self._version, - payload, - conference_sid=self._solution['conference_sid'], - participant_sid=self._solution['participant_sid'], - ) + self._solution = { conference_sid, participant_sid, } + self._uri = '/Conferences/${conference_sid}/Participants/${participant_sid}' + + + def fetch(self, events, metrics): + + """ + Fetch the ConferenceParticipantInstance + + :returns: The fetched ConferenceParticipantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConferenceParticipantInstance( + self._version, + payload, + conference_sidparticipant_sid=self._solution['conference_sid''participant_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ConferenceParticipantInstance(InstanceResource): - - class CallDirection(object): - INBOUND = "inbound" - OUTBOUND = "outbound" + return '' - class CallStatus(object): - ANSWERED = "answered" - COMPLETED = "completed" - BUSY = "busy" - FAIL = "fail" - NOANSWER = "noanswer" - RINGING = "ringing" - CANCELED = "canceled" - class JitterBufferSize(object): - LARGE = "large" - SMALL = "small" - MEDIUM = "medium" - OFF = "off" - class Region(object): - US1 = "us1" - US2 = "us2" - AU1 = "au1" - BR1 = "br1" - IE1 = "ie1" - JP1 = "jp1" - SG1 = "sg1" - DE1 = "de1" - - class CallType(object): - CARRIER = "carrier" - CLIENT = "client" - SIP = "sip" - - class ProcessingState(object): - COMPLETE = "complete" - IN_PROGRESS = "in_progress" - TIMEOUT = "timeout" - - def __init__(self, version, payload, conference_sid, participant_sid=None): - """ - Initialize the ConferenceParticipantInstance - - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantInstance - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantInstance - """ +class ConferenceParticipantInstance(InstanceResource): + def __init__(self, version, payload, conference_sid: str, participant_sid: str): super(ConferenceParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'participant_sid': payload.get('participant_sid'), - 'label': payload.get('label'), - 'conference_sid': payload.get('conference_sid'), - 'call_sid': payload.get('call_sid'), - 'account_sid': payload.get('account_sid'), - 'call_direction': payload.get('call_direction'), - 'from_': payload.get('from'), - 'to': payload.get('to'), - 'call_status': payload.get('call_status'), - 'country_code': payload.get('country_code'), - 'is_moderator': payload.get('is_moderator'), - 'join_time': deserialize.iso8601_datetime(payload.get('join_time')), - 'leave_time': deserialize.iso8601_datetime(payload.get('leave_time')), - 'duration_seconds': deserialize.integer(payload.get('duration_seconds')), - 'outbound_queue_length': deserialize.integer(payload.get('outbound_queue_length')), - 'outbound_time_in_queue': deserialize.integer(payload.get('outbound_time_in_queue')), - 'jitter_buffer_size': payload.get('jitter_buffer_size'), - 'is_coach': payload.get('is_coach'), - 'coached_participants': payload.get('coached_participants'), - 'participant_region': payload.get('participant_region'), - 'conference_region': payload.get('conference_region'), - 'call_type': payload.get('call_type'), - 'processing_state': payload.get('processing_state'), - 'properties': payload.get('properties'), - 'events': payload.get('events'), - 'metrics': payload.get('metrics'), - 'url': payload.get('url'), + self._properties = { + 'participant_sid' = payload.get('participant_sid'), + 'label' = payload.get('label'), + 'conference_sid' = payload.get('conference_sid'), + 'call_sid' = payload.get('call_sid'), + 'account_sid' = payload.get('account_sid'), + 'call_direction' = payload.get('call_direction'), + '_from' = payload.get('from'), + 'to' = payload.get('to'), + 'call_status' = payload.get('call_status'), + 'country_code' = payload.get('country_code'), + 'is_moderator' = payload.get('is_moderator'), + 'join_time' = payload.get('join_time'), + 'leave_time' = payload.get('leave_time'), + 'duration_seconds' = payload.get('duration_seconds'), + 'outbound_queue_length' = payload.get('outbound_queue_length'), + 'outbound_time_in_queue' = payload.get('outbound_time_in_queue'), + 'jitter_buffer_size' = payload.get('jitter_buffer_size'), + 'is_coach' = payload.get('is_coach'), + 'coached_participants' = payload.get('coached_participants'), + 'participant_region' = payload.get('participant_region'), + 'conference_region' = payload.get('conference_region'), + 'call_type' = payload.get('call_type'), + 'processing_state' = payload.get('processing_state'), + 'properties' = payload.get('properties'), + 'events' = payload.get('events'), + 'metrics' = payload.get('metrics'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'conference_sid': conference_sid, - 'participant_sid': participant_sid or self._properties['participant_sid'], + 'conference_sid': conference_sid or self._properties['conference_sid']'participant_sid': participant_sid or self._properties['participant_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConferenceParticipantContext for this ConferenceParticipantInstance - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantContext - """ if self._context is None: self._context = ConferenceParticipantContext( self._version, - conference_sid=self._solution['conference_sid'], - participant_sid=self._solution['participant_sid'], + conference_sid=self._solution['conference_sid'],participant_sid=self._solution['participant_sid'], ) return self._context - @property - def participant_sid(self): - """ - :returns: SID for this participant. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def label(self): - """ - :returns: The user-specified label of this participant. - :rtype: unicode - """ - return self._properties['label'] - - @property - def conference_sid(self): - """ - :returns: Conference SID. - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def call_sid(self): - """ - :returns: Unique SID identifier of the call. - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_direction(self): - """ - :returns: Call direction of the participant. - :rtype: ConferenceParticipantInstance.CallDirection - """ - return self._properties['call_direction'] - - @property - def from_(self): - """ - :returns: Caller ID of the calling party. - :rtype: unicode - """ - return self._properties['from_'] - - @property - def to(self): - """ - :returns: Called party. - :rtype: unicode - """ - return self._properties['to'] - - @property - def call_status(self): - """ - :returns: Call status of the call that generated the participant. - :rtype: ConferenceParticipantInstance.CallStatus - """ - return self._properties['call_status'] - - @property - def country_code(self): - """ - :returns: ISO alpha-2 country code of the participant. - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def is_moderator(self): - """ - :returns: Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true. - :rtype: bool - """ - return self._properties['is_moderator'] - - @property - def join_time(self): - """ - :returns: ISO 8601 timestamp of participant join event. - :rtype: datetime - """ - return self._properties['join_time'] - - @property - def leave_time(self): - """ - :returns: ISO 8601 timestamp of participant leave event. - :rtype: datetime - """ - return self._properties['leave_time'] - - @property - def duration_seconds(self): - """ - :returns: Participant durations in seconds. - :rtype: unicode - """ - return self._properties['duration_seconds'] - - @property - def outbound_queue_length(self): - """ - :returns: Estimated time in queue at call creation. - :rtype: unicode - """ - return self._properties['outbound_queue_length'] - - @property - def outbound_time_in_queue(self): - """ - :returns: Actual time in queue (seconds). - :rtype: unicode - """ - return self._properties['outbound_time_in_queue'] - - @property - def jitter_buffer_size(self): - """ - :returns: The Jitter Buffer Size of this Conference Participant. - :rtype: ConferenceParticipantInstance.JitterBufferSize - """ - return self._properties['jitter_buffer_size'] - - @property - def is_coach(self): - """ - :returns: Boolean. Indicated whether participant was a coach. - :rtype: bool - """ - return self._properties['is_coach'] - - @property - def coached_participants(self): - """ - :returns: Call SIDs coached by this participant. - :rtype: list[unicode] - """ - return self._properties['coached_participants'] - - @property - def participant_region(self): - """ - :returns: Twilio region where the participant media originates. - :rtype: ConferenceParticipantInstance.Region - """ - return self._properties['participant_region'] - - @property - def conference_region(self): - """ - :returns: The Conference Region of this Conference Participant. - :rtype: ConferenceParticipantInstance.Region - """ - return self._properties['conference_region'] + - @property - def call_type(self): - """ - :returns: The Call Type of this Conference Participant. - :rtype: ConferenceParticipantInstance.CallType - """ - return self._properties['call_type'] - - @property - def processing_state(self): + def __repr__(self): """ - :returns: Processing state of the Participant Summary. - :rtype: ConferenceParticipantInstance.ProcessingState + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['processing_state'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def properties(self): - """ - :returns: Participant properties and metadata. - :rtype: dict - """ - return self._properties['properties'] - @property - def events(self): - """ - :returns: Object containing information of actions taken by participants. Nested resource URLs. - :rtype: dict - """ - return self._properties['events'] - @property - def metrics(self): - """ - :returns: Object. Contains participant quality metrics. - :rtype: dict - """ - return self._properties['metrics'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] +class ConferenceParticipantListInstance(ListResource): + def __init__(self, version: V1, conference_sid: str): + # TODO: needs autogenerated docs + super(ConferenceParticipantListInstanceList, self).__init__(version) - def fetch(self, events=values.unset, metrics=values.unset): - """ - Fetch the ConferenceParticipantInstance + # Path Solution + self._solution = { conference_sid, } + self._uri = '/Conferences/${conference_sid}/Participants' + + + def page(self, participant_sid, label, events, page_size): + + data = values.of({ + 'participant_sid': participant_sid,'label': label,'events': events,'page_size': page_size, + }) - :param unicode events: Conference events generated by application or participant activity. - :param unicode metrics: Object. Contains call quality metrics. + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched ConferenceParticipantInstance - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantInstance - """ - return self._proxy.fetch(events=events, metrics=metrics, ) + return ConferenceParticipantPage(self._version, payload, conference_sid=self._solution['conference_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/insights/v1/room.py b/twilio/rest/insights/v1/room.py new file mode 100644 index 0000000000..7a779a2605 --- /dev/null +++ b/twilio/rest/insights/v1/room.py @@ -0,0 +1,157 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.room.participant import ParticipantListInstance + + +class RoomContext(InstanceContext): + def __init__(self, version: V1, room_sid: str): + # TODO: needs autogenerated docs + super(RoomContextList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, } + self._uri = '/Video/Rooms/${room_sid}' + + self._participants = None + + def fetch(self): + + """ + Fetch the RoomInstance + + :returns: The fetched RoomInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoomInstance( + self._version, + payload, + room_sid=self._solution['room_sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RoomInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str): + super(RoomInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'room_sid' = payload.get('room_sid'), + 'room_name' = payload.get('room_name'), + 'create_time' = payload.get('create_time'), + 'end_time' = payload.get('end_time'), + 'room_type' = payload.get('room_type'), + 'room_status' = payload.get('room_status'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'created_method' = payload.get('created_method'), + 'end_reason' = payload.get('end_reason'), + 'max_participants' = payload.get('max_participants'), + 'unique_participants' = payload.get('unique_participants'), + 'unique_participant_identities' = payload.get('unique_participant_identities'), + 'concurrent_participants' = payload.get('concurrent_participants'), + 'max_concurrent_participants' = payload.get('max_concurrent_participants'), + 'codecs' = payload.get('codecs'), + 'media_region' = payload.get('media_region'), + 'duration_sec' = payload.get('duration_sec'), + 'total_participant_duration_sec' = payload.get('total_participant_duration_sec'), + 'total_recording_duration_sec' = payload.get('total_recording_duration_sec'), + 'processing_state' = payload.get('processing_state'), + 'recording_enabled' = payload.get('recording_enabled'), + 'edge_location' = payload.get('edge_location'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RoomContext( + self._version, + room_sid=self._solution['room_sid'], + ) + return self._context + + @property + def participants(self): + return self._proxy.participants + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RoomListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RoomListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Video/Rooms' + + + def page(self, room_type, codec, room_name, created_after, created_before, page_size): + + data = values.of({ + 'room_type': room_type,'codec': codec,'room_name': room_name,'created_after': created_after,'created_before': created_before,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RoomPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index d202e5d794..03b3a89453 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -1,486 +1,144 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ParticipantList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, room_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param room_sid: Unique identifier for the room. - - :returns: twilio.rest.insights.v1.room.participant.ParticipantList - :rtype: twilio.rest.insights.v1.room.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, } - self._uri = '/Video/Rooms/{room_sid}/Participants'.format(**self._solution) - - def stream(self, 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 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.insights.v1.room.participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.insights.v1.room.participant.ParticipantInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :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 ParticipantInstance - :rtype: twilio.rest.insights.v1.room.participant.ParticipantPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.insights.v1.room.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get(self, participant_sid): - """ - Constructs a ParticipantContext - - :param participant_sid: The SID of the Participant resource. - - :returns: twilio.rest.insights.v1.room.participant.ParticipantContext - :rtype: twilio.rest.insights.v1.room.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=participant_sid, - ) - def __call__(self, participant_sid): - """ - Constructs a ParticipantContext - - :param participant_sid: The SID of the Participant resource. - - :returns: twilio.rest.insights.v1.room.participant.ParticipantContext - :rtype: twilio.rest.insights.v1.room.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=participant_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: Unique identifier for the room. - - :returns: twilio.rest.insights.v1.room.participant.ParticipantPage - :rtype: twilio.rest.insights.v1.room.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.insights.v1.room.participant.ParticipantInstance - :rtype: twilio.rest.insights.v1.room.participant.ParticipantInstance - """ - return ParticipantInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ParticipantContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, room_sid, participant_sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource. - :param participant_sid: The SID of the Participant resource. - - :returns: twilio.rest.insights.v1.room.participant.ParticipantContext - :rtype: twilio.rest.insights.v1.room.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) + def __init__(self, version: V1, room_sid: str, participant_sid: str): + # TODO: needs autogenerated docs + super(ParticipantContextList, self).__init__(version) # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, } - self._uri = '/Video/Rooms/{room_sid}/Participants/{participant_sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ParticipantInstance - - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.insights.v1.room.participant.ParticipantInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ParticipantInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - ) + self._solution = { room_sid, participant_sid, } + self._uri = '/Video/Rooms/${room_sid}/Participants/${participant_sid}' + + + def fetch(self): + + """ + Fetch the ParticipantInstance + + :returns: The fetched ParticipantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ParticipantInstance( + self._version, + payload, + room_sidparticipant_sid=self._solution['room_sid''participant_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ParticipantInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class RoomStatus(object): - IN_PROGRESS = "in_progress" - COMPLETED = "completed" - class Codec(object): - VP8 = "VP8" - H264 = "H264" - VP9 = "VP9" - class TwilioRealm(object): - US1 = "us1" - US2 = "us2" - AU1 = "au1" - BR1 = "br1" - IE1 = "ie1" - JP1 = "jp1" - SG1 = "sg1" - IN1 = "in1" - DE1 = "de1" - GLL = "gll" - - class EdgeLocation(object): - ASHBURN = "ashburn" - DUBLIN = "dublin" - FRANKFURT = "frankfurt" - SINGAPORE = "singapore" - SYDNEY = "sydney" - SAO_PAULO = "sao_paulo" - ROAMING = "roaming" - UMATILLA = "umatilla" - TOKYO = "tokyo" - - def __init__(self, version, payload, room_sid, participant_sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.insights.v1.room.participant.ParticipantInstance - :rtype: twilio.rest.insights.v1.room.participant.ParticipantInstance - """ +class ParticipantInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str, participant_sid: str): super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'participant_sid': payload.get('participant_sid'), - 'participant_identity': payload.get('participant_identity'), - 'join_time': deserialize.iso8601_datetime(payload.get('join_time')), - 'leave_time': deserialize.iso8601_datetime(payload.get('leave_time')), - 'duration_sec': deserialize.integer(payload.get('duration_sec')), - 'account_sid': payload.get('account_sid'), - 'room_sid': payload.get('room_sid'), - 'status': payload.get('status'), - 'codecs': payload.get('codecs'), - 'end_reason': payload.get('end_reason'), - 'error_code': deserialize.integer(payload.get('error_code')), - 'error_code_url': payload.get('error_code_url'), - 'media_region': payload.get('media_region'), - 'properties': payload.get('properties'), - 'edge_location': payload.get('edge_location'), - 'publisher_info': payload.get('publisher_info'), - 'url': payload.get('url'), + self._properties = { + 'participant_sid' = payload.get('participant_sid'), + 'participant_identity' = payload.get('participant_identity'), + 'join_time' = payload.get('join_time'), + 'leave_time' = payload.get('leave_time'), + 'duration_sec' = payload.get('duration_sec'), + 'account_sid' = payload.get('account_sid'), + 'room_sid' = payload.get('room_sid'), + 'status' = payload.get('status'), + 'codecs' = payload.get('codecs'), + 'end_reason' = payload.get('end_reason'), + 'error_code' = payload.get('error_code'), + 'error_code_url' = payload.get('error_code_url'), + 'media_region' = payload.get('media_region'), + 'properties' = payload.get('properties'), + 'edge_location' = payload.get('edge_location'), + 'publisher_info' = payload.get('publisher_info'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'room_sid': room_sid, - 'participant_sid': participant_sid or self._properties['participant_sid'], + 'room_sid': room_sid or self._properties['room_sid']'participant_sid': participant_sid or self._properties['participant_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.insights.v1.room.participant.ParticipantContext - """ if self._context is None: self._context = ParticipantContext( self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], + room_sid=self._solution['room_sid'],participant_sid=self._solution['participant_sid'], ) return self._context - @property - def participant_sid(self): - """ - :returns: Unique identifier for the participant. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def participant_identity(self): - """ - :returns: The application-defined string that uniquely identifies the participant within a Room. - :rtype: unicode - """ - return self._properties['participant_identity'] - - @property - def join_time(self): - """ - :returns: When the participant joined the room. - :rtype: datetime - """ - return self._properties['join_time'] - - @property - def leave_time(self): - """ - :returns: When the participant left the room - :rtype: datetime - """ - return self._properties['leave_time'] - - @property - def duration_sec(self): - """ - :returns: Amount of time in seconds the participant was in the room. - :rtype: unicode - """ - return self._properties['duration_sec'] - - @property - def account_sid(self): - """ - :returns: Account SID associated with the room. - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def room_sid(self): - """ - :returns: Unique identifier for the room. - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def status(self): - """ - :returns: Status of the room. - :rtype: ParticipantInstance.RoomStatus - """ - return self._properties['status'] - - @property - def codecs(self): - """ - :returns: Codecs detected from the participant. - :rtype: list[ParticipantInstance.Codec] - """ - return self._properties['codecs'] - - @property - def end_reason(self): - """ - :returns: Reason the participant left the room. - :rtype: unicode - """ - return self._properties['end_reason'] - - @property - def error_code(self): - """ - :returns: Errors encountered by the participant. - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def error_code_url(self): - """ - :returns: Twilio error code dictionary link. - :rtype: unicode - """ - return self._properties['error_code_url'] - - @property - def media_region(self): + def __repr__(self): """ - :returns: Twilio media region the participant connected to. - :rtype: ParticipantInstance.TwilioRealm + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['media_region'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def properties(self): - """ - :returns: Object containing information about the participant's data from the room. - :rtype: dict - """ - return self._properties['properties'] - @property - def edge_location(self): - """ - :returns: Name of the edge location the participant connected to. - :rtype: ParticipantInstance.EdgeLocation - """ - return self._properties['edge_location'] - @property - def publisher_info(self): - """ - :returns: Object containing information about the SDK name and version. - :rtype: dict - """ - return self._properties['publisher_info'] +class ParticipantListInstance(ListResource): + def __init__(self, version: V1, room_sid: str): + # TODO: needs autogenerated docs + super(ParticipantListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: URL of the participant resource. - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { room_sid, } + self._uri = '/Video/Rooms/${room_sid}/Participants' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the ParticipantInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.insights.v1.room.participant.ParticipantInstance - """ - return self._proxy.fetch() + return ParticipantPage(self._version, payload, room_sid=self._solution['room_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/insights/v1/setting.py b/twilio/rest/insights/v1/setting.py index c07fd2af0e..cc1b88ad1d 100644 --- a/twilio/rest/insights/v1/setting.py +++ b/twilio/rest/insights/v1/setting.py @@ -1,268 +1,130 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Insights + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SettingList(ListResource): - - def __init__(self, version): - """ - Initialize the SettingList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.insights.v1.setting.SettingList - :rtype: twilio.rest.insights.v1.setting.SettingList - """ - super(SettingList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a SettingContext - - :returns: twilio.rest.insights.v1.setting.SettingContext - :rtype: twilio.rest.insights.v1.setting.SettingContext - """ - return SettingContext(self._version, ) - - def __call__(self): - """ - Constructs a SettingContext - - :returns: twilio.rest.insights.v1.setting.SettingContext - :rtype: twilio.rest.insights.v1.setting.SettingContext - """ - return SettingContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SettingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SettingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.insights.v1.setting.SettingPage - :rtype: twilio.rest.insights.v1.setting.SettingPage - """ - super(SettingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of SettingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.insights.v1.setting.SettingInstance - :rtype: twilio.rest.insights.v1.setting.SettingInstance - """ - return SettingInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SettingContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the SettingContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.insights.v1.setting.SettingContext - :rtype: twilio.rest.insights.v1.setting.SettingContext - """ - super(SettingContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SettingContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/Voice/Settings'.format(**self._solution) - - def fetch(self, subaccount_sid=values.unset): - """ - Fetch the SettingInstance - - :param unicode subaccount_sid: The subaccount_sid - - :returns: The fetched SettingInstance - :rtype: twilio.rest.insights.v1.setting.SettingInstance - """ - data = values.of({'SubaccountSid': subaccount_sid, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return SettingInstance(self._version, payload, ) - - def update(self, advanced_features=values.unset, voice_trace=values.unset, - subaccount_sid=values.unset): - """ - Update the SettingInstance - - :param bool advanced_features: The advanced_features - :param bool voice_trace: The voice_trace - :param unicode subaccount_sid: The subaccount_sid - - :returns: The updated SettingInstance - :rtype: twilio.rest.insights.v1.setting.SettingInstance - """ - data = values.of({ - 'AdvancedFeatures': advanced_features, - 'VoiceTrace': voice_trace, - 'SubaccountSid': subaccount_sid, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SettingInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Voice/Settings' + + + def fetch(self, subaccount_sid): + + """ + Fetch the SettingInstance + + :returns: The fetched SettingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SettingInstance( + self._version, + payload, + =self._solution[], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SettingInstance(self._version, payload, ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SettingInstance(InstanceResource): +class SettingInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the SettingInstance - - :returns: twilio.rest.insights.v1.setting.SettingInstance - :rtype: twilio.rest.insights.v1.setting.SettingInstance - """ super(SettingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'advanced_features': payload.get('advanced_features'), - 'voice_trace': payload.get('voice_trace'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'advanced_features' = payload.get('advanced_features'), + 'voice_trace' = payload.get('voice_trace'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SettingContext for this SettingInstance - :rtype: twilio.rest.insights.v1.setting.SettingContext - """ if self._context is None: - self._context = SettingContext(self._version, ) + self._context = SettingContext( + self._version, + + ) return self._context - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def advanced_features(self): - """ - :returns: The advanced_features - :rtype: bool - """ - return self._properties['advanced_features'] - - @property - def voice_trace(self): - """ - :returns: The voice_trace - :rtype: bool - """ - return self._properties['voice_trace'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def fetch(self, subaccount_sid=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the SettingInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode subaccount_sid: The subaccount_sid - :returns: The fetched SettingInstance - :rtype: twilio.rest.insights.v1.setting.SettingInstance - """ - return self._proxy.fetch(subaccount_sid=subaccount_sid, ) - def update(self, advanced_features=values.unset, voice_trace=values.unset, - subaccount_sid=values.unset): - """ - Update the SettingInstance +class SettingListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SettingListInstanceList, self).__init__(version) - :param bool advanced_features: The advanced_features - :param bool voice_trace: The voice_trace - :param unicode subaccount_sid: The subaccount_sid - - :returns: The updated SettingInstance - :rtype: twilio.rest.insights.v1.setting.SettingInstance - """ - return self._proxy.update( - advanced_features=advanced_features, - voice_trace=voice_trace, - subaccount_sid=subaccount_sid, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/ipMessaging/__init__.py b/twilio/rest/ipMessaging/__init__.py new file mode 100644 index 0000000000..601bda1e34 --- /dev/null +++ b/twilio/rest/ipMessaging/__init__.py @@ -0,0 +1,63 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.IpMessaging.v2 import V2 + +class IpMessaging(Domain): + def __init__(self, twilio): + """ + Initialize the IpMessaging Domain + + :returns: Domain for IpMessaging + :rtype: twilio.rest.v2.IpMessaging + """ + super(IpMessaging, self).__init__(twilio) + self.base_url = 'https://IpMessaging.twilio.com' + self._V2 = None + + @property + def V2(self): + """ + :returns: Versions v2 of IpMessaging + :rtype: twilio.rest.IpMessaging.v2 + """ + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + + + @property + def credentials(self): + """ + :rtype: twilio.rest.v2.credentials + """ + return self.v2.credentials + + + @property + def services(self): + """ + :rtype: twilio.rest.v2.services + """ + return self.v2.services + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/ipMessaging/v1/.openapi-generator-ignore b/twilio/rest/ipMessaging/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/ipMessaging/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/ipMessaging/v1/.openapi-generator/FILES b/twilio/rest/ipMessaging/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..11ccc08c44 --- /dev/null +++ b/twilio/rest/ipMessaging/v1/.openapi-generator/FILES @@ -0,0 +1,19 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +credential.py +service.py +service/channel.py +service/channel/invite.py +service/channel/member.py +service/channel/message.py +service/role.py +service/user.py +service/user/user_channel.py diff --git a/twilio/rest/ipMessaging/v1/.openapi-generator/VERSION b/twilio/rest/ipMessaging/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/ipMessaging/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/ipMessaging/v1/credential.py b/twilio/rest/ipMessaging/v1/credential.py new file mode 100644 index 0000000000..b3ab2c6a96 --- /dev/null +++ b/twilio/rest/ipMessaging/v1/credential.py @@ -0,0 +1,167 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class CredentialContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CredentialContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Credentials/${sid}' + + + def delete(self): + + + """ + Deletes the CredentialInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialInstance + + :returns: The fetched CredentialInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CredentialInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(CredentialInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'sandbox' = payload.get('sandbox'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CredentialContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CredentialListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Credentials' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service.py b/twilio/rest/ipMessaging/v1/service.py new file mode 100644 index 0000000000..9e3d5d0e34 --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service.py @@ -0,0 +1,192 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._channels = None + self._roles = None + self._users = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'default_service_role_sid' = payload.get('default_service_role_sid'), + 'default_channel_role_sid' = payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' = payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' = payload.get('read_status_enabled'), + 'reachability_enabled' = payload.get('reachability_enabled'), + 'typing_indicator_timeout' = payload.get('typing_indicator_timeout'), + 'consumption_report_interval' = payload.get('consumption_report_interval'), + 'limits' = payload.get('limits'), + 'webhooks' = payload.get('webhooks'), + 'pre_webhook_url' = payload.get('pre_webhook_url'), + 'post_webhook_url' = payload.get('post_webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'webhook_filters' = payload.get('webhook_filters'), + 'notifications' = payload.get('notifications'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def channels(self): + return self._proxy.channels + @property + def roles(self): + return self._proxy.roles + @property + def users(self): + return self._proxy.users + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service/channel.py b/twilio/rest/ipMessaging/v1/service/channel.py new file mode 100644 index 0000000000..4f4fb3fa1d --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service/channel.py @@ -0,0 +1,185 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstance + + +class ChannelContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None + self._members = None + self._messages = None + + def delete(self): + + + """ + Deletes the ChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ChannelInstance + + :returns: The fetched ChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ChannelInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(ChannelInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'attributes' = payload.get('attributes'), + 'type' = payload.get('type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + 'members_count' = payload.get('members_count'), + 'messages_count' = payload.get('messages_count'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ChannelContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def invites(self): + return self._proxy.invites + @property + def members(self): + return self._proxy.members + @property + def messages(self): + return self._proxy.messages + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ChannelListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(ChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service/channel/invite.py b/twilio/rest/ipMessaging/v1/service/channel/invite.py new file mode 100644 index 0000000000..edd9840fb8 --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service/channel/invite.py @@ -0,0 +1,158 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class InviteContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InviteContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites/${sid}' + + + def delete(self): + + + """ + Deletes the InviteInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the InviteInstance + + :returns: The fetched InviteInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InviteInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class InviteInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): + super(InviteInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'created_by' = payload.get('created_by'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = InviteContext( + self._version, + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class InviteListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(InviteListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InviteInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InvitePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service/channel/member.py b/twilio/rest/ipMessaging/v1/service/channel/member.py new file mode 100644 index 0000000000..5db21927ce --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service/channel/member.py @@ -0,0 +1,170 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class MemberContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MemberContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members/${sid}' + + + def delete(self): + + + """ + Deletes the MemberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MemberInstance + + :returns: The fetched MemberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MemberInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MemberInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): + super(MemberInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'last_consumed_message_index' = payload.get('last_consumed_message_index'), + 'last_consumption_timestamp' = payload.get('last_consumption_timestamp'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MemberContext( + self._version, + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MemberListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MemberListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MemberPage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service/channel/message.py b/twilio/rest/ipMessaging/v1/service/channel/message.py new file mode 100644 index 0000000000..bfc145a14f --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service/channel/message.py @@ -0,0 +1,172 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class MessageContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages/${sid}' + + + def delete(self): + + + """ + Deletes the MessageInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessageInstance + + :returns: The fetched MessageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MessageInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): + super(MessageInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'attributes' = payload.get('attributes'), + 'service_sid' = payload.get('service_sid'), + 'to' = payload.get('to'), + 'channel_sid' = payload.get('channel_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'was_edited' = payload.get('was_edited'), + '_from' = payload.get('from'), + 'body' = payload.get('body'), + 'index' = payload.get('index'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MessageContext( + self._version, + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MessageListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MessageListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service/role.py b/twilio/rest/ipMessaging/v1/service/role.py new file mode 100644 index 0000000000..eed780b8b2 --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service/role.py @@ -0,0 +1,168 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class RoleContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RoleContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Roles/${sid}' + + + def delete(self): + + + """ + Deletes the RoleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RoleInstance + + :returns: The fetched RoleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoleInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RoleInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(RoleInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'permissions' = payload.get('permissions'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RoleContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RoleListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(RoleListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Roles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RolePage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service/user.py b/twilio/rest/ipMessaging/v1/service/user.py new file mode 100644 index 0000000000..b4a1743d53 --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service/user.py @@ -0,0 +1,177 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.user.user_channel import UserChannelListInstance + + +class UserContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + + self._user_channels = None + + def delete(self): + + + """ + Deletes the UserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserInstance + + :returns: The fetched UserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(UserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'attributes' = payload.get('attributes'), + 'friendly_name' = payload.get('friendly_name'), + 'role_sid' = payload.get('role_sid'), + 'identity' = payload.get('identity'), + 'is_online' = payload.get('is_online'), + 'is_notifiable' = payload.get('is_notifiable'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'joined_channels_count' = payload.get('joined_channels_count'), + 'links' = payload.get('links'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def user_channels(self): + return self._proxy.user_channels + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(UserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v1/service/user/user_channel.py b/twilio/rest/ipMessaging/v1/service/user/user_channel.py new file mode 100644 index 0000000000..8f3625e2ea --- /dev/null +++ b/twilio/rest/ipMessaging/v1/service/user/user_channel.py @@ -0,0 +1,58 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + + + +class UserChannelListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, user_sid: str): + # TODO: needs autogenerated docs + super(UserChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, user_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Channels' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserChannelPage(self._version, payload, service_sid=self._solution['service_sid']user_sid=self._solution['user_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/.openapi-generator-ignore b/twilio/rest/ipMessaging/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/ipMessaging/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/ipMessaging/v2/.openapi-generator/FILES b/twilio/rest/ipMessaging/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..ed711e785d --- /dev/null +++ b/twilio/rest/ipMessaging/v2/.openapi-generator/FILES @@ -0,0 +1,25 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +credential.py +service.py +service/binding.py +service/channel.py +service/channel/invite.py +service/channel/member.py +service/channel/message.py +service/channel/webhook.py +service/role.py +service/user.py +service/user/user_binding.py +service/user/user_channel.py diff --git a/twilio/rest/ipMessaging/v2/.openapi-generator/VERSION b/twilio/rest/ipMessaging/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/ipMessaging/v2/credential.py b/twilio/rest/ipMessaging/v2/credential.py new file mode 100644 index 0000000000..022bb658d0 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/credential.py @@ -0,0 +1,167 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class CredentialContext(InstanceContext): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(CredentialContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Credentials/${sid}' + + + def delete(self): + + + """ + Deletes the CredentialInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialInstance + + :returns: The fetched CredentialInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CredentialInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(CredentialInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'sandbox' = payload.get('sandbox'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CredentialContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CredentialListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Credentials' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service.py b/twilio/rest/ipMessaging/v2/service.py new file mode 100644 index 0000000000..5b41ddc99e --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service.py @@ -0,0 +1,198 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._bindings = None + self._channels = None + self._roles = None + self._users = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'default_service_role_sid' = payload.get('default_service_role_sid'), + 'default_channel_role_sid' = payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' = payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' = payload.get('read_status_enabled'), + 'reachability_enabled' = payload.get('reachability_enabled'), + 'typing_indicator_timeout' = payload.get('typing_indicator_timeout'), + 'consumption_report_interval' = payload.get('consumption_report_interval'), + 'limits' = payload.get('limits'), + 'pre_webhook_url' = payload.get('pre_webhook_url'), + 'post_webhook_url' = payload.get('post_webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'webhook_filters' = payload.get('webhook_filters'), + 'pre_webhook_retry_count' = payload.get('pre_webhook_retry_count'), + 'post_webhook_retry_count' = payload.get('post_webhook_retry_count'), + 'notifications' = payload.get('notifications'), + 'media' = payload.get('media'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def bindings(self): + return self._proxy.bindings + @property + def channels(self): + return self._proxy.channels + @property + def roles(self): + return self._proxy.roles + @property + def users(self): + return self._proxy.users + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/binding.py b/twilio/rest/ipMessaging/v2/service/binding.py new file mode 100644 index 0000000000..16cc4c03d9 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/binding.py @@ -0,0 +1,150 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class BindingContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BindingContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Bindings/${sid}' + + + def delete(self): + + + """ + Deletes the BindingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the BindingInstance + + :returns: The fetched BindingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BindingInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class BindingInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(BindingInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'endpoint' = payload.get('endpoint'), + 'identity' = payload.get('identity'), + 'credential_sid' = payload.get('credential_sid'), + 'binding_type' = payload.get('binding_type'), + 'message_types' = payload.get('message_types'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = BindingContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class BindingListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(BindingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Bindings' + + + def page(self, binding_type, identity, page_size): + + data = values.of({ + 'binding_type': binding_type,'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BindingPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/channel.py b/twilio/rest/ipMessaging/v2/service/channel.py new file mode 100644 index 0000000000..73f92d2fc4 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/channel.py @@ -0,0 +1,189 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstancefrom twilio.rest.channel.webhook import WebhookListInstance + + +class ChannelContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None + self._members = None + self._messages = None + self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the ChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ChannelInstance + + :returns: The fetched ChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ChannelInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(ChannelInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'attributes' = payload.get('attributes'), + 'type' = payload.get('type'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + 'members_count' = payload.get('members_count'), + 'messages_count' = payload.get('messages_count'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ChannelContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def invites(self): + return self._proxy.invites + @property + def members(self): + return self._proxy.members + @property + def messages(self): + return self._proxy.messages + @property + def webhooks(self): + return self._proxy.webhooks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ChannelListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(ChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/channel/invite.py b/twilio/rest/ipMessaging/v2/service/channel/invite.py new file mode 100644 index 0000000000..5735e69a6a --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/channel/invite.py @@ -0,0 +1,158 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class InviteContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InviteContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites/${sid}' + + + def delete(self): + + + """ + Deletes the InviteInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the InviteInstance + + :returns: The fetched InviteInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InviteInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class InviteInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): + super(InviteInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'created_by' = payload.get('created_by'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = InviteContext( + self._version, + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class InviteListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(InviteListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Invites' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InviteInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InvitePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/channel/member.py b/twilio/rest/ipMessaging/v2/service/channel/member.py new file mode 100644 index 0000000000..28ef0b3a1e --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/channel/member.py @@ -0,0 +1,171 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class MemberContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MemberContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members/${sid}' + + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the MemberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MemberInstance + + :returns: The fetched MemberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MemberInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MemberInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): + super(MemberInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'service_sid' = payload.get('service_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'role_sid' = payload.get('role_sid'), + 'last_consumed_message_index' = payload.get('last_consumed_message_index'), + 'last_consumption_timestamp' = payload.get('last_consumption_timestamp'), + 'url' = payload.get('url'), + 'attributes' = payload.get('attributes'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MemberContext( + self._version, + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MemberListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MemberListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Members' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MemberInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, identity, page_size): + + data = values.of({ + 'identity': identity,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MemberPage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/channel/message.py b/twilio/rest/ipMessaging/v2/service/channel/message.py new file mode 100644 index 0000000000..ba29470cd2 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/channel/message.py @@ -0,0 +1,175 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class MessageContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages/${sid}' + + + def delete(self, x_twilio_webhook_enabled): + + + """ + Deletes the MessageInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessageInstance + + :returns: The fetched MessageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MessageInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): + super(MessageInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'attributes' = payload.get('attributes'), + 'service_sid' = payload.get('service_sid'), + 'to' = payload.get('to'), + 'channel_sid' = payload.get('channel_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'last_updated_by' = payload.get('last_updated_by'), + 'was_edited' = payload.get('was_edited'), + '_from' = payload.get('from'), + 'body' = payload.get('body'), + 'index' = payload.get('index'), + 'type' = payload.get('type'), + 'media' = payload.get('media'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MessageContext( + self._version, + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MessageListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(MessageListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Messages' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagePage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/channel/webhook.py b/twilio/rest/ipMessaging/v2/service/channel/webhook.py new file mode 100644 index 0000000000..74862ad34d --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/channel/webhook.py @@ -0,0 +1,168 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class WebhookContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, channel_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Webhooks/${sid}' + + + def delete(self): + + + """ + Deletes the WebhookInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + service_sidchannel_sidsid=self._solution['service_sid''channel_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid'], channel_sid=self._solution['channel_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class WebhookInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, channel_sid: str, sid: str): + super(WebhookInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'type' = payload.get('type'), + 'url' = payload.get('url'), + 'configuration' = payload.get('configuration'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'channel_sid': channel_sid or self._properties['channel_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = WebhookContext( + self._version, + service_sid=self._solution['service_sid'],channel_sid=self._solution['channel_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class WebhookListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Channels/${channel_sid}/Webhooks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WebhookPage(self._version, payload, service_sid=self._solution['service_sid']channel_sid=self._solution['channel_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/role.py b/twilio/rest/ipMessaging/v2/service/role.py new file mode 100644 index 0000000000..e35958939b --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/role.py @@ -0,0 +1,168 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class RoleContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RoleContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Roles/${sid}' + + + def delete(self): + + + """ + Deletes the RoleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RoleInstance + + :returns: The fetched RoleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoleInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RoleInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(RoleInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'permissions' = payload.get('permissions'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RoleContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RoleListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(RoleListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Roles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RoleInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RolePage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/user.py b/twilio/rest/ipMessaging/v2/service/user.py new file mode 100644 index 0000000000..36ff119171 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/user.py @@ -0,0 +1,181 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.user.user_binding import UserBindingListInstancefrom twilio.rest.user.user_channel import UserChannelListInstance + + +class UserContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + + self._user_bindings = None + self._user_channels = None + + def delete(self): + + + """ + Deletes the UserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserInstance + + :returns: The fetched UserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(UserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'attributes' = payload.get('attributes'), + 'friendly_name' = payload.get('friendly_name'), + 'role_sid' = payload.get('role_sid'), + 'identity' = payload.get('identity'), + 'is_online' = payload.get('is_online'), + 'is_notifiable' = payload.get('is_notifiable'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'joined_channels_count' = payload.get('joined_channels_count'), + 'links' = payload.get('links'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def user_bindings(self): + return self._proxy.user_bindings + @property + def user_channels(self): + return self._proxy.user_channels + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(UserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/user/user_binding.py b/twilio/rest/ipMessaging/v2/service/user/user_binding.py new file mode 100644 index 0000000000..9fb3296c55 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/user/user_binding.py @@ -0,0 +1,150 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class UserBindingContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, user_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UserBindingContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, user_sid, sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Bindings/${sid}' + + + def delete(self): + + + """ + Deletes the UserBindingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserBindingInstance + + :returns: The fetched UserBindingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserBindingInstance( + self._version, + payload, + service_siduser_sidsid=self._solution['service_sid''user_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserBindingInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, user_sid: str, sid: str): + super(UserBindingInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'endpoint' = payload.get('endpoint'), + 'identity' = payload.get('identity'), + 'user_sid' = payload.get('user_sid'), + 'credential_sid' = payload.get('credential_sid'), + 'binding_type' = payload.get('binding_type'), + 'message_types' = payload.get('message_types'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'user_sid': user_sid or self._properties['user_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserBindingContext( + self._version, + service_sid=self._solution['service_sid'],user_sid=self._solution['user_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserBindingListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, user_sid: str): + # TODO: needs autogenerated docs + super(UserBindingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, user_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Bindings' + + + def page(self, binding_type, page_size): + + data = values.of({ + 'binding_type': binding_type,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserBindingPage(self._version, payload, service_sid=self._solution['service_sid']user_sid=self._solution['user_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/ipMessaging/v2/service/user/user_channel.py b/twilio/rest/ipMessaging/v2/service/user/user_channel.py new file mode 100644 index 0000000000..38fb012887 --- /dev/null +++ b/twilio/rest/ipMessaging/v2/service/user/user_channel.py @@ -0,0 +1,160 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class UserChannelContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, user_sid: str, channel_sid: str): + # TODO: needs autogenerated docs + super(UserChannelContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, user_sid, channel_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Channels/${channel_sid}' + + + def delete(self): + + + """ + Deletes the UserChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UserChannelInstance + + :returns: The fetched UserChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserChannelInstance( + self._version, + payload, + service_siduser_sidchannel_sid=self._solution['service_sid''user_sid''channel_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=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'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class UserChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, user_sid: str, channel_sid: str): + super(UserChannelInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'channel_sid' = payload.get('channel_sid'), + 'user_sid' = payload.get('user_sid'), + 'member_sid' = payload.get('member_sid'), + 'status' = payload.get('status'), + 'last_consumed_message_index' = payload.get('last_consumed_message_index'), + 'unread_messages_count' = payload.get('unread_messages_count'), + 'links' = payload.get('links'), + 'url' = payload.get('url'), + 'notification_level' = payload.get('notification_level'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'user_sid': user_sid or self._properties['user_sid']'channel_sid': channel_sid or self._properties['channel_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = UserChannelContext( + self._version, + service_sid=self._solution['service_sid'],user_sid=self._solution['user_sid'],channel_sid=self._solution['channel_sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class UserChannelListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, user_sid: str): + # TODO: needs autogenerated docs + super(UserChannelListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, user_sid, } + self._uri = '/Services/${service_sid}/Users/${user_sid}/Channels' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UserChannelPage(self._version, payload, service_sid=self._solution['service_sid']user_sid=self._solution['user_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/lookups/__init__.py b/twilio/rest/lookups/__init__.py index 407a6e874b..8da9925d87 100644 --- a/twilio/rest/lookups/__init__.py +++ b/twilio/rest/lookups/__init__.py @@ -1,64 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.lookups.v1 import V1 -from twilio.rest.lookups.v2 import V2 + Twilio - Lookups + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Lookups(Domain): +from twilio.base.domain import Domain +from twilio.rest.Lookups.v2 import V2 +class Lookups(Domain): def __init__(self, twilio): """ Initialize the Lookups Domain :returns: Domain for Lookups - :rtype: twilio.rest.lookups.Lookups + :rtype: twilio.rest.v2.Lookups """ super(Lookups, self).__init__(twilio) - - self.base_url = 'https://lookups.twilio.com' - - # Versions - self._v1 = None - self._v2 = None - - @property - def v1(self): - """ - :returns: Version v1 of lookups - :rtype: twilio.rest.lookups.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + self.base_url = 'https://Lookups.twilio.com' + self._V2 = None @property - def v2(self): + def V2(self): """ - :returns: Version v2 of lookups - :rtype: twilio.rest.lookups.v2.V2 + :returns: Versions v2 of Lookups + :rtype: twilio.rest.Lookups.v2 """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + @property def phone_numbers(self): """ - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberList + :rtype: twilio.rest.v2.phone_numbers """ - return self.v1.phone_numbers + return self.v2.phone_numbers + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/lookups/v1/.openapi-generator-ignore b/twilio/rest/lookups/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/lookups/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/lookups/v1/.openapi-generator/FILES b/twilio/rest/lookups/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..8568e3fd86 --- /dev/null +++ b/twilio/rest/lookups/v1/.openapi-generator/FILES @@ -0,0 +1,3 @@ +../__init__.py +.openapi-generator-ignore +phone_number.py diff --git a/twilio/rest/lookups/v1/.openapi-generator/VERSION b/twilio/rest/lookups/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/lookups/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py index a910a97da8..aa91c8380b 100644 --- a/twilio/rest/lookups/v1/phone_number.py +++ b/twilio/rest/lookups/v1/phone_number.py @@ -1,284 +1,122 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Lookups + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PhoneNumberList(ListResource): - - def __init__(self, version): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberList - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: The phone number to fetch in E.164 format - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - - def __call__(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: The phone number to fetch in E.164 format - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PhoneNumberPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberPage - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class PhoneNumberContext(InstanceContext): - - def __init__(self, version, phone_number): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param phone_number: The phone number to fetch in E.164 format - - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) + def __init__(self, version: V1, phone_number: str): + # TODO: needs autogenerated docs + super(PhoneNumberContextList, self).__init__(version) # Path Solution - self._solution = {'phone_number': phone_number, } - self._uri = '/PhoneNumbers/{phone_number}'.format(**self._solution) - - def fetch(self, country_code=values.unset, type=values.unset, - add_ons=values.unset, add_ons_data=values.unset): - """ - Fetch the PhoneNumberInstance - - :param unicode country_code: The ISO country code of the phone number - :param list[unicode] type: The type of information to return - :param list[unicode] add_ons: The unique_name of an Add-on you would like to invoke - :param dict add_ons_data: Data specific to the add-on you would like to invoke - - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ - data = values.of({ - 'CountryCode': country_code, - 'Type': serialize.map(type, lambda e: e), - 'AddOns': serialize.map(add_ons, lambda e: e), - }) - data.update(serialize.prefixed_collapsible_map(add_ons_data, 'AddOns')) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], ) + self._solution = { phone_number, } + self._uri = '/PhoneNumbers/${phone_number}' + + + def fetch(self, country_code, type, add_ons, add_ons_data): + + """ + Fetch the PhoneNumberInstance + + :returns: The fetched PhoneNumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PhoneNumberInstance( + self._version, + payload, + phone_number=self._solution['phone_number'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PhoneNumberInstance(InstanceResource): - - class Type(object): - LANDLINE = "landline" - MOBILE = "mobile" - VOIP = "voip" - - def __init__(self, version, payload, phone_number=None): - """ - Initialize the PhoneNumberInstance - :returns: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ +class PhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, phone_number: str): super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'caller_name': payload.get('caller_name'), - 'country_code': payload.get('country_code'), - 'phone_number': payload.get('phone_number'), - 'national_format': payload.get('national_format'), - 'carrier': payload.get('carrier'), - 'add_ons': payload.get('add_ons'), - 'url': payload.get('url'), + self._properties = { + 'caller_name' = payload.get('caller_name'), + 'country_code' = payload.get('country_code'), + 'phone_number' = payload.get('phone_number'), + 'national_format' = payload.get('national_format'), + 'carrier' = payload.get('carrier'), + 'add_ons' = payload.get('add_ons'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'phone_number': phone_number or self._properties['phone_number'], } + self._solution = { + 'phone_number': phone_number or self._properties['phone_number'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberContext - """ if self._context is None: - self._context = PhoneNumberContext(self._version, phone_number=self._solution['phone_number'], ) + self._context = PhoneNumberContext( + self._version, + phone_number=self._solution['phone_number'], + ) return self._context - @property - def caller_name(self): - """ - :returns: The name of the phone number's owner - :rtype: dict - """ - return self._properties['caller_name'] - - @property - def country_code(self): - """ - :returns: The ISO country code for the phone number - :rtype: unicode - """ - return self._properties['country_code'] + - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def national_format(self): - """ - :returns: The phone number, in national format - :rtype: unicode - """ - return self._properties['national_format'] - - @property - def carrier(self): - """ - :returns: The telecom company that provides the phone number - :rtype: dict - """ - return self._properties['carrier'] - - @property - def add_ons(self): + def __repr__(self): """ - :returns: A JSON string with the results of the Add-ons you specified - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['add_ons'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, country_code=values.unset, type=values.unset, - add_ons=values.unset, add_ons_data=values.unset): - """ - Fetch the PhoneNumberInstance - :param unicode country_code: The ISO country code of the phone number - :param list[unicode] type: The type of information to return - :param list[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 +class PhoneNumberListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(PhoneNumberListInstanceList, self).__init__(version) - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch( - country_code=country_code, - type=type, - add_ons=add_ons, - add_ons_data=add_ons_data, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/lookups/v2/.openapi-generator-ignore b/twilio/rest/lookups/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/lookups/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/lookups/v2/.openapi-generator/FILES b/twilio/rest/lookups/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..8568e3fd86 --- /dev/null +++ b/twilio/rest/lookups/v2/.openapi-generator/FILES @@ -0,0 +1,3 @@ +../__init__.py +.openapi-generator-ignore +phone_number.py diff --git a/twilio/rest/lookups/v2/.openapi-generator/VERSION b/twilio/rest/lookups/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/lookups/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index afddb6ff5e..b55925f8da 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -1,393 +1,128 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Lookups + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PhoneNumberList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.lookups.v2.phone_number.PhoneNumberList - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: Phone number to lookup - - :returns: twilio.rest.lookups.v2.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - - def __call__(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: Phone number to lookup - - :returns: twilio.rest.lookups.v2.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PhoneNumberPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.lookups.v2.phone_number.PhoneNumberPage - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.lookups.v2.phone_number.PhoneNumberInstance - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class PhoneNumberContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, phone_number): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param phone_number: Phone number to lookup - - :returns: twilio.rest.lookups.v2.phone_number.PhoneNumberContext - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) + def __init__(self, version: V2, phone_number: str): + # TODO: needs autogenerated docs + super(PhoneNumberContextList, self).__init__(version) # Path Solution - self._solution = {'phone_number': phone_number, } - self._uri = '/PhoneNumbers/{phone_number}'.format(**self._solution) - - def fetch(self, fields=values.unset, country_code=values.unset, - first_name=values.unset, last_name=values.unset, - address_line_1=values.unset, address_line_2=values.unset, - city=values.unset, state=values.unset, postal_code=values.unset, - address_country_code=values.unset, national_id=values.unset, - date_of_birth=values.unset): - """ - Fetch the PhoneNumberInstance - - :param unicode fields: Fields to return - :param unicode country_code: Country code for national phone number lookups - :param unicode first_name: User’s first name. - :param unicode last_name: User’s last name. - :param unicode address_line_1: User’s first address line. - :param unicode address_line_2: User’s second address line. - :param unicode city: User’s city. - :param unicode state: User’s country subdivision, such as state, province, or locality. - :param unicode postal_code: User’s postal zip code. - :param unicode address_country_code: User’s country, up to two characters. - :param unicode national_id: User’s national ID, such as SSN or Passport ID. - :param unicode date_of_birth: User’s date of birth, in YYYYMMDD format. - - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberInstance - """ - data = values.of({ - 'Fields': fields, - 'CountryCode': country_code, - 'FirstName': first_name, - 'LastName': last_name, - 'AddressLine1': address_line_1, - 'AddressLine2': address_line_2, - 'City': city, - 'State': state, - 'PostalCode': postal_code, - 'AddressCountryCode': address_country_code, - 'NationalId': national_id, - 'DateOfBirth': date_of_birth, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], ) + self._solution = { phone_number, } + self._uri = '/PhoneNumbers/${phone_number}' + + + def fetch(self, fields, country_code, first_name, last_name, address_line1, address_line2, city, state, postal_code, address_country_code, national_id, date_of_birth): + + """ + Fetch the PhoneNumberInstance + + :returns: The fetched PhoneNumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PhoneNumberInstance( + self._version, + payload, + phone_number=self._solution['phone_number'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class PhoneNumberInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class Type(object): - LANDLINE = "landline" - MOBILE = "mobile" - VOIP = "voip" - class ValidationError(object): - TOO_SHORT = "TOO_SHORT" - TOO_LONG = "TOO_LONG" - INVALID_BUT_POSSIBLE = "INVALID_BUT_POSSIBLE" - INVALID_COUNTRY_CODE = "INVALID_COUNTRY_CODE" - INVALID_LENGTH = "INVALID_LENGTH" - NOT_A_NUMBER = "NOT_A_NUMBER" - def __init__(self, version, payload, phone_number=None): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.lookups.v2.phone_number.PhoneNumberInstance - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberInstance - """ +class PhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, phone_number: str): super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'calling_country_code': payload.get('calling_country_code'), - 'country_code': payload.get('country_code'), - 'phone_number': payload.get('phone_number'), - 'national_format': payload.get('national_format'), - 'valid': payload.get('valid'), - 'validation_errors': payload.get('validation_errors'), - 'caller_name': payload.get('caller_name'), - 'sim_swap': payload.get('sim_swap'), - 'call_forwarding': payload.get('call_forwarding'), - 'live_activity': payload.get('live_activity'), - 'line_type_intelligence': payload.get('line_type_intelligence'), - 'identity_match': payload.get('identity_match'), - 'url': payload.get('url'), + self._properties = { + 'calling_country_code' = payload.get('calling_country_code'), + 'country_code' = payload.get('country_code'), + 'phone_number' = payload.get('phone_number'), + 'national_format' = payload.get('national_format'), + 'valid' = payload.get('valid'), + 'validation_errors' = payload.get('validation_errors'), + 'caller_name' = payload.get('caller_name'), + 'sim_swap' = payload.get('sim_swap'), + 'call_forwarding' = payload.get('call_forwarding'), + 'live_activity' = payload.get('live_activity'), + 'line_type_intelligence' = payload.get('line_type_intelligence'), + 'identity_match' = payload.get('identity_match'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'phone_number': phone_number or self._properties['phone_number'], } + self._solution = { + 'phone_number': phone_number or self._properties['phone_number'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberContext - """ if self._context is None: - self._context = PhoneNumberContext(self._version, phone_number=self._solution['phone_number'], ) + self._context = PhoneNumberContext( + self._version, + phone_number=self._solution['phone_number'], + ) return self._context - @property - def calling_country_code(self): - """ - :returns: International dialing prefix - :rtype: unicode - """ - return self._properties['calling_country_code'] - - @property - def country_code(self): - """ - :returns: Phone number's ISO country code - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def phone_number(self): - """ - :returns: Phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] + - @property - def national_format(self): - """ - :returns: Phone number in national format - :rtype: unicode - """ - return self._properties['national_format'] - - @property - def valid(self): - """ - :returns: Boolean which indicates if the phone number is valid - :rtype: bool - """ - return self._properties['valid'] - - @property - def validation_errors(self): - """ - :returns: Contains reasons why a phone number is invalid - :rtype: list[PhoneNumberInstance.ValidationError] - """ - return self._properties['validation_errors'] - - @property - def caller_name(self): - """ - :returns: An object that contains caller name information - :rtype: dict - """ - return self._properties['caller_name'] - - @property - def sim_swap(self): - """ - :returns: An object that contains SIM swap information - :rtype: dict - """ - return self._properties['sim_swap'] - - @property - def call_forwarding(self): - """ - :returns: An object that contains call forwarding status information - :rtype: dict - """ - return self._properties['call_forwarding'] - - @property - def live_activity(self): - """ - :returns: An object that contains live activity information - :rtype: dict - """ - return self._properties['live_activity'] - - @property - def line_type_intelligence(self): - """ - :returns: An object that contains line type information - :rtype: dict - """ - return self._properties['line_type_intelligence'] - - @property - def identity_match(self): + def __repr__(self): """ - :returns: An object that contains identity match information - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['identity_match'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, fields=values.unset, country_code=values.unset, - first_name=values.unset, last_name=values.unset, - address_line_1=values.unset, address_line_2=values.unset, - city=values.unset, state=values.unset, postal_code=values.unset, - address_country_code=values.unset, national_id=values.unset, - date_of_birth=values.unset): - """ - Fetch the PhoneNumberInstance - :param unicode fields: Fields to return - :param unicode country_code: Country code for national phone number lookups - :param unicode first_name: User’s first name. - :param unicode last_name: User’s last name. - :param unicode address_line_1: User’s first address line. - :param unicode address_line_2: User’s second address line. - :param unicode city: User’s city. - :param unicode state: User’s country subdivision, such as state, province, or locality. - :param unicode postal_code: User’s postal zip code. - :param unicode address_country_code: User’s country, up to two characters. - :param unicode national_id: User’s national ID, such as SSN or Passport ID. - :param unicode date_of_birth: User’s date of birth, in YYYYMMDD format. +class PhoneNumberListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(PhoneNumberListInstanceList, self).__init__(version) - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.lookups.v2.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch( - fields=fields, - country_code=country_code, - first_name=first_name, - last_name=last_name, - address_line_1=address_line_1, - address_line_2=address_line_2, - city=city, - state=state, - postal_code=postal_code, - address_country_code=address_country_code, - national_id=national_id, - date_of_birth=date_of_birth, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/media/__init__.py b/twilio/rest/media/__init__.py index 87f4c8fbf1..656eaff9ab 100644 --- a/twilio/rest/media/__init__.py +++ b/twilio/rest/media/__init__.py @@ -1,66 +1,70 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.media.v1 import V1 + Twilio - Media + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Media(Domain): +from twilio.base.domain import Domain +from twilio.rest.Media.v1 import V1 +class Media(Domain): def __init__(self, twilio): """ Initialize the Media Domain :returns: Domain for Media - :rtype: twilio.rest.media.Media + :rtype: twilio.rest.v1.Media """ super(Media, self).__init__(twilio) - - self.base_url = 'https://media.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Media.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of media - :rtype: twilio.rest.media.v1.V1 + :returns: Versions v1 of Media + :rtype: twilio.rest.Media.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def media_processor(self): """ - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorList + :rtype: twilio.rest.v1.media_processor """ return self.v1.media_processor + @property def media_recording(self): """ - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingList + :rtype: twilio.rest.v1.media_recording """ return self.v1.media_recording + @property def player_streamer(self): """ - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerList + :rtype: twilio.rest.v1.player_streamer """ return self.v1.player_streamer + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/media/v1/.openapi-generator-ignore b/twilio/rest/media/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/media/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/media/v1/.openapi-generator/FILES b/twilio/rest/media/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..609e649fe3 --- /dev/null +++ b/twilio/rest/media/v1/.openapi-generator/FILES @@ -0,0 +1,9 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +media_processor.py +media_recording.py +player_streamer.py +player_streamer/playback_grant.py diff --git a/twilio/rest/media/v1/.openapi-generator/VERSION b/twilio/rest/media/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/media/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/media/v1/media_processor.py b/twilio/rest/media/v1/media_processor.py index 02673d6e6c..8d16ed4198 100644 --- a/twilio/rest/media/v1/media_processor.py +++ b/twilio/rest/media/v1/media_processor.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Media + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,449 +19,142 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MediaProcessorList(ListResource): - - def __init__(self, version): - """ - Initialize the MediaProcessorList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.media.v1.media_processor.MediaProcessorList - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorList - """ - super(MediaProcessorList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/MediaProcessors'.format(**self._solution) - - 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 stream(self, order=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams MediaProcessorInstance 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 MediaProcessorInstance.Order order: The sort order of the list - :param MediaProcessorInstance.Status status: Status to filter by - :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.media.v1.media_processor.MediaProcessorInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists MediaProcessorInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MediaProcessorInstance.Order order: The sort order of the list - :param MediaProcessorInstance.Status status: Status to filter by - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.media.v1.media_processor.MediaProcessorInstance] - """ - return list(self.stream(order=order, status=status, limit=limit, page_size=page_size, )) - def page(self, order=values.unset, status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MediaProcessorInstance records from the API. - Request is executed immediately - - :param MediaProcessorInstance.Order order: The sort order of the list - :param MediaProcessorInstance.Status status: Status to filter by - :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 MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorPage - """ - data = values.of({ - 'Order': order, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MediaProcessorPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MediaProcessorInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MediaProcessorPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MediaProcessorContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.media_processor.MediaProcessorContext - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorContext - """ - return MediaProcessorContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a MediaProcessorContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.media_processor.MediaProcessorContext - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorContext - """ - return MediaProcessorContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MediaProcessorPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MediaProcessorPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.media.v1.media_processor.MediaProcessorPage - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorPage - """ - super(MediaProcessorPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MediaProcessorInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.media.v1.media_processor.MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorInstance - """ - return MediaProcessorInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class MediaProcessorContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the MediaProcessorContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.media_processor.MediaProcessorContext - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorContext - """ - super(MediaProcessorContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(MediaProcessorContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/MediaProcessors/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the MediaProcessorInstance - - :returns: The fetched MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MediaProcessorInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, status): - """ - Update the MediaProcessorInstance - - :param MediaProcessorInstance.UpdateStatus status: The status of the MediaProcessor - - :returns: The updated MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return MediaProcessorInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/MediaProcessors/${sid}' + + + def fetch(self): + + """ + Fetch the MediaProcessorInstance + + :returns: The fetched MediaProcessorInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MediaProcessorInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MediaProcessorInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class MediaProcessorInstance(InstanceResource): - - class Status(object): - FAILED = "failed" - STARTED = "started" - ENDED = "ended" - - class UpdateStatus(object): - ENDED = "ended" - - class Order(object): - ASC = "asc" - DESC = "desc" - - def __init__(self, version, payload, sid=None): - """ - Initialize the MediaProcessorInstance - :returns: twilio.rest.media.v1.media_processor.MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorInstance - """ +class MediaProcessorInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(MediaProcessorInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'extension': payload.get('extension'), - 'extension_context': payload.get('extension_context'), - 'status': payload.get('status'), - 'url': payload.get('url'), - 'ended_reason': payload.get('ended_reason'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'max_duration': deserialize.integer(payload.get('max_duration')), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'extension' = payload.get('extension'), + 'extension_context' = payload.get('extension_context'), + 'status' = payload.get('status'), + 'url' = payload.get('url'), + 'ended_reason' = payload.get('ended_reason'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'max_duration' = payload.get('max_duration'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MediaProcessorContext for this MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorContext - """ if self._context is None: - self._context = MediaProcessorContext(self._version, sid=self._solution['sid'], ) + self._context = MediaProcessorContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def extension(self): - """ - :returns: The Media Extension name or URL - :rtype: unicode - """ - return self._properties['extension'] - - @property - def extension_context(self): - """ - :returns: The Media Extension context - :rtype: unicode - """ - return self._properties['extension_context'] - - @property - def status(self): - """ - :returns: The status of the MediaProcessor - :rtype: MediaProcessorInstance.Status - """ - return self._properties['status'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def ended_reason(self): - """ - :returns: The reason why a MediaProcessor ended - :rtype: unicode - """ - return self._properties['ended_reason'] - - @property - def status_callback(self): - """ - :returns: The URL to which Twilio will send MediaProcessor event updates - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method Twilio should use to call the `status_callback` URL - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def max_duration(self): - """ - :returns: Maximum MediaProcessor duration in seconds - :rtype: unicode + def __repr__(self): """ - return self._properties['max_duration'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the MediaProcessorInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorInstance - """ - return self._proxy.fetch() - def update(self, status): - """ - Update the MediaProcessorInstance - :param MediaProcessorInstance.UpdateStatus status: The status of the MediaProcessor +class MediaProcessorListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(MediaProcessorListInstanceList, self).__init__(version) - :returns: The updated MediaProcessorInstance - :rtype: twilio.rest.media.v1.media_processor.MediaProcessorInstance - """ - return self._proxy.update(status, ) + # Path Solution + self._solution = { } + self._uri = '/MediaProcessors' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MediaProcessorInstance(self._version, payload, ) + + + def page(self, order, status, page_size): + + data = values.of({ + 'order': order,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MediaProcessorPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/media/v1/media_recording.py b/twilio/rest/media/v1/media_recording.py new file mode 100644 index 0000000000..b5e463ec90 --- /dev/null +++ b/twilio/rest/media/v1/media_recording.py @@ -0,0 +1,153 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Media + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class MediaRecordingContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(MediaRecordingContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/MediaRecordings/${sid}' + + + def delete(self): + + + """ + Deletes the MediaRecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MediaRecordingInstance + + :returns: The fetched MediaRecordingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MediaRecordingInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class MediaRecordingInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(MediaRecordingInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'duration' = payload.get('duration'), + 'format' = payload.get('format'), + 'links' = payload.get('links'), + 'processor_sid' = payload.get('processor_sid'), + 'resolution' = payload.get('resolution'), + 'source_sid' = payload.get('source_sid'), + 'sid' = payload.get('sid'), + 'media_size' = payload.get('media_size'), + 'status' = payload.get('status'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = MediaRecordingContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class MediaRecordingListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(MediaRecordingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/MediaRecordings' + + + def page(self, order, status, processor_sid, source_sid, page_size): + + data = values.of({ + 'order': order,'status': status,'processor_sid': processor_sid,'source_sid': source_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MediaRecordingPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/media/v1/player_streamer.py b/twilio/rest/media/v1/player_streamer.py new file mode 100644 index 0000000000..e2b2778d65 --- /dev/null +++ b/twilio/rest/media/v1/player_streamer.py @@ -0,0 +1,164 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Media + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.player_streamer.playback_grant import PlaybackGrantListInstance + + +class PlayerStreamerContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(PlayerStreamerContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/PlayerStreamers/${sid}' + + self._playback_grant = None + + def fetch(self): + + """ + Fetch the PlayerStreamerInstance + + :returns: The fetched PlayerStreamerInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PlayerStreamerInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return PlayerStreamerInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class PlayerStreamerInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(PlayerStreamerInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'video' = payload.get('video'), + 'links' = payload.get('links'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'url' = payload.get('url'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'ended_reason' = payload.get('ended_reason'), + 'max_duration' = payload.get('max_duration'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = PlayerStreamerContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def playback_grant(self): + return self._proxy.playback_grant + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class PlayerStreamerListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(PlayerStreamerListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/PlayerStreamers' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return PlayerStreamerInstance(self._version, payload, ) + + + def page(self, order, status, page_size): + + data = values.of({ + 'order': order,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PlayerStreamerPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/media/v1/player_streamer/playback_grant.py b/twilio/rest/media/v1/player_streamer/playback_grant.py index 0845e6ac58..8e1b94ed97 100644 --- a/twilio/rest/media/v1/player_streamer/playback_grant.py +++ b/twilio/rest/media/v1/player_streamer/playback_grant.py @@ -1,263 +1,125 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Media + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PlaybackGrantList(ListResource): - - def __init__(self, version, sid): - """ - Initialize the PlaybackGrantList - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the PlayerStreamer associated with this PlaybackGrant. - - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantList - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantList - """ - super(PlaybackGrantList, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - - def get(self): - """ - Constructs a PlaybackGrantContext - - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantContext - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantContext - """ - return PlaybackGrantContext(self._version, sid=self._solution['sid'], ) - - def __call__(self): - """ - Constructs a PlaybackGrantContext - - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantContext - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantContext - """ - return PlaybackGrantContext(self._version, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PlaybackGrantPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PlaybackGrantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sid: The unique string that identifies the PlayerStreamer associated with this PlaybackGrant. - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantPage - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantPage - """ - super(PlaybackGrantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of PlaybackGrantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - """ - return PlaybackGrantInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class PlaybackGrantContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the PlaybackGrantContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantContext - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantContext - """ - super(PlaybackGrantContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(PlaybackGrantContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/PlayerStreamers/{sid}/PlaybackGrant'.format(**self._solution) - - def create(self, ttl=values.unset, access_control_allow_origin=values.unset): - """ - Create the PlaybackGrantInstance - - :param unicode ttl: The time to live of the PlaybackGrant - :param unicode access_control_allow_origin: The full URL that is authorized to play back the livestream - - :returns: The created PlaybackGrantInstance - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - """ - data = values.of({'Ttl': ttl, 'AccessControlAllowOrigin': access_control_allow_origin, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return PlaybackGrantInstance(self._version, payload, sid=self._solution['sid'], ) - - def fetch(self): - """ - Fetch the PlaybackGrantInstance - - :returns: The fetched PlaybackGrantInstance - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PlaybackGrantInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/PlayerStreamers/${sid}/PlaybackGrant' + + + def create(self, body): + + + + + def fetch(self): + + """ + Fetch the PlaybackGrantInstance + + :returns: The fetched PlaybackGrantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PlaybackGrantInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PlaybackGrantInstance(InstanceResource): - - def __init__(self, version, payload, sid): - """ - Initialize the PlaybackGrantInstance - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - """ +class PlaybackGrantInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(PlaybackGrantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'grant': payload.get('grant'), + self._properties = { + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'grant' = payload.get('grant'), } - # Context self._context = None - self._solution = {'sid': sid, } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PlaybackGrantContext for this PlaybackGrantInstance - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantContext - """ if self._context is None: - self._context = PlaybackGrantContext(self._version, sid=self._solution['sid'], ) + self._context = PlaybackGrantContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the PlayerStreamer associated with this PlaybackGrant. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def grant(self): - """ - :returns: The grant that authorizes the player sdk to connect to the livestream - :rtype: dict + def __repr__(self): """ - return self._properties['grant'] - - def create(self, ttl=values.unset, access_control_allow_origin=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Create the PlaybackGrantInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode ttl: The time to live of the PlaybackGrant - :param unicode access_control_allow_origin: The full URL that is authorized to play back the livestream - :returns: The created PlaybackGrantInstance - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - """ - return self._proxy.create(ttl=ttl, access_control_allow_origin=access_control_allow_origin, ) - def fetch(self): - """ - Fetch the PlaybackGrantInstance +class PlaybackGrantListInstance(ListResource): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(PlaybackGrantListInstanceList, self).__init__(version) - :returns: The fetched PlaybackGrantInstance - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/__init__.py b/twilio/rest/messaging/__init__.py index 4bdc4bb3a4..cb0b08091e 100644 --- a/twilio/rest/messaging/__init__.py +++ b/twilio/rest/messaging/__init__.py @@ -1,101 +1,110 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.messaging.v1 import V1 + Twilio - Messaging + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Messaging(Domain): +from twilio.base.domain import Domain +from twilio.rest.Messaging.v1 import V1 +class Messaging(Domain): def __init__(self, twilio): """ Initialize the Messaging Domain :returns: Domain for Messaging - :rtype: twilio.rest.messaging.Messaging + :rtype: twilio.rest.v1.Messaging """ super(Messaging, self).__init__(twilio) - - self.base_url = 'https://messaging.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Messaging.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of messaging - :rtype: twilio.rest.messaging.v1.V1 + :returns: Versions v1 of Messaging + :rtype: twilio.rest.Messaging.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def brand_registrations(self): """ - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationList + :rtype: twilio.rest.v1.brand_registrations """ return self.v1.brand_registrations + @property def deactivations(self): """ - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsList + :rtype: twilio.rest.v1.deactivations """ return self.v1.deactivations + @property def domain_certs(self): """ - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsList + :rtype: twilio.rest.v1.domain_certs """ return self.v1.domain_certs + @property def domain_config(self): """ - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigList + :rtype: twilio.rest.v1.domain_config """ return self.v1.domain_config + @property def external_campaign(self): """ - :rtype: twilio.rest.messaging.v1.external_campaign.ExternalCampaignList + :rtype: twilio.rest.v1.external_campaign """ return self.v1.external_campaign + @property def services(self): """ - :rtype: twilio.rest.messaging.v1.service.ServiceList + :rtype: twilio.rest.v1.services """ return self.v1.services + @property def tollfree_verifications(self): """ - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationList + :rtype: twilio.rest.v1.tollfree_verifications """ return self.v1.tollfree_verifications + @property def usecases(self): """ - :rtype: twilio.rest.messaging.v1.usecase.UsecaseList + :rtype: twilio.rest.v1.usecases """ return self.v1.usecases + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/messaging/v1/.openapi-generator-ignore b/twilio/rest/messaging/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/messaging/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/messaging/v1/.openapi-generator/FILES b/twilio/rest/messaging/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..7537df1329 --- /dev/null +++ b/twilio/rest/messaging/v1/.openapi-generator/FILES @@ -0,0 +1,29 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +brand_registration.py +brand_registration/brand_vetting.py +deactivations.py +domain_certs.py +domain_config.py +external_campaign.py +service.py +service/alpha_sender.py +service/phone_number.py +service/short_code.py +service/us_app_to_person.py +service/us_app_to_person_usecase.py +tollfree_verification.py +usecase.py diff --git a/twilio/rest/messaging/v1/.openapi-generator/VERSION b/twilio/rest/messaging/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/messaging/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/messaging/v1/brand_registration.py b/twilio/rest/messaging/v1/brand_registration.py new file mode 100644 index 0000000000..5b66ad780e --- /dev/null +++ b/twilio/rest/messaging/v1/brand_registration.py @@ -0,0 +1,172 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.brand_registration.brand_vetting import BrandVettingListInstance + + +class BrandRegistrationContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(BrandRegistrationContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/a2p/BrandRegistrations/${sid}' + + self._brand_vettings = None + + def fetch(self): + + """ + Fetch the BrandRegistrationInstance + + :returns: The fetched BrandRegistrationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BrandRegistrationInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self): + data = values.of({ + + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return BrandRegistrationInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class BrandRegistrationInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(BrandRegistrationInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'customer_profile_bundle_sid' = payload.get('customer_profile_bundle_sid'), + 'a2p_profile_bundle_sid' = payload.get('a2p_profile_bundle_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'brand_type' = payload.get('brand_type'), + 'status' = payload.get('status'), + 'tcr_id' = payload.get('tcr_id'), + 'failure_reason' = payload.get('failure_reason'), + 'url' = payload.get('url'), + 'brand_score' = payload.get('brand_score'), + 'brand_feedback' = payload.get('brand_feedback'), + 'identity_status' = payload.get('identity_status'), + 'russell_3000' = payload.get('russell_3000'), + 'government_entity' = payload.get('government_entity'), + 'tax_exempt_status' = payload.get('tax_exempt_status'), + 'skip_automatic_sec_vet' = payload.get('skip_automatic_sec_vet'), + 'mock' = payload.get('mock'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = BrandRegistrationContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def brand_vettings(self): + return self._proxy.brand_vettings + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class BrandRegistrationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(BrandRegistrationListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/a2p/BrandRegistrations' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return BrandRegistrationInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BrandRegistrationPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index 2364d231c5..92bc32ea4f 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -1,418 +1,147 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BrandVettingList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, brand_sid): - """ - Initialize the BrandVettingList - - :param Version version: Version that contains the resource - :param brand_sid: A2P BrandRegistration Sid - - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingList - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingList - """ - super(BrandVettingList, self).__init__(version) - - # Path Solution - self._solution = {'brand_sid': brand_sid, } - self._uri = '/a2p/BrandRegistrations/{brand_sid}/Vettings'.format(**self._solution) - - def create(self, vetting_provider, vetting_id=values.unset): - """ - Create the BrandVettingInstance - - :param BrandVettingInstance.VettingProvider vetting_provider: Third-party provider of the vettings to create - :param unicode vetting_id: The unique ID of the vetting - - :returns: The created BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance - """ - data = values.of({'VettingProvider': vetting_provider, 'VettingId': vetting_id, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return BrandVettingInstance(self._version, payload, brand_sid=self._solution['brand_sid'], ) - - def stream(self, vetting_provider=values.unset, limit=None, page_size=None): - """ - Streams BrandVettingInstance 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 BrandVettingInstance.VettingProvider vetting_provider: Third-party provider of the vettings to create - :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.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(vetting_provider=vetting_provider, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, vetting_provider=values.unset, limit=None, page_size=None): - """ - Lists BrandVettingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param BrandVettingInstance.VettingProvider vetting_provider: Third-party provider of the vettings to create - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance] - """ - return list(self.stream(vetting_provider=vetting_provider, limit=limit, page_size=page_size, )) - - def page(self, vetting_provider=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of BrandVettingInstance records from the API. - Request is executed immediately - - :param BrandVettingInstance.VettingProvider vetting_provider: Third-party provider of the vettings to create - :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 BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingPage - """ - data = values.of({ - 'VettingProvider': vetting_provider, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - return BrandVettingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BrandVettingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BrandVettingPage(self._version, response, self._solution) - - def get(self, brand_vetting_sid): - """ - Constructs a BrandVettingContext - - :param brand_vetting_sid: SID for third-party vetting record - - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingContext - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingContext - """ - return BrandVettingContext( - self._version, - brand_sid=self._solution['brand_sid'], - brand_vetting_sid=brand_vetting_sid, - ) - - def __call__(self, brand_vetting_sid): - """ - Constructs a BrandVettingContext - - :param brand_vetting_sid: SID for third-party vetting record - - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingContext - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingContext - """ - return BrandVettingContext( - self._version, - brand_sid=self._solution['brand_sid'], - brand_vetting_sid=brand_vetting_sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BrandVettingPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the BrandVettingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param brand_sid: A2P BrandRegistration Sid - - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingPage - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingPage - """ - super(BrandVettingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BrandVettingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance - """ - return BrandVettingInstance(self._version, payload, brand_sid=self._solution['brand_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class BrandVettingContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, brand_sid, brand_vetting_sid): - """ - Initialize the BrandVettingContext - - :param Version version: Version that contains the resource - :param brand_sid: A2P BrandRegistration Sid - :param brand_vetting_sid: SID for third-party vetting record - - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingContext - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingContext - """ - super(BrandVettingContext, self).__init__(version) + def __init__(self, version: V1, brand_sid: str, brand_vetting_sid: str): + # TODO: needs autogenerated docs + super(BrandVettingContextList, self).__init__(version) # Path Solution - self._solution = {'brand_sid': brand_sid, 'brand_vetting_sid': brand_vetting_sid, } - self._uri = '/a2p/BrandRegistrations/{brand_sid}/Vettings/{brand_vetting_sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the BrandVettingInstance - - :returns: The fetched BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BrandVettingInstance( - self._version, - payload, - brand_sid=self._solution['brand_sid'], - brand_vetting_sid=self._solution['brand_vetting_sid'], - ) + self._solution = { brand_sid, brand_vetting_sid, } + self._uri = '/a2p/BrandRegistrations/${brand_sid}/Vettings/${brand_vetting_sid}' + + + def fetch(self): + + """ + Fetch the BrandVettingInstance + + :returns: The fetched BrandVettingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BrandVettingInstance( + self._version, + payload, + brand_sidbrand_vetting_sid=self._solution['brand_sid''brand_vetting_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class BrandVettingInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class VettingProvider(object): - CAMPAIGN_VERIFY = "campaign-verify" - def __init__(self, version, payload, brand_sid, brand_vetting_sid=None): - """ - Initialize the BrandVettingInstance - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance - """ +class BrandVettingInstance(InstanceResource): + def __init__(self, version, payload, brand_sid: str, brand_vetting_sid: str): super(BrandVettingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'brand_sid': payload.get('brand_sid'), - 'brand_vetting_sid': payload.get('brand_vetting_sid'), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'vetting_id': payload.get('vetting_id'), - 'vetting_class': payload.get('vetting_class'), - 'vetting_status': payload.get('vetting_status'), - 'vetting_provider': payload.get('vetting_provider'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'brand_sid' = payload.get('brand_sid'), + 'brand_vetting_sid' = payload.get('brand_vetting_sid'), + 'date_updated' = payload.get('date_updated'), + 'date_created' = payload.get('date_created'), + 'vetting_id' = payload.get('vetting_id'), + 'vetting_class' = payload.get('vetting_class'), + 'vetting_status' = payload.get('vetting_status'), + 'vetting_provider' = payload.get('vetting_provider'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'brand_sid': brand_sid, - 'brand_vetting_sid': brand_vetting_sid or self._properties['brand_vetting_sid'], + 'brand_sid': brand_sid or self._properties['brand_sid']'brand_vetting_sid': brand_vetting_sid or self._properties['brand_vetting_sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BrandVettingContext for this BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingContext - """ if self._context is None: self._context = BrandVettingContext( self._version, - brand_sid=self._solution['brand_sid'], - brand_vetting_sid=self._solution['brand_vetting_sid'], + brand_sid=self._solution['brand_sid'],brand_vetting_sid=self._solution['brand_vetting_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the vetting - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def brand_sid(self): - """ - :returns: A2P BrandRegistration Sid - :rtype: unicode - """ - return self._properties['brand_sid'] - - @property - def brand_vetting_sid(self): - """ - :returns: SID for third-party vetting record - :rtype: unicode - """ - return self._properties['brand_vetting_sid'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def vetting_id(self): - """ - :returns: The unique ID of the vetting - :rtype: unicode - """ - return self._properties['vetting_id'] - - @property - def vetting_class(self): - """ - :returns: The type of vetting - :rtype: unicode - """ - return self._properties['vetting_class'] + - @property - def vetting_status(self): + def __repr__(self): """ - :returns: Status of vetting attempt - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['vetting_status'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def vetting_provider(self): - """ - :returns: Third-party provider that has conducted the vetting - :rtype: BrandVettingInstance.VettingProvider - """ - return self._properties['vetting_provider'] - @property - def url(self): - """ - :returns: The absolute URL of the Brand Vetting - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the BrandVettingInstance +class BrandVettingListInstance(ListResource): + def __init__(self, version: V1, brand_sid: str): + # TODO: needs autogenerated docs + super(BrandVettingListInstanceList, self).__init__(version) - :returns: The fetched BrandVettingInstance - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { brand_sid, } + self._uri = '/a2p/BrandRegistrations/${brand_sid}/Vettings' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return BrandVettingInstance(self._version, payload, brand_sid=self._solution['brand_sid']) + + + def page(self, vetting_provider, page_size): + + data = values.of({ + 'vetting_provider': vetting_provider,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BrandVettingPage(self._version, payload, brand_sid=self._solution['brand_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/deactivations.py b/twilio/rest/messaging/v1/deactivations.py new file mode 100644 index 0000000000..1e2ef6c0eb --- /dev/null +++ b/twilio/rest/messaging/v1/deactivations.py @@ -0,0 +1,116 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class DeactivationsContext(InstanceContext): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(DeactivationsContextList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Deactivations' + + + def fetch(self, date): + + """ + Fetch the DeactivationsInstance + + :returns: The fetched DeactivationsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DeactivationsInstance( + self._version, + payload, + =self._solution[], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class DeactivationsInstance(InstanceResource): + def __init__(self, version, payload): + super(DeactivationsInstance, self).__init__(version) + self._properties = { + 'redirect_to' = payload.get('redirect_to'), + } + + self._context = None + self._solution = { + + } + + @property + def _proxy(self): + if self._context is None: + self._context = DeactivationsContext( + self._version, + + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class DeactivationsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(DeactivationsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/messaging/v1/domain_certs.py b/twilio/rest/messaging/v1/domain_certs.py new file mode 100644 index 0000000000..3132d86f27 --- /dev/null +++ b/twilio/rest/messaging/v1/domain_certs.py @@ -0,0 +1,145 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class DomainCertsContext(InstanceContext): + def __init__(self, version: V1, domain_sid: str): + # TODO: needs autogenerated docs + super(DomainCertsContextList, self).__init__(version) + + # Path Solution + self._solution = { domain_sid, } + self._uri = '/LinkShortening/Domains/${domain_sid}/Certificate' + + + def delete(self): + + + """ + Deletes the DomainCertsInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DomainCertsInstance + + :returns: The fetched DomainCertsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DomainCertsInstance( + self._version, + payload, + domain_sid=self._solution['domain_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return DomainCertsInstance(self._version, payload, domain_sid=self._solution['domain_sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class DomainCertsInstance(InstanceResource): + def __init__(self, version, payload, domain_sid: str): + super(DomainCertsInstance, self).__init__(version) + self._properties = { + 'domain_sid' = payload.get('domain_sid'), + 'date_updated' = payload.get('date_updated'), + 'date_expires' = payload.get('date_expires'), + 'date_created' = payload.get('date_created'), + 'domain_name' = payload.get('domain_name'), + 'certificate_sid' = payload.get('certificate_sid'), + 'url' = payload.get('url'), + 'validated' = payload.get('validated'), + } + + self._context = None + self._solution = { + 'domain_sid': domain_sid or self._properties['domain_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = DomainCertsContext( + self._version, + domain_sid=self._solution['domain_sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class DomainCertsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(DomainCertsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/messaging/v1/domain_config.py b/twilio/rest/messaging/v1/domain_config.py index ecacc3da45..c36f2ca970 100644 --- a/twilio/rest/messaging/v1/domain_config.py +++ b/twilio/rest/messaging/v1/domain_config.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,308 +19,116 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DomainConfigList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the DomainConfigList - :param Version version: Version that contains the resource - :returns: twilio.rest.messaging.v1.domain_config.DomainConfigList - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigList - """ - super(DomainConfigList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, domain_sid): - """ - Constructs a DomainConfigContext - - :param domain_sid: Unique string used to identify the domain that this config should be associated with. - - :returns: twilio.rest.messaging.v1.domain_config.DomainConfigContext - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigContext - """ - return DomainConfigContext(self._version, domain_sid=domain_sid, ) - - def __call__(self, domain_sid): - """ - Constructs a DomainConfigContext - - :param domain_sid: Unique string used to identify the domain that this config should be associated with. - - :returns: twilio.rest.messaging.v1.domain_config.DomainConfigContext - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigContext - """ - return DomainConfigContext(self._version, domain_sid=domain_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DomainConfigPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the DomainConfigPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.domain_config.DomainConfigPage - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigPage - """ - super(DomainConfigPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DomainConfigInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - """ - return DomainConfigInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DomainConfigContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, domain_sid): - """ - Initialize the DomainConfigContext - - :param Version version: Version that contains the resource - :param domain_sid: Unique string used to identify the domain that this config should be associated with. - - :returns: twilio.rest.messaging.v1.domain_config.DomainConfigContext - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigContext - """ - super(DomainConfigContext, self).__init__(version) + def __init__(self, version: V1, domain_sid: str): + # TODO: needs autogenerated docs + super(DomainConfigContextList, self).__init__(version) # Path Solution - self._solution = {'domain_sid': domain_sid, } - self._uri = '/LinkShortening/Domains/{domain_sid}/Config'.format(**self._solution) - - def update(self, messaging_service_sids, fallback_url=values.unset, - callback_url=values.unset, - messaging_service_sids_action=values.unset): - """ - Update the DomainConfigInstance - - :param list[unicode] messaging_service_sids: A list of messagingServiceSids (with prefix MG) - :param unicode fallback_url: We will redirect requests to urls we are unable to identify to this url. - :param unicode callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links - :param unicode messaging_service_sids_action: An action type for messaging_service_sids operation (ADD, DELETE, REPLACE) - - :returns: The updated DomainConfigInstance - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - """ - data = values.of({ - 'MessagingServiceSids': serialize.map(messaging_service_sids, lambda e: e), - 'FallbackUrl': fallback_url, - 'CallbackUrl': callback_url, - 'MessagingServiceSidsAction': messaging_service_sids_action, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return DomainConfigInstance(self._version, payload, domain_sid=self._solution['domain_sid'], ) - - def fetch(self): - """ - Fetch the DomainConfigInstance - - :returns: The fetched DomainConfigInstance - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DomainConfigInstance(self._version, payload, domain_sid=self._solution['domain_sid'], ) + self._solution = { domain_sid, } + self._uri = '/LinkShortening/Domains/${domain_sid}/Config' + + + def fetch(self): + + """ + Fetch the DomainConfigInstance + + :returns: The fetched DomainConfigInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DomainConfigInstance( + self._version, + payload, + domain_sid=self._solution['domain_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return DomainConfigInstance(self._version, payload, domain_sid=self._solution['domain_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DomainConfigInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, domain_sid=None): - """ - Initialize the DomainConfigInstance - :returns: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - """ +class DomainConfigInstance(InstanceResource): + def __init__(self, version, payload, domain_sid: str): super(DomainConfigInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'domain_sid': payload.get('domain_sid'), - 'config_sid': payload.get('config_sid'), - 'messaging_service_sids': payload.get('messaging_service_sids'), - 'fallback_url': payload.get('fallback_url'), - 'callback_url': payload.get('callback_url'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'domain_sid' = payload.get('domain_sid'), + 'config_sid' = payload.get('config_sid'), + 'messaging_service_sids' = payload.get('messaging_service_sids'), + 'fallback_url' = payload.get('fallback_url'), + 'callback_url' = payload.get('callback_url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'domain_sid': domain_sid or self._properties['domain_sid'], } + self._solution = { + 'domain_sid': domain_sid or self._properties['domain_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DomainConfigContext for this DomainConfigInstance - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigContext - """ if self._context is None: - self._context = DomainConfigContext(self._version, domain_sid=self._solution['domain_sid'], ) + self._context = DomainConfigContext( + self._version, + domain_sid=self._solution['domain_sid'], + ) return self._context - @property - def domain_sid(self): - """ - :returns: The unique string that we created to identify the Domain resource. - :rtype: unicode - """ - return self._properties['domain_sid'] + - @property - def config_sid(self): - """ - :returns: The unique string that we created to identify the Domain config (prefix ZK). - :rtype: unicode - """ - return self._properties['config_sid'] - - @property - def messaging_service_sids(self): - """ - :returns: A list of messagingServiceSids (with prefix MG). - :rtype: list[unicode] - """ - return self._properties['messaging_service_sids'] - - @property - def fallback_url(self): - """ - :returns: We will redirect requests to urls we are unable to identify to this url. - :rtype: unicode - """ - return self._properties['fallback_url'] - - @property - def callback_url(self): - """ - :returns: URL to receive click events to your webhook whenever the recipients click on the shortened links. - :rtype: unicode - """ - return self._properties['callback_url'] - - @property - def date_created(self): - """ - :returns: Date this Domain Config was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: Date that this Domain Config was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): + def __repr__(self): """ - :returns: The url - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, messaging_service_sids, fallback_url=values.unset, - callback_url=values.unset, - messaging_service_sids_action=values.unset): - """ - Update the DomainConfigInstance - :param list[unicode] messaging_service_sids: A list of messagingServiceSids (with prefix MG) - :param unicode fallback_url: We will redirect requests to urls we are unable to identify to this url. - :param unicode callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links - :param unicode messaging_service_sids_action: An action type for messaging_service_sids operation (ADD, DELETE, REPLACE) - :returns: The updated DomainConfigInstance - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - """ - return self._proxy.update( - messaging_service_sids, - fallback_url=fallback_url, - callback_url=callback_url, - messaging_service_sids_action=messaging_service_sids_action, - ) +class DomainConfigListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(DomainConfigListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the DomainConfigInstance - - :returns: The fetched DomainConfigInstance - :rtype: twilio.rest.messaging.v1.domain_config.DomainConfigInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index 7d4b2ddefd..1cd108b97d 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -1,174 +1,93 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class ExternalCampaignList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version): - """ - Initialize the ExternalCampaignList - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.external_campaign.ExternalCampaignList - :rtype: twilio.rest.messaging.v1.external_campaign.ExternalCampaignList - """ - super(ExternalCampaignList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services/PreregisteredUsa2p'.format(**self._solution) - def create(self, campaign_id, messaging_service_sid): - """ - Create the ExternalCampaignInstance - - :param unicode campaign_id: ID of the preregistered campaign. - :param unicode messaging_service_sid: The SID of the Messaging Service the resource is associated with +class ExternalCampaignInstance(InstanceResource): + def __init__(self, version, payload): + super(ExternalCampaignInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'campaign_id' = payload.get('campaign_id'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'date_created' = payload.get('date_created'), + } - :returns: The created ExternalCampaignInstance - :rtype: twilio.rest.messaging.v1.external_campaign.ExternalCampaignInstance - """ - data = values.of({'CampaignId': campaign_id, 'MessagingServiceSid': messaging_service_sid, }) + self._context = None + self._solution = { + + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = ExternalCampaignContext( + self._version, + + ) + return self._context - return ExternalCampaignInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class ExternalCampaignPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ExternalCampaignPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.external_campaign.ExternalCampaignPage - :rtype: twilio.rest.messaging.v1.external_campaign.ExternalCampaignPage - """ - super(ExternalCampaignPage, self).__init__(version, response) +class ExternalCampaignListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ExternalCampaignListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { } + self._uri = '/Services/PreregisteredUsa2p' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def get_instance(self, payload): - """ - Build an instance of ExternalCampaignInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.external_campaign.ExternalCampaignInstance - :rtype: twilio.rest.messaging.v1.external_campaign.ExternalCampaignInstance - """ - return ExternalCampaignInstance(self._version, payload, ) + return ExternalCampaignInstance(self._version, payload, ) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class ExternalCampaignInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload): - """ - Initialize the ExternalCampaignInstance + return '' - :returns: twilio.rest.messaging.v1.external_campaign.ExternalCampaignInstance - :rtype: twilio.rest.messaging.v1.external_campaign.ExternalCampaignInstance - """ - super(ExternalCampaignInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'campaign_id': payload.get('campaign_id'), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - } - - # Context - self._context = None - self._solution = {} - - @property - def sid(self): - """ - :returns: The unique string that identifies a US A2P Compliance resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def campaign_id(self): - """ - :returns: ID of the preregistered campaign. - :rtype: unicode - """ - return self._properties['campaign_id'] - - @property - def messaging_service_sid(self): - """ - :returns: The SID of the Messaging Service the resource is associated with - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/messaging/v1/service.py b/twilio/rest/messaging/v1/service.py new file mode 100644 index 0000000000..109e520115 --- /dev/null +++ b/twilio/rest/messaging/v1/service.py @@ -0,0 +1,202 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.alpha_sender import AlphaSenderListInstancefrom twilio.rest.service.phone_number import PhoneNumberListInstancefrom twilio.rest.service.short_code import ShortCodeListInstancefrom twilio.rest.service.us_app_to_person import UsAppToPersonListInstancefrom twilio.rest.service.us_app_to_person_usecase import UsAppToPersonUsecaseListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._alpha_senders = None + self._phone_numbers = None + self._short_codes = None + self._us_app_to_person = None + self._us_app_to_person_usecases = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'inbound_request_url' = payload.get('inbound_request_url'), + 'inbound_method' = payload.get('inbound_method'), + 'fallback_url' = payload.get('fallback_url'), + 'fallback_method' = payload.get('fallback_method'), + 'status_callback' = payload.get('status_callback'), + 'sticky_sender' = payload.get('sticky_sender'), + 'mms_converter' = payload.get('mms_converter'), + 'smart_encoding' = payload.get('smart_encoding'), + 'scan_message_content' = payload.get('scan_message_content'), + 'fallback_to_long_code' = payload.get('fallback_to_long_code'), + 'area_code_geomatch' = payload.get('area_code_geomatch'), + 'synchronous_validation' = payload.get('synchronous_validation'), + 'validity_period' = payload.get('validity_period'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'usecase' = payload.get('usecase'), + 'us_app_to_person_registered' = payload.get('us_app_to_person_registered'), + 'use_inbound_webhook_on_number' = payload.get('use_inbound_webhook_on_number'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def alpha_senders(self): + return self._proxy.alpha_senders + @property + def phone_numbers(self): + return self._proxy.phone_numbers + @property + def short_codes(self): + return self._proxy.short_codes + @property + def us_app_to_person(self): + return self._proxy.us_app_to_person + @property + def us_app_to_person_usecases(self): + return self._proxy.us_app_to_person_usecases + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/messaging/v1/service/alpha_sender.py b/twilio/rest/messaging/v1/service/alpha_sender.py index 59146fce22..391ee72ac2 100644 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ b/twilio/rest/messaging/v1/service/alpha_sender.py @@ -1,395 +1,156 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AlphaSenderList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the AlphaSenderList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - """ - super(AlphaSenderList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/AlphaSenders'.format(**self._solution) - - def create(self, alpha_sender): - """ - Create the AlphaSenderInstance - - :param unicode alpha_sender: The Alphanumeric Sender ID string - - :returns: The created AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - data = values.of({'AlphaSender': alpha_sender, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AlphaSenderInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams AlphaSenderInstance 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 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.messaging.v1.service.alpha_sender.AlphaSenderInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AlphaSenderInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.messaging.v1.service.alpha_sender.AlphaSenderInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AlphaSenderInstance records from the API. - Request is executed immediately - - :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 AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - return AlphaSenderPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AlphaSenderInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AlphaSenderPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AlphaSenderContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ - return AlphaSenderContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AlphaSenderContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ - return AlphaSenderContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AlphaSenderPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AlphaSenderPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderPage - """ - super(AlphaSenderPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AlphaSenderInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - return AlphaSenderInstance(self._version, payload, service_sid=self._solution['service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class AlphaSenderContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the AlphaSenderContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Messaging Service to fetch the resource from - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ - super(AlphaSenderContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AlphaSenderContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/AlphaSenders/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AlphaSenderInstance - - :returns: The fetched AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AlphaSenderInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the AlphaSenderInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/AlphaSenders/${sid}' + + + def delete(self): + + + """ + Deletes the AlphaSenderInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AlphaSenderInstance + + :returns: The fetched AlphaSenderInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AlphaSenderInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AlphaSenderInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the AlphaSenderInstance - - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ +class AlphaSenderInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(AlphaSenderInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'alpha_sender': payload.get('alpha_sender'), - 'capabilities': payload.get('capabilities'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'alpha_sender' = payload.get('alpha_sender'), + 'capabilities' = payload.get('capabilities'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AlphaSenderContext for this AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext - """ if self._context is None: self._context = AlphaSenderContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def alpha_sender(self): - """ - :returns: The Alphanumeric Sender ID string - :rtype: unicode - """ - return self._properties['alpha_sender'] - - @property - def capabilities(self): - """ - :returns: An array of values that describe whether the number can receive calls or messages - :rtype: list[unicode] - """ - return self._properties['capabilities'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the AlphaSender resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the AlphaSenderInstance - :returns: The fetched AlphaSenderInstance - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the AlphaSenderInstance +class AlphaSenderListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(AlphaSenderListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/AlphaSenders' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AlphaSenderInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AlphaSenderPage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py index 6822225118..48b3944b76 100644 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ b/twilio/rest/messaging/v1/service/phone_number.py @@ -1,404 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PhoneNumberList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers'.format(**self._solution) - - def create(self, phone_number_sid): - """ - Create the PhoneNumberInstance - - :param unicode phone_number_sid: The SID of the Phone Number being added to the Service - - :returns: The created PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - data = values.of({'PhoneNumberSid': phone_number_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams PhoneNumberInstance 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 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.messaging.v1.service.phone_number.PhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.messaging.v1.service.phone_number.PhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PhoneNumberInstance records from the API. - Request is executed immediately - - :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 PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PhoneNumberPage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PhoneNumberPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class PhoneNumberContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(PhoneNumberContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the PhoneNumberInstance - - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PhoneNumberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/PhoneNumbers/${sid}' + + + def delete(self): + + + """ + Deletes the PhoneNumberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the PhoneNumberInstance + + :returns: The fetched PhoneNumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PhoneNumberInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PhoneNumberInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the PhoneNumberInstance - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ +class PhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'phone_number': payload.get('phone_number'), - 'country_code': payload.get('country_code'), - 'capabilities': payload.get('capabilities'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'phone_number' = payload.get('phone_number'), + 'country_code' = payload.get('country_code'), + 'capabilities' = payload.get('capabilities'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext - """ if self._context is None: self._context = PhoneNumberContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] + - @property - def country_code(self): - """ - :returns: The 2-character ISO Country Code of the number - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def capabilities(self): - """ - :returns: An array of values that describe whether the number can receive calls or messages - :rtype: list[unicode] - """ - return self._properties['capabilities'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the PhoneNumber resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the PhoneNumberInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the PhoneNumberInstance +class PhoneNumberListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(PhoneNumberListInstanceList, self).__init__(version) - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/PhoneNumbers' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PhoneNumberPage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/service/short_code.py b/twilio/rest/messaging/v1/service/short_code.py index a5b6dea599..302ac1ec72 100644 --- a/twilio/rest/messaging/v1/service/short_code.py +++ b/twilio/rest/messaging/v1/service/short_code.py @@ -1,404 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ShortCodeList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the ShortCodeList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList - """ - super(ShortCodeList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/ShortCodes'.format(**self._solution) - - def create(self, short_code_sid): - """ - Create the ShortCodeInstance - - :param unicode short_code_sid: The SID of the ShortCode being added to the Service - - :returns: The created ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - data = values.of({'ShortCodeSid': short_code_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams ShortCodeInstance 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 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.messaging.v1.service.short_code.ShortCodeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ShortCodeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.messaging.v1.service.short_code.ShortCodeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ShortCodeInstance records from the API. - Request is executed immediately - - :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 ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ShortCodePage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ShortCodePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ShortCodePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ShortCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodePage - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodePage - """ - super(ShortCodePage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of ShortCodeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ShortCodeContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ShortCodeContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ - super(ShortCodeContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ShortCodeContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/ShortCodes/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the ShortCodeInstance - - :returns: The fetched ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ShortCodeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/ShortCodes/${sid}' + + + def delete(self): + + + """ + Deletes the ShortCodeInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ShortCodeInstance + + :returns: The fetched ShortCodeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ShortCodeInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ShortCodeInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ShortCodeInstance - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ +class ShortCodeInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(ShortCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'short_code': payload.get('short_code'), - 'country_code': payload.get('country_code'), - 'capabilities': payload.get('capabilities'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'short_code' = payload.get('short_code'), + 'country_code' = payload.get('country_code'), + 'capabilities' = payload.get('capabilities'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ShortCodeContext for this ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext - """ if self._context is None: self._context = ShortCodeContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def short_code(self): - """ - :returns: The E.164 format of the short code - :rtype: unicode - """ - return self._properties['short_code'] + - @property - def country_code(self): - """ - :returns: The 2-character ISO Country Code of the number - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def capabilities(self): - """ - :returns: An array of values that describe whether the number can receive calls or messages - :rtype: list[unicode] - """ - return self._properties['capabilities'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the ShortCode resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the ShortCodeInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the ShortCodeInstance +class ShortCodeListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(ShortCodeListInstanceList, self).__init__(version) - :returns: The fetched ShortCodeInstance - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/ShortCodes' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ShortCodePage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/service/us_app_to_person.py b/twilio/rest/messaging/v1/service/us_app_to_person.py index 3a1f9018fd..9a9427ea9e 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,579 +19,154 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UsAppToPersonList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, messaging_service_sid): - """ - Initialize the UsAppToPersonList - - :param Version version: Version that contains the resource - :param messaging_service_sid: The SID of the Messaging Service the resource is associated with - - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList - """ - super(UsAppToPersonList, self).__init__(version) - - # Path Solution - self._solution = {'messaging_service_sid': messaging_service_sid, } - self._uri = '/Services/{messaging_service_sid}/Compliance/Usa2p'.format(**self._solution) - - def create(self, brand_registration_sid, description, message_flow, - message_samples, us_app_to_person_usecase, has_embedded_links, - has_embedded_phone, opt_in_message=values.unset, - opt_out_message=values.unset, help_message=values.unset, - opt_in_keywords=values.unset, opt_out_keywords=values.unset, - help_keywords=values.unset): - """ - Create the UsAppToPersonInstance - - :param unicode brand_registration_sid: A2P Brand Registration SID - :param unicode description: A short description of what this SMS campaign does - :param unicode message_flow: The message flow of the campaign - :param list[unicode] message_samples: Message samples - :param unicode us_app_to_person_usecase: A2P Campaign Use Case. - :param bool has_embedded_links: Indicates that this SMS campaign will send messages that contain links - :param bool has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers - :param unicode opt_in_message: Opt In Message - :param unicode opt_out_message: Opt Out Message - :param unicode help_message: Help Message - :param list[unicode] opt_in_keywords: Opt In Keywords - :param list[unicode] opt_out_keywords: Opt Out Keywords - :param list[unicode] help_keywords: Help Keywords - - :returns: The created UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonInstance - """ - data = values.of({ - 'BrandRegistrationSid': brand_registration_sid, - 'Description': description, - 'MessageFlow': message_flow, - 'MessageSamples': serialize.map(message_samples, lambda e: e), - 'UsAppToPersonUsecase': us_app_to_person_usecase, - 'HasEmbeddedLinks': has_embedded_links, - 'HasEmbeddedPhone': has_embedded_phone, - 'OptInMessage': opt_in_message, - 'OptOutMessage': opt_out_message, - 'HelpMessage': help_message, - 'OptInKeywords': serialize.map(opt_in_keywords, lambda e: e), - 'OptOutKeywords': serialize.map(opt_out_keywords, lambda e: e), - 'HelpKeywords': serialize.map(help_keywords, lambda e: e), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return UsAppToPersonInstance( - self._version, - payload, - messaging_service_sid=self._solution['messaging_service_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams UsAppToPersonInstance 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 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.messaging.v1.service.us_app_to_person.UsAppToPersonInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UsAppToPersonInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.messaging.v1.service.us_app_to_person.UsAppToPersonInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UsAppToPersonInstance records from the API. - Request is executed immediately - - :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 UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UsAppToPersonPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UsAppToPersonInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UsAppToPersonPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UsAppToPersonContext - - :param sid: The SID that identifies the US A2P Compliance resource to fetch - - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext - """ - return UsAppToPersonContext( - self._version, - messaging_service_sid=self._solution['messaging_service_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a UsAppToPersonContext - - :param sid: The SID that identifies the US A2P Compliance resource to fetch - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext - """ - return UsAppToPersonContext( - self._version, - messaging_service_sid=self._solution['messaging_service_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UsAppToPersonPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the UsAppToPersonPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param messaging_service_sid: The SID of the Messaging Service the resource is associated with - - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonPage - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonPage - """ - super(UsAppToPersonPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsAppToPersonInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonInstance - """ - return UsAppToPersonInstance( - self._version, - payload, - messaging_service_sid=self._solution['messaging_service_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class UsAppToPersonContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, messaging_service_sid, sid): - """ - Initialize the UsAppToPersonContext - - :param Version version: Version that contains the resource - :param messaging_service_sid: The SID of the Messaging Service to fetch the resource from - :param sid: The SID that identifies the US A2P Compliance resource to fetch - - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext - """ - super(UsAppToPersonContext, self).__init__(version) + def __init__(self, version: V1, messaging_service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(UsAppToPersonContextList, self).__init__(version) # Path Solution - self._solution = {'messaging_service_sid': messaging_service_sid, 'sid': sid, } - self._uri = '/Services/{messaging_service_sid}/Compliance/Usa2p/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the UsAppToPersonInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the UsAppToPersonInstance - - :returns: The fetched UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UsAppToPersonInstance( - self._version, - payload, - messaging_service_sid=self._solution['messaging_service_sid'], - sid=self._solution['sid'], - ) + self._solution = { messaging_service_sid, sid, } + self._uri = '/Services/${messaging_service_sid}/Compliance/Usa2p/${sid}' + + + def delete(self): + + + """ + Deletes the UsAppToPersonInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the UsAppToPersonInstance + + :returns: The fetched UsAppToPersonInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UsAppToPersonInstance( + self._version, + payload, + messaging_service_sidsid=self._solution['messaging_service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UsAppToPersonInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, messaging_service_sid, sid=None): - """ - Initialize the UsAppToPersonInstance - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonInstance - """ +class UsAppToPersonInstance(InstanceResource): + def __init__(self, version, payload, messaging_service_sid: str, sid: str): super(UsAppToPersonInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'brand_registration_sid': payload.get('brand_registration_sid'), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'description': payload.get('description'), - 'message_samples': payload.get('message_samples'), - 'us_app_to_person_usecase': payload.get('us_app_to_person_usecase'), - 'has_embedded_links': payload.get('has_embedded_links'), - 'has_embedded_phone': payload.get('has_embedded_phone'), - 'campaign_status': payload.get('campaign_status'), - 'campaign_id': payload.get('campaign_id'), - 'is_externally_registered': payload.get('is_externally_registered'), - 'rate_limits': payload.get('rate_limits'), - 'message_flow': payload.get('message_flow'), - 'opt_in_message': payload.get('opt_in_message'), - 'opt_out_message': payload.get('opt_out_message'), - 'help_message': payload.get('help_message'), - 'opt_in_keywords': payload.get('opt_in_keywords'), - 'opt_out_keywords': payload.get('opt_out_keywords'), - 'help_keywords': payload.get('help_keywords'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'mock': payload.get('mock'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'brand_registration_sid' = payload.get('brand_registration_sid'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'description' = payload.get('description'), + 'message_samples' = payload.get('message_samples'), + 'us_app_to_person_usecase' = payload.get('us_app_to_person_usecase'), + 'has_embedded_links' = payload.get('has_embedded_links'), + 'has_embedded_phone' = payload.get('has_embedded_phone'), + 'campaign_status' = payload.get('campaign_status'), + 'campaign_id' = payload.get('campaign_id'), + 'is_externally_registered' = payload.get('is_externally_registered'), + 'rate_limits' = payload.get('rate_limits'), + 'message_flow' = payload.get('message_flow'), + 'opt_in_message' = payload.get('opt_in_message'), + 'opt_out_message' = payload.get('opt_out_message'), + 'help_message' = payload.get('help_message'), + 'opt_in_keywords' = payload.get('opt_in_keywords'), + 'opt_out_keywords' = payload.get('opt_out_keywords'), + 'help_keywords' = payload.get('help_keywords'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'mock' = payload.get('mock'), } - # Context self._context = None self._solution = { - 'messaging_service_sid': messaging_service_sid, - 'sid': sid or self._properties['sid'], + 'messaging_service_sid': messaging_service_sid or self._properties['messaging_service_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UsAppToPersonContext for this UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonContext - """ if self._context is None: self._context = UsAppToPersonContext( self._version, - messaging_service_sid=self._solution['messaging_service_sid'], - sid=self._solution['sid'], + messaging_service_sid=self._solution['messaging_service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies a US A2P Compliance resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def brand_registration_sid(self): - """ - :returns: A2P Brand Registration SID - :rtype: unicode - """ - return self._properties['brand_registration_sid'] - - @property - def messaging_service_sid(self): - """ - :returns: The SID of the Messaging Service the resource is associated with - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def description(self): - """ - :returns: A short description of what this SMS campaign does - :rtype: unicode - """ - return self._properties['description'] - - @property - def message_samples(self): - """ - :returns: Message samples - :rtype: list[unicode] - """ - return self._properties['message_samples'] - - @property - def us_app_to_person_usecase(self): - """ - :returns: A2P Campaign Use Case. - :rtype: unicode - """ - return self._properties['us_app_to_person_usecase'] - - @property - def has_embedded_links(self): - """ - :returns: Indicate that this SMS campaign will send messages that contain links - :rtype: bool - """ - return self._properties['has_embedded_links'] - - @property - def has_embedded_phone(self): - """ - :returns: Indicates that this SMS campaign will send messages that contain phone numbers - :rtype: bool - """ - return self._properties['has_embedded_phone'] - - @property - def campaign_status(self): - """ - :returns: Campaign status - :rtype: unicode - """ - return self._properties['campaign_status'] - - @property - def campaign_id(self): - """ - :returns: The Campaign Registry (TCR) Campaign ID. - :rtype: unicode - """ - return self._properties['campaign_id'] - - @property - def is_externally_registered(self): - """ - :returns: Indicates whether the campaign was registered externally or not - :rtype: bool - """ - return self._properties['is_externally_registered'] - - @property - def rate_limits(self): - """ - :returns: Rate limit and/or classification set by each carrier - :rtype: dict - """ - return self._properties['rate_limits'] - - @property - def message_flow(self): - """ - :returns: Consumer opt-in flow - :rtype: unicode - """ - return self._properties['message_flow'] - - @property - def opt_in_message(self): - """ - :returns: Opt In Message - :rtype: unicode - """ - return self._properties['opt_in_message'] - - @property - def opt_out_message(self): - """ - :returns: Opt Out Message - :rtype: unicode - """ - return self._properties['opt_out_message'] - - @property - def help_message(self): - """ - :returns: Help Message - :rtype: unicode - """ - return self._properties['help_message'] - - @property - def opt_in_keywords(self): - """ - :returns: Opt In Keywords - :rtype: list[unicode] - """ - return self._properties['opt_in_keywords'] - - @property - def opt_out_keywords(self): - """ - :returns: Opt Out Keywords - :rtype: list[unicode] - """ - return self._properties['opt_out_keywords'] - - @property - def help_keywords(self): - """ - :returns: Help Keywords - :rtype: list[unicode] - """ - return self._properties['help_keywords'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the US App to Person resource - :rtype: unicode - """ - return self._properties['url'] + - @property - def mock(self): + def __repr__(self): """ - :returns: A boolean that specifies whether campaign is a mock or not. - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['mock'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the UsAppToPersonInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the UsAppToPersonInstance +class UsAppToPersonListInstance(ListResource): + def __init__(self, version: V1, messaging_service_sid: str): + # TODO: needs autogenerated docs + super(UsAppToPersonListInstanceList, self).__init__(version) - :returns: The fetched UsAppToPersonInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { messaging_service_sid, } + self._uri = '/Services/${messaging_service_sid}/Compliance/Usa2p' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return UsAppToPersonInstance(self._version, payload, messaging_service_sid=self._solution['messaging_service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return UsAppToPersonPage(self._version, payload, messaging_service_sid=self._solution['messaging_service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py index b73126c88c..4293611561 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py @@ -1,144 +1,83 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page + Twilio - Messaging + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class UsAppToPersonUsecaseList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, messaging_service_sid): - """ - Initialize the UsAppToPersonUsecaseList +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - :param Version version: Version that contains the resource - :param messaging_service_sid: The unique string that identifies the resource - :returns: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseList - :rtype: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseList - """ - super(UsAppToPersonUsecaseList, self).__init__(version) - # Path Solution - self._solution = {'messaging_service_sid': messaging_service_sid, } - self._uri = '/Services/{messaging_service_sid}/Compliance/Usa2p/Usecases'.format(**self._solution) - def fetch(self, brand_registration_sid=values.unset): - """ - Fetch the UsAppToPersonUsecaseInstance - :param unicode brand_registration_sid: A2P Brand Registration SID +class UsAppToPersonUsecaseInstance(InstanceResource): + def __init__(self, version, payload, messaging_service_sid: str): + super(UsAppToPersonUsecaseInstance, self).__init__(version) + self._properties = { + 'us_app_to_person_usecases' = payload.get('us_app_to_person_usecases'), + } - :returns: The fetched UsAppToPersonUsecaseInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseInstance - """ - data = values.of({'BrandRegistrationSid': brand_registration_sid, }) + self._context = None + self._solution = { + 'messaging_service_sid': messaging_service_sid or self._properties['messaging_service_sid'] + } - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = UsAppToPersonUsecaseContext( + self._version, + messaging_service_sid=self._solution['messaging_service_sid'], + ) + return self._context - return UsAppToPersonUsecaseInstance( - self._version, - payload, - messaging_service_sid=self._solution['messaging_service_sid'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class UsAppToPersonUsecasePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def __init__(self, version, response, solution): - """ - Initialize the UsAppToPersonUsecasePage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param messaging_service_sid: The unique string that identifies the resource - :returns: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecasePage - :rtype: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecasePage - """ - super(UsAppToPersonUsecasePage, self).__init__(version, response) +class UsAppToPersonUsecaseListInstance(ListResource): + def __init__(self, version: V1, messaging_service_sid: str): + # TODO: needs autogenerated docs + super(UsAppToPersonUsecaseListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsAppToPersonUsecaseInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseInstance - """ - return UsAppToPersonUsecaseInstance( - self._version, - payload, - messaging_service_sid=self._solution['messaging_service_sid'], - ) + self._solution = { messaging_service_sid, } + self._uri = '/Services/${messaging_service_sid}/Compliance/Usa2p/Usecases' + + + def fetch(self, brand_registration_sid): + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class UsAppToPersonUsecaseInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, messaging_service_sid): - """ - Initialize the UsAppToPersonUsecaseInstance - - :returns: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseInstance - :rtype: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseInstance - """ - super(UsAppToPersonUsecaseInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'us_app_to_person_usecases': payload.get('us_app_to_person_usecases'), } - - # Context - self._context = None - self._solution = {'messaging_service_sid': messaging_service_sid, } - - @property - def us_app_to_person_usecases(self): - """ - :returns: Human readable A2P Use Case details - :rtype: list[dict] - """ - return self._properties['us_app_to_person_usecases'] - - def __repr__(self): - """ - Provide a friendly representation + return '' - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index b281be90f1..9fd5943b4c 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,655 +19,150 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TollfreeVerificationList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the TollfreeVerificationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationList - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationList - """ - super(TollfreeVerificationList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Tollfree/Verifications'.format(**self._solution) - - def stream(self, tollfree_phone_number_sid=values.unset, status=values.unset, - limit=None, page_size=None): - """ - Streams TollfreeVerificationInstance 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 tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification - :param TollfreeVerificationInstance.Status status: The compliance status of the Tollfree Verification record. - :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.messaging.v1.tollfree_verification.TollfreeVerificationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - tollfree_phone_number_sid=tollfree_phone_number_sid, - status=status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, tollfree_phone_number_sid=values.unset, status=values.unset, - limit=None, page_size=None): - """ - Lists TollfreeVerificationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification - :param TollfreeVerificationInstance.Status status: The compliance status of the Tollfree Verification record. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.messaging.v1.tollfree_verification.TollfreeVerificationInstance] - """ - return list(self.stream( - tollfree_phone_number_sid=tollfree_phone_number_sid, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, tollfree_phone_number_sid=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TollfreeVerificationInstance records from the API. - Request is executed immediately - - :param unicode tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification - :param TollfreeVerificationInstance.Status status: The compliance status of the Tollfree Verification record. - :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 TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationPage - """ - data = values.of({ - 'TollfreePhoneNumberSid': tollfree_phone_number_sid, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TollfreeVerificationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TollfreeVerificationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TollfreeVerificationPage(self._version, response, self._solution) - - def create(self, business_name, business_website, notification_email, - use_case_categories, use_case_summary, production_message_sample, - opt_in_image_urls, opt_in_type, message_volume, - tollfree_phone_number_sid, customer_profile_sid=values.unset, - business_street_address=values.unset, - business_street_address2=values.unset, business_city=values.unset, - business_state_province_region=values.unset, - business_postal_code=values.unset, business_country=values.unset, - additional_information=values.unset, - business_contact_first_name=values.unset, - business_contact_last_name=values.unset, - business_contact_email=values.unset, - business_contact_phone=values.unset): - """ - Create the TollfreeVerificationInstance - - :param unicode business_name: The name of the business or organization using the Tollfree number - :param unicode business_website: The website of the business or organization using the Tollfree number - :param unicode notification_email: The email address to receive the notification about the verification result. - :param list[unicode] use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable. - :param unicode use_case_summary: Further explaination on how messaging is used by the business or organization - :param unicode production_message_sample: An example of message content, i.e. a sample message - :param list[unicode] opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL - :param TollfreeVerificationInstance.OptInType opt_in_type: Describe how a user opts-in to text messages - :param unicode message_volume: Estimate monthly volume of messages from the Tollfree Number - :param unicode tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification - :param unicode customer_profile_sid: Customer's Profile Bundle BundleSid - :param unicode business_street_address: The address of the business or organization using the Tollfree number - :param unicode business_street_address2: The address of the business or organization using the Tollfree number - :param unicode business_city: The city of the business or organization using the Tollfree number - :param unicode business_state_province_region: The state/province/region of the business or organization using the Tollfree number - :param unicode business_postal_code: The postal code of the business or organization using the Tollfree number - :param unicode business_country: The country of the business or organization using the Tollfree number - :param unicode additional_information: Additional information to be provided for verification - :param unicode business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number - :param unicode business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number - :param unicode business_contact_email: The email address of the contact for the business or organization using the Tollfree number - :param unicode business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number - - :returns: The created TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationInstance - """ - data = values.of({ - 'BusinessName': business_name, - 'BusinessWebsite': business_website, - 'NotificationEmail': notification_email, - 'UseCaseCategories': serialize.map(use_case_categories, lambda e: e), - 'UseCaseSummary': use_case_summary, - 'ProductionMessageSample': production_message_sample, - 'OptInImageUrls': serialize.map(opt_in_image_urls, lambda e: e), - 'OptInType': opt_in_type, - 'MessageVolume': message_volume, - 'TollfreePhoneNumberSid': tollfree_phone_number_sid, - 'CustomerProfileSid': customer_profile_sid, - 'BusinessStreetAddress': business_street_address, - 'BusinessStreetAddress2': business_street_address2, - 'BusinessCity': business_city, - 'BusinessStateProvinceRegion': business_state_province_region, - 'BusinessPostalCode': business_postal_code, - 'BusinessCountry': business_country, - 'AdditionalInformation': additional_information, - 'BusinessContactFirstName': business_contact_first_name, - 'BusinessContactLastName': business_contact_last_name, - 'BusinessContactEmail': business_contact_email, - 'BusinessContactPhone': business_contact_phone, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TollfreeVerificationInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a TollfreeVerificationContext - - :param sid: Tollfree Verification Sid - - :returns: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationContext - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationContext - """ - return TollfreeVerificationContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TollfreeVerificationContext - - :param sid: Tollfree Verification Sid - - :returns: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationContext - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationContext - """ - return TollfreeVerificationContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TollfreeVerificationPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the TollfreeVerificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationPage - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationPage - """ - super(TollfreeVerificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TollfreeVerificationInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationInstance - """ - return TollfreeVerificationInstance(self._version, payload, ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TollfreeVerificationContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the TollfreeVerificationContext - - :param Version version: Version that contains the resource - :param sid: Tollfree Verification Sid - - :returns: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationContext - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationContext - """ - super(TollfreeVerificationContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(TollfreeVerificationContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Tollfree/Verifications/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the TollfreeVerificationInstance - - :returns: The fetched TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TollfreeVerificationInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Tollfree/Verifications/${sid}' + + + def fetch(self): + + """ + Fetch the TollfreeVerificationInstance + + :returns: The fetched TollfreeVerificationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TollfreeVerificationInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TollfreeVerificationInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - PENDING_REVIEW = "PENDING_REVIEW" - IN_REVIEW = "IN_REVIEW" - TWILIO_APPROVED = "TWILIO_APPROVED" - TWILIO_REJECTED = "TWILIO_REJECTED" - class OptInType(object): - VERBAL = "VERBAL" - WEB_FORM = "WEB_FORM" - PAPER_FORM = "PAPER_FORM" - VIA_TEXT = "VIA_TEXT" - MOBILE_QR_CODE = "MOBILE_QR_CODE" - - def __init__(self, version, payload, sid=None): - """ - Initialize the TollfreeVerificationInstance - - :returns: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationInstance - """ +class TollfreeVerificationInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(TollfreeVerificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'customer_profile_sid': payload.get('customer_profile_sid'), - 'trust_product_sid': payload.get('trust_product_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'regulated_item_sid': payload.get('regulated_item_sid'), - 'business_name': payload.get('business_name'), - 'business_street_address': payload.get('business_street_address'), - 'business_street_address2': payload.get('business_street_address2'), - 'business_city': payload.get('business_city'), - 'business_state_province_region': payload.get('business_state_province_region'), - 'business_postal_code': payload.get('business_postal_code'), - 'business_country': payload.get('business_country'), - 'business_website': payload.get('business_website'), - 'business_contact_first_name': payload.get('business_contact_first_name'), - 'business_contact_last_name': payload.get('business_contact_last_name'), - 'business_contact_email': payload.get('business_contact_email'), - 'business_contact_phone': payload.get('business_contact_phone'), - 'notification_email': payload.get('notification_email'), - 'use_case_categories': payload.get('use_case_categories'), - 'use_case_summary': payload.get('use_case_summary'), - 'production_message_sample': payload.get('production_message_sample'), - 'opt_in_image_urls': payload.get('opt_in_image_urls'), - 'opt_in_type': payload.get('opt_in_type'), - 'message_volume': payload.get('message_volume'), - 'additional_information': payload.get('additional_information'), - 'tollfree_phone_number_sid': payload.get('tollfree_phone_number_sid'), - 'status': payload.get('status'), - 'url': payload.get('url'), - 'resource_links': payload.get('resource_links'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'customer_profile_sid' = payload.get('customer_profile_sid'), + 'trust_product_sid' = payload.get('trust_product_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'regulated_item_sid' = payload.get('regulated_item_sid'), + 'business_name' = payload.get('business_name'), + 'business_street_address' = payload.get('business_street_address'), + 'business_street_address2' = payload.get('business_street_address2'), + 'business_city' = payload.get('business_city'), + 'business_state_province_region' = payload.get('business_state_province_region'), + 'business_postal_code' = payload.get('business_postal_code'), + 'business_country' = payload.get('business_country'), + 'business_website' = payload.get('business_website'), + 'business_contact_first_name' = payload.get('business_contact_first_name'), + 'business_contact_last_name' = payload.get('business_contact_last_name'), + 'business_contact_email' = payload.get('business_contact_email'), + 'business_contact_phone' = payload.get('business_contact_phone'), + 'notification_email' = payload.get('notification_email'), + 'use_case_categories' = payload.get('use_case_categories'), + 'use_case_summary' = payload.get('use_case_summary'), + 'production_message_sample' = payload.get('production_message_sample'), + 'opt_in_image_urls' = payload.get('opt_in_image_urls'), + 'opt_in_type' = payload.get('opt_in_type'), + 'message_volume' = payload.get('message_volume'), + 'additional_information' = payload.get('additional_information'), + 'tollfree_phone_number_sid' = payload.get('tollfree_phone_number_sid'), + 'status' = payload.get('status'), + 'url' = payload.get('url'), + 'resource_links' = payload.get('resource_links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TollfreeVerificationContext for this TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationContext - """ if self._context is None: - self._context = TollfreeVerificationContext(self._version, sid=self._solution['sid'], ) + self._context = TollfreeVerificationContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: Tollfree Verification Sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def customer_profile_sid(self): - """ - :returns: Customer's Profile Bundle BundleSid - :rtype: unicode - """ - return self._properties['customer_profile_sid'] + - @property - def trust_product_sid(self): - """ - :returns: Tollfree TrustProduct Bundle BundleSid - :rtype: unicode - """ - return self._properties['trust_product_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def regulated_item_sid(self): - """ - :returns: The SID of the Regulated Item - :rtype: unicode - """ - return self._properties['regulated_item_sid'] - - @property - def business_name(self): - """ - :returns: The name of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_name'] - - @property - def business_street_address(self): - """ - :returns: The address of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_street_address'] - - @property - def business_street_address2(self): - """ - :returns: The address of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_street_address2'] - - @property - def business_city(self): - """ - :returns: The city of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_city'] - - @property - def business_state_province_region(self): - """ - :returns: The state/province/region of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_state_province_region'] - - @property - def business_postal_code(self): - """ - :returns: The postal code of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_postal_code'] - - @property - def business_country(self): - """ - :returns: The country of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_country'] - - @property - def business_website(self): - """ - :returns: The website of the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_website'] - - @property - def business_contact_first_name(self): - """ - :returns: The first name of the contact for the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_contact_first_name'] - - @property - def business_contact_last_name(self): - """ - :returns: The last name of the contact for the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_contact_last_name'] - - @property - def business_contact_email(self): - """ - :returns: The email address of the contact for the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_contact_email'] - - @property - def business_contact_phone(self): - """ - :returns: The phone number of the contact for the business or organization using the Tollfree number - :rtype: unicode - """ - return self._properties['business_contact_phone'] - - @property - def notification_email(self): - """ - :returns: The email address to receive the notification about the verification result. - :rtype: unicode - """ - return self._properties['notification_email'] - - @property - def use_case_categories(self): - """ - :returns: The category of the use case for the Tollfree Number. List as many are applicable. - :rtype: list[unicode] - """ - return self._properties['use_case_categories'] - - @property - def use_case_summary(self): - """ - :returns: Further explaination on how messaging is used by the business or organization - :rtype: unicode - """ - return self._properties['use_case_summary'] - - @property - def production_message_sample(self): - """ - :returns: An example of message content, i.e. a sample message - :rtype: unicode - """ - return self._properties['production_message_sample'] - - @property - def opt_in_image_urls(self): - """ - :returns: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL - :rtype: list[unicode] - """ - return self._properties['opt_in_image_urls'] - - @property - def opt_in_type(self): - """ - :returns: Describe how a user opts-in to text messages - :rtype: TollfreeVerificationInstance.OptInType - """ - return self._properties['opt_in_type'] - - @property - def message_volume(self): - """ - :returns: Estimate monthly volume of messages from the Tollfree Number - :rtype: unicode - """ - return self._properties['message_volume'] - - @property - def additional_information(self): - """ - :returns: Additional information to be provided for verification - :rtype: unicode - """ - return self._properties['additional_information'] - - @property - def tollfree_phone_number_sid(self): - """ - :returns: The SID of the Phone Number associated with the Tollfree Verification - :rtype: unicode - """ - return self._properties['tollfree_phone_number_sid'] - - @property - def status(self): + def __repr__(self): """ - :returns: The compliance status of the Tollfree Verification record. - :rtype: TollfreeVerificationInstance.Status + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['status'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Tollfree Verification - :rtype: unicode - """ - return self._properties['url'] - @property - def resource_links(self): - """ - :returns: The URLs of the documents associated with the Tollfree Verification resource - :rtype: dict - """ - return self._properties['resource_links'] - def fetch(self): - """ - Fetch the TollfreeVerificationInstance +class TollfreeVerificationListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(TollfreeVerificationListInstanceList, self).__init__(version) - :returns: The fetched TollfreeVerificationInstance - :rtype: twilio.rest.messaging.v1.tollfree_verification.TollfreeVerificationInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Tollfree/Verifications' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TollfreeVerificationInstance(self._version, payload, ) + + + def page(self, tollfree_phone_number_sid, status, page_size): + + data = values.of({ + 'tollfree_phone_number_sid': tollfree_phone_number_sid,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TollfreeVerificationPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/usecase.py b/twilio/rest/messaging/v1/usecase.py index 142a9d932b..0cd8f2f2aa 100644 --- a/twilio/rest/messaging/v1/usecase.py +++ b/twilio/rest/messaging/v1/usecase.py @@ -1,130 +1,83 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class UsecaseList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version): - """ - Initialize the UsecaseList - - :param Version version: Version that contains the resource - :returns: twilio.rest.messaging.v1.usecase.UsecaseList - :rtype: twilio.rest.messaging.v1.usecase.UsecaseList - """ - super(UsecaseList, self).__init__(version) - # Path Solution - self._solution = {} - self._uri = '/Services/Usecases'.format(**self._solution) +class UsecaseInstance(InstanceResource): + def __init__(self, version, payload): + super(UsecaseInstance, self).__init__(version) + self._properties = { + 'usecases' = payload.get('usecases'), + } - def fetch(self): - """ - Fetch the UsecaseInstance + self._context = None + self._solution = { + + } - :returns: The fetched UsecaseInstance - :rtype: twilio.rest.messaging.v1.usecase.UsecaseInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + @property + def _proxy(self): + if self._context is None: + self._context = UsecaseContext( + self._version, + + ) + return self._context - return UsecaseInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class UsecasePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the UsecasePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.messaging.v1.usecase.UsecasePage - :rtype: twilio.rest.messaging.v1.usecase.UsecasePage - """ - super(UsecasePage, self).__init__(version, response) +class UsecaseListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UsecaseListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsecaseInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.usecase.UsecaseInstance - :rtype: twilio.rest.messaging.v1.usecase.UsecaseInstance - """ - return UsecaseInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Services/Usecases' + + + def fetch(self): + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class UsecaseInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload): - """ - Initialize the UsecaseInstance - - :returns: twilio.rest.messaging.v1.usecase.UsecaseInstance - :rtype: twilio.rest.messaging.v1.usecase.UsecaseInstance - """ - super(UsecaseInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'usecases': payload.get('usecases'), } - - # Context - self._context = None - self._solution = {} - - @property - def usecases(self): - """ - :returns: Human readable Messaging Service Use Case details - :rtype: list[dict] - """ - return self._properties['usecases'] - - def __repr__(self): - """ - Provide a friendly representation + return '' - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/microvisor/__init__.py b/twilio/rest/microvisor/__init__.py index d359b68f1b..6127f03758 100644 --- a/twilio/rest/microvisor/__init__.py +++ b/twilio/rest/microvisor/__init__.py @@ -1,59 +1,62 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.microvisor.v1 import V1 + Twilio - Microvisor + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Microvisor(Domain): +from twilio.base.domain import Domain +from twilio.rest.Microvisor.v1 import V1 +class Microvisor(Domain): def __init__(self, twilio): """ Initialize the Microvisor Domain :returns: Domain for Microvisor - :rtype: twilio.rest.microvisor.Microvisor + :rtype: twilio.rest.v1.Microvisor """ super(Microvisor, self).__init__(twilio) - - self.base_url = 'https://microvisor.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Microvisor.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of microvisor - :rtype: twilio.rest.microvisor.v1.V1 + :returns: Versions v1 of Microvisor + :rtype: twilio.rest.Microvisor.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def apps(self): """ - :rtype: twilio.rest.microvisor.v1.app.AppList + :rtype: twilio.rest.v1.apps """ return self.v1.apps + @property def devices(self): """ - :rtype: twilio.rest.microvisor.v1.device.DeviceList + :rtype: twilio.rest.v1.devices """ return self.v1.devices + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/microvisor/v1/.openapi-generator-ignore b/twilio/rest/microvisor/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/microvisor/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/microvisor/v1/.openapi-generator/FILES b/twilio/rest/microvisor/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..b9b874d9b7 --- /dev/null +++ b/twilio/rest/microvisor/v1/.openapi-generator/FILES @@ -0,0 +1,5 @@ +../__init__.py +../__init__.py +.openapi-generator-ignore +app.py +device.py diff --git a/twilio/rest/microvisor/v1/.openapi-generator/VERSION b/twilio/rest/microvisor/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/microvisor/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/microvisor/v1/app.py b/twilio/rest/microvisor/v1/app.py index 8f2fc29787..279f3981c2 100644 --- a/twilio/rest/microvisor/v1/app.py +++ b/twilio/rest/microvisor/v1/app.py @@ -1,363 +1,145 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Microvisor + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AppList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the AppList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.microvisor.v1.app.AppList - :rtype: twilio.rest.microvisor.v1.app.AppList - """ - super(AppList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Apps'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AppInstance 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 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.microvisor.v1.app.AppInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AppInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.microvisor.v1.app.AppInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AppInstance records from the API. - Request is executed immediately - - :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 AppInstance - :rtype: twilio.rest.microvisor.v1.app.AppPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AppPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AppInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AppInstance - :rtype: twilio.rest.microvisor.v1.app.AppPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AppPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AppContext - - :param sid: A string that uniquely identifies this App. - - :returns: twilio.rest.microvisor.v1.app.AppContext - :rtype: twilio.rest.microvisor.v1.app.AppContext - """ - return AppContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AppContext - - :param sid: A string that uniquely identifies this App. - - :returns: twilio.rest.microvisor.v1.app.AppContext - :rtype: twilio.rest.microvisor.v1.app.AppContext - """ - return AppContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AppPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AppPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.microvisor.v1.app.AppPage - :rtype: twilio.rest.microvisor.v1.app.AppPage - """ - super(AppPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AppInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.microvisor.v1.app.AppInstance - :rtype: twilio.rest.microvisor.v1.app.AppInstance - """ - return AppInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class AppContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the AppContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this App. - - :returns: twilio.rest.microvisor.v1.app.AppContext - :rtype: twilio.rest.microvisor.v1.app.AppContext - """ - super(AppContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(AppContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Apps/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AppInstance - - :returns: The fetched AppInstance - :rtype: twilio.rest.microvisor.v1.app.AppInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AppInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the AppInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Apps/${sid}' + + + def delete(self): + + + """ + Deletes the AppInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AppInstance + + :returns: The fetched AppInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AppInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class AppInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the AppInstance - :returns: twilio.rest.microvisor.v1.app.AppInstance - :rtype: twilio.rest.microvisor.v1.app.AppInstance - """ +class AppInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(AppInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'hash': payload.get('hash'), - 'unique_name': payload.get('unique_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'hash' = payload.get('hash'), + 'unique_name' = payload.get('unique_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AppContext for this AppInstance - :rtype: twilio.rest.microvisor.v1.app.AppContext - """ if self._context is None: - self._context = AppContext(self._version, sid=self._solution['sid'], ) + self._context = AppContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this App. - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): - """ - :returns: The Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def hash(self): - """ - :returns: App manifest hash represented as hash_algorithm:hash_value. - :rtype: unicode - """ - return self._properties['hash'] - - @property - def unique_name(self): - """ - :returns: An developer-defined string that uniquely identifies the App. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def date_created(self): + def __repr__(self): """ - :returns: The date that this App was created. - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The date that this App was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the AppInstance +class AppListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AppListInstanceList, self).__init__(version) - :returns: The fetched AppInstance - :rtype: twilio.rest.microvisor.v1.app.AppInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Apps' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def delete(self): - """ - Deletes the AppInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return AppPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/microvisor/v1/device.py b/twilio/rest/microvisor/v1/device.py new file mode 100644 index 0000000000..325ee491e8 --- /dev/null +++ b/twilio/rest/microvisor/v1/device.py @@ -0,0 +1,147 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Microvisor + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class DeviceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(DeviceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Devices/${sid}' + + + def fetch(self): + + """ + Fetch the DeviceInstance + + :returns: The fetched DeviceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DeviceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return DeviceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class DeviceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(DeviceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'app' = payload.get('app'), + 'logging' = payload.get('logging'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = DeviceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class DeviceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(DeviceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Devices' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DevicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/monitor/__init__.py b/twilio/rest/monitor/__init__.py index 3c4ba1e5c8..c84d87d451 100644 --- a/twilio/rest/monitor/__init__.py +++ b/twilio/rest/monitor/__init__.py @@ -1,59 +1,62 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.monitor.v1 import V1 + Twilio - Monitor + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Monitor(Domain): +from twilio.base.domain import Domain +from twilio.rest.Monitor.v1 import V1 +class Monitor(Domain): def __init__(self, twilio): """ Initialize the Monitor Domain :returns: Domain for Monitor - :rtype: twilio.rest.monitor.Monitor + :rtype: twilio.rest.v1.Monitor """ super(Monitor, self).__init__(twilio) - - self.base_url = 'https://monitor.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Monitor.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of monitor - :rtype: twilio.rest.monitor.v1.V1 + :returns: Versions v1 of Monitor + :rtype: twilio.rest.Monitor.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def alerts(self): """ - :rtype: twilio.rest.monitor.v1.alert.AlertList + :rtype: twilio.rest.v1.alerts """ return self.v1.alerts + @property def events(self): """ - :rtype: twilio.rest.monitor.v1.event.EventList + :rtype: twilio.rest.v1.events """ return self.v1.events + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/monitor/v1/.openapi-generator-ignore b/twilio/rest/monitor/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/monitor/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/monitor/v1/.openapi-generator/FILES b/twilio/rest/monitor/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..1df98db76a --- /dev/null +++ b/twilio/rest/monitor/v1/.openapi-generator/FILES @@ -0,0 +1,5 @@ +../__init__.py +../__init__.py +.openapi-generator-ignore +alert.py +event.py diff --git a/twilio/rest/monitor/v1/.openapi-generator/VERSION b/twilio/rest/monitor/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/monitor/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/monitor/v1/alert.py b/twilio/rest/monitor/v1/alert.py index 7a7e88d03c..fe99609c8d 100644 --- a/twilio/rest/monitor/v1/alert.py +++ b/twilio/rest/monitor/v1/alert.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Monitor + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,461 +19,128 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AlertList(ListResource): - - def __init__(self, version): - """ - Initialize the AlertList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.monitor.v1.alert.AlertList - :rtype: twilio.rest.monitor.v1.alert.AlertList - """ - super(AlertList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Alerts'.format(**self._solution) - - def stream(self, log_level=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams AlertInstance 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 log_level: Only show alerts for this log-level - :param datetime start_date: Only include alerts that occurred on or after this date and time - :param datetime end_date: Only include alerts that occurred on or before this date and time - :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.monitor.v1.alert.AlertInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - log_level=log_level, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, log_level=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists AlertInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - :param unicode log_level: Only show alerts for this log-level - :param datetime start_date: Only include alerts that occurred on or after this date and time - :param datetime end_date: Only include alerts that occurred on or before this date and time - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.monitor.v1.alert.AlertInstance] - """ - return list(self.stream( - log_level=log_level, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, log_level=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AlertInstance records from the API. - Request is executed immediately - - :param unicode log_level: Only show alerts for this log-level - :param datetime start_date: Only include alerts that occurred on or after this date and time - :param datetime end_date: Only include alerts that occurred on or before this date and time - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertPage - """ - data = values.of({ - 'LogLevel': log_level, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AlertPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AlertInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AlertPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AlertContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.monitor.v1.alert.AlertContext - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ - return AlertContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AlertContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.monitor.v1.alert.AlertContext - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ - return AlertContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AlertPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AlertPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.monitor.v1.alert.AlertPage - :rtype: twilio.rest.monitor.v1.alert.AlertPage - """ - super(AlertPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AlertInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.monitor.v1.alert.AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ - return AlertInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AlertContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the AlertContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.monitor.v1.alert.AlertContext - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ - super(AlertContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(AlertContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Alerts/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AlertInstance - - :returns: The fetched AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AlertInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Alerts/${sid}' + + + def fetch(self): + + """ + Fetch the AlertInstance + + :returns: The fetched AlertInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AlertInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AlertInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the AlertInstance - :returns: twilio.rest.monitor.v1.alert.AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ +class AlertInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(AlertInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'alert_text': payload.get('alert_text'), - 'api_version': payload.get('api_version'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_generated': deserialize.iso8601_datetime(payload.get('date_generated')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'error_code': payload.get('error_code'), - 'log_level': payload.get('log_level'), - 'more_info': payload.get('more_info'), - 'request_method': payload.get('request_method'), - 'request_url': payload.get('request_url'), - 'request_variables': payload.get('request_variables'), - 'resource_sid': payload.get('resource_sid'), - 'response_body': payload.get('response_body'), - 'response_headers': payload.get('response_headers'), - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'request_headers': payload.get('request_headers'), - 'service_sid': payload.get('service_sid'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'alert_text' = payload.get('alert_text'), + 'api_version' = payload.get('api_version'), + 'date_created' = payload.get('date_created'), + 'date_generated' = payload.get('date_generated'), + 'date_updated' = payload.get('date_updated'), + 'error_code' = payload.get('error_code'), + 'log_level' = payload.get('log_level'), + 'more_info' = payload.get('more_info'), + 'request_method' = payload.get('request_method'), + 'request_url' = payload.get('request_url'), + 'request_variables' = payload.get('request_variables'), + 'resource_sid' = payload.get('resource_sid'), + 'response_body' = payload.get('response_body'), + 'response_headers' = payload.get('response_headers'), + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'request_headers' = payload.get('request_headers'), + 'service_sid' = payload.get('service_sid'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AlertContext for this AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertContext - """ if self._context is None: - self._context = AlertContext(self._version, sid=self._solution['sid'], ) + self._context = AlertContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def alert_text(self): - """ - :returns: The text of the alert - :rtype: unicode - """ - return self._properties['alert_text'] - - @property - def api_version(self): - """ - :returns: The API version used when the alert was generated - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_generated(self): - """ - :returns: The date and time when the alert was generated specified in ISO 8601 format - :rtype: datetime - """ - return self._properties['date_generated'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def error_code(self): - """ - :returns: The error code for the condition that generated the alert - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def log_level(self): - """ - :returns: The log level - :rtype: unicode - """ - return self._properties['log_level'] - - @property - def more_info(self): - """ - :returns: The URL of the page in our Error Dictionary with more information about the error condition - :rtype: unicode - """ - return self._properties['more_info'] + - @property - def request_method(self): - """ - :returns: The method used by the request that generated the alert - :rtype: unicode - """ - return self._properties['request_method'] - - @property - def request_url(self): - """ - :returns: The URL of the request that generated the alert - :rtype: unicode - """ - return self._properties['request_url'] - - @property - def request_variables(self): - """ - :returns: The variables passed in the request that generated the alert - :rtype: unicode - """ - return self._properties['request_variables'] - - @property - def resource_sid(self): - """ - :returns: The SID of the resource for which the alert was generated - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def response_body(self): - """ - :returns: The response body of the request that generated the alert - :rtype: unicode - """ - return self._properties['response_body'] - - @property - def response_headers(self): + def __repr__(self): """ - :returns: The response headers of the request that generated the alert - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['response_headers'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - @property - def url(self): - """ - :returns: The absolute URL of the Alert resource - :rtype: unicode - """ - return self._properties['url'] - @property - def request_headers(self): - """ - :returns: The request headers of the request that generated the alert - :rtype: unicode - """ - return self._properties['request_headers'] +class AlertListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(AlertListInstanceList, self).__init__(version) - @property - def service_sid(self): - """ - :returns: The SID of the service or resource that generated the alert - :rtype: unicode - """ - return self._properties['service_sid'] + # Path Solution + self._solution = { } + self._uri = '/Alerts' + + + def page(self, log_level, start_date, end_date, page_size): + + data = values.of({ + 'log_level': log_level,'start_date': start_date,'end_date': end_date,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the AlertInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched AlertInstance - :rtype: twilio.rest.monitor.v1.alert.AlertInstance - """ - return self._proxy.fetch() + return AlertPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py index 71129c3064..a8f1d4f638 100644 --- a/twilio/rest/monitor/v1/event.py +++ b/twilio/rest/monitor/v1/event.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Monitor + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,440 +19,123 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EventList(ListResource): - - def __init__(self, version): - """ - Initialize the EventList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.monitor.v1.event.EventList - :rtype: twilio.rest.monitor.v1.event.EventList - """ - super(EventList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Events'.format(**self._solution) - - def stream(self, actor_sid=values.unset, event_type=values.unset, - resource_sid=values.unset, source_ip_address=values.unset, - start_date=values.unset, end_date=values.unset, limit=None, - page_size=None): - """ - Streams EventInstance 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 actor_sid: Only include events initiated by this Actor - :param unicode event_type: Only include events of this Event Type - :param unicode resource_sid: Only include events that refer to this resource - :param unicode source_ip_address: Only include events that originated from this IP address - :param datetime start_date: Only include events that occurred on or after this date - :param datetime end_date: Only include events that occurred on or before this date - :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.monitor.v1.event.EventInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - actor_sid=actor_sid, - event_type=event_type, - resource_sid=resource_sid, - source_ip_address=source_ip_address, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - return self._version.stream(page, limits['limit']) - - def list(self, actor_sid=values.unset, event_type=values.unset, - resource_sid=values.unset, source_ip_address=values.unset, - start_date=values.unset, end_date=values.unset, limit=None, - page_size=None): - """ - Lists EventInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode actor_sid: Only include events initiated by this Actor - :param unicode event_type: Only include events of this Event Type - :param unicode resource_sid: Only include events that refer to this resource - :param unicode source_ip_address: Only include events that originated from this IP address - :param datetime start_date: Only include events that occurred on or after this date - :param datetime end_date: Only include events that occurred on or before this date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.monitor.v1.event.EventInstance] - """ - return list(self.stream( - actor_sid=actor_sid, - event_type=event_type, - resource_sid=resource_sid, - source_ip_address=source_ip_address, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, actor_sid=values.unset, event_type=values.unset, - resource_sid=values.unset, source_ip_address=values.unset, - start_date=values.unset, end_date=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EventInstance records from the API. - Request is executed immediately - - :param unicode actor_sid: Only include events initiated by this Actor - :param unicode event_type: Only include events of this Event Type - :param unicode resource_sid: Only include events that refer to this resource - :param unicode source_ip_address: Only include events that originated from this IP address - :param datetime start_date: Only include events that occurred on or after this date - :param datetime end_date: Only include events that occurred on or before this date - :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 EventInstance - :rtype: twilio.rest.monitor.v1.event.EventPage - """ - data = values.of({ - 'ActorSid': actor_sid, - 'EventType': event_type, - 'ResourceSid': resource_sid, - 'SourceIpAddress': source_ip_address, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EventPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EventInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EventInstance - :rtype: twilio.rest.monitor.v1.event.EventPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EventPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EventContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.monitor.v1.event.EventContext - :rtype: twilio.rest.monitor.v1.event.EventContext - """ - return EventContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EventContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.monitor.v1.event.EventContext - :rtype: twilio.rest.monitor.v1.event.EventContext - """ - return EventContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EventPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EventPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.monitor.v1.event.EventPage - :rtype: twilio.rest.monitor.v1.event.EventPage - """ - super(EventPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EventInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.monitor.v1.event.EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ - return EventInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class EventContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the EventContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.monitor.v1.event.EventContext - :rtype: twilio.rest.monitor.v1.event.EventContext - """ - super(EventContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(EventContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Events/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EventInstance - - :returns: The fetched EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EventInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Events/${sid}' + + + def fetch(self): + + """ + Fetch the EventInstance + + :returns: The fetched EventInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EventInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class EventInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the EventInstance - :returns: twilio.rest.monitor.v1.event.EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ +class EventInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(EventInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'actor_sid': payload.get('actor_sid'), - 'actor_type': payload.get('actor_type'), - 'description': payload.get('description'), - 'event_data': payload.get('event_data'), - 'event_date': deserialize.iso8601_datetime(payload.get('event_date')), - 'event_type': payload.get('event_type'), - 'resource_sid': payload.get('resource_sid'), - 'resource_type': payload.get('resource_type'), - 'sid': payload.get('sid'), - 'source': payload.get('source'), - 'source_ip_address': payload.get('source_ip_address'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'actor_sid' = payload.get('actor_sid'), + 'actor_type' = payload.get('actor_type'), + 'description' = payload.get('description'), + 'event_data' = payload.get('event_data'), + 'event_date' = payload.get('event_date'), + 'event_type' = payload.get('event_type'), + 'resource_sid' = payload.get('resource_sid'), + 'resource_type' = payload.get('resource_type'), + 'sid' = payload.get('sid'), + 'source' = payload.get('source'), + 'source_ip_address' = payload.get('source_ip_address'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EventContext for this EventInstance - :rtype: twilio.rest.monitor.v1.event.EventContext - """ if self._context is None: - self._context = EventContext(self._version, sid=self._solution['sid'], ) + self._context = EventContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def actor_sid(self): - """ - :returns: The SID of the actor that caused the event, if available - :rtype: unicode - """ - return self._properties['actor_sid'] - - @property - def actor_type(self): - """ - :returns: The type of actor that caused the event - :rtype: unicode - """ - return self._properties['actor_type'] - - @property - def description(self): - """ - :returns: A description of the event - :rtype: unicode - """ - return self._properties['description'] + - @property - def event_data(self): - """ - :returns: A JSON string that represents an object with additional data about the event - :rtype: dict - """ - return self._properties['event_data'] - - @property - def event_date(self): - """ - :returns: The ISO 8601 date and time in GMT when the event was recorded - :rtype: datetime - """ - return self._properties['event_date'] - - @property - def event_type(self): - """ - :returns: The event's type - :rtype: unicode - """ - return self._properties['event_type'] - - @property - def resource_sid(self): - """ - :returns: The SID of the resource that was affected - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def resource_type(self): - """ - :returns: The type of resource that was affected - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def sid(self): + def __repr__(self): """ - :returns: The unique string that identifies the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def source(self): - """ - :returns: The originating system or interface that caused the event - :rtype: unicode - """ - return self._properties['source'] - @property - def source_ip_address(self): - """ - :returns: The IP address of the source - :rtype: unicode - """ - return self._properties['source_ip_address'] - @property - def url(self): - """ - :returns: The absolute URL of the resource that was affected - :rtype: unicode - """ - return self._properties['url'] +class EventListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(EventListInstanceList, self).__init__(version) - @property - def links(self): - """ - :returns: The absolute URLs of related resources - :rtype: unicode - """ - return self._properties['links'] + # Path Solution + self._solution = { } + self._uri = '/Events' + + + def page(self, actor_sid, event_type, resource_sid, source_ip_address, start_date, end_date, page_size): + + data = values.of({ + 'actor_sid': actor_sid,'event_type': event_type,'resource_sid': resource_sid,'source_ip_address': source_ip_address,'start_date': start_date,'end_date': end_date,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the EventInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched EventInstance - :rtype: twilio.rest.monitor.v1.event.EventInstance - """ - return self._proxy.fetch() + return EventPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/notify/__init__.py b/twilio/rest/notify/__init__.py index 888e70e4b3..f4c2583e39 100644 --- a/twilio/rest/notify/__init__.py +++ b/twilio/rest/notify/__init__.py @@ -1,59 +1,62 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.notify.v1 import V1 + Twilio - Notify + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Notify(Domain): +from twilio.base.domain import Domain +from twilio.rest.Notify.v1 import V1 +class Notify(Domain): def __init__(self, twilio): """ Initialize the Notify Domain :returns: Domain for Notify - :rtype: twilio.rest.notify.Notify + :rtype: twilio.rest.v1.Notify """ super(Notify, self).__init__(twilio) - - self.base_url = 'https://notify.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Notify.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of notify - :rtype: twilio.rest.notify.v1.V1 + :returns: Versions v1 of Notify + :rtype: twilio.rest.Notify.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def credentials(self): """ - :rtype: twilio.rest.notify.v1.credential.CredentialList + :rtype: twilio.rest.v1.credentials """ return self.v1.credentials + @property def services(self): """ - :rtype: twilio.rest.notify.v1.service.ServiceList + :rtype: twilio.rest.v1.services """ return self.v1.services + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/notify/v1/.openapi-generator-ignore b/twilio/rest/notify/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/notify/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/notify/v1/.openapi-generator/FILES b/twilio/rest/notify/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..2b37c85aa2 --- /dev/null +++ b/twilio/rest/notify/v1/.openapi-generator/FILES @@ -0,0 +1,9 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +credential.py +service.py +service/binding.py +service/notification.py diff --git a/twilio/rest/notify/v1/.openapi-generator/VERSION b/twilio/rest/notify/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/notify/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index 9edd701442..304b00b3b8 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -1,458 +1,167 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CredentialList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.notify.v1.credential.CredentialList - :rtype: twilio.rest.notify.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Credentials'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialInstance 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 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.notify.v1.credential.CredentialInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.notify.v1.credential.CredentialInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialInstance records from the API. - Request is executed immediately - - :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 CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialPage(self._version, response, self._solution) - - def create(self, type, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Create the CredentialInstance - - :param CredentialInstance.PushService type: The Credential type - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL-encoded representation of the certificate - :param unicode private_key: [APN only] URL-encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging - :param unicode secret: [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging - - :returns: The created CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - data = values.of({ - 'Type': type, - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, ) - def get(self, sid): - """ - Constructs a CredentialContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.credential.CredentialContext - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.credential.CredentialContext - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ - return CredentialContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.notify.v1.credential.CredentialPage - :rtype: twilio.rest.notify.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.credential.CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CredentialContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the CredentialContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.credential.CredentialContext - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ - super(CredentialContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CredentialContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Credentials/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL-encoded representation of the certificate - :param unicode private_key: [APN only] URL-encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging - :param unicode secret: [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging - - :returns: The updated CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Certificate': certificate, - 'PrivateKey': private_key, - 'Sandbox': sandbox, - 'ApiKey': api_key, - 'Secret': secret, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CredentialInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Credentials/${sid}' + + + def delete(self): + + + """ + Deletes the CredentialInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialInstance + + :returns: The fetched CredentialInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CredentialInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class PushService(object): - GCM = "gcm" - APN = "apn" - FCM = "fcm" - def __init__(self, version, payload, sid=None): - """ - Initialize the CredentialInstance - :returns: twilio.rest.notify.v1.credential.CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ +class CredentialInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(CredentialInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'sandbox': payload.get('sandbox'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'sandbox' = payload.get('sandbox'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialContext for this CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialContext - """ if self._context is None: - self._context = CredentialContext(self._version, sid=self._solution['sid'], ) + self._context = CredentialContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The Credential type, one of `gcm`, `fcm`, or `apn` - :rtype: CredentialInstance.PushService - """ - return self._properties['type'] - - @property - def sandbox(self): - """ - :returns: [APN only] Whether to send the credential to sandbox APNs - :rtype: unicode - """ - return self._properties['sandbox'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Credential resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): + def __repr__(self): """ - Fetch the CredentialInstance - - :returns: The fetched CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, friendly_name=values.unset, certificate=values.unset, - private_key=values.unset, sandbox=values.unset, api_key=values.unset, - secret=values.unset): - """ - Update the CredentialInstance - :param unicode friendly_name: A string to describe the resource - :param unicode certificate: [APN only] The URL-encoded representation of the certificate - :param unicode private_key: [APN only] URL-encoded representation of the private key - :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs - :param unicode api_key: [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging - :param unicode secret: [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging - :returns: The updated CredentialInstance - :rtype: twilio.rest.notify.v1.credential.CredentialInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - certificate=certificate, - private_key=private_key, - sandbox=sandbox, - api_key=api_key, - secret=secret, - ) - - def delete(self): - """ - Deletes the CredentialInstance +class CredentialListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CredentialListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/Credentials' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/notify/v1/service.py b/twilio/rest/notify/v1/service.py new file mode 100644 index 0000000000..ff683a35aa --- /dev/null +++ b/twilio/rest/notify/v1/service.py @@ -0,0 +1,187 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.notification import NotificationListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._bindings = None + self._notifications = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'apn_credential_sid' = payload.get('apn_credential_sid'), + 'gcm_credential_sid' = payload.get('gcm_credential_sid'), + 'fcm_credential_sid' = payload.get('fcm_credential_sid'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'facebook_messenger_page_id' = payload.get('facebook_messenger_page_id'), + 'default_apn_notification_protocol_version' = payload.get('default_apn_notification_protocol_version'), + 'default_gcm_notification_protocol_version' = payload.get('default_gcm_notification_protocol_version'), + 'default_fcm_notification_protocol_version' = payload.get('default_fcm_notification_protocol_version'), + 'log_enabled' = payload.get('log_enabled'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'alexa_skill_id' = payload.get('alexa_skill_id'), + 'default_alexa_notification_protocol_version' = payload.get('default_alexa_notification_protocol_version'), + 'delivery_callback_url' = payload.get('delivery_callback_url'), + 'delivery_callback_enabled' = payload.get('delivery_callback_enabled'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def bindings(self): + return self._proxy.bindings + @property + def notifications(self): + return self._proxy.notifications + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/notify/v1/service/binding.py b/twilio/rest/notify/v1/service/binding.py index 78bc017703..b8dc26bd5e 100644 --- a/twilio/rest/notify/v1/service/binding.py +++ b/twilio/rest/notify/v1/service/binding.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,499 +19,144 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BindingList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the BindingList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.notify.v1.service.binding.BindingList - :rtype: twilio.rest.notify.v1.service.binding.BindingList - """ - super(BindingList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Bindings'.format(**self._solution) - - def create(self, identity, binding_type, address, tag=values.unset, - notification_protocol_version=values.unset, - credential_sid=values.unset, endpoint=values.unset): - """ - Create the 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 list[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: The 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(method='POST', uri=self._uri, data=data, ) - - return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, start_date=values.unset, end_date=values.unset, - identity=values.unset, tag=values.unset, limit=None, page_size=None): - """ - Streams BindingInstance 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 date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param list[unicode] identity: The `identity` value of the resources to read - :param list[unicode] tag: Only list Bindings that have all of the specified Tags - :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.notify.v1.service.binding.BindingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - start_date=start_date, - end_date=end_date, - identity=identity, - tag=tag, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, start_date=values.unset, end_date=values.unset, - identity=values.unset, tag=values.unset, limit=None, page_size=None): - """ - Lists BindingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param list[unicode] identity: The `identity` value of the resources to read - :param list[unicode] tag: Only list Bindings that have all of the specified Tags - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.notify.v1.service.binding.BindingInstance] - """ - return list(self.stream( - start_date=start_date, - end_date=end_date, - identity=identity, - tag=tag, - limit=limit, - page_size=page_size, - )) - - def page(self, start_date=values.unset, end_date=values.unset, - identity=values.unset, tag=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of BindingInstance records from the API. - Request is executed immediately - - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param list[unicode] identity: The `identity` value of the resources to read - :param list[unicode] tag: Only list Bindings that have all of the specified Tags - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingPage - """ - data = values.of({ - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'Identity': serialize.map(identity, lambda e: e), - 'Tag': serialize.map(tag, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BindingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BindingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return BindingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BindingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.service.binding.BindingContext - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BindingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.service.binding.BindingContext - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ - return BindingContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BindingPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the BindingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.notify.v1.service.binding.BindingPage - :rtype: twilio.rest.notify.v1.service.binding.BindingPage - """ - super(BindingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BindingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.binding.BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class BindingContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the BindingContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.service.binding.BindingContext - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ - super(BindingContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BindingContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Bindings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the BindingInstance - - :returns: The fetched BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BindingInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the BindingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Bindings/${sid}' + + + def delete(self): + + + """ + Deletes the BindingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the BindingInstance + + :returns: The fetched BindingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BindingInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class BindingInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class BindingType(object): - APN = "apn" - GCM = "gcm" - SMS = "sms" - FCM = "fcm" - FACEBOOK_MESSENGER = "facebook-messenger" - ALEXA = "alexa" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the BindingInstance - :returns: twilio.rest.notify.v1.service.binding.BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ +class BindingInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(BindingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'credential_sid': payload.get('credential_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'notification_protocol_version': payload.get('notification_protocol_version'), - 'endpoint': payload.get('endpoint'), - 'identity': payload.get('identity'), - 'binding_type': payload.get('binding_type'), - 'address': payload.get('address'), - 'tags': payload.get('tags'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'credential_sid' = payload.get('credential_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'notification_protocol_version' = payload.get('notification_protocol_version'), + 'endpoint' = payload.get('endpoint'), + 'identity' = payload.get('identity'), + 'binding_type' = payload.get('binding_type'), + 'address' = payload.get('address'), + 'tags' = payload.get('tags'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BindingContext for this BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingContext - """ if self._context is None: self._context = BindingContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def credential_sid(self): - """ - :returns: The SID of the Credential resource to be used to send notifications to this Binding - :rtype: unicode - """ - return self._properties['credential_sid'] + - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def notification_protocol_version(self): - """ - :returns: The protocol version to use to send the notification - :rtype: unicode - """ - return self._properties['notification_protocol_version'] - - @property - def endpoint(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['endpoint'] - - @property - def identity(self): - """ - :returns: The `identity` value that identifies the new resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def binding_type(self): - """ - :returns: The type of the Binding - :rtype: unicode - """ - return self._properties['binding_type'] - - @property - def address(self): - """ - :returns: The channel-specific address - :rtype: unicode - """ - return self._properties['address'] - - @property - def tags(self): - """ - :returns: The list of tags associated with this Binding - :rtype: list[unicode] - """ - return self._properties['tags'] - - @property - def url(self): - """ - :returns: The absolute URL of the Binding resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): + def __repr__(self): """ - :returns: The URLs of related resources - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the BindingInstance - :returns: The fetched BindingInstance - :rtype: twilio.rest.notify.v1.service.binding.BindingInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the BindingInstance +class BindingListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(BindingListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Bindings' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return BindingInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, start_date, end_date, identity, tag, page_size): + + data = values.of({ + 'start_date': start_date,'end_date': end_date,'identity': identity,'tag': tag,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BindingPage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/notify/v1/service/notification.py b/twilio/rest/notify/v1/service/notification.py index 7bc9df62fe..0a025199be 100644 --- a/twilio/rest/notify/v1/service/notification.py +++ b/twilio/rest/notify/v1/service/notification.py @@ -1,357 +1,108 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NotificationList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the NotificationList - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :returns: twilio.rest.notify.v1.service.notification.NotificationList - :rtype: twilio.rest.notify.v1.service.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Notifications'.format(**self._solution) - 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, - delivery_callback_url=values.unset, identity=values.unset, - tag=values.unset): - """ - Create the 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 list[unicode] segment: A Segment to notify - :param dict alexa: Deprecated - :param list[unicode] to_binding: The destination address specified as a JSON string - :param unicode delivery_callback_url: URL to send webhooks - :param list[unicode] identity: The `identity` value that identifies the new resource's User - :param list[unicode] tag: A tag that selects the Bindings to notify +class NotificationInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str): + super(NotificationInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'identities' = payload.get('identities'), + 'tags' = payload.get('tags'), + 'segments' = payload.get('segments'), + 'priority' = payload.get('priority'), + 'ttl' = payload.get('ttl'), + 'title' = payload.get('title'), + 'body' = payload.get('body'), + 'sound' = payload.get('sound'), + 'action' = payload.get('action'), + 'data' = payload.get('data'), + 'apn' = payload.get('apn'), + 'gcm' = payload.get('gcm'), + 'fcm' = payload.get('fcm'), + 'sms' = payload.get('sms'), + 'facebook_messenger' = payload.get('facebook_messenger'), + 'alexa' = payload.get('alexa'), + } - :returns: The 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), - 'DeliveryCallbackUrl': delivery_callback_url, - }) + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = NotificationContext( + self._version, + service_sid=self._solution['service_sid'], + ) + return self._context - return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class NotificationPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :returns: twilio.rest.notify.v1.service.notification.NotificationPage - :rtype: twilio.rest.notify.v1.service.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) +class NotificationListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(NotificationListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NotificationInstance + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Notifications' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.notify.v1.service.notification.NotificationInstance - :rtype: twilio.rest.notify.v1.service.notification.NotificationInstance - """ - return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid'], ) + return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class NotificationInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Priority(object): - HIGH = "high" - LOW = "low" - - def __init__(self, version, payload, service_sid): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.notify.v1.service.notification.NotificationInstance - :rtype: twilio.rest.notify.v1.service.notification.NotificationInstance - """ - super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'identities': payload.get('identities'), - 'tags': payload.get('tags'), - 'segments': payload.get('segments'), - 'priority': payload.get('priority'), - 'ttl': deserialize.integer(payload.get('ttl')), - 'title': payload.get('title'), - 'body': payload.get('body'), - 'sound': payload.get('sound'), - 'action': payload.get('action'), - 'data': payload.get('data'), - 'apn': payload.get('apn'), - 'gcm': payload.get('gcm'), - 'fcm': payload.get('fcm'), - 'sms': payload.get('sms'), - 'facebook_messenger': payload.get('facebook_messenger'), - 'alexa': payload.get('alexa'), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def identities(self): - """ - :returns: The list of identity values of the Users to notify - :rtype: list[unicode] - """ - return self._properties['identities'] - - @property - def tags(self): - """ - :returns: The tags that select the Bindings to notify - :rtype: list[unicode] - """ - return self._properties['tags'] + return '' - @property - def segments(self): - """ - :returns: The list of Segments to notify - :rtype: list[unicode] - """ - return self._properties['segments'] - - @property - def priority(self): - """ - :returns: The priority of the notification - :rtype: NotificationInstance.Priority - """ - return self._properties['priority'] - - @property - def ttl(self): - """ - :returns: How long, in seconds, the notification is valid - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def title(self): - """ - :returns: The notification title - :rtype: unicode - """ - return self._properties['title'] - - @property - def body(self): - """ - :returns: The notification body text - :rtype: unicode - """ - return self._properties['body'] - - @property - def sound(self): - """ - :returns: The name of the sound to be played for the notification - :rtype: unicode - """ - return self._properties['sound'] - - @property - def action(self): - """ - :returns: The actions to display for the notification - :rtype: unicode - """ - return self._properties['action'] - - @property - def data(self): - """ - :returns: The custom key-value pairs of the notification's payload - :rtype: dict - """ - return self._properties['data'] - - @property - def apn(self): - """ - :returns: The APNS-specific payload that overrides corresponding attributes in a generic payload for APNS Bindings - :rtype: dict - """ - return self._properties['apn'] - - @property - def gcm(self): - """ - :returns: The GCM-specific payload that overrides corresponding attributes in generic payload for GCM Bindings - :rtype: dict - """ - return self._properties['gcm'] - - @property - def fcm(self): - """ - :returns: The FCM-specific payload that overrides corresponding attributes in generic payload for FCM Bindings - :rtype: dict - """ - return self._properties['fcm'] - - @property - def sms(self): - """ - :returns: The SMS-specific payload that overrides corresponding attributes in generic payload for SMS Bindings - :rtype: dict - """ - return self._properties['sms'] - - @property - def facebook_messenger(self): - """ - :returns: Deprecated - :rtype: dict - """ - return self._properties['facebook_messenger'] - - @property - def alexa(self): - """ - :returns: Deprecated - :rtype: dict - """ - return self._properties['alexa'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/numbers/__init__.py b/twilio/rest/numbers/__init__.py index ec01621114..9d7d4e2305 100644 --- a/twilio/rest/numbers/__init__.py +++ b/twilio/rest/numbers/__init__.py @@ -1,52 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.numbers.v2 import V2 + Twilio - Numbers + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Numbers(Domain): +from twilio.base.domain import Domain +from twilio.rest.Numbers.v2 import V2 +class Numbers(Domain): def __init__(self, twilio): """ Initialize the Numbers Domain :returns: Domain for Numbers - :rtype: twilio.rest.numbers.Numbers + :rtype: twilio.rest.v2.Numbers """ super(Numbers, self).__init__(twilio) - - self.base_url = 'https://numbers.twilio.com' - - # Versions - self._v2 = None + self.base_url = 'https://Numbers.twilio.com' + self._V2 = None @property - def v2(self): + def V2(self): """ - :returns: Version v2 of numbers - :rtype: twilio.rest.numbers.v2.V2 + :returns: Versions v2 of Numbers + :rtype: twilio.rest.Numbers.v2 """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + @property def regulatory_compliance(self): """ - :rtype: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryComplianceList + :rtype: twilio.rest.v2.regulatory_compliance """ return self.v2.regulatory_compliance + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/numbers/v2/.openapi-generator-ignore b/twilio/rest/numbers/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/numbers/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/numbers/v2/.openapi-generator/FILES b/twilio/rest/numbers/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..da20faca86 --- /dev/null +++ b/twilio/rest/numbers/v2/.openapi-generator/FILES @@ -0,0 +1,23 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +regulatory_compliance.py +regulatory_compliance/bundle.py +regulatory_compliance/bundle/bundle_copy.py +regulatory_compliance/bundle/evaluation.py +regulatory_compliance/bundle/item_assignment.py +regulatory_compliance/bundle/replace_items.py +regulatory_compliance/end_user.py +regulatory_compliance/end_user_type.py +regulatory_compliance/regulation.py +regulatory_compliance/supporting_document.py +regulatory_compliance/supporting_document_type.py diff --git a/twilio/rest/numbers/v2/.openapi-generator/VERSION b/twilio/rest/numbers/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/numbers/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/numbers/v2/regulatory_compliance.py b/twilio/rest/numbers/v2/regulatory_compliance.py new file mode 100644 index 0000000000..4187fe0d7b --- /dev/null +++ b/twilio/rest/numbers/v2/regulatory_compliance.py @@ -0,0 +1,52 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.regulatory_compliance.bundle import BundleListInstancefrom twilio.rest.regulatory_compliance.end_user import EndUserListInstancefrom twilio.rest.regulatory_compliance.end_user_type import EndUserTypeListInstancefrom twilio.rest.regulatory_compliance.regulation import RegulationListInstancefrom twilio.rest.regulatory_compliance.supporting_document import SupportingDocumentListInstancefrom twilio.rest.regulatory_compliance.supporting_document_type import SupportingDocumentTypeListInstance + + + + +class RegulatoryComplianceListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(RegulatoryComplianceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance' + + self._bundles = None + self._end_users = None + self._end_user_types = None + self._regulations = None + self._supporting_documents = None + self._supporting_document_types = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle.py new file mode 100644 index 0000000000..b70f41ad9b --- /dev/null +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle.py @@ -0,0 +1,187 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.bundle.bundle_copy import BundleCopyListInstancefrom twilio.rest.bundle.evaluation import EvaluationListInstancefrom twilio.rest.bundle.item_assignment import ItemAssignmentListInstancefrom twilio.rest.bundle.replace_items import ReplaceItemsListInstance + + +class BundleContext(InstanceContext): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(BundleContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/RegulatoryCompliance/Bundles/${sid}' + + self._bundle_copies = None + self._evaluations = None + self._item_assignments = None + self._replace_items = None + + def delete(self): + + + """ + Deletes the BundleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the BundleInstance + + :returns: The fetched BundleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BundleInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return BundleInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class BundleInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(BundleInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'regulation_sid' = payload.get('regulation_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'valid_until' = payload.get('valid_until'), + 'email' = payload.get('email'), + 'status_callback' = payload.get('status_callback'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = BundleContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def bundle_copies(self): + return self._proxy.bundle_copies + @property + def evaluations(self): + return self._proxy.evaluations + @property + def item_assignments(self): + return self._proxy.item_assignments + @property + def replace_items(self): + return self._proxy.replace_items + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class BundleListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(BundleListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance/Bundles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return BundleInstance(self._version, payload, ) + + + def page(self, status, friendly_name, regulation_sid, iso_country, number_type, has_valid_until_date, sort_by, sort_direction, valid_until_date, valid_until_date, valid_until_date, page_size): + + data = values.of({ + 'status': status,'friendly_name': friendly_name,'regulation_sid': regulation_sid,'iso_country': iso_country,'number_type': number_type,'has_valid_until_date': has_valid_until_date,'sort_by': sort_by,'sort_direction': sort_direction,'valid_until_date': valid_until_date,'valid_until_date': valid_until_date,'valid_until_date': valid_until_date,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BundlePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py index 4d5db355fc..4030241486 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py @@ -1,309 +1,110 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BundleCopyList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, bundle_sid): - """ - Initialize the BundleCopyList - - :param Version version: Version that contains the resource - :param bundle_sid: The unique string that identifies the resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyList - """ - super(BundleCopyList, self).__init__(version) - - # Path Solution - self._solution = {'bundle_sid': bundle_sid, } - self._uri = '/RegulatoryCompliance/Bundles/{bundle_sid}/Copies'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create the BundleCopyInstance - - :param unicode friendly_name: The string that you assigned to describe the copied bundle - - :returns: The created BundleCopyInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return BundleCopyInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams BundleCopyInstance 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 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.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists BundleCopyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BundleCopyInstance records from the API. - Request is executed immediately +from twilio.base.page import Page - :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 BundleCopyInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - response = self._version.page(method='GET', uri=self._uri, params=data, ) - return BundleCopyPage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of BundleCopyInstance records from the API. - Request is executed immediately +class BundleCopyInstance(InstanceResource): + def __init__(self, version, payload, bundle_sid: str): + super(BundleCopyInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'regulation_sid' = payload.get('regulation_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'valid_until' = payload.get('valid_until'), + 'email' = payload.get('email'), + 'status_callback' = payload.get('status_callback'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + } - :param str target_url: API-generated URL for the requested results page + self._context = None + self._solution = { + 'bundle_sid': bundle_sid or self._properties['bundle_sid'] + } - :returns: Page of BundleCopyInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) + @property + def _proxy(self): + if self._context is None: + self._context = BundleCopyContext( + self._version, + bundle_sid=self._solution['bundle_sid'], + ) + return self._context - return BundleCopyPage(self._version, response, self._solution) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class BundleCopyPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the BundleCopyPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param bundle_sid: The unique string that identifies the resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyPage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyPage - """ - super(BundleCopyPage, self).__init__(version, response) +class BundleCopyListInstance(ListResource): + def __init__(self, version: V2, bundle_sid: str): + # TODO: needs autogenerated docs + super(BundleCopyListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BundleCopyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyInstance - """ - return BundleCopyInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) + self._solution = { bundle_sid, } + self._uri = '/RegulatoryCompliance/Bundles/${bundle_sid}/Copies' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return BundleCopyInstance(self._version, payload, bundle_sid=self._solution['bundle_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BundleCopyPage(self._version, payload, bundle_sid=self._solution['bundle_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class BundleCopyInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - IN_REVIEW = "in-review" - TWILIO_REJECTED = "twilio-rejected" - TWILIO_APPROVED = "twilio-approved" - PROVISIONALLY_APPROVED = "provisionally-approved" - - class EndUserType(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - - def __init__(self, version, payload, bundle_sid): - """ - Initialize the BundleCopyInstance - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyInstance - """ - super(BundleCopyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'regulation_sid': payload.get('regulation_sid'), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'valid_until': deserialize.iso8601_datetime(payload.get('valid_until')), - 'email': payload.get('email'), - 'status_callback': payload.get('status_callback'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - } - - # Context - self._context = None - self._solution = {'bundle_sid': bundle_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def regulation_sid(self): - """ - :returns: The unique string of a regulation - :rtype: unicode - """ - return self._properties['regulation_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The verification status of the Bundle resource - :rtype: BundleCopyInstance.Status - """ - return self._properties['status'] - - @property - def valid_until(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource will be valid until - :rtype: datetime - """ - return self._properties['valid_until'] + return '' - @property - def email(self): - """ - :returns: The email address - :rtype: unicode - """ - return self._properties['email'] - - @property - def status_callback(self): - """ - :returns: The URL we call to inform your application of status changes - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py index b36902c35b..6baaebcb5a 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py @@ -1,369 +1,145 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EvaluationList(ListResource): - - def __init__(self, version, bundle_sid): - """ - Initialize the EvaluationList - - :param Version version: Version that contains the resource - :param bundle_sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationList - """ - super(EvaluationList, self).__init__(version) - - # Path Solution - self._solution = {'bundle_sid': bundle_sid, } - self._uri = '/RegulatoryCompliance/Bundles/{bundle_sid}/Evaluations'.format(**self._solution) - - def create(self): - """ - Create the EvaluationInstance - - :returns: The created EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance - """ - payload = self._version.create(method='POST', uri=self._uri, ) - - return EvaluationInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams EvaluationInstance 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 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.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EvaluationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EvaluationInstance records from the API. - Request is executed immediately - - :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 EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EvaluationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EvaluationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EvaluationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EvaluationContext - - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationContext - """ - return EvaluationContext(self._version, bundle_sid=self._solution['bundle_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EvaluationContext - - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationContext - """ - return EvaluationContext(self._version, bundle_sid=self._solution['bundle_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EvaluationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EvaluationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param bundle_sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationPage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationPage - """ - super(EvaluationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EvaluationInstance - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance - """ - return EvaluationInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class EvaluationContext(InstanceContext): - - def __init__(self, version, bundle_sid, sid): - """ - Initialize the EvaluationContext - - :param Version version: Version that contains the resource - :param bundle_sid: The unique string that identifies the resource - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationContext - """ - super(EvaluationContext, self).__init__(version) + def __init__(self, version: V2, bundle_sid: str, sid: str): + # TODO: needs autogenerated docs + super(EvaluationContextList, self).__init__(version) # Path Solution - self._solution = {'bundle_sid': bundle_sid, 'sid': sid, } - self._uri = '/RegulatoryCompliance/Bundles/{bundle_sid}/Evaluations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EvaluationInstance - - :returns: The fetched EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EvaluationInstance( - self._version, - payload, - bundle_sid=self._solution['bundle_sid'], - sid=self._solution['sid'], - ) + self._solution = { bundle_sid, sid, } + self._uri = '/RegulatoryCompliance/Bundles/${bundle_sid}/Evaluations/${sid}' + + + def fetch(self): + + """ + Fetch the EvaluationInstance + + :returns: The fetched EvaluationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EvaluationInstance( + self._version, + payload, + bundle_sidsid=self._solution['bundle_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class EvaluationInstance(InstanceResource): + return '' - class Status(object): - COMPLIANT = "compliant" - NONCOMPLIANT = "noncompliant" - def __init__(self, version, payload, bundle_sid, sid=None): - """ - Initialize the EvaluationInstance - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance - """ +class EvaluationInstance(InstanceResource): + def __init__(self, version, payload, bundle_sid: str, sid: str): super(EvaluationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'regulation_sid': payload.get('regulation_sid'), - 'bundle_sid': payload.get('bundle_sid'), - 'status': payload.get('status'), - 'results': payload.get('results'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'regulation_sid' = payload.get('regulation_sid'), + 'bundle_sid' = payload.get('bundle_sid'), + 'status' = payload.get('status'), + 'results' = payload.get('results'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'bundle_sid': bundle_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'bundle_sid': bundle_sid or self._properties['bundle_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EvaluationContext for this EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationContext - """ if self._context is None: self._context = EvaluationContext( self._version, - bundle_sid=self._solution['bundle_sid'], - sid=self._solution['sid'], + bundle_sid=self._solution['bundle_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Evaluation resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def regulation_sid(self): - """ - :returns: The unique string of a regulation - :rtype: unicode - """ - return self._properties['regulation_sid'] - - @property - def bundle_sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['bundle_sid'] - - @property - def status(self): - """ - :returns: The compliance status of the Evaluation resource - :rtype: EvaluationInstance.Status - """ - return self._properties['status'] + - @property - def results(self): + def __repr__(self): """ - :returns: The results of the Evaluation resource - :rtype: list[dict] + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['results'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the EvaluationInstance +class EvaluationListInstance(ListResource): + def __init__(self, version: V2, bundle_sid: str): + # TODO: needs autogenerated docs + super(EvaluationListInstanceList, self).__init__(version) - :returns: The fetched EvaluationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { bundle_sid, } + self._uri = '/RegulatoryCompliance/Bundles/${bundle_sid}/Evaluations' + + + def create(self): + data = values.of({ + + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EvaluationInstance(self._version, payload, bundle_sid=self._solution['bundle_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EvaluationPage(self._version, payload, bundle_sid=self._solution['bundle_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py index 4a3379a2c3..4016087e55 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py @@ -1,369 +1,154 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ItemAssignmentList(ListResource): - - def __init__(self, version, bundle_sid): - """ - Initialize the ItemAssignmentList - - :param Version version: Version that contains the resource - :param bundle_sid: The unique string that identifies the Bundle resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentList - """ - super(ItemAssignmentList, self).__init__(version) - - # Path Solution - self._solution = {'bundle_sid': bundle_sid, } - self._uri = '/RegulatoryCompliance/Bundles/{bundle_sid}/ItemAssignments'.format(**self._solution) - - def create(self, object_sid): - """ - Create the ItemAssignmentInstance - - :param unicode object_sid: The sid of an object bag - - :returns: The created ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance - """ - data = values.of({'ObjectSid': object_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ItemAssignmentInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams ItemAssignmentInstance 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 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.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ItemAssignmentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ItemAssignmentInstance records from the API. - Request is executed immediately - - :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 ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ItemAssignmentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ItemAssignmentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ItemAssignmentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ItemAssignmentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentContext - """ - return ItemAssignmentContext(self._version, bundle_sid=self._solution['bundle_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ItemAssignmentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentContext - """ - return ItemAssignmentContext(self._version, bundle_sid=self._solution['bundle_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ItemAssignmentPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ItemAssignmentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param bundle_sid: The unique string that identifies the Bundle resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentPage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentPage - """ - super(ItemAssignmentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of ItemAssignmentInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance - """ - return ItemAssignmentInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ItemAssignmentContext(InstanceContext): - - def __init__(self, version, bundle_sid, sid): - """ - Initialize the ItemAssignmentContext - - :param Version version: Version that contains the resource - :param bundle_sid: The unique string that identifies the resource. - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentContext - """ - super(ItemAssignmentContext, self).__init__(version) + def __init__(self, version: V2, bundle_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ItemAssignmentContextList, self).__init__(version) # Path Solution - self._solution = {'bundle_sid': bundle_sid, 'sid': sid, } - self._uri = '/RegulatoryCompliance/Bundles/{bundle_sid}/ItemAssignments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ItemAssignmentInstance - - :returns: The fetched ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ItemAssignmentInstance( - self._version, - payload, - bundle_sid=self._solution['bundle_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ItemAssignmentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { bundle_sid, sid, } + self._uri = '/RegulatoryCompliance/Bundles/${bundle_sid}/ItemAssignments/${sid}' + + + def delete(self): + + + """ + Deletes the ItemAssignmentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ItemAssignmentInstance + + :returns: The fetched ItemAssignmentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ItemAssignmentInstance( + self._version, + payload, + bundle_sidsid=self._solution['bundle_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ItemAssignmentInstance(InstanceResource): - - def __init__(self, version, payload, bundle_sid, sid=None): - """ - Initialize the ItemAssignmentInstance - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance - """ +class ItemAssignmentInstance(InstanceResource): + def __init__(self, version, payload, bundle_sid: str, sid: str): super(ItemAssignmentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'bundle_sid': payload.get('bundle_sid'), - 'account_sid': payload.get('account_sid'), - 'object_sid': payload.get('object_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'bundle_sid' = payload.get('bundle_sid'), + 'account_sid' = payload.get('account_sid'), + 'object_sid' = payload.get('object_sid'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'bundle_sid': bundle_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'bundle_sid': bundle_sid or self._properties['bundle_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ItemAssignmentContext for this ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentContext - """ if self._context is None: self._context = ItemAssignmentContext( self._version, - bundle_sid=self._solution['bundle_sid'], - sid=self._solution['sid'], + bundle_sid=self._solution['bundle_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def bundle_sid(self): - """ - :returns: The unique string that identifies the Bundle resource. - :rtype: unicode - """ - return self._properties['bundle_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def object_sid(self): - """ - :returns: The sid of an object bag - :rtype: unicode - """ - return self._properties['object_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Identity resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the ItemAssignmentInstance - :returns: The fetched ItemAssignmentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the ItemAssignmentInstance +class ItemAssignmentListInstance(ListResource): + def __init__(self, version: V2, bundle_sid: str): + # TODO: needs autogenerated docs + super(ItemAssignmentListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { bundle_sid, } + self._uri = '/RegulatoryCompliance/Bundles/${bundle_sid}/ItemAssignments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ItemAssignmentInstance(self._version, payload, bundle_sid=self._solution['bundle_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ItemAssignmentPage(self._version, payload, bundle_sid=self._solution['bundle_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py index 9bd28f79c9..1db42cc32e 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py @@ -1,232 +1,98 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class ReplaceItemsList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, bundle_sid): - """ - Initialize the ReplaceItemsList - :param Version version: Version that contains the resource - :param bundle_sid: The unique string that identifies the resource. - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsList - """ - super(ReplaceItemsList, self).__init__(version) - - # Path Solution - self._solution = {'bundle_sid': bundle_sid, } - self._uri = '/RegulatoryCompliance/Bundles/{bundle_sid}/ReplaceItems'.format(**self._solution) - - def create(self, from_bundle_sid): - """ - Create the ReplaceItemsInstance - :param unicode from_bundle_sid: The source bundle sid to copy the item assignments from +class ReplaceItemsInstance(InstanceResource): + def __init__(self, version, payload, bundle_sid: str): + super(ReplaceItemsInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'regulation_sid' = payload.get('regulation_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'valid_until' = payload.get('valid_until'), + 'email' = payload.get('email'), + 'status_callback' = payload.get('status_callback'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + } - :returns: The created ReplaceItemsInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsInstance - """ - data = values.of({'FromBundleSid': from_bundle_sid, }) + self._context = None + self._solution = { + 'bundle_sid': bundle_sid or self._properties['bundle_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = ReplaceItemsContext( + self._version, + bundle_sid=self._solution['bundle_sid'], + ) + return self._context - return ReplaceItemsInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class ReplaceItemsPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the ReplaceItemsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param bundle_sid: The unique string that identifies the resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsPage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsPage - """ - super(ReplaceItemsPage, self).__init__(version, response) +class ReplaceItemsListInstance(ListResource): + def __init__(self, version: V2, bundle_sid: str): + # TODO: needs autogenerated docs + super(ReplaceItemsListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ReplaceItemsInstance + self._solution = { bundle_sid, } + self._uri = '/RegulatoryCompliance/Bundles/${bundle_sid}/ReplaceItems' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsInstance - """ - return ReplaceItemsInstance(self._version, payload, bundle_sid=self._solution['bundle_sid'], ) + return ReplaceItemsInstance(self._version, payload, bundle_sid=self._solution['bundle_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + return '' -class ReplaceItemsInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - IN_REVIEW = "in-review" - TWILIO_REJECTED = "twilio-rejected" - TWILIO_APPROVED = "twilio-approved" - PROVISIONALLY_APPROVED = "provisionally-approved" - - class EndUserType(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - - def __init__(self, version, payload, bundle_sid): - """ - Initialize the ReplaceItemsInstance - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsInstance - """ - super(ReplaceItemsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'regulation_sid': payload.get('regulation_sid'), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'valid_until': deserialize.iso8601_datetime(payload.get('valid_until')), - 'email': payload.get('email'), - 'status_callback': payload.get('status_callback'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - } - - # Context - self._context = None - self._solution = {'bundle_sid': bundle_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def regulation_sid(self): - """ - :returns: The unique string of a regulation - :rtype: unicode - """ - return self._properties['regulation_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The verification status of the Bundle resource - :rtype: ReplaceItemsInstance.Status - """ - return self._properties['status'] - - @property - def valid_until(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource will be valid until - :rtype: datetime - """ - return self._properties['valid_until'] - - @property - def email(self): - """ - :returns: The email address - :rtype: unicode - """ - return self._properties['email'] - - @property - def status_callback(self): - """ - :returns: The URL we call to inform your application of status changes - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py index e870c93e63..85505e6e7f 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,403 +19,149 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EndUserList(ListResource): - - def __init__(self, version): - """ - Initialize the EndUserList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserList - """ - super(EndUserList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RegulatoryCompliance/EndUsers'.format(**self._solution) - - def create(self, friendly_name, type, attributes=values.unset): - """ - Create the EndUserInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param EndUserInstance.Type type: The type of end user of the Bundle resource - :param dict attributes: The set of parameters that compose the End User resource - - :returns: The created EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Attributes': serialize.object(attributes), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return EndUserInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams EndUserInstance 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 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.numbers.v2.regulatory_compliance.end_user.EndUserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EndUserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.end_user.EndUserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EndUserInstance records from the API. - Request is executed immediately - - :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 EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EndUserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EndUserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EndUserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EndUserContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserContext - """ - return EndUserContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EndUserContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserContext - """ - return EndUserContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.page import Page -class EndUserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EndUserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserPage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserPage - """ - super(EndUserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EndUserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - """ - return EndUserInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class EndUserContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the EndUserContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserContext - """ - super(EndUserContext, self).__init__(version) + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(EndUserContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RegulatoryCompliance/EndUsers/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EndUserInstance - - :returns: The fetched EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EndUserInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, attributes=values.unset): - """ - Update the EndUserInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the End User resource - - :returns: The updated EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Attributes': serialize.object(attributes), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return EndUserInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the EndUserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/RegulatoryCompliance/EndUsers/${sid}' + + + def delete(self): + + + """ + Deletes the EndUserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the EndUserInstance + + :returns: The fetched EndUserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EndUserInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return EndUserInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class EndUserInstance(InstanceResource): + return '' - class Type(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - def __init__(self, version, payload, sid=None): - """ - Initialize the EndUserInstance - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - """ +class EndUserInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(EndUserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'attributes': payload.get('attributes'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'attributes' = payload.get('attributes'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EndUserContext for this EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserContext - """ if self._context is None: - self._context = EndUserContext(self._version, sid=self._solution['sid'], ) + self._context = EndUserContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type of end user of the Bundle resource - :rtype: EndUserInstance.Type - """ - return self._properties['type'] - - @property - def attributes(self): - """ - :returns: The set of parameters that compose the End Users resource - :rtype: dict - """ - return self._properties['attributes'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the End User resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the EndUserInstance + - :returns: The fetched EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, attributes=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the EndUserInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the End User resource - :returns: The updated EndUserInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserInstance - """ - return self._proxy.update(friendly_name=friendly_name, attributes=attributes, ) - def delete(self): - """ - Deletes the EndUserInstance +class EndUserListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(EndUserListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance/EndUsers' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EndUserInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EndUserPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py index 380c244335..61665b1922 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py @@ -1,314 +1,132 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EndUserTypeList(ListResource): - - def __init__(self, version): - """ - Initialize the EndUserTypeList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeList - """ - super(EndUserTypeList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RegulatoryCompliance/EndUserTypes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams EndUserTypeInstance 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 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.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EndUserTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EndUserTypeInstance records from the API. - Request is executed immediately - - :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 EndUserTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EndUserTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EndUserTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EndUserTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EndUserTypePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EndUserTypeContext - - :param sid: The unique string that identifies the End-User Type resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeContext - """ - return EndUserTypeContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EndUserTypeContext - - :param sid: The unique string that identifies the End-User Type resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeContext - """ - return EndUserTypeContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EndUserTypePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EndUserTypePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypePage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypePage - """ - super(EndUserTypePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EndUserTypeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance - """ - return EndUserTypeInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class EndUserTypeContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the EndUserTypeContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the End-User Type resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeContext - """ - super(EndUserTypeContext, self).__init__(version) + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(EndUserTypeContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RegulatoryCompliance/EndUserTypes/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EndUserTypeInstance - - :returns: The fetched EndUserTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EndUserTypeInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/RegulatoryCompliance/EndUserTypes/${sid}' + + + def fetch(self): + + """ + Fetch the EndUserTypeInstance + + :returns: The fetched EndUserTypeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EndUserTypeInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class EndUserTypeInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the EndUserTypeInstance - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance - """ +class EndUserTypeInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(EndUserTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'machine_name': payload.get('machine_name'), - 'fields': payload.get('fields'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'machine_name' = payload.get('machine_name'), + 'fields' = payload.get('fields'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EndUserTypeContext for this EndUserTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeContext - """ if self._context is None: - self._context = EndUserTypeContext(self._version, sid=self._solution['sid'], ) + self._context = EndUserTypeContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the End-User Type resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def friendly_name(self): + def __repr__(self): """ - :returns: A human-readable description of the End-User Type resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['friendly_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def machine_name(self): - """ - :returns: A machine-readable description of the End-User Type resource - :rtype: unicode - """ - return self._properties['machine_name'] - @property - def fields(self): - """ - :returns: The required information for creating an End-User. - :rtype: list[dict] - """ - return self._properties['fields'] - @property - def url(self): - """ - :returns: The absolute URL of the End-User Type resource - :rtype: unicode - """ - return self._properties['url'] +class EndUserTypeListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(EndUserTypeListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the EndUserTypeInstance + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance/EndUserTypes' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :returns: The fetched EndUserTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EndUserTypePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py index 333594be80..498ba634ef 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py @@ -1,366 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RegulationList(ListResource): - - def __init__(self, version): - """ - Initialize the RegulationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationList - """ - super(RegulationList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RegulatoryCompliance/Regulations'.format(**self._solution) - - def stream(self, end_user_type=values.unset, iso_country=values.unset, - number_type=values.unset, limit=None, page_size=None): - """ - Streams RegulationInstance 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 RegulationInstance.EndUserType end_user_type: The type of End User of the Regulation resource - :param unicode iso_country: The ISO country code of the phone number's country - :param unicode number_type: The type of phone number being regulated - :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.numbers.v2.regulatory_compliance.regulation.RegulationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - end_user_type=end_user_type, - iso_country=iso_country, - number_type=number_type, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, end_user_type=values.unset, iso_country=values.unset, - number_type=values.unset, limit=None, page_size=None): - """ - Lists RegulationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RegulationInstance.EndUserType end_user_type: The type of End User of the Regulation resource - :param unicode iso_country: The ISO country code of the phone number's country - :param unicode number_type: The type of phone number being regulated - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.regulation.RegulationInstance] - """ - return list(self.stream( - end_user_type=end_user_type, - iso_country=iso_country, - number_type=number_type, - limit=limit, - page_size=page_size, - )) - - def page(self, end_user_type=values.unset, iso_country=values.unset, - number_type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RegulationInstance records from the API. - Request is executed immediately - - :param RegulationInstance.EndUserType end_user_type: The type of End User of the Regulation resource - :param unicode iso_country: The ISO country code of the phone number's country - :param unicode number_type: The type of phone number being regulated - :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 RegulationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationPage - """ - data = values.of({ - 'EndUserType': end_user_type, - 'IsoCountry': iso_country, - 'NumberType': number_type, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RegulationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RegulationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RegulationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RegulationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RegulationContext - - :param sid: The unique string that identifies the Regulation resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationContext - """ - return RegulationContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RegulationContext - - :param sid: The unique string that identifies the Regulation resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationContext - """ - return RegulationContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RegulationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RegulationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationPage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationPage - """ - super(RegulationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of RegulationInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationInstance - """ - return RegulationInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class RegulationContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the RegulationContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the Regulation resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationContext - """ - super(RegulationContext, self).__init__(version) + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(RegulationContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RegulatoryCompliance/Regulations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the RegulationInstance - - :returns: The fetched RegulationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RegulationInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/RegulatoryCompliance/Regulations/${sid}' + + + def fetch(self): + + """ + Fetch the RegulationInstance + + :returns: The fetched RegulationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RegulationInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RegulationInstance(InstanceResource): + return '' - class EndUserType(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - def __init__(self, version, payload, sid=None): - """ - Initialize the RegulationInstance - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationInstance - """ +class RegulationInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(RegulationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'iso_country': payload.get('iso_country'), - 'number_type': payload.get('number_type'), - 'end_user_type': payload.get('end_user_type'), - 'requirements': payload.get('requirements'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'iso_country' = payload.get('iso_country'), + 'number_type' = payload.get('number_type'), + 'end_user_type' = payload.get('end_user_type'), + 'requirements' = payload.get('requirements'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RegulationContext for this RegulationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationContext - """ if self._context is None: - self._context = RegulationContext(self._version, sid=self._solution['sid'], ) + self._context = RegulationContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Regulation resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: A human-readable description of the Regulation resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def iso_country(self): + def __repr__(self): """ - :returns: The ISO country code of the phone number's country - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['iso_country'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def number_type(self): - """ - :returns: The type of phone number restricted by the regulatory requirement - :rtype: unicode - """ - return self._properties['number_type'] - @property - def end_user_type(self): - """ - :returns: The type of End User of the Regulation resource - :rtype: RegulationInstance.EndUserType - """ - return self._properties['end_user_type'] - @property - def requirements(self): - """ - :returns: The sid of a regulation object that dictates requirements - :rtype: dict - """ - return self._properties['requirements'] +class RegulationListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(RegulationListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the Regulation resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance/Regulations' + + + def page(self, end_user_type, iso_country, number_type, page_size): + + data = values.of({ + 'end_user_type': end_user_type,'iso_country': iso_country,'number_type': number_type,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the RegulationInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched RegulationInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationInstance - """ - return self._proxy.fetch() + return RegulationPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index f2c98531f8..47368cd654 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,434 +19,152 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SupportingDocumentList(ListResource): - - def __init__(self, version): - """ - Initialize the SupportingDocumentList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentList - """ - super(SupportingDocumentList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RegulatoryCompliance/SupportingDocuments'.format(**self._solution) - - def create(self, friendly_name, type, attributes=values.unset): - """ - Create the SupportingDocumentInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode type: The type of the Supporting Document - :param dict attributes: The set of parameters that compose the Supporting Documents resource - - :returns: The created SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Attributes': serialize.object(attributes), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SupportingDocumentInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams SupportingDocumentInstance 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 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.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SupportingDocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SupportingDocumentInstance records from the API. - Request is executed immediately - - :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 SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SupportingDocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SupportingDocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SupportingDocumentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SupportingDocumentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentContext - """ - return SupportingDocumentContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SupportingDocumentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentContext - """ - return SupportingDocumentContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SupportingDocumentPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SupportingDocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentPage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentPage - """ - super(SupportingDocumentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of SupportingDocumentInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - """ - return SupportingDocumentInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SupportingDocumentContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the SupportingDocumentContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentContext - """ - super(SupportingDocumentContext, self).__init__(version) + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(SupportingDocumentContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RegulatoryCompliance/SupportingDocuments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SupportingDocumentInstance - - :returns: The fetched SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SupportingDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, attributes=values.unset): - """ - Update the SupportingDocumentInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the Supporting Document resource - - :returns: The updated SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Attributes': serialize.object(attributes), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SupportingDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the SupportingDocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/RegulatoryCompliance/SupportingDocuments/${sid}' + + + def delete(self): + + + """ + Deletes the SupportingDocumentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SupportingDocumentInstance + + :returns: The fetched SupportingDocumentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SupportingDocumentInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SupportingDocumentInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SupportingDocumentInstance(InstanceResource): - - class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - REJECTED = "rejected" - APPROVED = "approved" - EXPIRED = "expired" - PROVISIONALLY_APPROVED = "provisionally-approved" - def __init__(self, version, payload, sid=None): - """ - Initialize the SupportingDocumentInstance - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - """ +class SupportingDocumentInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(SupportingDocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'mime_type': payload.get('mime_type'), - 'status': payload.get('status'), - 'failure_reason': payload.get('failure_reason'), - 'type': payload.get('type'), - 'attributes': payload.get('attributes'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'mime_type' = payload.get('mime_type'), + 'status' = payload.get('status'), + 'failure_reason' = payload.get('failure_reason'), + 'type' = payload.get('type'), + 'attributes' = payload.get('attributes'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SupportingDocumentContext for this SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentContext - """ if self._context is None: - self._context = SupportingDocumentContext(self._version, sid=self._solution['sid'], ) + self._context = SupportingDocumentContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def mime_type(self): - """ - :returns: The image type of the file - :rtype: unicode - """ - return self._properties['mime_type'] - - @property - def status(self): - """ - :returns: The verification status of the Supporting Document resource - :rtype: SupportingDocumentInstance.Status - """ - return self._properties['status'] - - @property - def failure_reason(self): - """ - :returns: The failure reason of the Supporting Document Resource. - :rtype: unicode - """ - return self._properties['failure_reason'] - - @property - def type(self): - """ - :returns: The type of the Supporting Document - :rtype: unicode - """ - return self._properties['type'] - - @property - def attributes(self): - """ - :returns: The set of parameters that compose the Supporting Documents resource - :rtype: dict - """ - return self._properties['attributes'] + - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Supporting Document resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the SupportingDocumentInstance - - :returns: The fetched SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, attributes=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the SupportingDocumentInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the Supporting Document resource - :returns: The updated SupportingDocumentInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentInstance - """ - return self._proxy.update(friendly_name=friendly_name, attributes=attributes, ) - def delete(self): - """ - Deletes the SupportingDocumentInstance +class SupportingDocumentListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(SupportingDocumentListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance/SupportingDocuments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SupportingDocumentInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SupportingDocumentPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py index fad7bfdf22..509aac081b 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py @@ -1,314 +1,132 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SupportingDocumentTypeList(ListResource): - - def __init__(self, version): - """ - Initialize the SupportingDocumentTypeList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeList - """ - super(SupportingDocumentTypeList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RegulatoryCompliance/SupportingDocumentTypes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SupportingDocumentTypeInstance 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 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.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SupportingDocumentTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SupportingDocumentTypeInstance records from the API. - Request is executed immediately - - :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 SupportingDocumentTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SupportingDocumentTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SupportingDocumentTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SupportingDocumentTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SupportingDocumentTypePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SupportingDocumentTypeContext - - :param sid: The unique string that identifies the Supporting Document Type resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeContext - """ - return SupportingDocumentTypeContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SupportingDocumentTypeContext - - :param sid: The unique string that identifies the Supporting Document Type resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeContext - """ - return SupportingDocumentTypeContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SupportingDocumentTypePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SupportingDocumentTypePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypePage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypePage - """ - super(SupportingDocumentTypePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SupportingDocumentTypeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance - """ - return SupportingDocumentTypeInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class SupportingDocumentTypeContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the SupportingDocumentTypeContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the Supporting Document Type resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeContext - """ - super(SupportingDocumentTypeContext, self).__init__(version) + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(SupportingDocumentTypeContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RegulatoryCompliance/SupportingDocumentTypes/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SupportingDocumentTypeInstance - - :returns: The fetched SupportingDocumentTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SupportingDocumentTypeInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/RegulatoryCompliance/SupportingDocumentTypes/${sid}' + + + def fetch(self): + + """ + Fetch the SupportingDocumentTypeInstance + + :returns: The fetched SupportingDocumentTypeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SupportingDocumentTypeInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SupportingDocumentTypeInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the SupportingDocumentTypeInstance - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance - """ +class SupportingDocumentTypeInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(SupportingDocumentTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'machine_name': payload.get('machine_name'), - 'fields': payload.get('fields'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'machine_name' = payload.get('machine_name'), + 'fields' = payload.get('fields'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SupportingDocumentTypeContext for this SupportingDocumentTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeContext - """ if self._context is None: - self._context = SupportingDocumentTypeContext(self._version, sid=self._solution['sid'], ) + self._context = SupportingDocumentTypeContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Supporting Document Type resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def friendly_name(self): + def __repr__(self): """ - :returns: A human-readable description of the Supporting Document Type resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['friendly_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def machine_name(self): - """ - :returns: The machine-readable description of the Supporting Document Type resource - :rtype: unicode - """ - return self._properties['machine_name'] - @property - def fields(self): - """ - :returns: The required information for creating a Supporting Document - :rtype: list[dict] - """ - return self._properties['fields'] - @property - def url(self): - """ - :returns: The absolute URL of the Supporting Document Type resource - :rtype: unicode - """ - return self._properties['url'] +class SupportingDocumentTypeListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(SupportingDocumentTypeListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the SupportingDocumentTypeInstance + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance/SupportingDocumentTypes' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :returns: The fetched SupportingDocumentTypeInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SupportingDocumentTypePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/oauth/__init__.py b/twilio/rest/oauth/__init__.py index 815d617a3b..f7b00150c5 100644 --- a/twilio/rest/oauth/__init__.py +++ b/twilio/rest/oauth/__init__.py @@ -1,80 +1,86 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.oauth.v1 import V1 + Twilio - Oauth + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Oauth(Domain): +from twilio.base.domain import Domain +from twilio.rest.Oauth.v1 import V1 +class Oauth(Domain): def __init__(self, twilio): """ Initialize the Oauth Domain :returns: Domain for Oauth - :rtype: twilio.rest.oauth.Oauth + :rtype: twilio.rest.v1.Oauth """ super(Oauth, self).__init__(twilio) - - self.base_url = 'https://oauth.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Oauth.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of oauth - :rtype: twilio.rest.oauth.v1.V1 + :returns: Versions v1 of Oauth + :rtype: twilio.rest.Oauth.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property - def oauth(self): + def device_code(self): """ - :rtype: twilio.rest.oauth.v1.oauth.OauthList + :rtype: twilio.rest.v1.device_code """ - return self.v1.oauth + return self.v1.device_code + @property - def device_code(self): + def oauth(self): """ - :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeList + :rtype: twilio.rest.v1.oauth """ - return self.v1.device_code + return self.v1.oauth + @property def openid_discovery(self): """ - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryList + :rtype: twilio.rest.v1.openid_discovery """ return self.v1.openid_discovery + @property def token(self): """ - :rtype: twilio.rest.oauth.v1.token.TokenList + :rtype: twilio.rest.v1.token """ return self.v1.token + @property def user_info(self): """ - :rtype: twilio.rest.oauth.v1.user_info.UserInfoList + :rtype: twilio.rest.v1.user_info """ return self.v1.user_info + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/oauth/v1/.openapi-generator-ignore b/twilio/rest/oauth/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/oauth/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/oauth/v1/.openapi-generator/FILES b/twilio/rest/oauth/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..1cc191f777 --- /dev/null +++ b/twilio/rest/oauth/v1/.openapi-generator/FILES @@ -0,0 +1,11 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +device_code.py +oauth.py +openid_discovery.py +token.py +user_info.py diff --git a/twilio/rest/oauth/v1/.openapi-generator/VERSION b/twilio/rest/oauth/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/oauth/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/oauth/v1/device_code.py b/twilio/rest/oauth/v1/device_code.py index ddcaa47ff2..b350d4b5ef 100644 --- a/twilio/rest/oauth/v1/device_code.py +++ b/twilio/rest/oauth/v1/device_code.py @@ -1,183 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class DeviceCodeList(ListResource): - def __init__(self, version): - """ - Initialize the DeviceCodeList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.oauth.v1.device_code.DeviceCodeList - :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeList - """ - super(DeviceCodeList, self).__init__(version) - # Path Solution - self._solution = {} - self._uri = '/device/code'.format(**self._solution) - def create(self, client_sid, scopes, audiences=values.unset): - """ - Create the DeviceCodeInstance - :param unicode client_sid: A string that uniquely identifies this oauth app - :param list[unicode] scopes: An Array of scopes - :param list[unicode] audiences: An array of intended audiences +class DeviceCodeInstance(InstanceResource): + def __init__(self, version, payload): + super(DeviceCodeInstance, self).__init__(version) + self._properties = { + 'device_code' = payload.get('device_code'), + 'user_code' = payload.get('user_code'), + 'verification_uri' = payload.get('verification_uri'), + 'verification_uri_complete' = payload.get('verification_uri_complete'), + 'expires_in' = payload.get('expires_in'), + 'interval' = payload.get('interval'), + } - :returns: The created DeviceCodeInstance - :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeInstance - """ - data = values.of({ - 'ClientSid': client_sid, - 'Scopes': serialize.map(scopes, lambda e: e), - 'Audiences': serialize.map(audiences, lambda e: e), - }) + self._context = None + self._solution = { + + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = DeviceCodeContext( + self._version, + + ) + return self._context - return DeviceCodeInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class DeviceCodePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the DeviceCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.oauth.v1.device_code.DeviceCodePage - :rtype: twilio.rest.oauth.v1.device_code.DeviceCodePage - """ - super(DeviceCodePage, self).__init__(version, response) +class DeviceCodeListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(DeviceCodeListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeviceCodeInstance + self._solution = { } + self._uri = '/device/code' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.oauth.v1.device_code.DeviceCodeInstance - :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeInstance - """ - return DeviceCodeInstance(self._version, payload, ) + return DeviceCodeInstance(self._version, payload, ) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class DeviceCodeInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the DeviceCodeInstance - - :returns: twilio.rest.oauth.v1.device_code.DeviceCodeInstance - :rtype: twilio.rest.oauth.v1.device_code.DeviceCodeInstance - """ - super(DeviceCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'device_code': payload.get('device_code'), - 'user_code': payload.get('user_code'), - 'verification_uri': payload.get('verification_uri'), - 'verification_uri_complete': payload.get('verification_uri_complete'), - 'expires_in': deserialize.integer(payload.get('expires_in')), - 'interval': deserialize.integer(payload.get('interval')), - } - - # Context - self._context = None - self._solution = {} - - @property - def device_code(self): - """ - :returns: The device verification code - :rtype: unicode - """ - return self._properties['device_code'] - - @property - def user_code(self): - """ - :returns: The verification code for the end user - :rtype: unicode - """ - return self._properties['user_code'] - - @property - def verification_uri(self): - """ - :returns: The URI that the end user visits to verify request - :rtype: unicode - """ - return self._properties['verification_uri'] - - @property - def verification_uri_complete(self): - """ - :returns: he URI with user_code that the end-user alternatively visits to verify request - :rtype: unicode - """ - return self._properties['verification_uri_complete'] - - @property - def expires_in(self): - """ - :returns: The expiration time of the device_code and user_code in seconds - :rtype: unicode - """ - return self._properties['expires_in'] - - @property - def interval(self): - """ - :returns: The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint - :rtype: unicode - """ - return self._properties['interval'] + return '' - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/oauth/v1/oauth.py b/twilio/rest/oauth/v1/oauth.py index 50b751b5d7..c0b3ca283c 100644 --- a/twilio/rest/oauth/v1/oauth.py +++ b/twilio/rest/oauth/v1/oauth.py @@ -1,201 +1,117 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class OauthList(ListResource): - - def __init__(self, version): - """ - Initialize the OauthList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.oauth.v1.oauth.OauthList - :rtype: twilio.rest.oauth.v1.oauth.OauthList - """ - super(OauthList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a OauthContext - - :returns: twilio.rest.oauth.v1.oauth.OauthContext - :rtype: twilio.rest.oauth.v1.oauth.OauthContext - """ - return OauthContext(self._version, ) - - def __call__(self): - """ - Constructs a OauthContext - - :returns: twilio.rest.oauth.v1.oauth.OauthContext - :rtype: twilio.rest.oauth.v1.oauth.OauthContext - """ - return OauthContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class OauthPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the OauthPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.oauth.v1.oauth.OauthPage - :rtype: twilio.rest.oauth.v1.oauth.OauthPage - """ - super(OauthPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of OauthInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.oauth.v1.oauth.OauthInstance - :rtype: twilio.rest.oauth.v1.oauth.OauthInstance - """ - return OauthInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class OauthContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the OauthContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.oauth.v1.oauth.OauthContext - :rtype: twilio.rest.oauth.v1.oauth.OauthContext - """ - super(OauthContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(OauthContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/certs'.format(**self._solution) - - def fetch(self): - """ - Fetch the OauthInstance - - :returns: The fetched OauthInstance - :rtype: twilio.rest.oauth.v1.oauth.OauthInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return OauthInstance(self._version, payload, ) + self._solution = { } + self._uri = '/certs' + + + def fetch(self): + + """ + Fetch the OauthInstance + + :returns: The fetched OauthInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return OauthInstance( + self._version, + payload, + =self._solution[], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class OauthInstance(InstanceResource): +class OauthInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the OauthInstance - - :returns: twilio.rest.oauth.v1.oauth.OauthInstance - :rtype: twilio.rest.oauth.v1.oauth.OauthInstance - """ super(OauthInstance, self).__init__(version) + self._properties = { + 'keys' = payload.get('keys'), + 'url' = payload.get('url'), + } - # Marshaled Properties - self._properties = {'keys': payload.get('keys'), 'url': payload.get('url'), } - - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: OauthContext for this OauthInstance - :rtype: twilio.rest.oauth.v1.oauth.OauthContext - """ if self._context is None: - self._context = OauthContext(self._version, ) + self._context = OauthContext( + self._version, + + ) return self._context - @property - def keys(self): - """ - :returns: A collection of certificates - :rtype: dict - """ - return self._properties['keys'] + - @property - def url(self): + def __repr__(self): """ - :returns: The url - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the OauthInstance - :returns: The fetched OauthInstance - :rtype: twilio.rest.oauth.v1.oauth.OauthInstance - """ - return self._proxy.fetch() + +class OauthListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(OauthListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/oauth/v1/openid_discovery.py b/twilio/rest/oauth/v1/openid_discovery.py index 41d9eade95..134c63c9a8 100644 --- a/twilio/rest/oauth/v1/openid_discovery.py +++ b/twilio/rest/oauth/v1/openid_discovery.py @@ -1,303 +1,128 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class OpenidDiscoveryList(ListResource): - - def __init__(self, version): - """ - Initialize the OpenidDiscoveryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryList - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryList - """ - super(OpenidDiscoveryList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a OpenidDiscoveryContext - - :returns: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryContext - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryContext - """ - return OpenidDiscoveryContext(self._version, ) - - def __call__(self): - """ - Constructs a OpenidDiscoveryContext - - :returns: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryContext - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryContext - """ - return OpenidDiscoveryContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class OpenidDiscoveryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the OpenidDiscoveryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryPage - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryPage - """ - super(OpenidDiscoveryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of OpenidDiscoveryInstance - :param dict payload: Payload response from the API - :returns: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryInstance - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryInstance - """ - return OpenidDiscoveryInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class OpenidDiscoveryContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the OpenidDiscoveryContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryContext - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryContext - """ - super(OpenidDiscoveryContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(OpenidDiscoveryContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/.well-known/openid-configuration'.format(**self._solution) - - def fetch(self): - """ - Fetch the OpenidDiscoveryInstance - - :returns: The fetched OpenidDiscoveryInstance - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return OpenidDiscoveryInstance(self._version, payload, ) + self._solution = { } + self._uri = '/.well-known/openid-configuration' + + + def fetch(self): + + """ + Fetch the OpenidDiscoveryInstance + + :returns: The fetched OpenidDiscoveryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return OpenidDiscoveryInstance( + self._version, + payload, + =self._solution[], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class OpenidDiscoveryInstance(InstanceResource): +class OpenidDiscoveryInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the OpenidDiscoveryInstance - - :returns: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryInstance - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryInstance - """ super(OpenidDiscoveryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'issuer': payload.get('issuer'), - 'authorization_endpoint': payload.get('authorization_endpoint'), - 'device_authorization_endpoint': payload.get('device_authorization_endpoint'), - 'token_endpoint': payload.get('token_endpoint'), - 'userinfo_endpoint': payload.get('userinfo_endpoint'), - 'revocation_endpoint': payload.get('revocation_endpoint'), - 'jwk_uri': payload.get('jwk_uri'), - 'response_type_supported': payload.get('response_type_supported'), - 'subject_type_supported': payload.get('subject_type_supported'), - 'id_token_signing_alg_values_supported': payload.get('id_token_signing_alg_values_supported'), - 'scopes_supported': payload.get('scopes_supported'), - 'claims_supported': payload.get('claims_supported'), - 'url': payload.get('url'), + self._properties = { + 'issuer' = payload.get('issuer'), + 'authorization_endpoint' = payload.get('authorization_endpoint'), + 'device_authorization_endpoint' = payload.get('device_authorization_endpoint'), + 'token_endpoint' = payload.get('token_endpoint'), + 'userinfo_endpoint' = payload.get('userinfo_endpoint'), + 'revocation_endpoint' = payload.get('revocation_endpoint'), + 'jwk_uri' = payload.get('jwk_uri'), + 'response_type_supported' = payload.get('response_type_supported'), + 'subject_type_supported' = payload.get('subject_type_supported'), + 'id_token_signing_alg_values_supported' = payload.get('id_token_signing_alg_values_supported'), + 'scopes_supported' = payload.get('scopes_supported'), + 'claims_supported' = payload.get('claims_supported'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: OpenidDiscoveryContext for this OpenidDiscoveryInstance - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryContext - """ if self._context is None: - self._context = OpenidDiscoveryContext(self._version, ) + self._context = OpenidDiscoveryContext( + self._version, + + ) return self._context - @property - def issuer(self): - """ - :returns: The issuer URL - :rtype: unicode - """ - return self._properties['issuer'] - - @property - def authorization_endpoint(self): - """ - :returns: The URL of authorization endpoint - :rtype: unicode - """ - return self._properties['authorization_endpoint'] - - @property - def device_authorization_endpoint(self): - """ - :returns: The URL of device code authorization endpoint - :rtype: unicode - """ - return self._properties['device_authorization_endpoint'] - - @property - def token_endpoint(self): - """ - :returns: The URL of token endpoint - :rtype: unicode - """ - return self._properties['token_endpoint'] - - @property - def userinfo_endpoint(self): - """ - :returns: The URL of user info endpoint - :rtype: unicode - """ - return self._properties['userinfo_endpoint'] - - @property - def revocation_endpoint(self): - """ - :returns: The URL of revocation endpoint - :rtype: unicode - """ - return self._properties['revocation_endpoint'] - - @property - def jwk_uri(self): - """ - :returns: The URL of public JWK endpoint - :rtype: unicode - """ - return self._properties['jwk_uri'] - - @property - def response_type_supported(self): - """ - :returns: List of response type supported for identity token - :rtype: list[unicode] - """ - return self._properties['response_type_supported'] - - @property - def subject_type_supported(self): - """ - :returns: List of subject supported for identity token - :rtype: list[unicode] - """ - return self._properties['subject_type_supported'] - - @property - def id_token_signing_alg_values_supported(self): - """ - :returns: List of JWS signing algorithms supported for identity token - :rtype: list[unicode] - """ - return self._properties['id_token_signing_alg_values_supported'] + - @property - def scopes_supported(self): + def __repr__(self): """ - :returns: List of scopes supported identity token - :rtype: list[unicode] + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['scopes_supported'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def claims_supported(self): - """ - :returns: List of claims supported for identity token - :rtype: list[unicode] - """ - return self._properties['claims_supported'] - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the OpenidDiscoveryInstance +class OpenidDiscoveryListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(OpenidDiscoveryListInstanceList, self).__init__(version) - :returns: The fetched OpenidDiscoveryInstance - :rtype: twilio.rest.oauth.v1.openid_discovery.OpenidDiscoveryInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py index 0d17b28cd9..b1840b7f96 100644 --- a/twilio/rest/oauth/v1/token.py +++ b/twilio/rest/oauth/v1/token.py @@ -1,186 +1,93 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class TokenList(ListResource): - def __init__(self, version): - """ - Initialize the TokenList - :param Version version: Version that contains the resource - :returns: twilio.rest.oauth.v1.token.TokenList - :rtype: twilio.rest.oauth.v1.token.TokenList - """ - super(TokenList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/token'.format(**self._solution) +class TokenInstance(InstanceResource): + def __init__(self, version, payload): + super(TokenInstance, self).__init__(version) + self._properties = { + 'access_token' = payload.get('access_token'), + 'refresh_token' = payload.get('refresh_token'), + 'id_token' = payload.get('id_token'), + 'refresh_token_expires_at' = payload.get('refresh_token_expires_at'), + 'access_token_expires_at' = payload.get('access_token_expires_at'), + } - def create(self, grant_type, client_sid, client_secret=values.unset, - code=values.unset, code_verifier=values.unset, - device_code=values.unset, refresh_token=values.unset, - device_id=values.unset): - """ - Create the TokenInstance - - :param unicode grant_type: A way of representing resource owner's to obtain access token - :param unicode client_sid: A string that uniquely identifies this oauth app - :param unicode client_secret: The credential for confidential OAuth App - :param unicode code: Jwt token - :param unicode code_verifier: The cryptographically generated code - :param unicode device_code: Jwt token - :param unicode refresh_token: Jwt token - :param unicode device_id: An Id of device - - :returns: The created TokenInstance - :rtype: twilio.rest.oauth.v1.token.TokenInstance - """ - data = values.of({ - 'GrantType': grant_type, - 'ClientSid': client_sid, - 'ClientSecret': client_secret, - 'Code': code, - 'CodeVerifier': code_verifier, - 'DeviceCode': device_code, - 'RefreshToken': refresh_token, - 'DeviceId': device_id, - }) + self._context = None + self._solution = { + + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = TokenContext( + self._version, + + ) + return self._context - return TokenInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class TokenPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TokenPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.oauth.v1.token.TokenPage - :rtype: twilio.rest.oauth.v1.token.TokenPage - """ - super(TokenPage, self).__init__(version, response) +class TokenListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(TokenListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TokenInstance + self._solution = { } + self._uri = '/token' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.oauth.v1.token.TokenInstance - :rtype: twilio.rest.oauth.v1.token.TokenInstance - """ - return TokenInstance(self._version, payload, ) + return TokenInstance(self._version, payload, ) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class TokenInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the TokenInstance - - :returns: twilio.rest.oauth.v1.token.TokenInstance - :rtype: twilio.rest.oauth.v1.token.TokenInstance - """ - super(TokenInstance, self).__init__(version) + return '' - # Marshaled Properties - self._properties = { - 'access_token': payload.get('access_token'), - 'refresh_token': payload.get('refresh_token'), - 'id_token': payload.get('id_token'), - 'refresh_token_expires_at': deserialize.iso8601_datetime(payload.get('refresh_token_expires_at')), - 'access_token_expires_at': deserialize.iso8601_datetime(payload.get('access_token_expires_at')), - } - - # Context - self._context = None - self._solution = {} - - @property - def access_token(self): - """ - :returns: Token which carries the necessary information to access a Twilio resource directly - :rtype: unicode - """ - return self._properties['access_token'] - - @property - def refresh_token(self): - """ - :returns: Token which carries the information necessary to get a new access token - :rtype: unicode - """ - return self._properties['refresh_token'] - - @property - def id_token(self): - """ - :returns: The id_token - :rtype: unicode - """ - return self._properties['id_token'] - - @property - def refresh_token_expires_at(self): - """ - :returns: The RFC 2822 date and time in GMT when the refresh token expires - :rtype: datetime - """ - return self._properties['refresh_token_expires_at'] - - @property - def access_token_expires_at(self): - """ - :returns: The RFC 2822 date and time in GMT when the access token expires - :rtype: datetime - """ - return self._properties['access_token_expires_at'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/oauth/v1/user_info.py b/twilio/rest/oauth/v1/user_info.py index 033f4d0a6a..4ccef9d2cc 100644 --- a/twilio/rest/oauth/v1/user_info.py +++ b/twilio/rest/oauth/v1/user_info.py @@ -1,240 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Oauth + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UserInfoList(ListResource): - - def __init__(self, version): - """ - Initialize the UserInfoList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.oauth.v1.user_info.UserInfoList - :rtype: twilio.rest.oauth.v1.user_info.UserInfoList - """ - super(UserInfoList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a UserInfoContext - - :returns: twilio.rest.oauth.v1.user_info.UserInfoContext - :rtype: twilio.rest.oauth.v1.user_info.UserInfoContext - """ - return UserInfoContext(self._version, ) - - def __call__(self): - """ - Constructs a UserInfoContext - - :returns: twilio.rest.oauth.v1.user_info.UserInfoContext - :rtype: twilio.rest.oauth.v1.user_info.UserInfoContext - """ - return UserInfoContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserInfoPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserInfoPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.oauth.v1.user_info.UserInfoPage - :rtype: twilio.rest.oauth.v1.user_info.UserInfoPage - """ - super(UserInfoPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInfoInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.oauth.v1.user_info.UserInfoInstance - :rtype: twilio.rest.oauth.v1.user_info.UserInfoInstance - """ - return UserInfoInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class UserInfoContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the UserInfoContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.oauth.v1.user_info.UserInfoContext - :rtype: twilio.rest.oauth.v1.user_info.UserInfoContext - """ - super(UserInfoContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UserInfoContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/userinfo'.format(**self._solution) - - def fetch(self): - """ - Fetch the UserInfoInstance - - :returns: The fetched UserInfoInstance - :rtype: twilio.rest.oauth.v1.user_info.UserInfoInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInfoInstance(self._version, payload, ) + self._solution = { } + self._uri = '/userinfo' + + + def fetch(self): + + """ + Fetch the UserInfoInstance + + :returns: The fetched UserInfoInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UserInfoInstance( + self._version, + payload, + =self._solution[], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserInfoInstance(InstanceResource): +class UserInfoInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the UserInfoInstance - - :returns: twilio.rest.oauth.v1.user_info.UserInfoInstance - :rtype: twilio.rest.oauth.v1.user_info.UserInfoInstance - """ super(UserInfoInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'user_sid': payload.get('user_sid'), - 'first_name': payload.get('first_name'), - 'last_name': payload.get('last_name'), - 'friendly_name': payload.get('friendly_name'), - 'email': payload.get('email'), - 'url': payload.get('url'), + self._properties = { + 'user_sid' = payload.get('user_sid'), + 'first_name' = payload.get('first_name'), + 'last_name' = payload.get('last_name'), + 'friendly_name' = payload.get('friendly_name'), + 'email' = payload.get('email'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserInfoContext for this UserInfoInstance - :rtype: twilio.rest.oauth.v1.user_info.UserInfoContext - """ if self._context is None: - self._context = UserInfoContext(self._version, ) + self._context = UserInfoContext( + self._version, + + ) return self._context - @property - def user_sid(self): - """ - :returns: The user sid - :rtype: unicode - """ - return self._properties['user_sid'] - - @property - def first_name(self): - """ - :returns: The first name of the end-user - :rtype: unicode - """ - return self._properties['first_name'] + - @property - def last_name(self): + def __repr__(self): """ - :returns: The last name of the end-user - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['last_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def friendly_name(self): - """ - :returns: The friendly name of the end-user - :rtype: unicode - """ - return self._properties['friendly_name'] - @property - def email(self): - """ - :returns: The end-user's preferred email address - :rtype: unicode - """ - return self._properties['email'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the UserInfoInstance +class UserInfoListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UserInfoListInstanceList, self).__init__(version) - :returns: The fetched UserInfoInstance - :rtype: twilio.rest.oauth.v1.user_info.UserInfoInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/.openapi-generator-ignore b/twilio/rest/preview/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/preview/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/preview/.openapi-generator/FILES b/twilio/rest/preview/.openapi-generator/FILES new file mode 100644 index 0000000000..8cbd4ad617 --- /dev/null +++ b/twilio/rest/preview/.openapi-generator/FILES @@ -0,0 +1,79 @@ +.openapi-generator-ignore +DeployedDevices.py +DeployedDevices.py +DeployedDevices.py +DeployedDevices.py +DeployedDevices.py +HostedNumbers.py +HostedNumbers.py +HostedNumbers.py +Marketplace.py +Marketplace.py +Marketplace.py +Marketplace.py +Sync.py +Sync.py +Sync.py +Sync.py +Sync.py +Sync.py +Sync.py +Sync.py +Sync.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Understand.py +Wireless.py +Wireless.py +Wireless.py +Wireless.py +deployed_devices/fleet.py +deployed_devices/fleet/certificate.py +deployed_devices/fleet/deployment.py +deployed_devices/fleet/device.py +deployed_devices/fleet/key.py +hosted_numbers/authorization_document.py +hosted_numbers/authorization_document/dependent_hosted_number_order.py +hosted_numbers/hosted_number_order.py +marketplace/available_add_on.py +marketplace/available_add_on/available_add_on_extension.py +marketplace/installed_add_on.py +marketplace/installed_add_on/installed_add_on_extension.py +sync/service.py +sync/service/document.py +sync/service/document/document_permission.py +sync/service/sync_list.py +sync/service/sync_list/sync_list_item.py +sync/service/sync_list/sync_list_permission.py +sync/service/sync_map.py +sync/service/sync_map/sync_map_item.py +sync/service/sync_map/sync_map_permission.py +understand/assistant.py +understand/assistant/assistant_fallback_actions.py +understand/assistant/assistant_initiation_actions.py +understand/assistant/dialogue.py +understand/assistant/field_type.py +understand/assistant/field_type/field_value.py +understand/assistant/model_build.py +understand/assistant/query.py +understand/assistant/style_sheet.py +understand/assistant/task.py +understand/assistant/task/field.py +understand/assistant/task/sample.py +understand/assistant/task/task_actions.py +understand/assistant/task/task_statistics.py +wireless/command.py +wireless/rate_plan.py +wireless/sim.py +wireless/sim/usage.py diff --git a/twilio/rest/preview/.openapi-generator/VERSION b/twilio/rest/preview/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/preview/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/preview/DeployedDevices.py b/twilio/rest/preview/DeployedDevices.py new file mode 100644 index 0000000000..adb84a9dcf --- /dev/null +++ b/twilio/rest/preview/DeployedDevices.py @@ -0,0 +1,55 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.Preview.deployed_devices import DeployedDevices + +class Preview(Domain): + def __init__(self, twilio): + """ + Initialize the Preview Domain + + :returns: Domain for Preview + :rtype: twilio.rest.deployed_devices.Preview + """ + super(Preview, self).__init__(twilio) + self.base_url = 'https://Preview.twilio.com' + self._DeployedDevices = None + + @property + def DeployedDevices(self): + """ + :returns: Versions deployed_devices of Preview + :rtype: twilio.rest.Preview.deployed_devices + """ + if self._DeployedDevices is None: + self._DeployedDevices = DeployedDevices(self) + return self._DeployedDevices + + + @property + def fleets(self): + """ + :rtype: twilio.rest.deployed_devices.fleets + """ + return self.deployed_devices.fleets + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/HostedNumbers.py b/twilio/rest/preview/HostedNumbers.py new file mode 100644 index 0000000000..7692d930a3 --- /dev/null +++ b/twilio/rest/preview/HostedNumbers.py @@ -0,0 +1,63 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.Preview.hosted_numbers import HostedNumbers + +class Preview(Domain): + def __init__(self, twilio): + """ + Initialize the Preview Domain + + :returns: Domain for Preview + :rtype: twilio.rest.hosted_numbers.Preview + """ + super(Preview, self).__init__(twilio) + self.base_url = 'https://Preview.twilio.com' + self._HostedNumbers = None + + @property + def HostedNumbers(self): + """ + :returns: Versions hosted_numbers of Preview + :rtype: twilio.rest.Preview.hosted_numbers + """ + if self._HostedNumbers is None: + self._HostedNumbers = HostedNumbers(self) + return self._HostedNumbers + + + @property + def authorization_documents(self): + """ + :rtype: twilio.rest.hosted_numbers.authorization_documents + """ + return self.hosted_numbers.authorization_documents + + + @property + def hosted_number_orders(self): + """ + :rtype: twilio.rest.hosted_numbers.hosted_number_orders + """ + return self.hosted_numbers.hosted_number_orders + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/Marketplace.py b/twilio/rest/preview/Marketplace.py new file mode 100644 index 0000000000..d549d009bd --- /dev/null +++ b/twilio/rest/preview/Marketplace.py @@ -0,0 +1,63 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.Preview.marketplace import Marketplace + +class Preview(Domain): + def __init__(self, twilio): + """ + Initialize the Preview Domain + + :returns: Domain for Preview + :rtype: twilio.rest.marketplace.Preview + """ + super(Preview, self).__init__(twilio) + self.base_url = 'https://Preview.twilio.com' + self._Marketplace = None + + @property + def Marketplace(self): + """ + :returns: Versions marketplace of Preview + :rtype: twilio.rest.Preview.marketplace + """ + if self._Marketplace is None: + self._Marketplace = Marketplace(self) + return self._Marketplace + + + @property + def available_add_ons(self): + """ + :rtype: twilio.rest.marketplace.available_add_ons + """ + return self.marketplace.available_add_ons + + + @property + def installed_add_ons(self): + """ + :rtype: twilio.rest.marketplace.installed_add_ons + """ + return self.marketplace.installed_add_ons + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/Sync.py b/twilio/rest/preview/Sync.py new file mode 100644 index 0000000000..4e0ad3b8e9 --- /dev/null +++ b/twilio/rest/preview/Sync.py @@ -0,0 +1,55 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.Preview.sync import Sync + +class Preview(Domain): + def __init__(self, twilio): + """ + Initialize the Preview Domain + + :returns: Domain for Preview + :rtype: twilio.rest.sync.Preview + """ + super(Preview, self).__init__(twilio) + self.base_url = 'https://Preview.twilio.com' + self._Sync = None + + @property + def Sync(self): + """ + :returns: Versions sync of Preview + :rtype: twilio.rest.Preview.sync + """ + if self._Sync is None: + self._Sync = Sync(self) + return self._Sync + + + @property + def services(self): + """ + :rtype: twilio.rest.sync.services + """ + return self.sync.services + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/Understand.py b/twilio/rest/preview/Understand.py new file mode 100644 index 0000000000..916ec7d2e7 --- /dev/null +++ b/twilio/rest/preview/Understand.py @@ -0,0 +1,55 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.Preview.understand import Understand + +class Preview(Domain): + def __init__(self, twilio): + """ + Initialize the Preview Domain + + :returns: Domain for Preview + :rtype: twilio.rest.understand.Preview + """ + super(Preview, self).__init__(twilio) + self.base_url = 'https://Preview.twilio.com' + self._Understand = None + + @property + def Understand(self): + """ + :returns: Versions understand of Preview + :rtype: twilio.rest.Preview.understand + """ + if self._Understand is None: + self._Understand = Understand(self) + return self._Understand + + + @property + def assistants(self): + """ + :rtype: twilio.rest.understand.assistants + """ + return self.understand.assistants + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/Wireless.py b/twilio/rest/preview/Wireless.py new file mode 100644 index 0000000000..1e93190b92 --- /dev/null +++ b/twilio/rest/preview/Wireless.py @@ -0,0 +1,71 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from twilio.base.domain import Domain +from twilio.rest.Preview.wireless import Wireless + +class Preview(Domain): + def __init__(self, twilio): + """ + Initialize the Preview Domain + + :returns: Domain for Preview + :rtype: twilio.rest.wireless.Preview + """ + super(Preview, self).__init__(twilio) + self.base_url = 'https://Preview.twilio.com' + self._Wireless = None + + @property + def Wireless(self): + """ + :returns: Versions wireless of Preview + :rtype: twilio.rest.Preview.wireless + """ + if self._Wireless is None: + self._Wireless = Wireless(self) + return self._Wireless + + + @property + def commands(self): + """ + :rtype: twilio.rest.wireless.commands + """ + return self.wireless.commands + + + @property + def rate_plans(self): + """ + :rtype: twilio.rest.wireless.rate_plans + """ + return self.wireless.rate_plans + + + @property + def sims(self): + """ + :rtype: twilio.rest.wireless.sims + """ + return self.wireless.sims + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/deployed_devices/fleet.py b/twilio/rest/preview/deployed_devices/fleet.py new file mode 100644 index 0000000000..7fe4cf9a78 --- /dev/null +++ b/twilio/rest/preview/deployed_devices/fleet.py @@ -0,0 +1,184 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.fleet.certificate import CertificateListInstancefrom twilio.rest.fleet.deployment import DeploymentListInstancefrom twilio.rest.fleet.device import DeviceListInstancefrom twilio.rest.fleet.key import KeyListInstance + + +class FleetContext(InstanceContext): + def __init__(self, version: DeployedDevices, sid: str): + # TODO: needs autogenerated docs + super(FleetContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Fleets/${sid}' + + self._certificates = None + self._deployments = None + self._devices = None + self._keys = None + + def delete(self): + + + """ + Deletes the FleetInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FleetInstance + + :returns: The fetched FleetInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FleetInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FleetInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FleetInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(FleetInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'unique_name' = payload.get('unique_name'), + 'friendly_name' = payload.get('friendly_name'), + 'account_sid' = payload.get('account_sid'), + 'default_deployment_sid' = payload.get('default_deployment_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FleetContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def certificates(self): + return self._proxy.certificates + @property + def deployments(self): + return self._proxy.deployments + @property + def devices(self): + return self._proxy.devices + @property + def keys(self): + return self._proxy.keys + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FleetListInstance(ListResource): + def __init__(self, version: DeployedDevices): + # TODO: needs autogenerated docs + super(FleetListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Fleets' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FleetInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FleetPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/deployed_devices/fleet/certificate.py b/twilio/rest/preview/deployed_devices/fleet/certificate.py index 9f376979fa..2eb8f9f4b4 100644 --- a/twilio/rest/preview/deployed_devices/fleet/certificate.py +++ b/twilio/rest/preview/deployed_devices/fleet/certificate.py @@ -1,456 +1,168 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CertificateList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the CertificateList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - """ - super(CertificateList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Certificates'.format(**self._solution) - - def create(self, certificate_data, friendly_name=values.unset, - device_sid=values.unset): - """ - Create the CertificateInstance - - :param unicode certificate_data: The public certificate data. - :param unicode friendly_name: The human readable description for this Certificate. - :param unicode device_sid: The unique identifier of a Device to be authenticated. - - :returns: The created CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - data = values.of({ - 'CertificateData': certificate_data, - 'FriendlyName': friendly_name, - 'DeviceSid': device_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CertificateInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, device_sid=values.unset, limit=None, page_size=None): - """ - Streams CertificateInstance 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 device_sid: Find all Certificates authenticating specified Device. - :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.deployed_devices.fleet.certificate.CertificateInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(device_sid=device_sid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, device_sid=values.unset, limit=None, page_size=None): - """ - Lists CertificateInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode device_sid: Find all Certificates authenticating specified Device. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.deployed_devices.fleet.certificate.CertificateInstance] - """ - return list(self.stream(device_sid=device_sid, limit=limit, page_size=page_size, )) - - def page(self, device_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CertificateInstance records from the API. - Request is executed immediately - - :param unicode device_sid: Find all Certificates authenticating specified Device. - :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 CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - """ - data = values.of({ - 'DeviceSid': device_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CertificatePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CertificateInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return CertificatePage(self._version, response, self._solution) - - 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, ) - - def __call__(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, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CertificatePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the CertificatePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificatePage - """ - super(CertificatePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CertificateContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the CertificateContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :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 - """ - super(CertificateContext, self).__init__(version) + def __init__(self, version: DeployedDevices, fleet_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CertificateContextList, self).__init__(version) # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Certificates/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CertificateInstance - - :returns: The fetched CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CertificateInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the CertificateInstance - - :param unicode friendly_name: The human readable description for this Certificate. - :param unicode device_sid: The unique identifier of a Device to be authenticated. - - :returns: The updated CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - data = values.of({'FriendlyName': friendly_name, 'DeviceSid': device_sid, }) + self._solution = { fleet_sid, sid, } + self._uri = '/Fleets/${fleet_sid}/Certificates/${sid}' + + + def delete(self): + + + """ + Deletes the CertificateInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CertificateInstance + + :returns: The fetched CertificateInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CertificateInstance( + self._version, + payload, + fleet_sidsid=self._solution['fleet_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return CertificateInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) + return CertificateInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CertificateInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the CertificateInstance - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ +class CertificateInstance(InstanceResource): + def __init__(self, version, payload, fleet_sid: str, sid: str): super(CertificateInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'friendly_name': payload.get('friendly_name'), - 'fleet_sid': payload.get('fleet_sid'), - 'account_sid': payload.get('account_sid'), - 'device_sid': payload.get('device_sid'), - 'thumbprint': payload.get('thumbprint'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'friendly_name' = payload.get('friendly_name'), + 'fleet_sid' = payload.get('fleet_sid'), + 'account_sid' = payload.get('account_sid'), + 'device_sid' = payload.get('device_sid'), + 'thumbprint' = payload.get('thumbprint'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'fleet_sid': fleet_sid or self._properties['fleet_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CertificateContext for this CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext - """ if self._context is None: self._context = CertificateContext( self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], + fleet_sid=self._solution['fleet_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Certificate. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Certificate. - :rtype: unicode - """ - return self._properties['url'] + - @property - def friendly_name(self): - """ - :returns: A human readable description for this Certificate. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def device_sid(self): - """ - :returns: The unique identifier of a mapped Device. - :rtype: unicode - """ - return self._properties['device_sid'] - - @property - def thumbprint(self): - """ - :returns: A Certificate unique payload hash. - :rtype: unicode - """ - return self._properties['thumbprint'] - - @property - def date_created(self): - """ - :returns: The date this Certificate was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Certificate was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch the CertificateInstance - - :returns: The fetched CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the CertificateInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the CertificateInstance - :param unicode friendly_name: The human readable description for this Certificate. - :param unicode device_sid: The unique identifier of a Device to be authenticated. +class CertificateListInstance(ListResource): + def __init__(self, version: DeployedDevices, fleet_sid: str): + # TODO: needs autogenerated docs + super(CertificateListInstanceList, self).__init__(version) - :returns: The updated CertificateInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance - """ - return self._proxy.update(friendly_name=friendly_name, device_sid=device_sid, ) + # Path Solution + self._solution = { fleet_sid, } + self._uri = '/Fleets/${fleet_sid}/Certificates' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CertificateInstance(self._version, payload, fleet_sid=self._solution['fleet_sid']) + + + def page(self, device_sid, page_size): + + data = values.of({ + 'device_sid': device_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CertificatePage(self._version, payload, fleet_sid=self._solution['fleet_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/deployed_devices/fleet/deployment.py b/twilio/rest/preview/deployed_devices/fleet/deployment.py index a9010d1097..8abf555cc2 100644 --- a/twilio/rest/preview/deployed_devices/fleet/deployment.py +++ b/twilio/rest/preview/deployed_devices/fleet/deployment.py @@ -1,433 +1,167 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DeploymentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the DeploymentList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - """ - super(DeploymentList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Deployments'.format(**self._solution) - - def create(self, friendly_name=values.unset, sync_service_sid=values.unset): - """ - Create the DeploymentInstance - - :param unicode friendly_name: A human readable description for this Deployment. - :param unicode sync_service_sid: The unique identifier of the Sync service instance. - - :returns: The created DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - data = values.of({'FriendlyName': friendly_name, 'SyncServiceSid': sync_service_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return DeploymentInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams DeploymentInstance 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 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.deployed_devices.fleet.deployment.DeploymentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DeploymentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.deployed_devices.fleet.deployment.DeploymentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DeploymentInstance records from the API. - Request is executed immediately - - :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 DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DeploymentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeploymentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DeploymentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DeploymentContext - - :param sid: A string that uniquely identifies the Deployment. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ - return DeploymentContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DeploymentContext - - :param sid: A string that uniquely identifies the Deployment. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ - return DeploymentContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.page import Page -class DeploymentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DeploymentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentPage - """ - super(DeploymentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeploymentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - return DeploymentInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class DeploymentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the DeploymentContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :param sid: A string that uniquely identifies the Deployment. - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ - super(DeploymentContext, self).__init__(version) + def __init__(self, version: DeployedDevices, fleet_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DeploymentContextList, self).__init__(version) # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Deployments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DeploymentInstance - - :returns: The fetched DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the DeploymentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, sync_service_sid=values.unset): - """ - Update the DeploymentInstance - - :param unicode friendly_name: A human readable description for this Deployment. - :param unicode sync_service_sid: The unique identifier of the Sync service instance. - - :returns: The updated DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - data = values.of({'FriendlyName': friendly_name, 'SyncServiceSid': sync_service_sid, }) + self._solution = { fleet_sid, sid, } + self._uri = '/Fleets/${fleet_sid}/Deployments/${sid}' + + + def delete(self): + + + """ + Deletes the DeploymentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DeploymentInstance + + :returns: The fetched DeploymentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DeploymentInstance( + self._version, + payload, + fleet_sidsid=self._solution['fleet_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return DeploymentInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) + return DeploymentInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DeploymentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the DeploymentInstance - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ +class DeploymentInstance(InstanceResource): + def __init__(self, version, payload, fleet_sid: str, sid: str): super(DeploymentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'friendly_name': payload.get('friendly_name'), - 'fleet_sid': payload.get('fleet_sid'), - 'account_sid': payload.get('account_sid'), - 'sync_service_sid': payload.get('sync_service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'friendly_name' = payload.get('friendly_name'), + 'fleet_sid' = payload.get('fleet_sid'), + 'account_sid' = payload.get('account_sid'), + 'sync_service_sid' = payload.get('sync_service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'fleet_sid': fleet_sid or self._properties['fleet_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeploymentContext for this DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentContext - """ if self._context is None: self._context = DeploymentContext( self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], + fleet_sid=self._solution['fleet_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Deployment. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Deployment. - :rtype: unicode - """ - return self._properties['url'] + - @property - def friendly_name(self): - """ - :returns: A human readable description for this Deployment - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sync_service_sid(self): - """ - :returns: The unique identifier of the Sync service instance. - :rtype: unicode - """ - return self._properties['sync_service_sid'] - - @property - def date_created(self): - """ - :returns: The date this Deployment was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Deployment was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch the DeploymentInstance - - :returns: The fetched DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the DeploymentInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, friendly_name=values.unset, sync_service_sid=values.unset): - """ - Update the DeploymentInstance - :param unicode friendly_name: A human readable description for this Deployment. - :param unicode sync_service_sid: The unique identifier of the Sync service instance. +class DeploymentListInstance(ListResource): + def __init__(self, version: DeployedDevices, fleet_sid: str): + # TODO: needs autogenerated docs + super(DeploymentListInstanceList, self).__init__(version) - :returns: The updated DeploymentInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentInstance - """ - return self._proxy.update(friendly_name=friendly_name, sync_service_sid=sync_service_sid, ) + # Path Solution + self._solution = { fleet_sid, } + self._uri = '/Fleets/${fleet_sid}/Deployments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DeploymentInstance(self._version, payload, fleet_sid=self._solution['fleet_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DeploymentPage(self._version, payload, fleet_sid=self._solution['fleet_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/deployed_devices/fleet/device.py b/twilio/rest/preview/deployed_devices/fleet/device.py index d72d0b2cac..7aff7b0920 100644 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ b/twilio/rest/preview/deployed_devices/fleet/device.py @@ -1,504 +1,171 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DeviceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the DeviceList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - """ - super(DeviceList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Devices'.format(**self._solution) - - def create(self, unique_name=values.unset, friendly_name=values.unset, - identity=values.unset, deployment_sid=values.unset, - enabled=values.unset): - """ - Create the DeviceInstance - - :param unicode unique_name: A unique, addressable name of this Device. - :param unicode friendly_name: A human readable description for this Device. - :param unicode identity: An identifier of the Device user. - :param unicode deployment_sid: The unique SID of the Deployment group. - :param bool enabled: The enabled - - :returns: The created DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'Identity': identity, - 'DeploymentSid': deployment_sid, - 'Enabled': enabled, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return DeviceInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, deployment_sid=values.unset, limit=None, page_size=None): - """ - Streams DeviceInstance 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 deployment_sid: Find all Devices grouped under the specified Deployment. - :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.deployed_devices.fleet.device.DeviceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(deployment_sid=deployment_sid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, deployment_sid=values.unset, limit=None, page_size=None): - """ - Lists DeviceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode deployment_sid: Find all Devices grouped under the specified Deployment. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.deployed_devices.fleet.device.DeviceInstance] - """ - return list(self.stream(deployment_sid=deployment_sid, limit=limit, page_size=page_size, )) - - def page(self, deployment_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of DeviceInstance records from the API. - Request is executed immediately - - :param unicode deployment_sid: Find all Devices grouped under the specified Deployment. - :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 DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - """ - data = values.of({ - 'DeploymentSid': deployment_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DevicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeviceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DevicePage(self._version, response, self._solution) - - 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, ) - - def __call__(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, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DevicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DevicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage - """ - super(DevicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - 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'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DeviceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the DeviceContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :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 - """ - super(DeviceContext, self).__init__(version) + def __init__(self, version: DeployedDevices, fleet_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DeviceContextList, self).__init__(version) # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Devices/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DeviceInstance - - :returns: The fetched DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the DeviceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, identity=values.unset, - deployment_sid=values.unset, enabled=values.unset): - """ - Update the DeviceInstance + self._solution = { fleet_sid, sid, } + self._uri = '/Fleets/${fleet_sid}/Devices/${sid}' + + + def delete(self): + + + """ + Deletes the DeviceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DeviceInstance + + :returns: The fetched DeviceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DeviceInstance( + self._version, + payload, + fleet_sidsid=self._solution['fleet_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :param unicode friendly_name: A human readable description for this Device. - :param unicode identity: An identifier of the Device user. - :param unicode deployment_sid: The unique SID of the Deployment group. - :param bool enabled: The enabled + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The updated DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Identity': identity, - 'DeploymentSid': deployment_sid, - 'Enabled': enabled, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return DeviceInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) + return DeviceInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DeviceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the DeviceInstance - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ +class DeviceInstance(InstanceResource): + def __init__(self, version, payload, fleet_sid: str, sid: str): super(DeviceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'unique_name': payload.get('unique_name'), - 'friendly_name': payload.get('friendly_name'), - 'fleet_sid': payload.get('fleet_sid'), - 'enabled': payload.get('enabled'), - 'account_sid': payload.get('account_sid'), - 'identity': payload.get('identity'), - 'deployment_sid': payload.get('deployment_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'date_authenticated': deserialize.iso8601_datetime(payload.get('date_authenticated')), + self._properties = { + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'unique_name' = payload.get('unique_name'), + 'friendly_name' = payload.get('friendly_name'), + 'fleet_sid' = payload.get('fleet_sid'), + 'enabled' = payload.get('enabled'), + 'account_sid' = payload.get('account_sid'), + 'identity' = payload.get('identity'), + 'deployment_sid' = payload.get('deployment_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'date_authenticated' = payload.get('date_authenticated'), } - # Context self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'fleet_sid': fleet_sid or self._properties['fleet_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeviceContext for this DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext - """ if self._context is None: self._context = DeviceContext( self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], + fleet_sid=self._solution['fleet_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Device. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Device. - :rtype: unicode - """ - return self._properties['url'] - - @property - def unique_name(self): - """ - :returns: A unique, addressable name of this Device. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this Device - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def enabled(self): - """ - :returns: Device enabled flag. - :rtype: bool - """ - return self._properties['enabled'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def identity(self): - """ - :returns: An identifier of the Device user. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def deployment_sid(self): - """ - :returns: The unique SID of the Deployment group. - :rtype: unicode - """ - return self._properties['deployment_sid'] + - @property - def date_created(self): - """ - :returns: The date this Device was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Device was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_authenticated(self): - """ - :returns: The date this Device was authenticated. - :rtype: datetime - """ - return self._properties['date_authenticated'] - - def fetch(self): - """ - Fetch the DeviceInstance - - :returns: The fetched DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the DeviceInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, friendly_name=values.unset, identity=values.unset, - deployment_sid=values.unset, enabled=values.unset): - """ - Update the DeviceInstance - :param unicode friendly_name: A human readable description for this Device. - :param unicode identity: An identifier of the Device user. - :param unicode deployment_sid: The unique SID of the Deployment group. - :param bool enabled: The enabled +class DeviceListInstance(ListResource): + def __init__(self, version: DeployedDevices, fleet_sid: str): + # TODO: needs autogenerated docs + super(DeviceListInstanceList, self).__init__(version) - :returns: The updated DeviceInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - identity=identity, - deployment_sid=deployment_sid, - enabled=enabled, - ) + # Path Solution + self._solution = { fleet_sid, } + self._uri = '/Fleets/${fleet_sid}/Devices' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DeviceInstance(self._version, payload, fleet_sid=self._solution['fleet_sid']) + + + def page(self, deployment_sid, page_size): + + data = values.of({ + 'deployment_sid': deployment_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DevicePage(self._version, payload, fleet_sid=self._solution['fleet_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/deployed_devices/fleet/key.py b/twilio/rest/preview/deployed_devices/fleet/key.py index 4e989d64b7..81e1f1e1cf 100644 --- a/twilio/rest/preview/deployed_devices/fleet/key.py +++ b/twilio/rest/preview/deployed_devices/fleet/key.py @@ -1,450 +1,168 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class KeyList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid): - """ - Initialize the KeyList - - :param Version version: Version that contains the resource - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyList - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyList - """ - super(KeyList, self).__init__(version) - - # Path Solution - self._solution = {'fleet_sid': fleet_sid, } - self._uri = '/Fleets/{fleet_sid}/Keys'.format(**self._solution) - - def create(self, friendly_name=values.unset, device_sid=values.unset): - """ - Create the KeyInstance - - :param unicode friendly_name: The human readable description for this Key. - :param unicode device_sid: The unique identifier of a Key to be authenticated. - - :returns: The created KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - data = values.of({'FriendlyName': friendly_name, 'DeviceSid': device_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return KeyInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) - - def stream(self, device_sid=values.unset, limit=None, page_size=None): - """ - Streams KeyInstance 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 device_sid: Find all Keys authenticating specified Device. - :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.deployed_devices.fleet.key.KeyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(device_sid=device_sid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, device_sid=values.unset, limit=None, page_size=None): - """ - Lists KeyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode device_sid: Find all Keys authenticating specified Device. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.deployed_devices.fleet.key.KeyInstance] - """ - return list(self.stream(device_sid=device_sid, limit=limit, page_size=page_size, )) - - def page(self, device_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of KeyInstance records from the API. - Request is executed immediately - - :param unicode device_sid: Find all Keys authenticating specified Device. - :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 KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - """ - data = values.of({ - 'DeviceSid': device_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return KeyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of KeyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return KeyPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a KeyContext - - :param sid: A string that uniquely identifies the Key. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ - return KeyContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a KeyContext - - :param sid: A string that uniquely identifies the Key. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ - return KeyContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class KeyPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the KeyPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param fleet_sid: The unique identifier of the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage - """ - super(KeyPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of KeyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - return KeyInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class KeyContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, fleet_sid, sid): - """ - Initialize the KeyContext - - :param Version version: Version that contains the resource - :param fleet_sid: The fleet_sid - :param sid: A string that uniquely identifies the Key. - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ - super(KeyContext, self).__init__(version) + def __init__(self, version: DeployedDevices, fleet_sid: str, sid: str): + # TODO: needs autogenerated docs + super(KeyContextList, self).__init__(version) # Path Solution - self._solution = {'fleet_sid': fleet_sid, 'sid': sid, } - self._uri = '/Fleets/{fleet_sid}/Keys/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the KeyInstance - - :returns: The fetched KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the KeyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the KeyInstance - - :param unicode friendly_name: The human readable description for this Key. - :param unicode device_sid: The unique identifier of a Key to be authenticated. - - :returns: The updated KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - data = values.of({'FriendlyName': friendly_name, 'DeviceSid': device_sid, }) + self._solution = { fleet_sid, sid, } + self._uri = '/Fleets/${fleet_sid}/Keys/${sid}' + + + def delete(self): + + + """ + Deletes the KeyInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the KeyInstance + + :returns: The fetched KeyInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return KeyInstance( + self._version, + payload, + fleet_sidsid=self._solution['fleet_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return KeyInstance( - self._version, - payload, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], - ) + return KeyInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class KeyInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, fleet_sid, sid=None): - """ - Initialize the KeyInstance - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ +class KeyInstance(InstanceResource): + def __init__(self, version, payload, fleet_sid: str, sid: str): super(KeyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'friendly_name': payload.get('friendly_name'), - 'fleet_sid': payload.get('fleet_sid'), - 'account_sid': payload.get('account_sid'), - 'device_sid': payload.get('device_sid'), - 'secret': payload.get('secret'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'friendly_name' = payload.get('friendly_name'), + 'fleet_sid' = payload.get('fleet_sid'), + 'account_sid' = payload.get('account_sid'), + 'device_sid' = payload.get('device_sid'), + 'secret' = payload.get('secret'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'fleet_sid': fleet_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'fleet_sid': fleet_sid or self._properties['fleet_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: KeyContext for this KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext - """ if self._context is None: self._context = KeyContext( self._version, - fleet_sid=self._solution['fleet_sid'], - sid=self._solution['sid'], + fleet_sid=self._solution['fleet_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Key. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Key. - :rtype: unicode - """ - return self._properties['url'] + - @property - def friendly_name(self): - """ - :returns: A human readable description for this Key. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def fleet_sid(self): - """ - :returns: The unique identifier of the Fleet. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def device_sid(self): - """ - :returns: The unique identifier of a mapped Device. - :rtype: unicode - """ - return self._properties['device_sid'] - - @property - def secret(self): - """ - :returns: The key secret. - :rtype: unicode - """ - return self._properties['secret'] - - @property - def date_created(self): - """ - :returns: The date this Key credential was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Key credential was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - def fetch(self): - """ - Fetch the KeyInstance - - :returns: The fetched KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the KeyInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, friendly_name=values.unset, device_sid=values.unset): - """ - Update the KeyInstance - :param unicode friendly_name: The human readable description for this Key. - :param unicode device_sid: The unique identifier of a Key to be authenticated. +class KeyListInstance(ListResource): + def __init__(self, version: DeployedDevices, fleet_sid: str): + # TODO: needs autogenerated docs + super(KeyListInstanceList, self).__init__(version) - :returns: The updated KeyInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance - """ - return self._proxy.update(friendly_name=friendly_name, device_sid=device_sid, ) + # Path Solution + self._solution = { fleet_sid, } + self._uri = '/Fleets/${fleet_sid}/Keys' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return KeyInstance(self._version, payload, fleet_sid=self._solution['fleet_sid']) + + + def page(self, device_sid, page_size): + + data = values.of({ + 'device_sid': device_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return KeyPage(self._version, payload, fleet_sid=self._solution['fleet_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/hosted_numbers/authorization_document.py b/twilio/rest/preview/hosted_numbers/authorization_document.py new file mode 100644 index 0000000000..ab43ffa7a8 --- /dev/null +++ b/twilio/rest/preview/hosted_numbers/authorization_document.py @@ -0,0 +1,161 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.authorization_document.dependent_hosted_number_order import DependentHostedNumberOrderListInstance + + +class AuthorizationDocumentContext(InstanceContext): + def __init__(self, version: HostedNumbers, sid: str): + # TODO: needs autogenerated docs + super(AuthorizationDocumentContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/AuthorizationDocuments/${sid}' + + self._dependent_hosted_number_orders = None + + def fetch(self): + + """ + Fetch the AuthorizationDocumentInstance + + :returns: The fetched AuthorizationDocumentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AuthorizationDocumentInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AuthorizationDocumentInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(AuthorizationDocumentInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'address_sid' = payload.get('address_sid'), + 'status' = payload.get('status'), + 'email' = payload.get('email'), + 'cc_emails' = payload.get('cc_emails'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AuthorizationDocumentContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def dependent_hosted_number_orders(self): + return self._proxy.dependent_hosted_number_orders + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AuthorizationDocumentListInstance(ListResource): + def __init__(self, version: HostedNumbers): + # TODO: needs autogenerated docs + super(AuthorizationDocumentListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/AuthorizationDocuments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AuthorizationDocumentInstance(self._version, payload, ) + + + def page(self, email, status, page_size): + + data = values.of({ + 'email': email,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AuthorizationDocumentPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py index fd24f1a97b..d48f594379 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py @@ -1,457 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DependentHostedNumberOrderList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, signing_document_sid): - """ - Initialize the DependentHostedNumberOrderList - - :param Version version: Version that contains the resource - :param signing_document_sid: LOA document sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - """ - super(DependentHostedNumberOrderList, self).__init__(version) - - # Path Solution - self._solution = {'signing_document_sid': signing_document_sid, } - self._uri = '/AuthorizationDocuments/{signing_document_sid}/DependentHostedNumberOrders'.format(**self._solution) - - def stream(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Streams DependentHostedNumberOrderInstance 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 DependentHostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber 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 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.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Lists DependentHostedNumberOrderInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param DependentHostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber 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 int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance] - """ - return list(self.stream( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of DependentHostedNumberOrderInstance records from the API. - Request is executed immediately - - :param DependentHostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber 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 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 DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - """ - data = values.of({ - 'Status': status, - 'PhoneNumber': phone_number, - 'IncomingPhoneNumberSid': incoming_phone_number_sid, - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DependentHostedNumberOrderPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DependentHostedNumberOrderInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page +from twilio.base.page import Page - :returns: Page of DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return DependentHostedNumberOrderPage(self._version, response, self._solution) - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' -class DependentHostedNumberOrderPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DependentHostedNumberOrderPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param signing_document_sid: LOA document sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderPage - """ - super(DependentHostedNumberOrderPage, self).__init__(version, response) +class DependentHostedNumberOrderListInstance(ListResource): + def __init__(self, version: HostedNumbers, signing_document_sid: str): + # TODO: needs autogenerated docs + super(DependentHostedNumberOrderListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DependentHostedNumberOrderInstance + self._solution = { signing_document_sid, } + self._uri = '/AuthorizationDocuments/${signing_document_sid}/DependentHostedNumberOrders' + + + def page(self, status, phone_number, incoming_phone_number_sid, friendly_name, unique_name, page_size): + + data = values.of({ + 'status': status,'phone_number': phone_number,'incoming_phone_number_sid': incoming_phone_number_sid,'friendly_name': friendly_name,'unique_name': unique_name,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - """ - return DependentHostedNumberOrderInstance( - self._version, - payload, - signing_document_sid=self._solution['signing_document_sid'], - ) + return DependentHostedNumberOrderPage(self._version, payload, signing_document_sid=self._solution['signing_document_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class DependentHostedNumberOrderInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - RECEIVED = "received" - PENDING_VERIFICATION = "pending-verification" - VERIFIED = "verified" - PENDING_LOA = "pending-loa" - CARRIER_PROCESSING = "carrier-processing" - TESTING = "testing" - COMPLETED = "completed" - FAILED = "failed" - ACTION_REQUIRED = "action-required" - - class VerificationType(object): - PHONE_CALL = "phone-call" - PHONE_BILL = "phone-bill" - - def __init__(self, version, payload, signing_document_sid): - """ - Initialize the DependentHostedNumberOrderInstance - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderInstance - """ - super(DependentHostedNumberOrderInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'incoming_phone_number_sid': payload.get('incoming_phone_number_sid'), - 'address_sid': payload.get('address_sid'), - 'signing_document_sid': payload.get('signing_document_sid'), - 'phone_number': payload.get('phone_number'), - 'capabilities': payload.get('capabilities'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'status': payload.get('status'), - 'failure_reason': payload.get('failure_reason'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'verification_attempts': deserialize.integer(payload.get('verification_attempts')), - 'email': payload.get('email'), - 'cc_emails': payload.get('cc_emails'), - 'verification_type': payload.get('verification_type'), - 'verification_document_sid': payload.get('verification_document_sid'), - 'extension': payload.get('extension'), - 'call_delay': deserialize.integer(payload.get('call_delay')), - 'verification_code': payload.get('verification_code'), - 'verification_call_sids': payload.get('verification_call_sids'), - } - - # Context - self._context = None - self._solution = {'signing_document_sid': signing_document_sid, } - - @property - def sid(self): - """ - :returns: HostedNumberOrder sid. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account sid. - :rtype: unicode - """ - return self._properties['account_sid'] + return '' - @property - def incoming_phone_number_sid(self): - """ - :returns: IncomingPhoneNumber sid. - :rtype: unicode - """ - return self._properties['incoming_phone_number_sid'] - - @property - def address_sid(self): - """ - :returns: Address sid. - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def signing_document_sid(self): - """ - :returns: LOA document sid. - :rtype: unicode - """ - return self._properties['signing_document_sid'] - - @property - def phone_number(self): - """ - :returns: An E164 formatted phone number. - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def capabilities(self): - """ - :returns: A mapping of phone number capabilities. - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: A unique, developer assigned name of this HostedNumberOrder. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status(self): - """ - :returns: The Status of this HostedNumberOrder. - :rtype: DependentHostedNumberOrderInstance.Status - """ - return self._properties['status'] - - @property - def failure_reason(self): - """ - :returns: Why a hosted_number_order reached status "action-required" - :rtype: unicode - """ - return self._properties['failure_reason'] - - @property - def date_created(self): - """ - :returns: The date this HostedNumberOrder was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this HostedNumberOrder was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def verification_attempts(self): - """ - :returns: The number of attempts made to verify ownership of the phone number. - :rtype: unicode - """ - return self._properties['verification_attempts'] - - @property - def email(self): - """ - :returns: Email. - :rtype: unicode - """ - return self._properties['email'] - - @property - def cc_emails(self): - """ - :returns: A list of emails. - :rtype: list[unicode] - """ - return self._properties['cc_emails'] - - @property - def verification_type(self): - """ - :returns: The method used for verifying ownership of the number to be hosted. - :rtype: DependentHostedNumberOrderInstance.VerificationType - """ - return self._properties['verification_type'] - - @property - def verification_document_sid(self): - """ - :returns: Verification Document Sid. - :rtype: unicode - """ - return self._properties['verification_document_sid'] - - @property - def extension(self): - """ - :returns: Phone extension to use for ownership verification call. - :rtype: unicode - """ - return self._properties['extension'] - - @property - def call_delay(self): - """ - :returns: Seconds (0-30) to delay ownership verification call by. - :rtype: unicode - """ - return self._properties['call_delay'] - - @property - def verification_code(self): - """ - :returns: The digits passed during the ownership verification call. - :rtype: unicode - """ - return self._properties['verification_code'] - - @property - def verification_call_sids(self): - """ - :returns: List of IDs for ownership verification calls. - :rtype: list[unicode] - """ - return self._properties['verification_call_sids'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index 854000fa84..89ccca923d 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,688 +19,164 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class HostedNumberOrderList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the HostedNumberOrderList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderList - """ - super(HostedNumberOrderList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/HostedNumberOrders'.format(**self._solution) - - def stream(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Streams HostedNumberOrderInstance 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 HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber 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 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.hosted_numbers.hosted_number_order.HostedNumberOrderInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, limit=None, page_size=None): - """ - Lists HostedNumberOrderInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber 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 int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.hosted_numbers.hosted_number_order.HostedNumberOrderInstance] - """ - return list(self.stream( - status=status, - phone_number=phone_number, - incoming_phone_number_sid=incoming_phone_number_sid, - friendly_name=friendly_name, - unique_name=unique_name, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, phone_number=values.unset, - incoming_phone_number_sid=values.unset, friendly_name=values.unset, - unique_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of HostedNumberOrderInstance records from the API. - Request is executed immediately - - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode phone_number: An E164 formatted phone number. - :param unicode incoming_phone_number_sid: IncomingPhoneNumber 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 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 HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - """ - data = values.of({ - 'Status': status, - 'PhoneNumber': phone_number, - 'IncomingPhoneNumberSid': incoming_phone_number_sid, - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return HostedNumberOrderPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of HostedNumberOrderInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return HostedNumberOrderPage(self._version, response, self._solution) - - def create(self, phone_number, sms_capability, account_sid=values.unset, - friendly_name=values.unset, unique_name=values.unset, - cc_emails=values.unset, sms_url=values.unset, - sms_method=values.unset, sms_fallback_url=values.unset, - sms_fallback_method=values.unset, status_callback_url=values.unset, - status_callback_method=values.unset, - sms_application_sid=values.unset, address_sid=values.unset, - email=values.unset, verification_type=values.unset, - verification_document_sid=values.unset): - """ - Create the 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 list[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: The 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(method='POST', uri=self._uri, data=data, ) - - return HostedNumberOrderInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a HostedNumberOrderContext - - :param sid: HostedNumberOrder sid. - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ - return HostedNumberOrderContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a HostedNumberOrderContext - - :param sid: HostedNumberOrder sid. - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ - return HostedNumberOrderContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class HostedNumberOrderPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the HostedNumberOrderPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderPage - """ - super(HostedNumberOrderPage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of HostedNumberOrderInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - return HostedNumberOrderInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class HostedNumberOrderContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the HostedNumberOrderContext - - :param Version version: Version that contains the resource - :param sid: HostedNumberOrder sid. - - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ - super(HostedNumberOrderContext, self).__init__(version) + def __init__(self, version: HostedNumbers, sid: str): + # TODO: needs autogenerated docs + super(HostedNumberOrderContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/HostedNumberOrders/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the HostedNumberOrderInstance - - :returns: The fetched HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return HostedNumberOrderInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the HostedNumberOrderInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - email=values.unset, cc_emails=values.unset, status=values.unset, - verification_code=values.unset, verification_type=values.unset, - verification_document_sid=values.unset, extension=values.unset, - call_delay=values.unset): - """ - Update the HostedNumberOrderInstance - - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param unicode email: Email. - :param list[unicode] cc_emails: A list of emails. - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode verification_code: A verification code. - :param HostedNumberOrderInstance.VerificationType verification_type: Verification Type. - :param unicode verification_document_sid: Verification Document Sid - :param unicode extension: Digits to dial after connecting the verification call. - :param unicode call_delay: The number of seconds, between 0 and 60, to delay before initiating the verification call. - - :returns: The updated HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Email': email, - 'CcEmails': serialize.map(cc_emails, lambda e: e), - 'Status': status, - 'VerificationCode': verification_code, - 'VerificationType': verification_type, - 'VerificationDocumentSid': verification_document_sid, - 'Extension': extension, - 'CallDelay': call_delay, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return HostedNumberOrderInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/HostedNumberOrders/${sid}' + + + def delete(self): + + + """ + Deletes the HostedNumberOrderInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the HostedNumberOrderInstance + + :returns: The fetched HostedNumberOrderInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return HostedNumberOrderInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return HostedNumberOrderInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class HostedNumberOrderInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - RECEIVED = "received" - PENDING_VERIFICATION = "pending-verification" - VERIFIED = "verified" - PENDING_LOA = "pending-loa" - CARRIER_PROCESSING = "carrier-processing" - TESTING = "testing" - COMPLETED = "completed" - FAILED = "failed" - ACTION_REQUIRED = "action-required" - - class VerificationType(object): - PHONE_CALL = "phone-call" - PHONE_BILL = "phone-bill" - - def __init__(self, version, payload, sid=None): - """ - Initialize the HostedNumberOrderInstance - :returns: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ +class HostedNumberOrderInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(HostedNumberOrderInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'incoming_phone_number_sid': payload.get('incoming_phone_number_sid'), - 'address_sid': payload.get('address_sid'), - 'signing_document_sid': payload.get('signing_document_sid'), - 'phone_number': payload.get('phone_number'), - 'capabilities': payload.get('capabilities'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'status': payload.get('status'), - 'failure_reason': payload.get('failure_reason'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'verification_attempts': deserialize.integer(payload.get('verification_attempts')), - 'email': payload.get('email'), - 'cc_emails': payload.get('cc_emails'), - 'url': payload.get('url'), - 'verification_type': payload.get('verification_type'), - 'verification_document_sid': payload.get('verification_document_sid'), - 'extension': payload.get('extension'), - 'call_delay': deserialize.integer(payload.get('call_delay')), - 'verification_code': payload.get('verification_code'), - 'verification_call_sids': payload.get('verification_call_sids'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'incoming_phone_number_sid' = payload.get('incoming_phone_number_sid'), + 'address_sid' = payload.get('address_sid'), + 'signing_document_sid' = payload.get('signing_document_sid'), + 'phone_number' = payload.get('phone_number'), + 'capabilities' = payload.get('capabilities'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'status' = payload.get('status'), + 'failure_reason' = payload.get('failure_reason'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'verification_attempts' = payload.get('verification_attempts'), + 'email' = payload.get('email'), + 'cc_emails' = payload.get('cc_emails'), + 'url' = payload.get('url'), + 'verification_type' = payload.get('verification_type'), + 'verification_document_sid' = payload.get('verification_document_sid'), + 'extension' = payload.get('extension'), + 'call_delay' = payload.get('call_delay'), + 'verification_code' = payload.get('verification_code'), + 'verification_call_sids' = payload.get('verification_call_sids'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: HostedNumberOrderContext for this HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderContext - """ if self._context is None: - self._context = HostedNumberOrderContext(self._version, sid=self._solution['sid'], ) + self._context = HostedNumberOrderContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: HostedNumberOrder sid. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def incoming_phone_number_sid(self): - """ - :returns: IncomingPhoneNumber sid. - :rtype: unicode - """ - return self._properties['incoming_phone_number_sid'] - - @property - def address_sid(self): - """ - :returns: Address sid. - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def signing_document_sid(self): - """ - :returns: LOA document sid. - :rtype: unicode - """ - return self._properties['signing_document_sid'] - - @property - def phone_number(self): - """ - :returns: An E164 formatted phone number. - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def capabilities(self): - """ - :returns: A mapping of phone number capabilities. - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: A unique, developer assigned name of this HostedNumberOrder. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status(self): - """ - :returns: The Status of this HostedNumberOrder. - :rtype: HostedNumberOrderInstance.Status - """ - return self._properties['status'] - - @property - def failure_reason(self): - """ - :returns: Why a hosted_number_order reached status "action-required" - :rtype: unicode - """ - return self._properties['failure_reason'] - - @property - def date_created(self): - """ - :returns: The date this HostedNumberOrder was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this HostedNumberOrder was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def verification_attempts(self): - """ - :returns: The number of attempts made to verify ownership of the phone number. - :rtype: unicode - """ - return self._properties['verification_attempts'] - - @property - def email(self): - """ - :returns: Email. - :rtype: unicode - """ - return self._properties['email'] + - @property - def cc_emails(self): - """ - :returns: A list of emails. - :rtype: list[unicode] - """ - return self._properties['cc_emails'] - - @property - def url(self): - """ - :returns: The URL of this HostedNumberOrder. - :rtype: unicode - """ - return self._properties['url'] - - @property - def verification_type(self): - """ - :returns: The method used for verifying ownership of the number to be hosted. - :rtype: HostedNumberOrderInstance.VerificationType - """ - return self._properties['verification_type'] - - @property - def verification_document_sid(self): - """ - :returns: Verification Document Sid. - :rtype: unicode - """ - return self._properties['verification_document_sid'] - - @property - def extension(self): - """ - :returns: Phone extension to use for ownership verification call. - :rtype: unicode - """ - return self._properties['extension'] - - @property - def call_delay(self): - """ - :returns: Seconds (0-30) to delay ownership verification call by. - :rtype: unicode - """ - return self._properties['call_delay'] - - @property - def verification_code(self): - """ - :returns: The digits passed during the ownership verification call. - :rtype: unicode - """ - return self._properties['verification_code'] - - @property - def verification_call_sids(self): - """ - :returns: List of IDs for ownership verification calls. - :rtype: list[unicode] + def __repr__(self): """ - return self._properties['verification_call_sids'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the HostedNumberOrderInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the HostedNumberOrderInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() +class HostedNumberOrderListInstance(ListResource): + def __init__(self, version: HostedNumbers): + # TODO: needs autogenerated docs + super(HostedNumberOrderListInstanceList, self).__init__(version) - def update(self, friendly_name=values.unset, unique_name=values.unset, - email=values.unset, cc_emails=values.unset, status=values.unset, - verification_code=values.unset, verification_type=values.unset, - verification_document_sid=values.unset, extension=values.unset, - call_delay=values.unset): - """ - Update the HostedNumberOrderInstance - - :param unicode friendly_name: A human readable description of this resource. - :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder. - :param unicode email: Email. - :param list[unicode] cc_emails: A list of emails. - :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder. - :param unicode verification_code: A verification code. - :param HostedNumberOrderInstance.VerificationType verification_type: Verification Type. - :param unicode verification_document_sid: Verification Document Sid - :param unicode extension: Digits to dial after connecting the verification call. - :param unicode call_delay: The number of seconds, between 0 and 60, to delay before initiating the verification call. - - :returns: The updated HostedNumberOrderInstance - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - email=email, - cc_emails=cc_emails, - status=status, - verification_code=verification_code, - verification_type=verification_type, - verification_document_sid=verification_document_sid, - extension=extension, - call_delay=call_delay, - ) + # Path Solution + self._solution = { } + self._uri = '/HostedNumberOrders' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return HostedNumberOrderInstance(self._version, payload, ) + + + def page(self, status, phone_number, incoming_phone_number_sid, friendly_name, unique_name, page_size): + + data = values.of({ + 'status': status,'phone_number': phone_number,'incoming_phone_number_sid': incoming_phone_number_sid,'friendly_name': friendly_name,'unique_name': unique_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return HostedNumberOrderPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/marketplace/available_add_on.py b/twilio/rest/preview/marketplace/available_add_on.py new file mode 100644 index 0000000000..7360521194 --- /dev/null +++ b/twilio/rest/preview/marketplace/available_add_on.py @@ -0,0 +1,138 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.available_add_on.available_add_on_extension import AvailableAddOnExtensionListInstance + + +class AvailableAddOnContext(InstanceContext): + def __init__(self, version: Marketplace, sid: str): + # TODO: needs autogenerated docs + super(AvailableAddOnContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/AvailableAddOns/${sid}' + + self._extensions = None + + def fetch(self): + + """ + Fetch the AvailableAddOnInstance + + :returns: The fetched AvailableAddOnInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AvailableAddOnInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AvailableAddOnInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(AvailableAddOnInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'description' = payload.get('description'), + 'pricing_type' = payload.get('pricing_type'), + 'configuration_schema' = payload.get('configuration_schema'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AvailableAddOnContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def extensions(self): + return self._proxy.extensions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AvailableAddOnListInstance(ListResource): + def __init__(self, version: Marketplace): + # TODO: needs autogenerated docs + super(AvailableAddOnListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/AvailableAddOns' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AvailableAddOnPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py index ef5dfc9625..6f2e6c025e 100644 --- a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py +++ b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py @@ -1,362 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AvailableAddOnExtensionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, available_add_on_sid): - """ - Initialize the AvailableAddOnExtensionList - - :param Version version: Version that contains the resource - :param available_add_on_sid: The SID of the AvailableAddOn resource to which this extension applies - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - """ - super(AvailableAddOnExtensionList, self).__init__(version) - - # Path Solution - self._solution = {'available_add_on_sid': available_add_on_sid, } - self._uri = '/AvailableAddOns/{available_add_on_sid}/Extensions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AvailableAddOnExtensionInstance 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 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.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AvailableAddOnExtensionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AvailableAddOnExtensionInstance records from the API. - Request is executed immediately - - :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 AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AvailableAddOnExtensionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AvailableAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AvailableAddOnExtensionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AvailableAddOnExtensionContext - - :param sid: The SID of the AvailableAddOn Extension resource to fetch - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ - return AvailableAddOnExtensionContext( - self._version, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AvailableAddOnExtensionContext - - :param sid: The SID of the AvailableAddOn Extension resource to fetch - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ - return AvailableAddOnExtensionContext( - self._version, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AvailableAddOnExtensionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AvailableAddOnExtensionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param available_add_on_sid: The SID of the AvailableAddOn resource to which this extension applies - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionPage - """ - super(AvailableAddOnExtensionPage, self).__init__(version, response) - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AvailableAddOnExtensionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ - return AvailableAddOnExtensionInstance( - self._version, - payload, - available_add_on_sid=self._solution['available_add_on_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class AvailableAddOnExtensionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, available_add_on_sid, sid): - """ - Initialize the AvailableAddOnExtensionContext - - :param Version version: Version that contains the resource - :param available_add_on_sid: The SID of the AvailableAddOn resource with the extension to fetch - :param sid: The SID of the AvailableAddOn Extension resource to fetch - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ - super(AvailableAddOnExtensionContext, self).__init__(version) + def __init__(self, version: Marketplace, available_add_on_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AvailableAddOnExtensionContextList, self).__init__(version) # Path Solution - self._solution = {'available_add_on_sid': available_add_on_sid, 'sid': sid, } - self._uri = '/AvailableAddOns/{available_add_on_sid}/Extensions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AvailableAddOnExtensionInstance - - :returns: The fetched AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AvailableAddOnExtensionInstance( - self._version, - payload, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=self._solution['sid'], - ) + self._solution = { available_add_on_sid, sid, } + self._uri = '/AvailableAddOns/${available_add_on_sid}/Extensions/${sid}' + + + def fetch(self): + + """ + Fetch the AvailableAddOnExtensionInstance + + :returns: The fetched AvailableAddOnExtensionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AvailableAddOnExtensionInstance( + self._version, + payload, + available_add_on_sidsid=self._solution['available_add_on_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class AvailableAddOnExtensionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, available_add_on_sid, sid=None): - """ - Initialize the AvailableAddOnExtensionInstance - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ +class AvailableAddOnExtensionInstance(InstanceResource): + def __init__(self, version, payload, available_add_on_sid: str, sid: str): super(AvailableAddOnExtensionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'available_add_on_sid': payload.get('available_add_on_sid'), - 'friendly_name': payload.get('friendly_name'), - 'product_name': payload.get('product_name'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'available_add_on_sid' = payload.get('available_add_on_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'product_name' = payload.get('product_name'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'available_add_on_sid': available_add_on_sid, - 'sid': sid or self._properties['sid'], + 'available_add_on_sid': available_add_on_sid or self._properties['available_add_on_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AvailableAddOnExtensionContext for this AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionContext - """ if self._context is None: self._context = AvailableAddOnExtensionContext( self._version, - available_add_on_sid=self._solution['available_add_on_sid'], - sid=self._solution['sid'], + available_add_on_sid=self._solution['available_add_on_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def available_add_on_sid(self): + def __repr__(self): """ - :returns: The SID of the AvailableAddOn resource to which this extension applies - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['available_add_on_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - @property - def product_name(self): - """ - :returns: The name of the Extension's Product - :rtype: unicode - """ - return self._properties['product_name'] - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] +class AvailableAddOnExtensionListInstance(ListResource): + def __init__(self, version: Marketplace, available_add_on_sid: str): + # TODO: needs autogenerated docs + super(AvailableAddOnExtensionListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { available_add_on_sid, } + self._uri = '/AvailableAddOns/${available_add_on_sid}/Extensions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the AvailableAddOnExtensionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched AvailableAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance - """ - return self._proxy.fetch() + return AvailableAddOnExtensionPage(self._version, payload, available_add_on_sid=self._solution['available_add_on_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/marketplace/installed_add_on.py b/twilio/rest/preview/marketplace/installed_add_on.py new file mode 100644 index 0000000000..912845902a --- /dev/null +++ b/twilio/rest/preview/marketplace/installed_add_on.py @@ -0,0 +1,173 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.installed_add_on.installed_add_on_extension import InstalledAddOnExtensionListInstance + + +class InstalledAddOnContext(InstanceContext): + def __init__(self, version: Marketplace, sid: str): + # TODO: needs autogenerated docs + super(InstalledAddOnContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/InstalledAddOns/${sid}' + + self._extensions = None + + def delete(self): + + + """ + Deletes the InstalledAddOnInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the InstalledAddOnInstance + + :returns: The fetched InstalledAddOnInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InstalledAddOnInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return InstalledAddOnInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class InstalledAddOnInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(InstalledAddOnInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'description' = payload.get('description'), + 'configuration' = payload.get('configuration'), + 'unique_name' = payload.get('unique_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = InstalledAddOnContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def extensions(self): + return self._proxy.extensions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class InstalledAddOnListInstance(ListResource): + def __init__(self, version: Marketplace): + # TODO: needs autogenerated docs + super(InstalledAddOnListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/InstalledAddOns' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return InstalledAddOnInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InstalledAddOnPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py index e5b776ab4d..1dad7db793 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py +++ b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py @@ -1,402 +1,145 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class InstalledAddOnExtensionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, installed_add_on_sid): - """ - Initialize the InstalledAddOnExtensionList - - :param Version version: Version that contains the resource - :param installed_add_on_sid: The SID of the InstalledAddOn resource to which this extension applies - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - """ - super(InstalledAddOnExtensionList, self).__init__(version) - - # Path Solution - self._solution = {'installed_add_on_sid': installed_add_on_sid, } - self._uri = '/InstalledAddOns/{installed_add_on_sid}/Extensions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams InstalledAddOnExtensionInstance 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 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.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists InstalledAddOnExtensionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of InstalledAddOnExtensionInstance records from the API. - Request is executed immediately - - :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 InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return InstalledAddOnExtensionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InstalledAddOnExtensionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - :returns: Page of InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InstalledAddOnExtensionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InstalledAddOnExtensionContext - - :param sid: The SID of the InstalledAddOn Extension resource to fetch - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ - return InstalledAddOnExtensionContext( - self._version, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InstalledAddOnExtensionContext - - :param sid: The SID of the InstalledAddOn Extension resource to fetch - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ - return InstalledAddOnExtensionContext( - self._version, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class InstalledAddOnExtensionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the InstalledAddOnExtensionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param installed_add_on_sid: The SID of the InstalledAddOn resource to which this extension applies - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionPage - """ - super(InstalledAddOnExtensionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of InstalledAddOnExtensionInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - return InstalledAddOnExtensionInstance( - self._version, - payload, - installed_add_on_sid=self._solution['installed_add_on_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class InstalledAddOnExtensionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, installed_add_on_sid, sid): - """ - Initialize the InstalledAddOnExtensionContext - - :param Version version: Version that contains the resource - :param installed_add_on_sid: The SID of the InstalledAddOn resource with the extension to fetch - :param sid: The SID of the InstalledAddOn Extension resource to fetch - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ - super(InstalledAddOnExtensionContext, self).__init__(version) + def __init__(self, version: Marketplace, installed_add_on_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InstalledAddOnExtensionContextList, self).__init__(version) # Path Solution - self._solution = {'installed_add_on_sid': installed_add_on_sid, 'sid': sid, } - self._uri = '/InstalledAddOns/{installed_add_on_sid}/Extensions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the InstalledAddOnExtensionInstance - - :returns: The fetched InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return InstalledAddOnExtensionInstance( - self._version, - payload, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=self._solution['sid'], - ) - - def update(self, enabled): - """ - Update the InstalledAddOnExtensionInstance - - :param bool enabled: Whether the Extension should be invoked - - :returns: The updated InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - data = values.of({'Enabled': enabled, }) + self._solution = { installed_add_on_sid, sid, } + self._uri = '/InstalledAddOns/${installed_add_on_sid}/Extensions/${sid}' + + + def fetch(self): + + """ + Fetch the InstalledAddOnExtensionInstance + + :returns: The fetched InstalledAddOnExtensionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InstalledAddOnExtensionInstance( + self._version, + payload, + installed_add_on_sidsid=self._solution['installed_add_on_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return InstalledAddOnExtensionInstance( - self._version, - payload, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=self._solution['sid'], - ) + return InstalledAddOnExtensionInstance(self._version, payload, installed_add_on_sid=self._solution['installed_add_on_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class InstalledAddOnExtensionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, installed_add_on_sid, sid=None): - """ - Initialize the InstalledAddOnExtensionInstance - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ +class InstalledAddOnExtensionInstance(InstanceResource): + def __init__(self, version, payload, installed_add_on_sid: str, sid: str): super(InstalledAddOnExtensionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'installed_add_on_sid': payload.get('installed_add_on_sid'), - 'friendly_name': payload.get('friendly_name'), - 'product_name': payload.get('product_name'), - 'unique_name': payload.get('unique_name'), - 'enabled': payload.get('enabled'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'installed_add_on_sid' = payload.get('installed_add_on_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'product_name' = payload.get('product_name'), + 'unique_name' = payload.get('unique_name'), + 'enabled' = payload.get('enabled'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'installed_add_on_sid': installed_add_on_sid, - 'sid': sid or self._properties['sid'], + 'installed_add_on_sid': installed_add_on_sid or self._properties['installed_add_on_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InstalledAddOnExtensionContext for this InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionContext - """ if self._context is None: self._context = InstalledAddOnExtensionContext( self._version, - installed_add_on_sid=self._solution['installed_add_on_sid'], - sid=self._solution['sid'], + installed_add_on_sid=self._solution['installed_add_on_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def installed_add_on_sid(self): - """ - :returns: The SID of the InstalledAddOn resource to which this extension applies - :rtype: unicode - """ - return self._properties['installed_add_on_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def product_name(self): - """ - :returns: The name of the Extension's Product - :rtype: unicode - """ - return self._properties['product_name'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] + - @property - def enabled(self): + def __repr__(self): """ - :returns: Whether the Extension will be invoked - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['enabled'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the InstalledAddOnExtensionInstance - :returns: The fetched InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - return self._proxy.fetch() +class InstalledAddOnExtensionListInstance(ListResource): + def __init__(self, version: Marketplace, installed_add_on_sid: str): + # TODO: needs autogenerated docs + super(InstalledAddOnExtensionListInstanceList, self).__init__(version) - def update(self, enabled): - """ - Update the InstalledAddOnExtensionInstance + # Path Solution + self._solution = { installed_add_on_sid, } + self._uri = '/InstalledAddOns/${installed_add_on_sid}/Extensions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param bool enabled: Whether the Extension should be invoked + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated InstalledAddOnExtensionInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionInstance - """ - return self._proxy.update(enabled, ) + return InstalledAddOnExtensionPage(self._version, payload, installed_add_on_sid=self._solution['installed_add_on_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service.py b/twilio/rest/preview/sync/service.py new file mode 100644 index 0000000000..ee8fc5fd22 --- /dev/null +++ b/twilio/rest/preview/sync/service.py @@ -0,0 +1,181 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.document import DocumentListInstancefrom twilio.rest.service.sync_list import SyncListListInstancefrom twilio.rest.service.sync_map import SyncMapListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: Sync, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._documents = None + self._sync_lists = None + self._sync_maps = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'webhook_url' = payload.get('webhook_url'), + 'reachability_webhooks_enabled' = payload.get('reachability_webhooks_enabled'), + 'acl_enabled' = payload.get('acl_enabled'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def documents(self): + return self._proxy.documents + @property + def sync_lists(self): + return self._proxy.sync_lists + @property + def sync_maps(self): + return self._proxy.sync_maps + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: Sync): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/sync/service/document.py b/twilio/rest/preview/sync/service/document.py new file mode 100644 index 0000000000..f725f74b8e --- /dev/null +++ b/twilio/rest/preview/sync/service/document.py @@ -0,0 +1,174 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.document.document_permission import DocumentPermissionListInstance + + +class DocumentContext(InstanceContext): + def __init__(self, version: Sync, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DocumentContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Documents/${sid}' + + self._document_permissions = None + + def delete(self): + + + """ + Deletes the DocumentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DocumentInstance + + :returns: The fetched DocumentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DocumentInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class DocumentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(DocumentInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'revision' = payload.get('revision'), + 'data' = payload.get('data'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = DocumentContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def document_permissions(self): + return self._proxy.document_permissions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class DocumentListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str): + # TODO: needs autogenerated docs + super(DocumentListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Documents' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DocumentPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/sync/service/document/document_permission.py b/twilio/rest/preview/sync/service/document/document_permission.py index d1c67730f2..c45bcef965 100644 --- a/twilio/rest/preview/sync/service/document/document_permission.py +++ b/twilio/rest/preview/sync/service/document/document_permission.py @@ -1,443 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DocumentPermissionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, document_sid): - """ - Initialize the DocumentPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param document_sid: Sync Document SID. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - """ - super(DocumentPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentPermissionInstance 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 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.sync.service.document.document_permission.DocumentPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.service.document.document_permission.DocumentPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :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 DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DocumentPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPermissionPage(self._version, response, self._solution) - def get(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DocumentPermissionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param document_sid: Sync Document SID. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionPage - """ - super(DocumentPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentPermissionInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DocumentPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, document_sid, identity): - """ - Initialize the DocumentPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param document_sid: Sync Document SID or unique name. - :param identity: Identity of the user to whom the Sync Document Permission applies. - - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ - super(DocumentPermissionContext, self).__init__(version) + def __init__(self, version: Sync, service_sid: str, document_sid: str, identity: str): + # TODO: needs autogenerated docs + super(DocumentPermissionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DocumentPermissionInstance - - :returns: The fetched DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the DocumentPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: The updated DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) + self._solution = { service_sid, document_sid, identity, } + self._uri = '/Services/${service_sid}/Documents/${document_sid}/Permissions/${identity}' + + + def delete(self): + + + """ + Deletes the DocumentPermissionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DocumentPermissionInstance + + :returns: The fetched DocumentPermissionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DocumentPermissionInstance( + self._version, + payload, + service_siddocument_sididentity=self._solution['service_sid''document_sid''identity'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) + return DocumentPermissionInstance(self._version, payload, service_sid=self._solution['service_sid'], document_sid=self._solution['document_sid'], identity=self._solution['identity'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DocumentPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, service_sid, document_sid, identity=None): - """ - Initialize the DocumentPermissionInstance - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ +class DocumentPermissionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, document_sid: str, identity: str): super(DocumentPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'document_sid': payload.get('document_sid'), - 'identity': payload.get('identity'), - 'read': payload.get('read'), - 'write': payload.get('write'), - 'manage': payload.get('manage'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'document_sid' = payload.get('document_sid'), + 'identity' = payload.get('identity'), + 'read' = payload.get('read'), + 'write' = payload.get('write'), + 'manage' = payload.get('manage'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'document_sid': document_sid, - 'identity': identity or self._properties['identity'], + 'service_sid': service_sid or self._properties['service_sid']'document_sid': document_sid or self._properties['document_sid']'identity': identity or self._properties['identity'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentPermissionContext for this DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionContext - """ if self._context is None: self._context = DocumentPermissionContext( self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], + service_sid=self._solution['service_sid'],document_sid=self._solution['document_sid'],identity=self._solution['identity'], ) return self._context - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def document_sid(self): - """ - :returns: Sync Document SID. - :rtype: unicode - """ - return self._properties['document_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync Document Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] + - @property - def url(self): + def __repr__(self): """ - :returns: URL of this Sync Document Permission. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the DocumentPermissionInstance - :returns: The fetched DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the DocumentPermissionInstance +class DocumentPermissionListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str, document_sid: str): + # TODO: needs autogenerated docs + super(DocumentPermissionListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, document_sid, } + self._uri = '/Services/${service_sid}/Documents/${document_sid}/Permissions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: The updated DocumentPermissionInstance - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.update(read, write, manage, ) + return DocumentPermissionPage(self._version, payload, service_sid=self._solution['service_sid']document_sid=self._solution['document_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service/sync_list.py b/twilio/rest/preview/sync/service/sync_list.py new file mode 100644 index 0000000000..2866cd5faa --- /dev/null +++ b/twilio/rest/preview/sync/service/sync_list.py @@ -0,0 +1,166 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sync_list.sync_list_item import SyncListItemListInstancefrom twilio.rest.sync_list.sync_list_permission import SyncListPermissionListInstance + + +class SyncListContext(InstanceContext): + def __init__(self, version: Sync, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SyncListContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Lists/${sid}' + + self._sync_list_items = None + self._sync_list_permissions = None + + def delete(self): + + + """ + Deletes the SyncListInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncListInstance + + :returns: The fetched SyncListInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncListInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SyncListInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(SyncListInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'revision' = payload.get('revision'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SyncListContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def sync_list_items(self): + return self._proxy.sync_list_items + @property + def sync_list_permissions(self): + return self._proxy.sync_list_permissions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SyncListListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str): + # TODO: needs autogenerated docs + super(SyncListListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Lists' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncListPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py index 2b427e6a28..bbee33d605 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,504 +19,151 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncListItemList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListItemList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: The list_sid - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - """ - super(SyncListItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items'.format(**self._solution) - - def create(self, data): - """ - Create the SyncListItemInstance - - :param dict data: The data - - :returns: The created SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - data = values.of({'Data': serialize.object(data), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncListItemInstance 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 SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :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.sync.service.sync_list.sync_list_item.SyncListItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncListItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.service.sync_list.sync_list_item.SyncListItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListItemInstance records from the API. - Request is executed immediately - - :param SyncListItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncListItemInstance.QueryFromBoundType bounds: The bounds - :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 SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - """ - data = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncListItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListItemPage(self._version, response, self._solution) - - def get(self, index): - """ - Constructs a SyncListItemContext - :param index: The index - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __call__(self, index): - """ - Constructs a SyncListItemContext - - :param index: The index - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncListItemPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param list_sid: The list_sid - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemPage - """ - super(SyncListItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of SyncListItemInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncListItemContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid, index): - """ - Initialize the SyncListItemContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: The list_sid - :param index: The index - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ - super(SyncListItemContext, self).__init__(version) + def __init__(self, version: Sync, service_sid: str, list_sid: str, index: int): + # TODO: needs autogenerated docs + super(SyncListItemContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'index': index, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items/{index}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncListItemInstance - - :returns: The fetched SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - - def delete(self, if_match=values.unset): - """ - Deletes the SyncListItemInstance - - :param unicode if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, data, if_match=values.unset): - """ - Update the SyncListItemInstance - - :param dict data: The data - :param unicode if_match: The If-Match HTTP request header - - :returns: The updated SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - data = values.of({'Data': serialize.object(data), }) - headers = values.of({'If-Match': if_match, }) + self._solution = { service_sid, list_sid, index, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Items/${index}' + + + def delete(self, if_match): + + + """ + Deletes the SyncListItemInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncListItemInstance + + :returns: The fetched SyncListItemInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncListItemInstance( + self._version, + payload, + service_sidlist_sidindex=self._solution['service_sid''list_sid''index'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + payload = self._version.update(method='post', uri=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'], - ) + return SyncListItemInstance(self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], index=self._solution['index'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SyncListItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ + return '' - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - def __init__(self, version, payload, service_sid, list_sid, index=None): - """ - Initialize the SyncListItemInstance - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ +class SyncListItemInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, list_sid: str, index: int): super(SyncListItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'index': deserialize.integer(payload.get('index')), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'list_sid': payload.get('list_sid'), - 'url': payload.get('url'), - 'revision': payload.get('revision'), - 'data': payload.get('data'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), + self._properties = { + 'index' = payload.get('index'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'list_sid' = payload.get('list_sid'), + 'url' = payload.get('url'), + 'revision' = payload.get('revision'), + 'data' = payload.get('data'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'index': index or self._properties['index'], + 'service_sid': service_sid or self._properties['service_sid']'list_sid': list_sid or self._properties['list_sid']'index': index or self._properties['index'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListItemContext for this SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemContext - """ if self._context is None: self._context = SyncListItemContext( self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], + service_sid=self._solution['service_sid'],list_sid=self._solution['list_sid'],index=self._solution['index'], ) return self._context - @property - def index(self): - """ - :returns: The index - :rtype: unicode - """ - return self._properties['index'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: The list_sid - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] + - def fetch(self): - """ - Fetch the SyncListItemInstance - - :returns: The fetched SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self, if_match=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the SyncListItemInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(if_match=if_match, ) - - def update(self, data, if_match=values.unset): - """ - Update the SyncListItemInstance - :param dict data: The data - :param unicode if_match: The If-Match HTTP request header +class SyncListItemListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str, list_sid: str): + # TODO: needs autogenerated docs + super(SyncListItemListInstanceList, self).__init__(version) - :returns: The updated SyncListItemInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance - """ - return self._proxy.update(data, if_match=if_match, ) + # Path Solution + self._solution = { service_sid, list_sid, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Items' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncListItemInstance(self._version, payload, service_sid=self._solution['service_sid']list_sid=self._solution['list_sid']) + + + def page(self, order, _from, bounds, page_size): + + data = values.of({ + 'order': order,'_from': _from,'bounds': bounds,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncListItemPage(self._version, payload, service_sid=self._solution['service_sid']list_sid=self._solution['list_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py index 3a0bb2afb7..a2c9f1668f 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py @@ -1,443 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncListPermissionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param list_sid: Sync List SID. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - """ - super(SyncListPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListPermissionInstance 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 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.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :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 SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncListPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPermissionPage(self._version, response, self._solution) - def get(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.preview.sync.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, - ) - - def __call__(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.preview.sync.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, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncListPermissionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param list_sid: Sync List SID. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - super(SyncListPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListPermissionInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncListPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, list_sid, identity): - """ - Initialize the SyncListPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param list_sid: Sync List SID or unique name. - :param identity: Identity of the user to whom the Sync List Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - super(SyncListPermissionContext, self).__init__(version) + def __init__(self, version: Sync, service_sid: str, list_sid: str, identity: str): + # TODO: needs autogenerated docs + super(SyncListPermissionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncListPermissionInstance - - :returns: The fetched SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncListPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - 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: The updated SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) + self._solution = { service_sid, list_sid, identity, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Permissions/${identity}' + + + def delete(self): + + + """ + Deletes the SyncListPermissionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncListPermissionInstance + + :returns: The fetched SyncListPermissionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncListPermissionInstance( + self._version, + payload, + service_sidlist_sididentity=self._solution['service_sid''list_sid''identity'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=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'], - ) + return SyncListPermissionInstance(self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], identity=self._solution['identity'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncListPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, service_sid, list_sid, identity=None): - """ - Initialize the SyncListPermissionInstance - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ +class SyncListPermissionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, list_sid: str, identity: str): super(SyncListPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'list_sid': payload.get('list_sid'), - 'identity': payload.get('identity'), - 'read': payload.get('read'), - 'write': payload.get('write'), - 'manage': payload.get('manage'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'list_sid' = payload.get('list_sid'), + 'identity' = payload.get('identity'), + 'read' = payload.get('read'), + 'write' = payload.get('write'), + 'manage' = payload.get('manage'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'identity': identity or self._properties['identity'], + 'service_sid': service_sid or self._properties['service_sid']'list_sid': list_sid or self._properties['list_sid']'identity': identity or self._properties['identity'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListPermissionContext for this SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionContext - """ if self._context is None: self._context = SyncListPermissionContext( self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], + service_sid=self._solution['service_sid'],list_sid=self._solution['list_sid'],identity=self._solution['identity'], ) return self._context - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: Sync List SID. - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync List Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] + - @property - def url(self): + def __repr__(self): """ - :returns: URL of this Sync List Permission. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the SyncListPermissionInstance - :returns: The fetched SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the SyncListPermissionInstance +class SyncListPermissionListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str, list_sid: str): + # TODO: needs autogenerated docs + super(SyncListPermissionListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, list_sid, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Permissions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def update(self, read, write, manage): - """ - Update the SyncListPermissionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: The updated SyncListPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.update(read, write, manage, ) + return SyncListPermissionPage(self._version, payload, service_sid=self._solution['service_sid']list_sid=self._solution['list_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service/sync_map.py b/twilio/rest/preview/sync/service/sync_map.py new file mode 100644 index 0000000000..a58d5615c1 --- /dev/null +++ b/twilio/rest/preview/sync/service/sync_map.py @@ -0,0 +1,166 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sync_map.sync_map_item import SyncMapItemListInstancefrom twilio.rest.sync_map.sync_map_permission import SyncMapPermissionListInstance + + +class SyncMapContext(InstanceContext): + def __init__(self, version: Sync, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SyncMapContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Maps/${sid}' + + self._sync_map_items = None + self._sync_map_permissions = None + + def delete(self): + + + """ + Deletes the SyncMapInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncMapInstance + + :returns: The fetched SyncMapInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncMapInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SyncMapInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(SyncMapInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'revision' = payload.get('revision'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SyncMapContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def sync_map_items(self): + return self._proxy.sync_map_items + @property + def sync_map_permissions(self): + return self._proxy.sync_map_permissions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SyncMapListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str): + # TODO: needs autogenerated docs + super(SyncMapListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Maps' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncMapPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py index 81d3aa01cc..9c61d682ce 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,505 +19,151 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncMapItemList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapItemList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: The map_sid - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - """ - super(SyncMapItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items'.format(**self._solution) - - def create(self, key, data): - """ - Create the SyncMapItemInstance - - :param unicode key: The key - :param dict data: The data - - :returns: The 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(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 stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncMapItemInstance 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 SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :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.sync.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncMapItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param SyncMapItemInstance.QueryResultOrder order: The order - :param unicode from_: The from - :param SyncMapItemInstance.QueryFromBoundType bounds: The bounds - :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 SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - """ - data = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncMapItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapItemPage(self._version, response, self._solution) - - 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, - ) - - def __call__(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, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncMapItemPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - :param map_sid: The map_sid - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemPage - """ - super(SyncMapItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - 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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncMapItemContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid, key): - """ - Initialize the SyncMapItemContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: The map_sid - :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 - """ - super(SyncMapItemContext, self).__init__(version) + def __init__(self, version: Sync, service_sid: str, map_sid: str, key: str): + # TODO: needs autogenerated docs + super(SyncMapItemContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'key': key, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items/{key}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncMapItemInstance - - :returns: The fetched SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - - def delete(self, if_match=values.unset): - """ - Deletes the SyncMapItemInstance - - :param unicode if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, data, if_match=values.unset): - """ - Update the SyncMapItemInstance - - :param dict data: The data - :param unicode if_match: The If-Match HTTP request header - - :returns: The updated SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - data = values.of({'Data': serialize.object(data), }) - headers = values.of({'If-Match': if_match, }) + self._solution = { service_sid, map_sid, key, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Items/${key}' + + + def delete(self, if_match): + + + """ + Deletes the SyncMapItemInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncMapItemInstance + + :returns: The fetched SyncMapItemInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncMapItemInstance( + self._version, + payload, + service_sidmap_sidkey=self._solution['service_sid''map_sid''key'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + payload = self._version.update(method='post', uri=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'], - ) + return SyncMapItemInstance(self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SyncMapItemInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ + return '' - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - def __init__(self, version, payload, service_sid, map_sid, key=None): - """ - Initialize the SyncMapItemInstance - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ +class SyncMapItemInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, map_sid: str, key: str): super(SyncMapItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'key': payload.get('key'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'map_sid': payload.get('map_sid'), - 'url': payload.get('url'), - 'revision': payload.get('revision'), - 'data': payload.get('data'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), + self._properties = { + 'key' = payload.get('key'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'map_sid' = payload.get('map_sid'), + 'url' = payload.get('url'), + 'revision' = payload.get('revision'), + 'data' = payload.get('data'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'key': key or self._properties['key'], + 'service_sid': service_sid or self._properties['service_sid']'map_sid': map_sid or self._properties['map_sid']'key': key or self._properties['key'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapItemContext for this SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext - """ if self._context is None: self._context = SyncMapItemContext( self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], + service_sid=self._solution['service_sid'],map_sid=self._solution['map_sid'],key=self._solution['key'], ) return self._context - @property - def key(self): - """ - :returns: The key - :rtype: unicode - """ - return self._properties['key'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: The map_sid - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] + - def fetch(self): - """ - Fetch the SyncMapItemInstance - - :returns: The fetched SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self, if_match=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the SyncMapItemInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(if_match=if_match, ) - - def update(self, data, if_match=values.unset): - """ - Update the SyncMapItemInstance - :param dict data: The data - :param unicode if_match: The If-Match HTTP request header +class SyncMapItemListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str, map_sid: str): + # TODO: needs autogenerated docs + super(SyncMapItemListInstanceList, self).__init__(version) - :returns: The updated SyncMapItemInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return self._proxy.update(data, if_match=if_match, ) + # Path Solution + self._solution = { service_sid, map_sid, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Items' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + 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 page(self, order, _from, bounds, page_size): + + data = values.of({ + 'order': order,'_from': _from,'bounds': bounds,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncMapItemPage(self._version, payload, service_sid=self._solution['service_sid']map_sid=self._solution['map_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py index 765ca6ee07..e093e0079c 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py @@ -1,443 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncMapPermissionList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapPermissionList - - :param Version version: Version that contains the resource - :param service_sid: Sync Service Instance SID. - :param map_sid: Sync Map SID. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - super(SyncMapPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapPermissionInstance 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 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.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :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 SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncMapPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPermissionPage(self._version, response, self._solution) - def get(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.preview.sync.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, - ) - - def __call__(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.preview.sync.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, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncMapPermissionPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Sync Service Instance SID. - :param map_sid: Sync Map SID. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - super(SyncMapPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapPermissionInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncMapPermissionContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, map_sid, identity): - """ - Initialize the SyncMapPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param map_sid: Sync Map SID or unique name. - :param identity: Identity of the user to whom the Sync Map Permission applies. - - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - super(SyncMapPermissionContext, self).__init__(version) + def __init__(self, version: Sync, service_sid: str, map_sid: str, identity: str): + # TODO: needs autogenerated docs + super(SyncMapPermissionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncMapPermissionInstance - - :returns: The fetched SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncMapPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance - - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: The updated SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) + self._solution = { service_sid, map_sid, identity, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Permissions/${identity}' + + + def delete(self): + + + """ + Deletes the SyncMapPermissionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncMapPermissionInstance + + :returns: The fetched SyncMapPermissionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncMapPermissionInstance( + self._version, + payload, + service_sidmap_sididentity=self._solution['service_sid''map_sid''identity'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) + return SyncMapPermissionInstance(self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], identity=self._solution['identity'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncMapPermissionInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, service_sid, map_sid, identity=None): - """ - Initialize the SyncMapPermissionInstance - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ +class SyncMapPermissionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, map_sid: str, identity: str): super(SyncMapPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'map_sid': payload.get('map_sid'), - 'identity': payload.get('identity'), - 'read': payload.get('read'), - 'write': payload.get('write'), - 'manage': payload.get('manage'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'map_sid' = payload.get('map_sid'), + 'identity' = payload.get('identity'), + 'read' = payload.get('read'), + 'write' = payload.get('write'), + 'manage' = payload.get('manage'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'identity': identity or self._properties['identity'], + 'service_sid': service_sid or self._properties['service_sid']'map_sid': map_sid or self._properties['map_sid']'identity': identity or self._properties['identity'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapPermissionContext for this SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ if self._context is None: self._context = SyncMapPermissionContext( self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], + service_sid=self._solution['service_sid'],map_sid=self._solution['map_sid'],identity=self._solution['identity'], ) return self._context - @property - def account_sid(self): - """ - :returns: Twilio Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Sync Service Instance SID. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: Sync Map SID. - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def identity(self): - """ - :returns: Identity of the user to whom the Sync Map Permission applies. - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access. - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access. - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access. - :rtype: bool - """ - return self._properties['manage'] + - @property - def url(self): + def __repr__(self): """ - :returns: URL of this Sync Map Permission. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the SyncMapPermissionInstance - :returns: The fetched SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the SyncMapPermissionInstance +class SyncMapPermissionListInstance(ListResource): + def __init__(self, version: Sync, service_sid: str, map_sid: str): + # TODO: needs autogenerated docs + super(SyncMapPermissionListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, map_sid, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Permissions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param bool read: Read access. - :param bool write: Write access. - :param bool manage: Manage access. - - :returns: The updated SyncMapPermissionInstance - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.update(read, write, manage, ) + return SyncMapPermissionPage(self._version, payload, service_sid=self._solution['service_sid']map_sid=self._solution['map_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant.py b/twilio/rest/preview/understand/assistant.py new file mode 100644 index 0000000000..61be1551ae --- /dev/null +++ b/twilio/rest/preview/understand/assistant.py @@ -0,0 +1,203 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.assistant.assistant_fallback_actions import AssistantFallbackActionsListInstancefrom twilio.rest.assistant.assistant_initiation_actions import AssistantInitiationActionsListInstancefrom twilio.rest.assistant.dialogue import DialogueListInstancefrom twilio.rest.assistant.field_type import FieldTypeListInstancefrom twilio.rest.assistant.model_build import ModelBuildListInstancefrom twilio.rest.assistant.query import QueryListInstancefrom twilio.rest.assistant.style_sheet import StyleSheetListInstancefrom twilio.rest.assistant.task import TaskListInstance + + +class AssistantContext(InstanceContext): + def __init__(self, version: Understand, sid: str): + # TODO: needs autogenerated docs + super(AssistantContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Assistants/${sid}' + + self._assistant_fallback_actions = None + self._assistant_initiation_actions = None + self._dialogues = None + self._field_types = None + self._model_builds = None + self._queries = None + self._style_sheet = None + self._tasks = None + + def delete(self): + + + """ + Deletes the AssistantInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AssistantInstance + + :returns: The fetched AssistantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssistantInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AssistantInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(AssistantInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'latest_model_build_sid' = payload.get('latest_model_build_sid'), + 'links' = payload.get('links'), + 'log_queries' = payload.get('log_queries'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + 'callback_url' = payload.get('callback_url'), + 'callback_events' = payload.get('callback_events'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AssistantContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def assistant_fallback_actions(self): + return self._proxy.assistant_fallback_actions + @property + def assistant_initiation_actions(self): + return self._proxy.assistant_initiation_actions + @property + def dialogues(self): + return self._proxy.dialogues + @property + def field_types(self): + return self._proxy.field_types + @property + def model_builds(self): + return self._proxy.model_builds + @property + def queries(self): + return self._proxy.queries + @property + def style_sheet(self): + return self._proxy.style_sheet + @property + def tasks(self): + return self._proxy.tasks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AssistantListInstance(ListResource): + def __init__(self, version: Understand): + # TODO: needs autogenerated docs + super(AssistantListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Assistants' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssistantInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssistantPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py b/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py index 2c3ad2b33f..55b8bc1133 100644 --- a/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py +++ b/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py @@ -1,214 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AssistantFallbackActionsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the AssistantFallbackActionsList - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsList - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsList - """ - super(AssistantFallbackActionsList, self).__init__(version) - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - - def get(self): - """ - Constructs a AssistantFallbackActionsContext - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsContext - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsContext - """ - return AssistantFallbackActionsContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __call__(self): - """ - Constructs a AssistantFallbackActionsContext - - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsContext - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsContext - """ - return AssistantFallbackActionsContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssistantFallbackActionsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssistantFallbackActionsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The assistant_sid - - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsPage - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsPage - """ - super(AssistantFallbackActionsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssistantFallbackActionsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - """ - return AssistantFallbackActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AssistantFallbackActionsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the AssistantFallbackActionsContext - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsContext - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsContext - """ - super(AssistantFallbackActionsContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(AssistantFallbackActionsContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/FallbackActions'.format(**self._solution) - - def fetch(self): - """ - Fetch the AssistantFallbackActionsInstance - - :returns: The fetched AssistantFallbackActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssistantFallbackActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - ) - - def update(self, fallback_actions=values.unset): - """ - Update the AssistantFallbackActionsInstance - - :param dict fallback_actions: The fallback_actions - - :returns: The updated AssistantFallbackActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - """ - data = values.of({'FallbackActions': serialize.object(fallback_actions), }) + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/FallbackActions' + + + def fetch(self): + + """ + Fetch the AssistantFallbackActionsInstance + + :returns: The fetched AssistantFallbackActionsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssistantFallbackActionsInstance( + self._version, + payload, + assistant_sid=self._solution['assistant_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return AssistantFallbackActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - ) + return AssistantFallbackActionsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AssistantFallbackActionsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid): - """ - Initialize the AssistantFallbackActionsInstance - - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - """ +class AssistantFallbackActionsInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str): super(AssistantFallbackActionsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'url': payload.get('url'), - 'data': payload.get('data'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'url' = payload.get('url'), + 'data' = payload.get('data'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssistantFallbackActionsContext for this AssistantFallbackActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsContext - """ if self._context is None: self._context = AssistantFallbackActionsContext( self._version, @@ -216,64 +96,35 @@ def _proxy(self): ) return self._context - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assistant_sid(self): - """ - :returns: The assistant_sid - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict + def __repr__(self): """ - return self._properties['data'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the AssistantFallbackActionsInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched AssistantFallbackActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - """ - return self._proxy.fetch() - def update(self, fallback_actions=values.unset): - """ - Update the AssistantFallbackActionsInstance - :param dict fallback_actions: The fallback_actions +class AssistantFallbackActionsListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(AssistantFallbackActionsListInstanceList, self).__init__(version) - :returns: The updated AssistantFallbackActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance - """ - return self._proxy.update(fallback_actions=fallback_actions, ) + # Path Solution + self._solution = { assistant_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py b/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py index a0ffd23431..ea25dbeac2 100644 --- a/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py +++ b/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py @@ -1,220 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AssistantInitiationActionsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the AssistantInitiationActionsList - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsList - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsList - """ - super(AssistantInitiationActionsList, self).__init__(version) - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - - def get(self): - """ - Constructs a AssistantInitiationActionsContext - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsContext - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsContext - """ - return AssistantInitiationActionsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - ) - - def __call__(self): - """ - Constructs a AssistantInitiationActionsContext - - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsContext - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsContext - """ - return AssistantInitiationActionsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssistantInitiationActionsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssistantInitiationActionsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The assistant_sid - - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsPage - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsPage - """ - super(AssistantInitiationActionsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssistantInitiationActionsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - """ - return AssistantInitiationActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AssistantInitiationActionsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the AssistantInitiationActionsContext - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsContext - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsContext - """ - super(AssistantInitiationActionsContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(AssistantInitiationActionsContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/InitiationActions'.format(**self._solution) - - def fetch(self): - """ - Fetch the AssistantInitiationActionsInstance - - :returns: The fetched AssistantInitiationActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssistantInitiationActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - ) - - def update(self, initiation_actions=values.unset): - """ - Update the AssistantInitiationActionsInstance - - :param dict initiation_actions: The initiation_actions - - :returns: The updated AssistantInitiationActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - """ - data = values.of({'InitiationActions': serialize.object(initiation_actions), }) + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/InitiationActions' + + + def fetch(self): + + """ + Fetch the AssistantInitiationActionsInstance + + :returns: The fetched AssistantInitiationActionsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssistantInitiationActionsInstance( + self._version, + payload, + assistant_sid=self._solution['assistant_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return AssistantInitiationActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - ) + return AssistantInitiationActionsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AssistantInitiationActionsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid): - """ - Initialize the AssistantInitiationActionsInstance - - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - """ +class AssistantInitiationActionsInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str): super(AssistantInitiationActionsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'url': payload.get('url'), - 'data': payload.get('data'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'url' = payload.get('url'), + 'data' = payload.get('data'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssistantInitiationActionsContext for this AssistantInitiationActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsContext - """ if self._context is None: self._context = AssistantInitiationActionsContext( self._version, @@ -222,64 +96,35 @@ def _proxy(self): ) return self._context - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assistant_sid(self): - """ - :returns: The assistant_sid - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict + def __repr__(self): """ - return self._properties['data'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the AssistantInitiationActionsInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched AssistantInitiationActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - """ - return self._proxy.fetch() - def update(self, initiation_actions=values.unset): - """ - Update the AssistantInitiationActionsInstance - :param dict initiation_actions: The initiation_actions +class AssistantInitiationActionsListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(AssistantInitiationActionsListInstanceList, self).__init__(version) - :returns: The updated AssistantInitiationActionsInstance - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsInstance - """ - return self._proxy.update(initiation_actions=initiation_actions, ) + # Path Solution + self._solution = { assistant_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/dialogue.py b/twilio/rest/preview/understand/assistant/dialogue.py index 5f33372693..079823b9a2 100644 --- a/twilio/rest/preview/understand/assistant/dialogue.py +++ b/twilio/rest/preview/understand/assistant/dialogue.py @@ -1,260 +1,120 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DialogueList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the DialogueList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueList - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueList - """ - super(DialogueList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - - def get(self, sid): - """ - Constructs a DialogueContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueContext - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueContext - """ - return DialogueContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DialogueContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueContext - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueContext - """ - return DialogueContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - -class DialoguePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, response, solution): - """ - Initialize the DialoguePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the parent Assistant. - - :returns: twilio.rest.preview.understand.assistant.dialogue.DialoguePage - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialoguePage - """ - super(DialoguePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DialogueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueInstance - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueInstance - """ - return DialogueInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DialogueContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the DialogueContext - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueContext - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueContext - """ - super(DialogueContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DialogueContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Dialogues/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DialogueInstance - - :returns: The fetched DialogueInstance - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DialogueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Dialogues/${sid}' + + + def fetch(self): + + """ + Fetch the DialogueInstance + + :returns: The fetched DialogueInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DialogueInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DialogueInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the DialogueInstance - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueInstance - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueInstance - """ +class DialogueInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): super(DialogueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'data': payload.get('data'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'data' = payload.get('data'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DialogueContext for this DialogueInstance - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueContext - """ if self._context is None: self._context = DialogueContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Field. - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def assistant_sid(self): + def __repr__(self): """ - :returns: The unique ID of the parent Assistant. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['assistant_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sid(self): - """ - :returns: The unique ID of the Dialogue - :rtype: unicode - """ - return self._properties['sid'] - @property - def data(self): - """ - :returns: The dialogue memory object as json - :rtype: dict - """ - return self._properties['data'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the DialogueInstance +class DialogueListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(DialogueListInstanceList, self).__init__(version) - :returns: The fetched DialogueInstance - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { assistant_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/field_type.py b/twilio/rest/preview/understand/assistant/field_type.py new file mode 100644 index 0000000000..2c0259eca8 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/field_type.py @@ -0,0 +1,172 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.field_type.field_value import FieldValueListInstance + + +class FieldTypeContext(InstanceContext): + def __init__(self, version: Understand, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FieldTypeContextList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${sid}' + + self._field_values = None + + def delete(self): + + + """ + Deletes the FieldTypeInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FieldTypeInstance + + :returns: The fetched FieldTypeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FieldTypeInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FieldTypeInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super(FieldTypeInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'links' = payload.get('links'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FieldTypeContext( + self._version, + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def field_values(self): + return self._proxy.field_values + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FieldTypeListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(FieldTypeListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldTypePage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/understand/assistant/field_type/field_value.py b/twilio/rest/preview/understand/assistant/field_type/field_value.py index 5f8b8b9e14..6c81ead626 100644 --- a/twilio/rest/preview/understand/assistant/field_type/field_value.py +++ b/twilio/rest/preview/understand/assistant/field_type/field_value.py @@ -1,456 +1,158 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FieldValueList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, field_type_sid): - """ - Initialize the FieldValueList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - :param field_type_sid: The unique ID of the Field Type associated with this Field Value. - - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueList - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueList - """ - super(FieldValueList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'field_type_sid': field_type_sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues'.format(**self._solution) - - def stream(self, language=values.unset, limit=None, page_size=None): - """ - Streams FieldValueInstance 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 language: An ISO language-country string of the value. For example: en-US - :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.understand.assistant.field_type.field_value.FieldValueInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(language=language, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, language=values.unset, limit=None, page_size=None): - """ - Lists FieldValueInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: An ISO language-country string of the value. For example: en-US - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.understand.assistant.field_type.field_value.FieldValueInstance] - """ - return list(self.stream(language=language, limit=limit, page_size=page_size, )) - - def page(self, language=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of FieldValueInstance records from the API. - Request is executed immediately - - :param unicode language: An ISO language-country string of the value. For example: en-US - :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 FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValuePage - """ - data = values.of({ - 'Language': language, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FieldValuePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldValueInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValuePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldValuePage(self._version, response, self._solution) - - def create(self, language, value, synonym_of=values.unset): - """ - Create the FieldValueInstance - - :param unicode language: An ISO language-country string of the value. - :param unicode value: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param unicode synonym_of: A value that indicates this field value is a synonym of. Empty if the value is not a synonym. - - :returns: The created FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueInstance - """ - data = values.of({'Language': language, 'Value': value, 'SynonymOf': synonym_of, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FieldValueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - ) - - def get(self, sid): - """ - Constructs a FieldValueContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueContext - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueContext - """ - return FieldValueContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FieldValueContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueContext - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueContext - """ - return FieldValueContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldValuePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FieldValuePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the Assistant. - :param field_type_sid: The unique ID of the Field Type associated with this Field Value. - - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValuePage - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValuePage - """ - super(FieldValuePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldValueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueInstance - """ - return FieldValueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class FieldValueContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, field_type_sid, sid): - """ - Initialize the FieldValueContext - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - :param field_type_sid: The field_type_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueContext - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueContext - """ - super(FieldValueContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, field_type_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FieldValueContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'field_type_sid': field_type_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes/{field_type_sid}/FieldValues/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the FieldValueInstance - - :returns: The fetched FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FieldValueInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldValueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { assistant_sid, field_type_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${field_type_sid}/FieldValues/${sid}' + + + def delete(self): + + + """ + Deletes the FieldValueInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FieldValueInstance + + :returns: The fetched FieldValueInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FieldValueInstance( + self._version, + payload, + assistant_sidfield_type_sidsid=self._solution['assistant_sid''field_type_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FieldValueInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, assistant_sid, field_type_sid, sid=None): - """ - Initialize the FieldValueInstance - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueInstance - """ +class FieldValueInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, field_type_sid: str, sid: str): super(FieldValueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'field_type_sid': payload.get('field_type_sid'), - 'language': payload.get('language'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'value': payload.get('value'), - 'url': payload.get('url'), - 'synonym_of': payload.get('synonym_of'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'field_type_sid' = payload.get('field_type_sid'), + 'language' = payload.get('language'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'value' = payload.get('value'), + 'url' = payload.get('url'), + 'synonym_of' = payload.get('synonym_of'), } - # Context self._context = None self._solution = { - 'assistant_sid': assistant_sid, - 'field_type_sid': field_type_sid, - 'sid': sid or self._properties['sid'], + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'field_type_sid': field_type_sid or self._properties['field_type_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldValueContext for this FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueContext - """ if self._context is None: self._context = FieldValueContext( self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['field_type_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],field_type_sid=self._solution['field_type_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Field Value. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def field_type_sid(self): - """ - :returns: The unique ID of the Field Type associated with this Field Value. - :rtype: unicode - """ - return self._properties['field_type_sid'] - - @property - def language(self): - """ - :returns: An ISO language-country string of the value. - :rtype: unicode - """ - return self._properties['language'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def value(self): - """ - :returns: The Field Value itself. - :rtype: unicode - """ - return self._properties['value'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] + - @property - def synonym_of(self): + def __repr__(self): """ - :returns: A value that indicates this field value is a synonym of. Empty if the value is not a synonym. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['synonym_of'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the FieldValueInstance - :returns: The fetched FieldValueInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the FieldValueInstance +class FieldValueListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str, field_type_sid: str): + # TODO: needs autogenerated docs + super(FieldValueListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, field_type_sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${field_type_sid}/FieldValues' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldValueInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']field_type_sid=self._solution['field_type_sid']) + + + def page(self, language, page_size): + + data = values.of({ + 'language': language,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldValuePage(self._version, payload, assistant_sid=self._solution['assistant_sid']field_type_sid=self._solution['field_type_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/model_build.py b/twilio/rest/preview/understand/assistant/model_build.py index 974356359a..b85e0f14dd 100644 --- a/twilio/rest/preview/understand/assistant/model_build.py +++ b/twilio/rest/preview/understand/assistant/model_build.py @@ -1,456 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ModelBuildList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the ModelBuildList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildList - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildList - """ - super(ModelBuildList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/ModelBuilds'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ModelBuildInstance 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 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.understand.assistant.model_build.ModelBuildInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ModelBuildInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.understand.assistant.model_build.ModelBuildInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ModelBuildInstance records from the API. - Request is executed immediately - - :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 ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ModelBuildPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ModelBuildInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ModelBuildPage(self._version, response, self._solution) - - def create(self, status_callback=values.unset, unique_name=values.unset): - """ - Create the ModelBuildInstance - - :param unicode status_callback: The status_callback - :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. For example: v0.1 - - :returns: The created ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - """ - data = values.of({'StatusCallback': status_callback, 'UniqueName': unique_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - def get(self, sid): - """ - Constructs a ModelBuildContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildContext - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildContext - """ - return ModelBuildContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ModelBuildContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildContext - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildContext - """ - return ModelBuildContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ModelBuildPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ModelBuildPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the parent Assistant. - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildPage - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildPage - """ - super(ModelBuildPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ModelBuildInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - """ - return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ModelBuildContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the ModelBuildContext - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildContext - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildContext - """ - super(ModelBuildContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ModelBuildContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/ModelBuilds/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ModelBuildInstance - - :returns: The fetched ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ModelBuildInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def update(self, unique_name=values.unset): - """ - Update the ModelBuildInstance - - :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. For example: v0.1 - - :returns: The updated ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ModelBuildInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/ModelBuilds/${sid}' + + + def delete(self): + + + """ + Deletes the ModelBuildInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ModelBuildInstance + + :returns: The fetched ModelBuildInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ModelBuildInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the ModelBuildInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ModelBuildInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - ENQUEUED = "enqueued" - BUILDING = "building" - COMPLETED = "completed" - FAILED = "failed" - CANCELED = "canceled" - - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the ModelBuildInstance - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - """ +class ModelBuildInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): super(ModelBuildInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), - 'build_duration': deserialize.integer(payload.get('build_duration')), - 'error_code': deserialize.integer(payload.get('error_code')), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), + 'build_duration' = payload.get('build_duration'), + 'error_code' = payload.get('error_code'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ModelBuildContext for this ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildContext - """ if self._context is None: self._context = ModelBuildContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Model Build. - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the parent Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: A string that described the model build status. The values can be: enqueued, building, completed, failed - :rtype: ModelBuildInstance.Status - """ - return self._properties['status'] - - @property - def unique_name(self): - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def build_duration(self): - """ - :returns: The time in seconds it took to build the model. - :rtype: unicode - """ - return self._properties['build_duration'] - - @property - def error_code(self): - """ - :returns: The error_code - :rtype: unicode - """ - return self._properties['error_code'] - - def fetch(self): - """ - Fetch the ModelBuildInstance - - :returns: The fetched ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ModelBuildInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :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. For example: v0.1 - :returns: The updated ModelBuildInstance - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildInstance - """ - return self._proxy.update(unique_name=unique_name, ) - def delete(self): - """ - Deletes the ModelBuildInstance +class ModelBuildListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(ModelBuildListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/ModelBuilds' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ModelBuildInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ModelBuildPage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/query.py b/twilio/rest/preview/understand/assistant/query.py index 1400f61e48..c641f24bc3 100644 --- a/twilio/rest/preview/understand/assistant/query.py +++ b/twilio/rest/preview/understand/assistant/query.py @@ -1,518 +1,172 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class QueryList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the QueryList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - - :returns: twilio.rest.preview.understand.assistant.query.QueryList - :rtype: twilio.rest.preview.understand.assistant.query.QueryList - """ - super(QueryList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/Queries'.format(**self._solution) - - def stream(self, language=values.unset, model_build=values.unset, - status=values.unset, limit=None, page_size=None): - """ - Streams QueryInstance 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 language: An ISO language-country string of the sample. - :param unicode model_build: The Model Build Sid or unique name of the Model Build to be queried. - :param unicode status: A string that described the query status. The values can be: pending_review, reviewed, discarded - :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.understand.assistant.query.QueryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - language=language, - model_build=model_build, - status=status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, language=values.unset, model_build=values.unset, - status=values.unset, limit=None, page_size=None): - """ - Lists QueryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: An ISO language-country string of the sample. - :param unicode model_build: The Model Build Sid or unique name of the Model Build to be queried. - :param unicode status: A string that described the query status. The values can be: pending_review, reviewed, discarded - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.understand.assistant.query.QueryInstance] - """ - return list(self.stream( - language=language, - model_build=model_build, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, language=values.unset, model_build=values.unset, - status=values.unset, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of QueryInstance records from the API. - Request is executed immediately - - :param unicode language: An ISO language-country string of the sample. - :param unicode model_build: The Model Build Sid or unique name of the Model Build to be queried. - :param unicode status: A string that described the query status. The values can be: pending_review, reviewed, discarded - :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 QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryPage - """ - data = values.of({ - 'Language': language, - 'ModelBuild': model_build, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return QueryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of QueryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return QueryPage(self._version, response, self._solution) - - def create(self, language, query, tasks=values.unset, model_build=values.unset, - field=values.unset): - """ - Create the QueryInstance - - :param unicode language: An ISO language-country string of the sample. - :param unicode query: A user-provided string that uniquely identifies this resource as an alternative to the sid. It can be up to 2048 characters long. - :param unicode tasks: Constraints the query to a set of tasks. Useful when you need to constrain the paths the user can take. Tasks should be comma separated task-unique-name-1, task-unique-name-2 - :param unicode model_build: The Model Build Sid or unique name of the Model Build to be queried. - :param unicode field: Constraints the query to a given Field with an task. Useful when you know the Field you are expecting. It accepts one field in the format task-unique-name-1:field-unique-name - - :returns: The created QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance - """ - data = values.of({ - 'Language': language, - 'Query': query, - 'Tasks': tasks, - 'ModelBuild': model_build, - 'Field': field, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def get(self, sid): - """ - Constructs a QueryContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.query.QueryContext - :rtype: twilio.rest.preview.understand.assistant.query.QueryContext - """ - return QueryContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - def __call__(self, sid): - """ - Constructs a QueryContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.query.QueryContext - :rtype: twilio.rest.preview.understand.assistant.query.QueryContext - """ - return QueryContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class QueryPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the QueryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the parent Assistant. - - :returns: twilio.rest.preview.understand.assistant.query.QueryPage - :rtype: twilio.rest.preview.understand.assistant.query.QueryPage - """ - super(QueryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of QueryInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.preview.understand.assistant.query.QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance - """ - return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class QueryContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the QueryContext - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.query.QueryContext - :rtype: twilio.rest.preview.understand.assistant.query.QueryContext - """ - super(QueryContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(QueryContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Queries/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the QueryInstance - - :returns: The fetched QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return QueryInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def update(self, sample_sid=values.unset, status=values.unset): - """ - Update the QueryInstance - - :param unicode sample_sid: An optional reference to the Sample created from this query. - :param unicode status: A string that described the query status. The values can be: pending_review, reviewed, discarded - - :returns: The updated QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance - """ - data = values.of({'SampleSid': sample_sid, 'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return QueryInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Queries/${sid}' + + + def delete(self): + + + """ + Deletes the QueryInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the QueryInstance + + :returns: The fetched QueryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return QueryInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the QueryInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class QueryInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the QueryInstance - :returns: twilio.rest.preview.understand.assistant.query.QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance - """ +class QueryInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): super(QueryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'results': payload.get('results'), - 'language': payload.get('language'), - 'model_build_sid': payload.get('model_build_sid'), - 'query': payload.get('query'), - 'sample_sid': payload.get('sample_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'url': payload.get('url'), - 'source_channel': payload.get('source_channel'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'results' = payload.get('results'), + 'language' = payload.get('language'), + 'model_build_sid' = payload.get('model_build_sid'), + 'query' = payload.get('query'), + 'sample_sid' = payload.get('sample_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'url' = payload.get('url'), + 'source_channel' = payload.get('source_channel'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: QueryContext for this QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryContext - """ if self._context is None: self._context = QueryContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Query. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def results(self): - """ - :returns: The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields. - :rtype: dict - """ - return self._properties['results'] - - @property - def language(self): - """ - :returns: An ISO language-country string of the sample. - :rtype: unicode - """ - return self._properties['language'] - - @property - def model_build_sid(self): - """ - :returns: The unique ID of the Model Build queried. - :rtype: unicode - """ - return self._properties['model_build_sid'] - - @property - def query(self): - """ - :returns: The end-user's natural language input. - :rtype: unicode - """ - return self._properties['query'] - - @property - def sample_sid(self): - """ - :returns: An optional reference to the Sample created from this query. - :rtype: unicode - """ - return self._properties['sample_sid'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the parent Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: A string that described the query status. The values can be: pending_review, reviewed, discarded - :rtype: unicode - """ - return self._properties['status'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] + - @property - def source_channel(self): - """ - :returns: The communication channel where this end-user input came from - :rtype: unicode - """ - return self._properties['source_channel'] - - def fetch(self): - """ - Fetch the QueryInstance - - :returns: The fetched QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, sample_sid=values.unset, status=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the QueryInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode sample_sid: An optional reference to the Sample created from this query. - :param unicode status: A string that described the query status. The values can be: pending_review, reviewed, discarded - :returns: The updated QueryInstance - :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance - """ - return self._proxy.update(sample_sid=sample_sid, status=status, ) - def delete(self): - """ - Deletes the QueryInstance +class QueryListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(QueryListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Queries' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return QueryInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, language, model_build, status, page_size): + + data = values.of({ + 'language': language,'model_build': model_build,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return QueryPage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/style_sheet.py b/twilio/rest/preview/understand/assistant/style_sheet.py index 26813c8151..9a7866c766 100644 --- a/twilio/rest/preview/understand/assistant/style_sheet.py +++ b/twilio/rest/preview/understand/assistant/style_sheet.py @@ -1,264 +1,130 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class StyleSheetList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the StyleSheetList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant - - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetList - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetList - """ - super(StyleSheetList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - - def get(self): - """ - Constructs a StyleSheetContext - - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetContext - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetContext - """ - return StyleSheetContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __call__(self): - """ - Constructs a StyleSheetContext - - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetContext - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetContext - """ - return StyleSheetContext(self._version, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class StyleSheetPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the StyleSheetPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the Assistant - - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetPage - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetPage - """ - super(StyleSheetPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StyleSheetInstance - :param dict payload: Payload response from the API - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - """ - return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class StyleSheetContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the StyleSheetContext - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant - - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetContext - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetContext - """ - super(StyleSheetContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(StyleSheetContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/StyleSheet'.format(**self._solution) - - def fetch(self): - """ - Fetch the StyleSheetInstance - - :returns: The fetched StyleSheetInstance - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return StyleSheetInstance(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: The updated StyleSheetInstance - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - """ - data = values.of({'StyleSheet': serialize.object(style_sheet), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/StyleSheet' + + + def fetch(self): + + """ + Fetch the StyleSheetInstance + + :returns: The fetched StyleSheetInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return StyleSheetInstance( + self._version, + payload, + assistant_sid=self._solution['assistant_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class StyleSheetInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid): - """ - Initialize the StyleSheetInstance - - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - """ +class StyleSheetInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str): super(StyleSheetInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'url': payload.get('url'), - 'data': payload.get('data'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'url' = payload.get('url'), + 'data' = payload.get('data'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: StyleSheetContext for this StyleSheetInstance - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetContext - """ if self._context is None: - self._context = StyleSheetContext(self._version, assistant_sid=self._solution['assistant_sid'], ) + self._context = StyleSheetContext( + self._version, + assistant_sid=self._solution['assistant_sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Assistant - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the Assistant - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def data(self): - """ - :returns: The JSON style sheet object - :rtype: dict + def __repr__(self): """ - return self._properties['data'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the StyleSheetInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched StyleSheetInstance - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - """ - return self._proxy.fetch() - def update(self, style_sheet=values.unset): - """ - Update the StyleSheetInstance - :param dict style_sheet: The JSON Style sheet string +class StyleSheetListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(StyleSheetListInstanceList, self).__init__(version) - :returns: The updated StyleSheetInstance - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance - """ - return self._proxy.update(style_sheet=style_sheet, ) + # Path Solution + self._solution = { assistant_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/task.py b/twilio/rest/preview/understand/assistant/task.py new file mode 100644 index 0000000000..d97f71ed08 --- /dev/null +++ b/twilio/rest/preview/understand/assistant/task.py @@ -0,0 +1,185 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.task.field import FieldListInstancefrom twilio.rest.task.sample import SampleListInstancefrom twilio.rest.task.task_actions import TaskActionsListInstancefrom twilio.rest.task.task_statistics import TaskStatisticsListInstance + + +class TaskContext(InstanceContext): + def __init__(self, version: Understand, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TaskContextList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${sid}' + + self._fields = None + self._samples = None + self._task_actions = None + self._statistics = None + + def delete(self): + + + """ + Deletes the TaskInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TaskInstance + + :returns: The fetched TaskInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskInstance( + self._version, + payload, + assistant_sidsid=self._solution['assistant_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + 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 __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class TaskInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super(TaskInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'links' = payload.get('links'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'actions_url' = payload.get('actions_url'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = TaskContext( + self._version, + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def fields(self): + return self._proxy.fields + @property + def samples(self): + return self._proxy.samples + @property + def task_actions(self): + return self._proxy.task_actions + @property + def statistics(self): + return self._proxy.statistics + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class TaskListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str): + # TODO: needs autogenerated docs + super(TaskListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TaskPage(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/understand/assistant/task/field.py b/twilio/rest/preview/understand/assistant/task/field.py index 31cf2a0156..2baeead3db 100644 --- a/twilio/rest/preview/understand/assistant/task/field.py +++ b/twilio/rest/preview/understand/assistant/task/field.py @@ -1,438 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FieldList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the FieldList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task associated with this Field. - - :returns: twilio.rest.preview.understand.assistant.task.field.FieldList - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldList - """ - super(FieldList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FieldInstance 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 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.understand.assistant.task.field.FieldInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FieldInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.understand.assistant.task.field.FieldInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FieldInstance records from the API. - Request is executed immediately - - :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 FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FieldPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldPage(self._version, response, self._solution) - def create(self, field_type, unique_name): - """ - Create the FieldInstance - - :param unicode field_type: The unique name or sid of the FieldType. It can be any Built-in Field Type or the unique_name or sid of a custom Field Type. - :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. - - :returns: The created FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldInstance - """ - data = values.of({'FieldType': field_type, 'UniqueName': unique_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FieldInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def get(self, sid): - """ - Constructs a FieldContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.field.FieldContext - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldContext - """ - return FieldContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FieldContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.field.FieldContext - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldContext - """ - return FieldContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FieldPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task associated with this Field. - - :returns: twilio.rest.preview.understand.assistant.task.field.FieldPage - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldPage - """ - super(FieldPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.task.field.FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldInstance - """ - return FieldInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class FieldContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid, sid): - """ - Initialize the FieldContext - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - :param task_sid: The unique ID of the Task associated with this Field. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.field.FieldContext - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldContext - """ - super(FieldContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, task_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FieldContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Fields/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the FieldInstance - - :returns: The fetched FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FieldInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { assistant_sid, task_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Fields/${sid}' + + + def delete(self): + + + """ + Deletes the FieldInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FieldInstance + + :returns: The fetched FieldInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FieldInstance( + self._version, + payload, + assistant_sidtask_sidsid=self._solution['assistant_sid''task_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class FieldInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, task_sid, sid=None): - """ - Initialize the FieldInstance - :returns: twilio.rest.preview.understand.assistant.task.field.FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldInstance - """ +class FieldInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str, sid: str): super(FieldInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'field_type': payload.get('field_type'), - 'task_sid': payload.get('task_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'field_type' = payload.get('field_type'), + 'task_sid' = payload.get('task_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'assistant_sid': assistant_sid, - 'task_sid': task_sid, - 'sid': sid or self._properties['sid'], + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldContext for this FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldContext - """ if self._context is None: self._context = FieldContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Field. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def field_type(self): - """ - :returns: The Field Type of this field. It can be any Built-in Field Type or unique_name or the Field Type sid of a custom Field Type. - :rtype: unicode - """ - return self._properties['field_type'] - - @property - def task_sid(self): - """ - :returns: The unique ID of the Task associated with this Field. - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the parent Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] + - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): + def __repr__(self): """ - :returns: The url - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the FieldInstance - :returns: The fetched FieldInstance - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the FieldInstance +class FieldListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(FieldListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Fields' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldPage(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/task/sample.py b/twilio/rest/preview/understand/assistant/task/sample.py index f3c1d0f938..68f0f708a5 100644 --- a/twilio/rest/preview/understand/assistant/task/sample.py +++ b/twilio/rest/preview/understand/assistant/task/sample.py @@ -1,494 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SampleList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the SampleList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - :param task_sid: The unique ID of the Task associated with this Sample. - - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleList - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleList - """ - super(SampleList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples'.format(**self._solution) - - def stream(self, language=values.unset, limit=None, page_size=None): - """ - Streams SampleInstance 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 language: An ISO language-country string of the sample. - :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.understand.assistant.task.sample.SampleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(language=language, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, language=values.unset, limit=None, page_size=None): - """ - Lists SampleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode language: An ISO language-country string of the sample. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.understand.assistant.task.sample.SampleInstance] - """ - return list(self.stream(language=language, limit=limit, page_size=page_size, )) - - def page(self, language=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SampleInstance records from the API. - Request is executed immediately - - :param unicode language: An ISO language-country string of the sample. - :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 SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SamplePage - """ - data = values.of({ - 'Language': language, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SamplePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SampleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SamplePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SamplePage(self._version, response, self._solution) - - def create(self, language, tagged_text, source_channel=values.unset): - """ - Create the SampleInstance - - :param unicode language: An ISO language-country string of the sample. - :param unicode tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. - :param unicode source_channel: The communication channel the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included the value will be null - - :returns: The created SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - """ - data = values.of({'Language': language, 'TaggedText': tagged_text, 'SourceChannel': source_channel, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def get(self, sid): - """ - Constructs a SampleContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleContext - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleContext - """ - return SampleContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a SampleContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleContext - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleContext - """ - return SampleContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SamplePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SamplePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the Assistant. - :param task_sid: The unique ID of the Task associated with this Sample. - - :returns: twilio.rest.preview.understand.assistant.task.sample.SamplePage - :rtype: twilio.rest.preview.understand.assistant.task.sample.SamplePage - """ - super(SamplePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SampleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - """ - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class SampleContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid, sid): - """ - Initialize the SampleContext - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - :param task_sid: The unique ID of the Task associated with this Sample. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleContext - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleContext - """ - super(SampleContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, task_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SampleContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Samples/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SampleInstance - - :returns: The fetched SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - - def update(self, language=values.unset, tagged_text=values.unset, - source_channel=values.unset): - """ - Update the SampleInstance - - :param unicode language: An ISO language-country string of the sample. - :param unicode tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. - :param unicode source_channel: The communication channel the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included the value will be null - - :returns: The updated SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - """ - data = values.of({'Language': language, 'TaggedText': tagged_text, 'SourceChannel': source_channel, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + self._solution = { assistant_sid, task_sid, sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Samples/${sid}' + + + def delete(self): + + + """ + Deletes the SampleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SampleInstance + + :returns: The fetched SampleInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SampleInstance( + self._version, + payload, + assistant_sidtask_sidsid=self._solution['assistant_sid''task_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - return SampleInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the SampleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return SampleInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], task_sid=self._solution['task_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SampleInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, assistant_sid, task_sid, sid=None): - """ - Initialize the SampleInstance - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - """ +class SampleInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str, sid: str): super(SampleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'task_sid': payload.get('task_sid'), - 'language': payload.get('language'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'tagged_text': payload.get('tagged_text'), - 'url': payload.get('url'), - 'source_channel': payload.get('source_channel'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'task_sid' = payload.get('task_sid'), + 'language' = payload.get('language'), + 'assistant_sid' = payload.get('assistant_sid'), + 'sid' = payload.get('sid'), + 'tagged_text' = payload.get('tagged_text'), + 'url' = payload.get('url'), + 'source_channel' = payload.get('source_channel'), } - # Context self._context = None self._solution = { - 'assistant_sid': assistant_sid, - 'task_sid': task_sid, - 'sid': sid or self._properties['sid'], + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SampleContext for this SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleContext - """ if self._context is None: self._context = SampleContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Sample. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def task_sid(self): - """ - :returns: The unique ID of the Task associated with this Sample. - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def language(self): - """ - :returns: An ISO language-country string of the sample. - :rtype: unicode - """ - return self._properties['language'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def tagged_text(self): - """ - :returns: The text example of how end-users may express this task. The sample may contain Field tag blocks. - :rtype: unicode - """ - return self._properties['tagged_text'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def source_channel(self): - """ - :returns: The communication channel the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included the value will be null - :rtype: unicode - """ - return self._properties['source_channel'] - - def fetch(self): - """ - Fetch the SampleInstance - - :returns: The fetched SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, language=values.unset, tagged_text=values.unset, - source_channel=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the SampleInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode language: An ISO language-country string of the sample. - :param unicode tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. - :param unicode source_channel: The communication channel the sample was captured. It can be: voice, sms, chat, alexa, google-assistant, or slack. If not included the value will be null - :returns: The updated SampleInstance - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleInstance - """ - return self._proxy.update(language=language, tagged_text=tagged_text, source_channel=source_channel, ) - def delete(self): - """ - Deletes the SampleInstance +class SampleListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(SampleListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Samples' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SampleInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + + + def page(self, language, page_size): + + data = values.of({ + 'language': language,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SamplePage(self._version, payload, assistant_sid=self._solution['assistant_sid']task_sid=self._solution['task_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/task/task_actions.py b/twilio/rest/preview/understand/assistant/task/task_actions.py index d27aae5c81..7e5b404805 100644 --- a/twilio/rest/preview/understand/assistant/task/task_actions.py +++ b/twilio/rest/preview/understand/assistant/task/task_actions.py @@ -1,303 +1,131 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskActionsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskActionsList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task. - - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsList - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsList - """ - super(TaskActionsList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - - def get(self): - """ - Constructs a TaskActionsContext - - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsContext - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsContext - """ - return TaskActionsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __call__(self): - """ - Constructs a TaskActionsContext - - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsContext - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsContext - """ - return TaskActionsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskActionsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskActionsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task. - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsPage - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsPage - """ - super(TaskActionsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of TaskActionsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - """ - return TaskActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskActionsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskActionsContext - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task. - - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsContext - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsContext - """ - super(TaskActionsContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskActionsContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Actions'.format(**self._solution) - - def fetch(self): - """ - Fetch the TaskActionsInstance - - :returns: The fetched TaskActionsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_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: The updated TaskActionsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - """ - data = values.of({'Actions': serialize.object(actions), }) + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Actions' + + + def fetch(self): + + """ + Fetch the TaskActionsInstance + + :returns: The fetched TaskActionsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskActionsInstance( + self._version, + payload, + assistant_sidtask_sid=self._solution['assistant_sid''task_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return TaskActionsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) + return TaskActionsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], task_sid=self._solution['task_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TaskActionsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, assistant_sid, task_sid): - """ - Initialize the TaskActionsInstance - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - """ +class TaskActionsInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str): super(TaskActionsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'task_sid': payload.get('task_sid'), - 'url': payload.get('url'), - 'data': payload.get('data'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'task_sid' = payload.get('task_sid'), + 'url' = payload.get('url'), + 'data' = payload.get('data'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskActionsContext for this TaskActionsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsContext - """ if self._context is None: self._context = TaskActionsContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Field. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the parent Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def task_sid(self): - """ - :returns: The unique ID of the Task. - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] + - @property - def data(self): - """ - :returns: The data - :rtype: dict + def __repr__(self): """ - return self._properties['data'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the TaskActionsInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched TaskActionsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - """ - return self._proxy.fetch() - def update(self, actions=values.unset): - """ - Update the TaskActionsInstance - :param dict actions: The JSON actions that instruct the Assistant how to perform this task. +class TaskActionsListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskActionsListInstanceList, self).__init__(version) - :returns: The updated TaskActionsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance - """ - return self._proxy.update(actions=actions, ) + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/task/task_statistics.py b/twilio/rest/preview/understand/assistant/task/task_statistics.py index 6f7f505908..d6b55e27ee 100644 --- a/twilio/rest/preview/understand/assistant/task/task_statistics.py +++ b/twilio/rest/preview/understand/assistant/task/task_statistics.py @@ -1,281 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskStatisticsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskStatisticsList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task associated with this Field. - - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsList - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsList - """ - super(TaskStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - def get(self): - """ - Constructs a TaskStatisticsContext - - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsContext - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsContext - """ - return TaskStatisticsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - def __call__(self): - """ - Constructs a TaskStatisticsContext - - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsContext - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsContext - """ - return TaskStatisticsContext( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskStatisticsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task associated with this Field. - - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsPage - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsPage - """ - super(TaskStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsInstance - """ - return TaskStatisticsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskStatisticsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, task_sid): - """ - Initialize the TaskStatisticsContext - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the parent Assistant. - :param task_sid: The unique ID of the Task associated with this Field. - - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsContext - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsContext - """ - super(TaskStatisticsContext, self).__init__(version) + def __init__(self, version: Understand, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{task_sid}/Statistics'.format(**self._solution) - - def fetch(self): - """ - Fetch the TaskStatisticsInstance - - :returns: The fetched TaskStatisticsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskStatisticsInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], - ) + self._solution = { assistant_sid, task_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${task_sid}/Statistics' + + + def fetch(self): + + """ + Fetch the TaskStatisticsInstance + + :returns: The fetched TaskStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskStatisticsInstance( + self._version, + payload, + assistant_sidtask_sid=self._solution['assistant_sid''task_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TaskStatisticsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, task_sid): - """ - Initialize the TaskStatisticsInstance - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsInstance - """ +class TaskStatisticsInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, task_sid: str): super(TaskStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assistant_sid': payload.get('assistant_sid'), - 'task_sid': payload.get('task_sid'), - 'samples_count': deserialize.integer(payload.get('samples_count')), - 'fields_count': deserialize.integer(payload.get('fields_count')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assistant_sid' = payload.get('assistant_sid'), + 'task_sid' = payload.get('task_sid'), + 'samples_count' = payload.get('samples_count'), + 'fields_count' = payload.get('fields_count'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'task_sid': task_sid, } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid']'task_sid': task_sid or self._properties['task_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskStatisticsContext for this TaskStatisticsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsContext - """ if self._context is None: self._context = TaskStatisticsContext( self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['task_sid'], + assistant_sid=self._solution['assistant_sid'],task_sid=self._solution['task_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Field. - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def assistant_sid(self): + def __repr__(self): """ - :returns: The unique ID of the parent Assistant. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['assistant_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def task_sid(self): - """ - :returns: The unique ID of the Task associated with this Field. - :rtype: unicode - """ - return self._properties['task_sid'] - @property - def samples_count(self): - """ - :returns: The total number of Samples associated with this Task. - :rtype: unicode - """ - return self._properties['samples_count'] - @property - def fields_count(self): - """ - :returns: The total number of Fields associated with this Task. - :rtype: unicode - """ - return self._properties['fields_count'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the TaskStatisticsInstance +class TaskStatisticsListInstance(ListResource): + def __init__(self, version: Understand, assistant_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(TaskStatisticsListInstanceList, self).__init__(version) - :returns: The fetched TaskStatisticsInstance - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { assistant_sid, task_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py index 9ba70d7baa..978f0a869e 100644 --- a/twilio/rest/preview/wireless/command.py +++ b/twilio/rest/preview/wireless/command.py @@ -1,448 +1,148 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CommandList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the CommandList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.wireless.command.CommandList - :rtype: twilio.rest.preview.wireless.command.CommandList - """ - super(CommandList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Commands'.format(**self._solution) - - def stream(self, device=values.unset, sim=values.unset, status=values.unset, - direction=values.unset, limit=None, page_size=None): - """ - Streams CommandInstance 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 device: The device - :param unicode sim: The sim - :param unicode status: The status - :param unicode direction: The direction - :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.command.CommandInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - device=device, - sim=sim, - status=status, - direction=direction, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, device=values.unset, sim=values.unset, status=values.unset, - direction=values.unset, limit=None, page_size=None): - """ - Lists CommandInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode device: The device - :param unicode sim: The sim - :param unicode status: The status - :param unicode direction: The direction - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.command.CommandInstance] - """ - return list(self.stream( - device=device, - sim=sim, - status=status, - direction=direction, - limit=limit, - page_size=page_size, - )) - - def page(self, device=values.unset, sim=values.unset, status=values.unset, - direction=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CommandInstance records from the API. - Request is executed immediately - - :param unicode device: The device - :param unicode sim: The sim - :param unicode status: The status - :param unicode direction: The direction - :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 CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandPage - """ - data = values.of({ - 'Device': device, - 'Sim': sim, - 'Status': status, - 'Direction': direction, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CommandPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CommandInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CommandPage(self._version, response, self._solution) - def create(self, command, device=values.unset, sim=values.unset, - callback_method=values.unset, callback_url=values.unset, - command_mode=values.unset, include_sid=values.unset): - """ - Create the CommandInstance - - :param unicode command: The command - :param unicode device: The device - :param unicode sim: The sim - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode command_mode: The command_mode - :param unicode include_sid: The include_sid - - :returns: The created CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - data = values.of({ - 'Command': command, - 'Device': device, - 'Sim': sim, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'CommandMode': command_mode, - 'IncludeSid': include_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CommandInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CommandContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.command.CommandContext - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CommandContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.command.CommandContext - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CommandPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the CommandPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.wireless.command.CommandPage - :rtype: twilio.rest.preview.wireless.command.CommandPage - """ - super(CommandPage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of CommandInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.command.CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - return CommandInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class CommandContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the CommandContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.wireless.command.CommandContext - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ - super(CommandContext, self).__init__(version) + def __init__(self, version: Wireless, sid: str): + # TODO: needs autogenerated docs + super(CommandContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Commands/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CommandInstance - - :returns: The fetched CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CommandInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Commands/${sid}' + + + def fetch(self): + + """ + Fetch the CommandInstance + + :returns: The fetched CommandInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CommandInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CommandInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the CommandInstance - - :returns: twilio.rest.preview.wireless.command.CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ +class CommandInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(CommandInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'device_sid': payload.get('device_sid'), - 'sim_sid': payload.get('sim_sid'), - 'command': payload.get('command'), - 'command_mode': payload.get('command_mode'), - 'status': payload.get('status'), - 'direction': payload.get('direction'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'device_sid' = payload.get('device_sid'), + 'sim_sid' = payload.get('sim_sid'), + 'command' = payload.get('command'), + 'command_mode' = payload.get('command_mode'), + 'status' = payload.get('status'), + 'direction' = payload.get('direction'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CommandContext for this CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandContext - """ if self._context is None: - self._context = CommandContext(self._version, sid=self._solution['sid'], ) + self._context = CommandContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def device_sid(self): - """ - :returns: The device_sid - :rtype: unicode - """ - return self._properties['device_sid'] + - @property - def sim_sid(self): - """ - :returns: The sim_sid - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def command(self): - """ - :returns: The command - :rtype: unicode - """ - return self._properties['command'] - - @property - def command_mode(self): - """ - :returns: The command_mode - :rtype: unicode - """ - return self._properties['command_mode'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - @property - def direction(self): - """ - :returns: The direction - :rtype: unicode - """ - return self._properties['direction'] - - @property - def date_created(self): + def __repr__(self): """ - :returns: The date_created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the CommandInstance +class CommandListInstance(ListResource): + def __init__(self, version: Wireless): + # TODO: needs autogenerated docs + super(CommandListInstanceList, self).__init__(version) - :returns: The fetched CommandInstance - :rtype: twilio.rest.preview.wireless.command.CommandInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Commands' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CommandInstance(self._version, payload, ) + + + def page(self, device, sim, status, direction, page_size): + + data = values.of({ + 'device': device,'sim': sim,'status': status,'direction': direction,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CommandPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py index ae974d469e..954155da2b 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,484 +19,155 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RatePlanList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the RatePlanList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanList - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanList - """ - super(RatePlanList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RatePlans'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams RatePlanInstance 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 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.rate_plan.RatePlanInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RatePlanInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.rate_plan.RatePlanInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RatePlanInstance records from the API. - Request is executed immediately - - :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 RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RatePlanPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RatePlanInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RatePlanPage(self._version, response, self._solution) - - def create(self, unique_name=values.unset, friendly_name=values.unset, - data_enabled=values.unset, data_limit=values.unset, - data_metering=values.unset, messaging_enabled=values.unset, - voice_enabled=values.unset, commands_enabled=values.unset, - national_roaming_enabled=values.unset, - international_roaming=values.unset): - """ - Create the RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - :param bool data_enabled: The data_enabled - :param unicode data_limit: The data_limit - :param unicode data_metering: The data_metering - :param bool messaging_enabled: The messaging_enabled - :param bool voice_enabled: The voice_enabled - :param bool commands_enabled: The commands_enabled - :param bool national_roaming_enabled: The national_roaming_enabled - :param list[unicode] international_roaming: The international_roaming - - :returns: The created RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'DataEnabled': data_enabled, - 'DataLimit': data_limit, - 'DataMetering': data_metering, - 'MessagingEnabled': messaging_enabled, - 'VoiceEnabled': voice_enabled, - 'CommandsEnabled': commands_enabled, - 'NationalRoamingEnabled': national_roaming_enabled, - 'InternationalRoaming': serialize.map(international_roaming, lambda e: e), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RatePlanInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanContext - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanContext - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RatePlanPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, response, solution): - """ - Initialize the RatePlanPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanPage - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanPage - """ - super(RatePlanPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RatePlanInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - return RatePlanInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RatePlanContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the RatePlanContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanContext - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ - super(RatePlanContext, self).__init__(version) + def __init__(self, version: Wireless, sid: str): + # TODO: needs autogenerated docs + super(RatePlanContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RatePlans/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the RatePlanInstance - - :returns: The fetched RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, unique_name=values.unset, friendly_name=values.unset): - """ - Update the RatePlanInstance - - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - - :returns: The updated RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the RatePlanInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/RatePlans/${sid}' + + + def delete(self): + + + """ + Deletes the RatePlanInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RatePlanInstance + + :returns: The fetched RatePlanInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RatePlanInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RatePlanInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the RatePlanInstance - :returns: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ +class RatePlanInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(RatePlanInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'data_enabled': payload.get('data_enabled'), - 'data_metering': payload.get('data_metering'), - 'data_limit': deserialize.integer(payload.get('data_limit')), - 'messaging_enabled': payload.get('messaging_enabled'), - 'voice_enabled': payload.get('voice_enabled'), - 'national_roaming_enabled': payload.get('national_roaming_enabled'), - 'international_roaming': payload.get('international_roaming'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'data_enabled' = payload.get('data_enabled'), + 'data_metering' = payload.get('data_metering'), + 'data_limit' = payload.get('data_limit'), + 'messaging_enabled' = payload.get('messaging_enabled'), + 'voice_enabled' = payload.get('voice_enabled'), + 'national_roaming_enabled' = payload.get('national_roaming_enabled'), + 'international_roaming' = payload.get('international_roaming'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RatePlanContext for this RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanContext - """ if self._context is None: - self._context = RatePlanContext(self._version, sid=self._solution['sid'], ) + self._context = RatePlanContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def data_enabled(self): - """ - :returns: The data_enabled - :rtype: bool - """ - return self._properties['data_enabled'] - - @property - def data_metering(self): - """ - :returns: The data_metering - :rtype: unicode - """ - return self._properties['data_metering'] - - @property - def data_limit(self): - """ - :returns: The data_limit - :rtype: unicode - """ - return self._properties['data_limit'] - - @property - def messaging_enabled(self): - """ - :returns: The messaging_enabled - :rtype: bool - """ - return self._properties['messaging_enabled'] - - @property - def voice_enabled(self): - """ - :returns: The voice_enabled - :rtype: bool - """ - return self._properties['voice_enabled'] - - @property - def national_roaming_enabled(self): - """ - :returns: The national_roaming_enabled - :rtype: bool - """ - return self._properties['national_roaming_enabled'] - - @property - def international_roaming(self): - """ - :returns: The international_roaming - :rtype: list[unicode] - """ - return self._properties['international_roaming'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the RatePlanInstance - - :returns: The fetched RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset, friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the RatePlanInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode unique_name: The unique_name - :param unicode friendly_name: The friendly_name - :returns: The updated RatePlanInstance - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance - """ - return self._proxy.update(unique_name=unique_name, friendly_name=friendly_name, ) - def delete(self): - """ - Deletes the RatePlanInstance +class RatePlanListInstance(ListResource): + def __init__(self, version: Wireless): + # TODO: needs autogenerated docs + super(RatePlanListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/RatePlans' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RatePlanInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RatePlanPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/wireless/sim.py b/twilio/rest/preview/wireless/sim.py new file mode 100644 index 0000000000..299a7d8b13 --- /dev/null +++ b/twilio/rest/preview/wireless/sim.py @@ -0,0 +1,164 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sim.usage import UsageListInstance + + +class SimContext(InstanceContext): + def __init__(self, version: Wireless, sid: str): + # TODO: needs autogenerated docs + super(SimContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Sims/${sid}' + + self._usage = None + + def fetch(self): + + """ + Fetch the SimInstance + + :returns: The fetched SimInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SimInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SimInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SimInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(SimInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'rate_plan_sid' = payload.get('rate_plan_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'iccid' = payload.get('iccid'), + 'e_id' = payload.get('e_id'), + 'status' = payload.get('status'), + 'commands_callback_url' = payload.get('commands_callback_url'), + 'commands_callback_method' = payload.get('commands_callback_method'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SimContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def usage(self): + return self._proxy.usage + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SimListInstance(ListResource): + def __init__(self, version: Wireless): + # TODO: needs autogenerated docs + super(SimListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Sims' + + + def page(self, status, iccid, rate_plan, eid, sim_registration_code, page_size): + + data = values.of({ + 'status': status,'iccid': iccid,'rate_plan': rate_plan,'eid': eid,'sim_registration_code': sim_registration_code,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SimPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/preview/wireless/sim/usage.py b/twilio/rest/preview/wireless/sim/usage.py index a101618797..bfe732bba7 100644 --- a/twilio/rest/preview/wireless/sim/usage.py +++ b/twilio/rest/preview/wireless/sim/usage.py @@ -1,290 +1,124 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UsageList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sim_sid): - """ - Initialize the UsageList - - :param Version version: Version that contains the resource - :param sim_sid: The sim_sid - - :returns: twilio.rest.preview.wireless.sim.usage.UsageList - :rtype: twilio.rest.preview.wireless.sim.usage.UsageList - """ - super(UsageList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - - def get(self): - """ - Constructs a UsageContext - - :returns: twilio.rest.preview.wireless.sim.usage.UsageContext - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ - return UsageContext(self._version, sim_sid=self._solution['sim_sid'], ) - - def __call__(self): - """ - Constructs a UsageContext - - :returns: twilio.rest.preview.wireless.sim.usage.UsageContext - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ - return UsageContext(self._version, sim_sid=self._solution['sim_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' -class UsagePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the UsagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The sim_sid - - :returns: twilio.rest.preview.wireless.sim.usage.UsagePage - :rtype: twilio.rest.preview.wireless.sim.usage.UsagePage - """ - super(UsagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.sim.usage.UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ - return UsageInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class UsageContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sim_sid): - """ - Initialize the UsageContext - - :param Version version: Version that contains the resource - :param sim_sid: The sim_sid - - :returns: twilio.rest.preview.wireless.sim.usage.UsageContext - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ - super(UsageContext, self).__init__(version) + def __init__(self, version: Wireless, sim_sid: str): + # TODO: needs autogenerated docs + super(UsageContextList, self).__init__(version) # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/Usage'.format(**self._solution) - - def fetch(self, end=values.unset, start=values.unset): - """ - Fetch the UsageInstance - - :param unicode end: The end - :param unicode start: The start - - :returns: The fetched UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ - data = values.of({'End': end, 'Start': start, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return UsageInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) + self._solution = { sim_sid, } + self._uri = '/Sims/${sim_sid}/Usage' + + + def fetch(self, end, start): + + """ + Fetch the UsageInstance + + :returns: The fetched UsageInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return UsageInstance( + self._version, + payload, + sim_sid=self._solution['sim_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class UsageInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sim_sid): - """ - Initialize the UsageInstance - :returns: twilio.rest.preview.wireless.sim.usage.UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ +class UsageInstance(InstanceResource): + def __init__(self, version, payload, sim_sid: str): super(UsageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sim_sid': payload.get('sim_sid'), - 'sim_unique_name': payload.get('sim_unique_name'), - 'account_sid': payload.get('account_sid'), - 'period': payload.get('period'), - 'commands_usage': payload.get('commands_usage'), - 'commands_costs': payload.get('commands_costs'), - 'data_usage': payload.get('data_usage'), - 'data_costs': payload.get('data_costs'), - 'url': payload.get('url'), + self._properties = { + 'sim_sid' = payload.get('sim_sid'), + 'sim_unique_name' = payload.get('sim_unique_name'), + 'account_sid' = payload.get('account_sid'), + 'period' = payload.get('period'), + 'commands_usage' = payload.get('commands_usage'), + 'commands_costs' = payload.get('commands_costs'), + 'data_usage' = payload.get('data_usage'), + 'data_costs' = payload.get('data_costs'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sim_sid': sim_sid, } + self._solution = { + 'sim_sid': sim_sid or self._properties['sim_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UsageContext for this UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageContext - """ if self._context is None: - self._context = UsageContext(self._version, sim_sid=self._solution['sim_sid'], ) + self._context = UsageContext( + self._version, + sim_sid=self._solution['sim_sid'], + ) return self._context - @property - def sim_sid(self): - """ - :returns: The sim_sid - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def sim_unique_name(self): - """ - :returns: The sim_unique_name - :rtype: unicode - """ - return self._properties['sim_unique_name'] + - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def period(self): - """ - :returns: The period - :rtype: dict - """ - return self._properties['period'] - - @property - def commands_usage(self): - """ - :returns: The commands_usage - :rtype: dict - """ - return self._properties['commands_usage'] - - @property - def commands_costs(self): - """ - :returns: The commands_costs - :rtype: dict - """ - return self._properties['commands_costs'] - - @property - def data_usage(self): - """ - :returns: The data_usage - :rtype: dict - """ - return self._properties['data_usage'] - - @property - def data_costs(self): + def __repr__(self): """ - :returns: The data_costs - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['data_costs'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, end=values.unset, start=values.unset): - """ - Fetch the UsageInstance - :param unicode end: The end - :param unicode start: The start +class UsageListInstance(ListResource): + def __init__(self, version: Wireless, sim_sid: str): + # TODO: needs autogenerated docs + super(UsageListInstanceList, self).__init__(version) - :returns: The fetched UsageInstance - :rtype: twilio.rest.preview.wireless.sim.usage.UsageInstance - """ - return self._proxy.fetch(end=end, start=start, ) + # Path Solution + self._solution = { sim_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/__init__.py b/twilio/rest/pricing/__init__.py index 0228befccb..84b7f59c28 100644 --- a/twilio/rest/pricing/__init__.py +++ b/twilio/rest/pricing/__init__.py @@ -1,92 +1,70 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.pricing.v1 import V1 -from twilio.rest.pricing.v2 import V2 + Twilio - Pricing + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Pricing(Domain): +from twilio.base.domain import Domain +from twilio.rest.Pricing.v2 import V2 +class Pricing(Domain): def __init__(self, twilio): """ Initialize the Pricing Domain :returns: Domain for Pricing - :rtype: twilio.rest.pricing.Pricing + :rtype: twilio.rest.v2.Pricing """ super(Pricing, self).__init__(twilio) - - self.base_url = 'https://pricing.twilio.com' - - # Versions - self._v1 = None - self._v2 = None + self.base_url = 'https://Pricing.twilio.com' + self._V2 = None @property - def v1(self): + def V2(self): """ - :returns: Version v1 of pricing - :rtype: twilio.rest.pricing.v1.V1 + :returns: Versions v2 of Pricing + :rtype: twilio.rest.Pricing.v2 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + @property - def v2(self): - """ - :returns: Version v2 of pricing - :rtype: twilio.rest.pricing.v2.V2 - """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 - - @property - def messaging(self): + def countries(self): """ - :rtype: twilio.rest.pricing.v1.messaging.MessagingList + :rtype: twilio.rest.v2.countries """ - return self.v1.messaging + return self.v2.countries + @property - def phone_numbers(self): + def numbers(self): """ - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberList + :rtype: twilio.rest.v2.numbers """ - return self.v1.phone_numbers + return self.v2.numbers + @property def voice(self): """ - :rtype: twilio.rest.pricing.v2.voice.VoiceList + :rtype: twilio.rest.v2.voice """ return self.v2.voice - - @property - def countries(self): - """ - :rtype: twilio.rest.pricing.v2.country.CountryList - """ - return self.v2.countries - - @property - def numbers(self): - """ - :rtype: twilio.rest.pricing.v2.number.NumberList - """ - return self.v2.numbers + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/pricing/v1/.openapi-generator-ignore b/twilio/rest/pricing/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/pricing/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/pricing/v1/.openapi-generator/FILES b/twilio/rest/pricing/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..beb47ee825 --- /dev/null +++ b/twilio/rest/pricing/v1/.openapi-generator/FILES @@ -0,0 +1,15 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +messaging.py +messaging/country.py +phone_number.py +phone_number/country.py +voice.py +voice/country.py +voice/number.py diff --git a/twilio/rest/pricing/v1/.openapi-generator/VERSION b/twilio/rest/pricing/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/pricing/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/pricing/v1/messaging.py b/twilio/rest/pricing/v1/messaging.py new file mode 100644 index 0000000000..4bed374da0 --- /dev/null +++ b/twilio/rest/pricing/v1/messaging.py @@ -0,0 +1,47 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.messaging.country import CountryListInstance + + + + +class MessagingListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(MessagingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Messaging' + + self._countries = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/pricing/v1/messaging/country.py b/twilio/rest/pricing/v1/messaging/country.py index 26e7d806fa..05ea323826 100644 --- a/twilio/rest/pricing/v1/messaging/country.py +++ b/twilio/rest/pricing/v1/messaging/country.py @@ -1,323 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CountryList(ListResource): - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.messaging.country.CountryList - :rtype: twilio.rest.pricing.v1.messaging.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Messaging/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance 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 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.pricing.v1.messaging.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.pricing.v1.messaging.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :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 CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.messaging.country.CountryContext - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.messaging.country.CountryContext - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CountryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.messaging.country.CountryPage - :rtype: twilio.rest.pricing.v1.messaging.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.pricing.v1.messaging.country.CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CountryContext(InstanceContext): - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.messaging.country.CountryContext - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ - super(CountryContext, self).__init__(version) + def __init__(self, version: V1, iso_country: str): + # TODO: needs autogenerated docs + super(CountryContextList, self).__init__(version) # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/Messaging/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CountryInstance - - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) + self._solution = { iso_country, } + self._uri = '/Messaging/Countries/${iso_country}' + + + def fetch(self): + + """ + Fetch the CountryInstance + + :returns: The fetched CountryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CountryInstance( + self._version, + payload, + iso_country=self._solution['iso_country'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CountryInstance(InstanceResource): - - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - :returns: twilio.rest.pricing.v1.messaging.country.CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ +class CountryInstance(InstanceResource): + def __init__(self, version, payload, iso_country: str): super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'outbound_sms_prices': payload.get('outbound_sms_prices'), - 'inbound_sms_prices': payload.get('inbound_sms_prices'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'outbound_sms_prices' = payload.get('outbound_sms_prices'), + 'inbound_sms_prices' = payload.get('inbound_sms_prices'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } + self._solution = { + 'iso_country': iso_country or self._properties['iso_country'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryContext - """ if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) + self._context = CountryContext( + self._version, + iso_country=self._solution['iso_country'], + ) return self._context - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] + - @property - def iso_country(self): + def __repr__(self): """ - :returns: The ISO country code - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['iso_country'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def outbound_sms_prices(self): - """ - :returns: The list of OutboundSMSPrice records - :rtype: list[unicode] - """ - return self._properties['outbound_sms_prices'] - @property - def inbound_sms_prices(self): - """ - :returns: The list of InboundPrice records - :rtype: list[unicode] - """ - return self._properties['inbound_sms_prices'] - @property - def price_unit(self): - """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode - """ - return self._properties['price_unit'] +class CountryListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CountryListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { } + self._uri = '/Messaging/Countries' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the CountryInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v1.messaging.country.CountryInstance - """ - return self._proxy.fetch() + return CountryPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v1/phone_number.py b/twilio/rest/pricing/v1/phone_number.py new file mode 100644 index 0000000000..c73e84f5ee --- /dev/null +++ b/twilio/rest/pricing/v1/phone_number.py @@ -0,0 +1,47 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.phone_number.country import CountryListInstance + + + + +class PhoneNumberListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(PhoneNumberListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/PhoneNumbers' + + self._countries = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/pricing/v1/phone_number/country.py b/twilio/rest/pricing/v1/phone_number/country.py index 94dfb73426..15f6601b7c 100644 --- a/twilio/rest/pricing/v1/phone_number/country.py +++ b/twilio/rest/pricing/v1/phone_number/country.py @@ -1,314 +1,132 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CountryList(ListResource): - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryList - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/PhoneNumbers/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance 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 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.pricing.v1.phone_number.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.pricing.v1.phone_number.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :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 CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryContext - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryContext - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CountryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.pricing.v1.phone_number.country.CountryPage - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CountryContext(InstanceContext): - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryContext - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ - super(CountryContext, self).__init__(version) + def __init__(self, version: V1, iso_country: str): + # TODO: needs autogenerated docs + super(CountryContextList, self).__init__(version) # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/PhoneNumbers/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CountryInstance - - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) + self._solution = { iso_country, } + self._uri = '/PhoneNumbers/Countries/${iso_country}' + + + def fetch(self): + + """ + Fetch the CountryInstance + + :returns: The fetched CountryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CountryInstance( + self._version, + payload, + iso_country=self._solution['iso_country'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - - :returns: twilio.rest.pricing.v1.phone_number.country.CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ +class CountryInstance(InstanceResource): + def __init__(self, version, payload, iso_country: str): super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'phone_number_prices': payload.get('phone_number_prices'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'phone_number_prices' = payload.get('phone_number_prices'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } + self._solution = { + 'iso_country': iso_country or self._properties['iso_country'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryContext - """ if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) + self._context = CountryContext( + self._version, + iso_country=self._solution['iso_country'], + ) return self._context - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] + - @property - def iso_country(self): + def __repr__(self): """ - :returns: The ISO country code - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['iso_country'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def phone_number_prices(self): - """ - :returns: The list of PhoneNumberPrices records - :rtype: list[unicode] - """ - return self._properties['phone_number_prices'] - @property - def price_unit(self): - """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode - """ - return self._properties['price_unit'] - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] +class CountryListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CountryListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the CountryInstance + # Path Solution + self._solution = { } + self._uri = '/PhoneNumbers/Countries' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CountryPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v1/voice.py b/twilio/rest/pricing/v1/voice.py new file mode 100644 index 0000000000..6d56a100cd --- /dev/null +++ b/twilio/rest/pricing/v1/voice.py @@ -0,0 +1,48 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.voice.country import CountryListInstancefrom twilio.rest.voice.number import NumberListInstance + + + + +class VoiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(VoiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Voice' + + self._countries = None + self._numbers = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/pricing/v1/voice/country.py b/twilio/rest/pricing/v1/voice/country.py index 81e8a4fc8e..90586ff432 100644 --- a/twilio/rest/pricing/v1/voice/country.py +++ b/twilio/rest/pricing/v1/voice/country.py @@ -1,323 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CountryList(ListResource): - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.voice.country.CountryList - :rtype: twilio.rest.pricing.v1.voice.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Voice/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance 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 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.pricing.v1.voice.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.pricing.v1.voice.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :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 CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.voice.country.CountryContext - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.voice.country.CountryContext - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CountryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.voice.country.CountryPage - :rtype: twilio.rest.pricing.v1.voice.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.pricing.v1.voice.country.CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CountryContext(InstanceContext): - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The ISO country code - - :returns: twilio.rest.pricing.v1.voice.country.CountryContext - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ - super(CountryContext, self).__init__(version) + def __init__(self, version: V1, iso_country: str): + # TODO: needs autogenerated docs + super(CountryContextList, self).__init__(version) # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/Voice/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CountryInstance - - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) + self._solution = { iso_country, } + self._uri = '/Voice/Countries/${iso_country}' + + + def fetch(self): + + """ + Fetch the CountryInstance + + :returns: The fetched CountryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CountryInstance( + self._version, + payload, + iso_country=self._solution['iso_country'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CountryInstance(InstanceResource): - - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - :returns: twilio.rest.pricing.v1.voice.country.CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ +class CountryInstance(InstanceResource): + def __init__(self, version, payload, iso_country: str): super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'outbound_prefix_prices': payload.get('outbound_prefix_prices'), - 'inbound_call_prices': payload.get('inbound_call_prices'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'outbound_prefix_prices' = payload.get('outbound_prefix_prices'), + 'inbound_call_prices' = payload.get('inbound_call_prices'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } + self._solution = { + 'iso_country': iso_country or self._properties['iso_country'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryContext - """ if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) + self._context = CountryContext( + self._version, + iso_country=self._solution['iso_country'], + ) return self._context - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] + - @property - def iso_country(self): + def __repr__(self): """ - :returns: The ISO country code - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['iso_country'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def outbound_prefix_prices(self): - """ - :returns: The list of OutboundPrefixPrice records - :rtype: list[unicode] - """ - return self._properties['outbound_prefix_prices'] - @property - def inbound_call_prices(self): - """ - :returns: The list of InboundCallPrice records - :rtype: list[unicode] - """ - return self._properties['inbound_call_prices'] - @property - def price_unit(self): - """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode - """ - return self._properties['price_unit'] +class CountryListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CountryListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { } + self._uri = '/Voice/Countries' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the CountryInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v1.voice.country.CountryInstance - """ - return self._proxy.fetch() + return CountryPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v1/voice/number.py b/twilio/rest/pricing/v1/voice/number.py index 9c7d75b812..6e7a8af2a9 100644 --- a/twilio/rest/pricing/v1/voice/number.py +++ b/twilio/rest/pricing/v1/voice/number.py @@ -1,254 +1,122 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NumberList(ListResource): - - def __init__(self, version): - """ - Initialize the NumberList - :param Version version: Version that contains the resource - :returns: twilio.rest.pricing.v1.voice.number.NumberList - :rtype: twilio.rest.pricing.v1.voice.number.NumberList - """ - super(NumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, number): - """ - Constructs a NumberContext - - :param number: The phone number to fetch - - :returns: twilio.rest.pricing.v1.voice.number.NumberContext - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ - return NumberContext(self._version, number=number, ) - - def __call__(self, number): - """ - Constructs a NumberContext - - :param number: The phone number to fetch - - :returns: twilio.rest.pricing.v1.voice.number.NumberContext - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ - return NumberContext(self._version, number=number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NumberPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the NumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v1.voice.number.NumberPage - :rtype: twilio.rest.pricing.v1.voice.number.NumberPage - """ - super(NumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.voice.number.NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ - return NumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class NumberContext(InstanceContext): - - def __init__(self, version, number): - """ - Initialize the NumberContext - - :param Version version: Version that contains the resource - :param number: The phone number to fetch - - :returns: twilio.rest.pricing.v1.voice.number.NumberContext - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ - super(NumberContext, self).__init__(version) + def __init__(self, version: V1, number: str): + # TODO: needs autogenerated docs + super(NumberContextList, self).__init__(version) # Path Solution - self._solution = {'number': number, } - self._uri = '/Voice/Numbers/{number}'.format(**self._solution) - - def fetch(self): - """ - Fetch the NumberInstance - - :returns: The fetched NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return NumberInstance(self._version, payload, number=self._solution['number'], ) + self._solution = { number, } + self._uri = '/Voice/Numbers/${number}' + + + def fetch(self): + + """ + Fetch the NumberInstance + + :returns: The fetched NumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NumberInstance( + self._version, + payload, + number=self._solution['number'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NumberInstance(InstanceResource): - def __init__(self, version, payload, number=None): - """ - Initialize the NumberInstance - - :returns: twilio.rest.pricing.v1.voice.number.NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ +class NumberInstance(InstanceResource): + def __init__(self, version, payload, number: str): super(NumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'number': payload.get('number'), - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'outbound_call_price': payload.get('outbound_call_price'), - 'inbound_call_price': payload.get('inbound_call_price'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'number' = payload.get('number'), + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'outbound_call_price' = payload.get('outbound_call_price'), + 'inbound_call_price' = payload.get('inbound_call_price'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'number': number or self._properties['number'], } + self._solution = { + 'number': number or self._properties['number'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NumberContext for this NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberContext - """ if self._context is None: - self._context = NumberContext(self._version, number=self._solution['number'], ) + self._context = NumberContext( + self._version, + number=self._solution['number'], + ) return self._context - @property - def number(self): - """ - :returns: The phone number - :rtype: unicode - """ - return self._properties['number'] - - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] + - @property - def iso_country(self): - """ - :returns: The ISO country code - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def outbound_call_price(self): - """ - :returns: The OutboundCallPrice record - :rtype: unicode - """ - return self._properties['outbound_call_price'] - - @property - def inbound_call_price(self): + def __repr__(self): """ - :returns: The InboundCallPrice record - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['inbound_call_price'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def price_unit(self): - """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode - """ - return self._properties['price_unit'] - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the NumberInstance +class NumberListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(NumberListInstanceList, self).__init__(version) - :returns: The fetched NumberInstance - :rtype: twilio.rest.pricing.v1.voice.number.NumberInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v2/.openapi-generator-ignore b/twilio/rest/pricing/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/pricing/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/pricing/v2/.openapi-generator/FILES b/twilio/rest/pricing/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..f2f3ebb1f4 --- /dev/null +++ b/twilio/rest/pricing/v2/.openapi-generator/FILES @@ -0,0 +1,11 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +country.py +number.py +voice.py +voice/country.py +voice/number.py diff --git a/twilio/rest/pricing/v2/.openapi-generator/VERSION b/twilio/rest/pricing/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/pricing/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/pricing/v2/country.py b/twilio/rest/pricing/v2/country.py index c42bc60d7d..b9b6cd6b1c 100644 --- a/twilio/rest/pricing/v2/country.py +++ b/twilio/rest/pricing/v2/country.py @@ -1,323 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CountryList(ListResource): - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v2.country.CountryList - :rtype: twilio.rest.pricing.v2.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Trunking/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance 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 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.pricing.v2.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.pricing.v2.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :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 CountryInstance - :rtype: twilio.rest.pricing.v2.country.CountryPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v2.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code of the pricing information to fetch - - :returns: twilio.rest.pricing.v2.country.CountryContext - :rtype: twilio.rest.pricing.v2.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code of the pricing information to fetch - - :returns: twilio.rest.pricing.v2.country.CountryContext - :rtype: twilio.rest.pricing.v2.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CountryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v2.country.CountryPage - :rtype: twilio.rest.pricing.v2.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.pricing.v2.country.CountryInstance - :rtype: twilio.rest.pricing.v2.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CountryContext(InstanceContext): - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The ISO country code of the pricing information to fetch - - :returns: twilio.rest.pricing.v2.country.CountryContext - :rtype: twilio.rest.pricing.v2.country.CountryContext - """ - super(CountryContext, self).__init__(version) + def __init__(self, version: V2, iso_country: str): + # TODO: needs autogenerated docs + super(CountryContextList, self).__init__(version) # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/Trunking/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CountryInstance - - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v2.country.CountryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) + self._solution = { iso_country, } + self._uri = '/Trunking/Countries/${iso_country}' + + + def fetch(self): + + """ + Fetch the CountryInstance + + :returns: The fetched CountryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CountryInstance( + self._version, + payload, + iso_country=self._solution['iso_country'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CountryInstance(InstanceResource): - - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - :returns: twilio.rest.pricing.v2.country.CountryInstance - :rtype: twilio.rest.pricing.v2.country.CountryInstance - """ +class CountryInstance(InstanceResource): + def __init__(self, version, payload, iso_country: str): super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'terminating_prefix_prices': payload.get('terminating_prefix_prices'), - 'originating_call_prices': payload.get('originating_call_prices'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'terminating_prefix_prices' = payload.get('terminating_prefix_prices'), + 'originating_call_prices' = payload.get('originating_call_prices'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } + self._solution = { + 'iso_country': iso_country or self._properties['iso_country'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v2.country.CountryContext - """ if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) + self._context = CountryContext( + self._version, + iso_country=self._solution['iso_country'], + ) return self._context - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] + - @property - def iso_country(self): + def __repr__(self): """ - :returns: The ISO country code - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['iso_country'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def terminating_prefix_prices(self): - """ - :returns: The list of TerminatingPrefixPrice records - :rtype: list[unicode] - """ - return self._properties['terminating_prefix_prices'] - @property - def originating_call_prices(self): - """ - :returns: The list of OriginatingCallPrice records - :rtype: list[unicode] - """ - return self._properties['originating_call_prices'] - @property - def price_unit(self): - """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode - """ - return self._properties['price_unit'] +class CountryListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(CountryListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { } + self._uri = '/Trunking/Countries' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the CountryInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v2.country.CountryInstance - """ - return self._proxy.fetch() + return CountryPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v2/number.py b/twilio/rest/pricing/v2/number.py index dc87c01a51..f00d627ab6 100644 --- a/twilio/rest/pricing/v2/number.py +++ b/twilio/rest/pricing/v2/number.py @@ -1,190 +1,87 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NumberList(ListResource): - - def __init__(self, version): - """ - Initialize the NumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v2.number.NumberList - :rtype: twilio.rest.pricing.v2.number.NumberList - """ - super(NumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, destination_number): - """ - Constructs a NumberContext - - :param destination_number: The destination number for which to fetch pricing information - - :returns: twilio.rest.pricing.v2.number.NumberContext - :rtype: twilio.rest.pricing.v2.number.NumberContext - """ - return NumberContext(self._version, destination_number=destination_number, ) - - def __call__(self, destination_number): - """ - Constructs a NumberContext - - :param destination_number: The destination number for which to fetch pricing information - - :returns: twilio.rest.pricing.v2.number.NumberContext - :rtype: twilio.rest.pricing.v2.number.NumberContext - """ - return NumberContext(self._version, destination_number=destination_number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NumberPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the NumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.pricing.v2.number.NumberPage - :rtype: twilio.rest.pricing.v2.number.NumberPage - """ - super(NumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v2.number.NumberInstance - :rtype: twilio.rest.pricing.v2.number.NumberInstance - """ - return NumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class NumberContext(InstanceContext): - - def __init__(self, version, destination_number): - """ - Initialize the NumberContext - - :param Version version: Version that contains the resource - :param destination_number: The destination number for which to fetch pricing information - - :returns: twilio.rest.pricing.v2.number.NumberContext - :rtype: twilio.rest.pricing.v2.number.NumberContext - """ - super(NumberContext, self).__init__(version) + def __init__(self, version: V2, destination_number: str): + # TODO: needs autogenerated docs + super(NumberContextList, self).__init__(version) # Path Solution - self._solution = {'destination_number': destination_number, } - self._uri = '/Trunking/Numbers/{destination_number}'.format(**self._solution) - - def fetch(self, origination_number=values.unset): - """ - Fetch the NumberInstance - - :param unicode origination_number: The origination number for which to fetch pricing information - - :returns: The fetched NumberInstance - :rtype: twilio.rest.pricing.v2.number.NumberInstance - """ - data = values.of({'OriginationNumber': origination_number, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return NumberInstance( - self._version, - payload, - destination_number=self._solution['destination_number'], - ) + self._solution = { destination_number, } + self._uri = '/Trunking/Numbers/${destination_number}' + + + def fetch(self, origination_number): + + """ + Fetch the NumberInstance + + :returns: The fetched NumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NumberInstance( + self._version, + payload, + destination_number=self._solution['destination_number'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NumberInstance(InstanceResource): - def __init__(self, version, payload, destination_number=None): - """ - Initialize the NumberInstance - - :returns: twilio.rest.pricing.v2.number.NumberInstance - :rtype: twilio.rest.pricing.v2.number.NumberInstance - """ +class NumberInstance(InstanceResource): + def __init__(self, version, payload, destination_number: str): super(NumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'destination_number': payload.get('destination_number'), - 'origination_number': payload.get('origination_number'), - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'terminating_prefix_prices': payload.get('terminating_prefix_prices'), - 'originating_call_price': payload.get('originating_call_price'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'destination_number' = payload.get('destination_number'), + 'origination_number' = payload.get('origination_number'), + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'terminating_prefix_prices' = payload.get('terminating_prefix_prices'), + 'originating_call_price' = payload.get('originating_call_price'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'destination_number': destination_number or self._properties['destination_number'], + 'destination_number': destination_number or self._properties['destination_number'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NumberContext for this NumberInstance - :rtype: twilio.rest.pricing.v2.number.NumberContext - """ if self._context is None: self._context = NumberContext( self._version, @@ -192,87 +89,35 @@ def _proxy(self): ) return self._context - @property - def destination_number(self): - """ - :returns: The destination phone number, in E.164 format - :rtype: unicode - """ - return self._properties['destination_number'] - - @property - def origination_number(self): - """ - :returns: The origination phone number, in E.164 format - :rtype: unicode - """ - return self._properties['origination_number'] + - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] - - @property - def iso_country(self): - """ - :returns: The ISO country code - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def terminating_prefix_prices(self): - """ - :returns: The terminating_prefix_prices - :rtype: list[unicode] - """ - return self._properties['terminating_prefix_prices'] - - @property - def originating_call_price(self): - """ - :returns: The OriginatingCallPrice record - :rtype: unicode - """ - return self._properties['originating_call_price'] - - @property - def price_unit(self): + def __repr__(self): """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['price_unit'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, origination_number=values.unset): - """ - Fetch the NumberInstance - :param unicode origination_number: The origination number for which to fetch pricing information +class NumberListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(NumberListInstanceList, self).__init__(version) - :returns: The fetched NumberInstance - :rtype: twilio.rest.pricing.v2.number.NumberInstance - """ - return self._proxy.fetch(origination_number=origination_number, ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v2/voice.py b/twilio/rest/pricing/v2/voice.py new file mode 100644 index 0000000000..d73b049423 --- /dev/null +++ b/twilio/rest/pricing/v2/voice.py @@ -0,0 +1,48 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.voice.country import CountryListInstancefrom twilio.rest.voice.number import NumberListInstance + + + + +class VoiceListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(VoiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Voice' + + self._countries = None + self._numbers = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/pricing/v2/voice/country.py b/twilio/rest/pricing/v2/voice/country.py index 8cdbd0f090..7d8d8b1d23 100644 --- a/twilio/rest/pricing/v2/voice/country.py +++ b/twilio/rest/pricing/v2/voice/country.py @@ -1,323 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CountryList(ListResource): - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v2.voice.country.CountryList - :rtype: twilio.rest.pricing.v2.voice.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Voice/Countries'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CountryInstance 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 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.pricing.v2.voice.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.pricing.v2.voice.country.CountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :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 CountryInstance - :rtype: twilio.rest.pricing.v2.voice.country.CountryPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.pricing.v2.voice.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) - - def get(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code of the pricing information to fetch - - :returns: twilio.rest.pricing.v2.voice.country.CountryContext - :rtype: twilio.rest.pricing.v2.voice.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __call__(self, iso_country): - """ - Constructs a CountryContext - - :param iso_country: The ISO country code of the pricing information to fetch - - :returns: twilio.rest.pricing.v2.voice.country.CountryContext - :rtype: twilio.rest.pricing.v2.voice.country.CountryContext - """ - return CountryContext(self._version, iso_country=iso_country, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CountryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v2.voice.country.CountryPage - :rtype: twilio.rest.pricing.v2.voice.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.pricing.v2.voice.country.CountryInstance - :rtype: twilio.rest.pricing.v2.voice.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CountryContext(InstanceContext): - - def __init__(self, version, iso_country): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_country: The ISO country code of the pricing information to fetch - - :returns: twilio.rest.pricing.v2.voice.country.CountryContext - :rtype: twilio.rest.pricing.v2.voice.country.CountryContext - """ - super(CountryContext, self).__init__(version) + def __init__(self, version: V2, iso_country: str): + # TODO: needs autogenerated docs + super(CountryContextList, self).__init__(version) # Path Solution - self._solution = {'iso_country': iso_country, } - self._uri = '/Voice/Countries/{iso_country}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CountryInstance - - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v2.voice.country.CountryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CountryInstance(self._version, payload, iso_country=self._solution['iso_country'], ) + self._solution = { iso_country, } + self._uri = '/Voice/Countries/${iso_country}' + + + def fetch(self): + + """ + Fetch the CountryInstance + + :returns: The fetched CountryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CountryInstance( + self._version, + payload, + iso_country=self._solution['iso_country'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CountryInstance(InstanceResource): - - def __init__(self, version, payload, iso_country=None): - """ - Initialize the CountryInstance - :returns: twilio.rest.pricing.v2.voice.country.CountryInstance - :rtype: twilio.rest.pricing.v2.voice.country.CountryInstance - """ +class CountryInstance(InstanceResource): + def __init__(self, version, payload, iso_country: str): super(CountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'outbound_prefix_prices': payload.get('outbound_prefix_prices'), - 'inbound_call_prices': payload.get('inbound_call_prices'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'outbound_prefix_prices' = payload.get('outbound_prefix_prices'), + 'inbound_call_prices' = payload.get('inbound_call_prices'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'iso_country': iso_country or self._properties['iso_country'], } + self._solution = { + 'iso_country': iso_country or self._properties['iso_country'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.pricing.v2.voice.country.CountryContext - """ if self._context is None: - self._context = CountryContext(self._version, iso_country=self._solution['iso_country'], ) + self._context = CountryContext( + self._version, + iso_country=self._solution['iso_country'], + ) return self._context - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] + - @property - def iso_country(self): + def __repr__(self): """ - :returns: The ISO country code - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['iso_country'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def outbound_prefix_prices(self): - """ - :returns: The list of OutboundPrefixPriceWithOrigin records - :rtype: list[unicode] - """ - return self._properties['outbound_prefix_prices'] - @property - def inbound_call_prices(self): - """ - :returns: The list of InboundCallPrice records - :rtype: list[unicode] - """ - return self._properties['inbound_call_prices'] - @property - def price_unit(self): - """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode - """ - return self._properties['price_unit'] +class CountryListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(CountryListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { } + self._uri = '/Voice/Countries' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the CountryInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched CountryInstance - :rtype: twilio.rest.pricing.v2.voice.country.CountryInstance - """ - return self._proxy.fetch() + return CountryPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v2/voice/number.py b/twilio/rest/pricing/v2/voice/number.py index c7a45c7a71..075646f5c4 100644 --- a/twilio/rest/pricing/v2/voice/number.py +++ b/twilio/rest/pricing/v2/voice/number.py @@ -1,190 +1,87 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NumberList(ListResource): - - def __init__(self, version): - """ - Initialize the NumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v2.voice.number.NumberList - :rtype: twilio.rest.pricing.v2.voice.number.NumberList - """ - super(NumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, destination_number): - """ - Constructs a NumberContext - - :param destination_number: The destination number for which to fetch pricing information - - :returns: twilio.rest.pricing.v2.voice.number.NumberContext - :rtype: twilio.rest.pricing.v2.voice.number.NumberContext - """ - return NumberContext(self._version, destination_number=destination_number, ) - - def __call__(self, destination_number): - """ - Constructs a NumberContext - - :param destination_number: The destination number for which to fetch pricing information - - :returns: twilio.rest.pricing.v2.voice.number.NumberContext - :rtype: twilio.rest.pricing.v2.voice.number.NumberContext - """ - return NumberContext(self._version, destination_number=destination_number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NumberPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the NumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.pricing.v2.voice.number.NumberPage - :rtype: twilio.rest.pricing.v2.voice.number.NumberPage - """ - super(NumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v2.voice.number.NumberInstance - :rtype: twilio.rest.pricing.v2.voice.number.NumberInstance - """ - return NumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class NumberContext(InstanceContext): - - def __init__(self, version, destination_number): - """ - Initialize the NumberContext - - :param Version version: Version that contains the resource - :param destination_number: The destination number for which to fetch pricing information - - :returns: twilio.rest.pricing.v2.voice.number.NumberContext - :rtype: twilio.rest.pricing.v2.voice.number.NumberContext - """ - super(NumberContext, self).__init__(version) + def __init__(self, version: V2, destination_number: str): + # TODO: needs autogenerated docs + super(NumberContextList, self).__init__(version) # Path Solution - self._solution = {'destination_number': destination_number, } - self._uri = '/Voice/Numbers/{destination_number}'.format(**self._solution) - - def fetch(self, origination_number=values.unset): - """ - Fetch the NumberInstance - - :param unicode origination_number: The origination number for which to fetch pricing information - - :returns: The fetched NumberInstance - :rtype: twilio.rest.pricing.v2.voice.number.NumberInstance - """ - data = values.of({'OriginationNumber': origination_number, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return NumberInstance( - self._version, - payload, - destination_number=self._solution['destination_number'], - ) + self._solution = { destination_number, } + self._uri = '/Voice/Numbers/${destination_number}' + + + def fetch(self, origination_number): + + """ + Fetch the NumberInstance + + :returns: The fetched NumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NumberInstance( + self._version, + payload, + destination_number=self._solution['destination_number'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NumberInstance(InstanceResource): - def __init__(self, version, payload, destination_number=None): - """ - Initialize the NumberInstance - - :returns: twilio.rest.pricing.v2.voice.number.NumberInstance - :rtype: twilio.rest.pricing.v2.voice.number.NumberInstance - """ +class NumberInstance(InstanceResource): + def __init__(self, version, payload, destination_number: str): super(NumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'destination_number': payload.get('destination_number'), - 'origination_number': payload.get('origination_number'), - 'country': payload.get('country'), - 'iso_country': payload.get('iso_country'), - 'outbound_call_prices': payload.get('outbound_call_prices'), - 'inbound_call_price': payload.get('inbound_call_price'), - 'price_unit': payload.get('price_unit'), - 'url': payload.get('url'), + self._properties = { + 'destination_number' = payload.get('destination_number'), + 'origination_number' = payload.get('origination_number'), + 'country' = payload.get('country'), + 'iso_country' = payload.get('iso_country'), + 'outbound_call_prices' = payload.get('outbound_call_prices'), + 'inbound_call_price' = payload.get('inbound_call_price'), + 'price_unit' = payload.get('price_unit'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'destination_number': destination_number or self._properties['destination_number'], + 'destination_number': destination_number or self._properties['destination_number'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NumberContext for this NumberInstance - :rtype: twilio.rest.pricing.v2.voice.number.NumberContext - """ if self._context is None: self._context = NumberContext( self._version, @@ -192,87 +89,35 @@ def _proxy(self): ) return self._context - @property - def destination_number(self): - """ - :returns: The destination phone number, in E.164 format - :rtype: unicode - """ - return self._properties['destination_number'] - - @property - def origination_number(self): - """ - :returns: The origination phone number, in E.164 format - :rtype: unicode - """ - return self._properties['origination_number'] + - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] - - @property - def iso_country(self): - """ - :returns: The ISO country code - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def outbound_call_prices(self): - """ - :returns: The list of OutboundCallPriceWithOrigin records - :rtype: list[unicode] - """ - return self._properties['outbound_call_prices'] - - @property - def inbound_call_price(self): - """ - :returns: The InboundCallPrice record - :rtype: unicode - """ - return self._properties['inbound_call_price'] - - @property - def price_unit(self): + def __repr__(self): """ - :returns: The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['price_unit'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, origination_number=values.unset): - """ - Fetch the NumberInstance - :param unicode origination_number: The origination number for which to fetch pricing information +class NumberListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(NumberListInstanceList, self).__init__(version) - :returns: The fetched NumberInstance - :rtype: twilio.rest.pricing.v2.voice.number.NumberInstance - """ - return self._proxy.fetch(origination_number=origination_number, ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/proxy/__init__.py b/twilio/rest/proxy/__init__.py index 8086868b43..d902791e39 100644 --- a/twilio/rest/proxy/__init__.py +++ b/twilio/rest/proxy/__init__.py @@ -1,52 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.proxy.v1 import V1 + Twilio - Proxy + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Proxy(Domain): +from twilio.base.domain import Domain +from twilio.rest.Proxy.v1 import V1 +class Proxy(Domain): def __init__(self, twilio): """ Initialize the Proxy Domain :returns: Domain for Proxy - :rtype: twilio.rest.proxy.Proxy + :rtype: twilio.rest.v1.Proxy """ super(Proxy, self).__init__(twilio) - - self.base_url = 'https://proxy.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Proxy.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of proxy - :rtype: twilio.rest.proxy.v1.V1 + :returns: Versions v1 of Proxy + :rtype: twilio.rest.Proxy.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def services(self): """ - :rtype: twilio.rest.proxy.v1.service.ServiceList + :rtype: twilio.rest.v1.services """ return self.v1.services + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/proxy/v1/.openapi-generator-ignore b/twilio/rest/proxy/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/proxy/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/proxy/v1/.openapi-generator/FILES b/twilio/rest/proxy/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..d0c47fc424 --- /dev/null +++ b/twilio/rest/proxy/v1/.openapi-generator/FILES @@ -0,0 +1,15 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +service.py +service/phone_number.py +service/session.py +service/session/interaction.py +service/session/participant.py +service/session/participant/message_interaction.py +service/short_code.py diff --git a/twilio/rest/proxy/v1/.openapi-generator/VERSION b/twilio/rest/proxy/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/proxy/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/proxy/v1/service.py b/twilio/rest/proxy/v1/service.py new file mode 100644 index 0000000000..466f5841c6 --- /dev/null +++ b/twilio/rest/proxy/v1/service.py @@ -0,0 +1,185 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.phone_number import PhoneNumberListInstancefrom twilio.rest.service.session import SessionListInstancefrom twilio.rest.service.short_code import ShortCodeListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._phone_numbers = None + self._sessions = None + self._short_codes = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'chat_instance_sid' = payload.get('chat_instance_sid'), + 'callback_url' = payload.get('callback_url'), + 'default_ttl' = payload.get('default_ttl'), + 'number_selection_behavior' = payload.get('number_selection_behavior'), + 'geo_match_level' = payload.get('geo_match_level'), + 'intercept_callback_url' = payload.get('intercept_callback_url'), + 'out_of_session_callback_url' = payload.get('out_of_session_callback_url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def phone_numbers(self): + return self._proxy.phone_numbers + @property + def sessions(self): + return self._proxy.sessions + @property + def short_codes(self): + return self._proxy.short_codes + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py index 71747f10ab..aae4d05fe4 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -1,465 +1,171 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PhoneNumberList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the PhoneNumber resource's parent Service resource - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers'.format(**self._solution) - - def create(self, sid=values.unset, phone_number=values.unset, - is_reserved=values.unset): - """ - Create the PhoneNumberInstance - - :param unicode sid: The SID of a Twilio IncomingPhoneNumber resource - :param unicode phone_number: The phone number in E.164 format - :param bool is_reserved: Whether the new phone number should be reserved - - :returns: The created PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - data = values.of({'Sid': sid, 'PhoneNumber': phone_number, 'IsReserved': is_reserved, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams PhoneNumberInstance 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 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.proxy.v1.service.phone_number.PhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.proxy.v1.service.phone_number.PhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PhoneNumberInstance records from the API. - Request is executed immediately - - :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 PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PhoneNumberContext - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PhoneNumberPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the PhoneNumber resource's parent Service resource - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class PhoneNumberContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the parent Service resource of the PhoneNumber resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(PhoneNumberContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/PhoneNumbers/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the PhoneNumberInstance - - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PhoneNumberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def update(self, is_reserved=values.unset): - """ - Update the PhoneNumberInstance - - :param bool is_reserved: Whether the new phone number should be reserved - - :returns: The updated PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - data = values.of({'IsReserved': is_reserved, }) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/PhoneNumbers/${sid}' + + + def delete(self): + + + """ + Deletes the PhoneNumberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the PhoneNumberInstance + + :returns: The fetched PhoneNumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PhoneNumberInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return PhoneNumberInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PhoneNumberInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ +class PhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'phone_number': payload.get('phone_number'), - 'friendly_name': payload.get('friendly_name'), - 'iso_country': payload.get('iso_country'), - 'capabilities': payload.get('capabilities'), - 'url': payload.get('url'), - 'is_reserved': payload.get('is_reserved'), - 'in_use': deserialize.integer(payload.get('in_use')), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'phone_number' = payload.get('phone_number'), + 'friendly_name' = payload.get('friendly_name'), + 'iso_country' = payload.get('iso_country'), + 'capabilities' = payload.get('capabilities'), + 'url' = payload.get('url'), + 'is_reserved' = payload.get('is_reserved'), + 'in_use' = payload.get('in_use'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberContext - """ if self._context is None: self._context = PhoneNumberContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the PhoneNumber resource's parent Service resource - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iso_country(self): - """ - :returns: The ISO Country Code - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def capabilities(self): - """ - :returns: The capabilities of the phone number - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The absolute URL of the PhoneNumber resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def is_reserved(self): - """ - :returns: Reserve the phone number for manual assignment to participants only - :rtype: bool - """ - return self._properties['is_reserved'] - - @property - def in_use(self): - """ - :returns: The number of open session assigned to the number. - :rtype: unicode - """ - return self._properties['in_use'] - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the PhoneNumberInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() - def update(self, is_reserved=values.unset): - """ - Update the PhoneNumberInstance - :param bool is_reserved: Whether the new phone number should be reserved +class PhoneNumberListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(PhoneNumberListInstanceList, self).__init__(version) - :returns: The updated PhoneNumberInstance - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberInstance - """ - return self._proxy.update(is_reserved=is_reserved, ) + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/PhoneNumbers' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return PhoneNumberInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PhoneNumberPage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/proxy/v1/service/session.py b/twilio/rest/proxy/v1/service/session.py new file mode 100644 index 0000000000..a2c01975b6 --- /dev/null +++ b/twilio/rest/proxy/v1/service/session.py @@ -0,0 +1,183 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.session.interaction import InteractionListInstancefrom twilio.rest.session.participant import ParticipantListInstance + + +class SessionContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SessionContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Sessions/${sid}' + + self._interactions = None + self._participants = None + + def delete(self): + + + """ + Deletes the SessionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SessionInstance + + :returns: The fetched SessionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SessionInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SessionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(SessionInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'date_started' = payload.get('date_started'), + 'date_ended' = payload.get('date_ended'), + 'date_last_interaction' = payload.get('date_last_interaction'), + 'date_expiry' = payload.get('date_expiry'), + 'unique_name' = payload.get('unique_name'), + 'status' = payload.get('status'), + 'closed_reason' = payload.get('closed_reason'), + 'ttl' = payload.get('ttl'), + 'mode' = payload.get('mode'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SessionContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def interactions(self): + return self._proxy.interactions + @property + def participants(self): + return self._proxy.participants + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SessionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(SessionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Sessions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SessionInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SessionPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/proxy/v1/service/session/interaction.py b/twilio/rest/proxy/v1/service/session/interaction.py index ea5adf48e5..e1b8bb75c3 100644 --- a/twilio/rest/proxy/v1/service/session/interaction.py +++ b/twilio/rest/proxy/v1/service/session/interaction.py @@ -1,531 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class InteractionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid): - """ - Initialize the InteractionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the resource's parent Service - :param session_sid: The SID of the resource's parent Session - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionList - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionList - """ - super(InteractionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Interactions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams InteractionInstance 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 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.proxy.v1.service.session.interaction.InteractionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists InteractionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.proxy.v1.service.session.interaction.InteractionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of InteractionInstance records from the API. - Request is executed immediately - - :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 InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return InteractionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InteractionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InteractionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InteractionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ - return InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InteractionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ - return InteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class InteractionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the InteractionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the resource's parent Service - :param session_sid: The SID of the resource's parent Session - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionPage - """ - super(InteractionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InteractionInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ - return InteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class InteractionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, sid): - """ - Initialize the InteractionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the parent Service of the resource to fetch - :param session_sid: he SID of the parent Session of the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ - super(InteractionContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, session_sid: str, sid: str): + # TODO: needs autogenerated docs + super(InteractionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Interactions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the InteractionInstance - - :returns: The fetched InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return InteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the InteractionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { service_sid, session_sid, sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Interactions/${sid}' + + + def delete(self): + + + """ + Deletes the InteractionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the InteractionInstance + + :returns: The fetched InteractionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return InteractionInstance( + self._version, + payload, + service_sidsession_sidsid=self._solution['service_sid''session_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class InteractionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Type(object): - MESSAGE = "message" - VOICE = "voice" - UNKNOWN = "unknown" - - class ResourceStatus(object): - ACCEPTED = "accepted" - ANSWERED = "answered" - BUSY = "busy" - CANCELED = "canceled" - COMPLETED = "completed" - DELETED = "deleted" - DELIVERED = "delivered" - DELIVERY_UNKNOWN = "delivery-unknown" - FAILED = "failed" - IN_PROGRESS = "in-progress" - INITIATED = "initiated" - NO_ANSWER = "no-answer" - QUEUED = "queued" - RECEIVED = "received" - RECEIVING = "receiving" - RINGING = "ringing" - SCHEDULED = "scheduled" - SENDING = "sending" - SENT = "sent" - UNDELIVERED = "undelivered" - UNKNOWN = "unknown" - def __init__(self, version, payload, service_sid, session_sid, sid=None): - """ - Initialize the InteractionInstance - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ +class InteractionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, session_sid: str, sid: str): super(InteractionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'session_sid': payload.get('session_sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'data': payload.get('data'), - 'type': payload.get('type'), - 'inbound_participant_sid': payload.get('inbound_participant_sid'), - 'inbound_resource_sid': payload.get('inbound_resource_sid'), - 'inbound_resource_status': payload.get('inbound_resource_status'), - 'inbound_resource_type': payload.get('inbound_resource_type'), - 'inbound_resource_url': payload.get('inbound_resource_url'), - 'outbound_participant_sid': payload.get('outbound_participant_sid'), - 'outbound_resource_sid': payload.get('outbound_resource_sid'), - 'outbound_resource_status': payload.get('outbound_resource_status'), - 'outbound_resource_type': payload.get('outbound_resource_type'), - 'outbound_resource_url': payload.get('outbound_resource_url'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'session_sid' = payload.get('session_sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'data' = payload.get('data'), + 'type' = payload.get('type'), + 'inbound_participant_sid' = payload.get('inbound_participant_sid'), + 'inbound_resource_sid' = payload.get('inbound_resource_sid'), + 'inbound_resource_status' = payload.get('inbound_resource_status'), + 'inbound_resource_type' = payload.get('inbound_resource_type'), + 'inbound_resource_url' = payload.get('inbound_resource_url'), + 'outbound_participant_sid' = payload.get('outbound_participant_sid'), + 'outbound_resource_sid' = payload.get('outbound_resource_sid'), + 'outbound_resource_status' = payload.get('outbound_resource_status'), + 'outbound_resource_type' = payload.get('outbound_resource_type'), + 'outbound_resource_url' = payload.get('outbound_resource_url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'session_sid': session_sid or self._properties['session_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InteractionContext for this InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionContext - """ if self._context is None: self._context = InteractionContext( self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],session_sid=self._solution['session_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: The SID of the resource's parent Session - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the resource's parent Service - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def data(self): - """ - :returns: A JSON string that includes the message body of message interactions - :rtype: unicode - """ - return self._properties['data'] - - @property - def type(self): - """ - :returns: The Type of the Interaction - :rtype: InteractionInstance.Type - """ - return self._properties['type'] - - @property - def inbound_participant_sid(self): - """ - :returns: The SID of the inbound Participant resource - :rtype: unicode - """ - return self._properties['inbound_participant_sid'] - - @property - def inbound_resource_sid(self): - """ - :returns: The SID of the inbound resource - :rtype: unicode - """ - return self._properties['inbound_resource_sid'] - - @property - def inbound_resource_status(self): - """ - :returns: The inbound resource status of the Interaction - :rtype: InteractionInstance.ResourceStatus - """ - return self._properties['inbound_resource_status'] - - @property - def inbound_resource_type(self): - """ - :returns: The inbound resource type - :rtype: unicode - """ - return self._properties['inbound_resource_type'] - - @property - def inbound_resource_url(self): - """ - :returns: The URL of the Twilio inbound resource - :rtype: unicode - """ - return self._properties['inbound_resource_url'] - - @property - def outbound_participant_sid(self): - """ - :returns: The SID of the outbound Participant - :rtype: unicode - """ - return self._properties['outbound_participant_sid'] - - @property - def outbound_resource_sid(self): - """ - :returns: The SID of the outbound resource - :rtype: unicode - """ - return self._properties['outbound_resource_sid'] - - @property - def outbound_resource_status(self): - """ - :returns: The outbound resource status of the Interaction - :rtype: InteractionInstance.ResourceStatus - """ - return self._properties['outbound_resource_status'] - - @property - def outbound_resource_type(self): - """ - :returns: The outbound resource type - :rtype: unicode - """ - return self._properties['outbound_resource_type'] + - @property - def outbound_resource_url(self): + def __repr__(self): """ - :returns: The URL of the Twilio outbound resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['outbound_resource_url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Interaction was created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The absolute URL of the Interaction resource - :rtype: unicode - """ - return self._properties['url'] +class InteractionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, session_sid: str): + # TODO: needs autogenerated docs + super(InteractionListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the InteractionInstance + # Path Solution + self._solution = { service_sid, session_sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Interactions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :returns: The fetched InteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='get', uri=self._uri, data=data, ) - def delete(self): - """ - Deletes the InteractionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return InteractionPage(self._version, payload, service_sid=self._solution['service_sid']session_sid=self._solution['session_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/proxy/v1/service/session/participant.py b/twilio/rest/proxy/v1/service/session/participant.py new file mode 100644 index 0000000000..64a766514b --- /dev/null +++ b/twilio/rest/proxy/v1/service/session/participant.py @@ -0,0 +1,165 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.participant.message_interaction import MessageInteractionListInstance + + +class ParticipantContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, session_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ParticipantContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, session_sid, sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants/${sid}' + + self._message_interactions = None + + def delete(self): + + + """ + Deletes the ParticipantInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ParticipantInstance + + :returns: The fetched ParticipantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ParticipantInstance( + self._version, + payload, + service_sidsession_sidsid=self._solution['service_sid''session_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ParticipantInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, session_sid: str, sid: str): + super(ParticipantInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'session_sid' = payload.get('session_sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'identifier' = payload.get('identifier'), + 'proxy_identifier' = payload.get('proxy_identifier'), + 'proxy_identifier_sid' = payload.get('proxy_identifier_sid'), + 'date_deleted' = payload.get('date_deleted'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'session_sid': session_sid or self._properties['session_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ParticipantContext( + self._version, + service_sid=self._solution['service_sid'],session_sid=self._solution['session_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def message_interactions(self): + return self._proxy.message_interactions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ParticipantListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, session_sid: str): + # TODO: needs autogenerated docs + super(ParticipantListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, session_sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ParticipantInstance(self._version, payload, service_sid=self._solution['service_sid']session_sid=self._solution['session_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ParticipantPage(self._version, payload, service_sid=self._solution['service_sid']session_sid=self._solution['session_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py index 5ad325bb47..24c5253e82 100644 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,553 +19,139 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MessageInteractionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, participant_sid): - """ - Initialize the MessageInteractionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the resource's parent Service - :param session_sid: The SID of the resource's parent Session - :param participant_sid: The SID of the Participant resource - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - """ - super(MessageInteractionList, self).__init__(version) - - # Path Solution - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{participant_sid}/MessageInteractions'.format(**self._solution) - - def create(self, body=values.unset, media_url=values.unset): - """ - Create the MessageInteractionInstance - - :param unicode body: Message body - :param list[unicode] media_url: Reserved - - :returns: The 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(method='POST', uri=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'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams MessageInteractionInstance 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 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.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists MessageInteractionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MessageInteractionInstance records from the API. - Request is executed immediately - - :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 MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MessageInteractionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInteractionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessageInteractionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageInteractionContext - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ - return MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageInteractionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ - return MessageInteractionContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MessageInteractionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the MessageInteractionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the resource's parent Service - :param session_sid: The SID of the resource's parent Session - :param participant_sid: The SID of the Participant resource - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionPage - """ - super(MessageInteractionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class MessageInteractionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, participant_sid, sid): - """ - Initialize the MessageInteractionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param session_sid: The SID of the parent Session - :param participant_sid: The SID of the Participant resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ - super(MessageInteractionContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, session_sid: str, participant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(MessageInteractionContextList, self).__init__(version) # Path Solution - self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - 'sid': sid, - } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{participant_sid}/MessageInteractions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the MessageInteractionInstance - - :returns: The fetched MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MessageInteractionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, session_sid, participant_sid, sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants/${participant_sid}/MessageInteractions/${sid}' + + + def fetch(self): + + """ + Fetch the MessageInteractionInstance + + :returns: The fetched MessageInteractionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessageInteractionInstance( + self._version, + payload, + service_sidsession_sidparticipant_sidsid=self._solution['service_sid''session_sid''participant_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class MessageInteractionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - class Type(object): - MESSAGE = "message" - VOICE = "voice" - UNKNOWN = "unknown" - - class ResourceStatus(object): - ACCEPTED = "accepted" - ANSWERED = "answered" - BUSY = "busy" - CANCELED = "canceled" - COMPLETED = "completed" - DELETED = "deleted" - DELIVERED = "delivered" - DELIVERY_UNKNOWN = "delivery-unknown" - FAILED = "failed" - IN_PROGRESS = "in-progress" - INITIATED = "initiated" - NO_ANSWER = "no-answer" - QUEUED = "queued" - RECEIVED = "received" - RECEIVING = "receiving" - RINGING = "ringing" - SCHEDULED = "scheduled" - SENDING = "sending" - SENT = "sent" - UNDELIVERED = "undelivered" - UNKNOWN = "unknown" - - def __init__(self, version, payload, service_sid, session_sid, participant_sid, - sid=None): - """ - Initialize the MessageInteractionInstance - - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ +class MessageInteractionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, session_sid: str, participant_sid: str, sid: str): super(MessageInteractionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'session_sid': payload.get('session_sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'data': payload.get('data'), - 'type': payload.get('type'), - 'participant_sid': payload.get('participant_sid'), - 'inbound_participant_sid': payload.get('inbound_participant_sid'), - 'inbound_resource_sid': payload.get('inbound_resource_sid'), - 'inbound_resource_status': payload.get('inbound_resource_status'), - 'inbound_resource_type': payload.get('inbound_resource_type'), - 'inbound_resource_url': payload.get('inbound_resource_url'), - 'outbound_participant_sid': payload.get('outbound_participant_sid'), - 'outbound_resource_sid': payload.get('outbound_resource_sid'), - 'outbound_resource_status': payload.get('outbound_resource_status'), - 'outbound_resource_type': payload.get('outbound_resource_type'), - 'outbound_resource_url': payload.get('outbound_resource_url'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'session_sid' = payload.get('session_sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'data' = payload.get('data'), + 'type' = payload.get('type'), + 'participant_sid' = payload.get('participant_sid'), + 'inbound_participant_sid' = payload.get('inbound_participant_sid'), + 'inbound_resource_sid' = payload.get('inbound_resource_sid'), + 'inbound_resource_status' = payload.get('inbound_resource_status'), + 'inbound_resource_type' = payload.get('inbound_resource_type'), + 'inbound_resource_url' = payload.get('inbound_resource_url'), + 'outbound_participant_sid' = payload.get('outbound_participant_sid'), + 'outbound_resource_sid' = payload.get('outbound_resource_sid'), + 'outbound_resource_status' = payload.get('outbound_resource_status'), + 'outbound_resource_type' = payload.get('outbound_resource_type'), + 'outbound_resource_url' = payload.get('outbound_resource_url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'participant_sid': participant_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'session_sid': session_sid or self._properties['session_sid']'participant_sid': participant_sid or self._properties['participant_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageInteractionContext for this MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionContext - """ if self._context is None: self._context = MessageInteractionContext( self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],session_sid=self._solution['session_sid'],participant_sid=self._solution['participant_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: The SID of the resource's parent Session - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the resource's parent Service - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def data(self): - """ - :returns: A JSON string that includes the message body sent to the participant - :rtype: unicode - """ - return self._properties['data'] - - @property - def type(self): - """ - :returns: The Type of Message Interaction - :rtype: MessageInteractionInstance.Type - """ - return self._properties['type'] - - @property - def participant_sid(self): - """ - :returns: The SID of the Participant resource - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def inbound_participant_sid(self): - """ - :returns: Always empty for Message Interactions - :rtype: unicode - """ - return self._properties['inbound_participant_sid'] - - @property - def inbound_resource_sid(self): - """ - :returns: Always empty for Message Interactions - :rtype: unicode - """ - return self._properties['inbound_resource_sid'] - - @property - def inbound_resource_status(self): - """ - :returns: Always empty for Message Interactions - :rtype: MessageInteractionInstance.ResourceStatus - """ - return self._properties['inbound_resource_status'] - - @property - def inbound_resource_type(self): - """ - :returns: Always empty for Message Interactions - :rtype: unicode - """ - return self._properties['inbound_resource_type'] - - @property - def inbound_resource_url(self): - """ - :returns: Always empty for Message Interactions - :rtype: unicode - """ - return self._properties['inbound_resource_url'] - - @property - def outbound_participant_sid(self): - """ - :returns: The SID of the outbound Participant resource - :rtype: unicode - """ - return self._properties['outbound_participant_sid'] - - @property - def outbound_resource_sid(self): - """ - :returns: The SID of the outbound Message resource - :rtype: unicode - """ - return self._properties['outbound_resource_sid'] - - @property - def outbound_resource_status(self): - """ - :returns: The outbound resource status - :rtype: MessageInteractionInstance.ResourceStatus - """ - return self._properties['outbound_resource_status'] - - @property - def outbound_resource_type(self): - """ - :returns: The outbound resource type - :rtype: unicode - """ - return self._properties['outbound_resource_type'] - - @property - def outbound_resource_url(self): - """ - :returns: The URL of the Twilio message resource - :rtype: unicode - """ - return self._properties['outbound_resource_url'] - - @property - def date_created(self): + def __repr__(self): """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The absolute URL of the MessageInteraction resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the MessageInteractionInstance +class MessageInteractionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, session_sid: str, participant_sid: str): + # TODO: needs autogenerated docs + super(MessageInteractionListInstanceList, self).__init__(version) - :returns: The fetched MessageInteractionInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, session_sid, participant_sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants/${participant_sid}/MessageInteractions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=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']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessageInteractionPage(self._version, payload, service_sid=self._solution['service_sid']session_sid=self._solution['session_sid']participant_sid=self._solution['participant_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/proxy/v1/service/short_code.py index 9afbc40d4f..8011b7e4c1 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/proxy/v1/service/short_code.py @@ -1,444 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ShortCodeList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the ShortCodeList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the resource's parent Service - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeList - """ - super(ShortCodeList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/ShortCodes'.format(**self._solution) - - def create(self, sid): - """ - Create the ShortCodeInstance - - :param unicode sid: The SID of a Twilio ShortCode resource - - :returns: The created ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - data = values.of({'Sid': sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams ShortCodeInstance 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 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.proxy.v1.service.short_code.ShortCodeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ShortCodeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.proxy.v1.service.short_code.ShortCodeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ShortCodeInstance records from the API. - Request is executed immediately - - :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 ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ShortCodePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ShortCodeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ShortCodePage(self._version, response, self._solution) - def get(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ShortCodeContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ - return ShortCodeContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ShortCodePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ShortCodePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the resource's parent Service - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodePage - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodePage - """ - super(ShortCodePage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of ShortCodeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ShortCodeContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the ShortCodeContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the parent Service to fetch the resource from - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ - super(ShortCodeContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ShortCodeContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/ShortCodes/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the ShortCodeInstance - - :returns: The fetched ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ShortCodeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def update(self, is_reserved=values.unset): - """ - Update the ShortCodeInstance - - :param bool is_reserved: Whether the short code should be reserved for manual assignment to participants only - - :returns: The updated ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - data = values.of({'IsReserved': is_reserved, }) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/ShortCodes/${sid}' + + + def delete(self): + + + """ + Deletes the ShortCodeInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ShortCodeInstance + + :returns: The fetched ShortCodeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ShortCodeInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ShortCodeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ShortCodeInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ShortCodeInstance - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ +class ShortCodeInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(ShortCodeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'short_code': payload.get('short_code'), - 'iso_country': payload.get('iso_country'), - 'capabilities': payload.get('capabilities'), - 'url': payload.get('url'), - 'is_reserved': payload.get('is_reserved'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'short_code' = payload.get('short_code'), + 'iso_country' = payload.get('iso_country'), + 'capabilities' = payload.get('capabilities'), + 'url' = payload.get('url'), + 'is_reserved' = payload.get('is_reserved'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ShortCodeContext for this ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeContext - """ if self._context is None: self._context = ShortCodeContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the resource's parent Service - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def short_code(self): - """ - :returns: The short code's number - :rtype: unicode - """ - return self._properties['short_code'] - - @property - def iso_country(self): - """ - :returns: The ISO Country Code - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def capabilities(self): - """ - :returns: The capabilities of the short code - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def url(self): - """ - :returns: The absolute URL of the ShortCode resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def is_reserved(self): - """ - :returns: Whether the short code should be reserved for manual assignment to participants only - :rtype: bool - """ - return self._properties['is_reserved'] - - def delete(self): - """ - Deletes the ShortCodeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the ShortCodeInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - return self._proxy.fetch() - def update(self, is_reserved=values.unset): - """ - Update the ShortCodeInstance - :param bool is_reserved: Whether the short code should be reserved for manual assignment to participants only +class ShortCodeListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(ShortCodeListInstanceList, self).__init__(version) - :returns: The updated ShortCodeInstance - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance - """ - return self._proxy.update(is_reserved=is_reserved, ) + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/ShortCodes' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ShortCodePage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/routes/__init__.py b/twilio/rest/routes/__init__.py index 289c962b85..71ad2e0831 100644 --- a/twilio/rest/routes/__init__.py +++ b/twilio/rest/routes/__init__.py @@ -1,66 +1,70 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.routes.v2 import V2 + Twilio - Routes + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Routes(Domain): +from twilio.base.domain import Domain +from twilio.rest.Routes.v2 import V2 +class Routes(Domain): def __init__(self, twilio): """ Initialize the Routes Domain :returns: Domain for Routes - :rtype: twilio.rest.routes.Routes + :rtype: twilio.rest.v2.Routes """ super(Routes, self).__init__(twilio) - - self.base_url = 'https://routes.twilio.com' - - # Versions - self._v2 = None + self.base_url = 'https://Routes.twilio.com' + self._V2 = None @property - def v2(self): + def V2(self): """ - :returns: Version v2 of routes - :rtype: twilio.rest.routes.v2.V2 + :returns: Versions v2 of Routes + :rtype: twilio.rest.Routes.v2 """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + @property def phone_numbers(self): """ - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberList + :rtype: twilio.rest.v2.phone_numbers """ return self.v2.phone_numbers + @property def sip_domains(self): """ - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainList + :rtype: twilio.rest.v2.sip_domains """ return self.v2.sip_domains + @property def trunks(self): """ - :rtype: twilio.rest.routes.v2.trunk.TrunkList + :rtype: twilio.rest.v2.trunks """ return self.v2.trunks + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/routes/v2/.openapi-generator-ignore b/twilio/rest/routes/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/routes/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/routes/v2/.openapi-generator/FILES b/twilio/rest/routes/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..01dc3954f7 --- /dev/null +++ b/twilio/rest/routes/v2/.openapi-generator/FILES @@ -0,0 +1,7 @@ +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +phone_number.py +sip_domain.py +trunk.py diff --git a/twilio/rest/routes/v2/.openapi-generator/VERSION b/twilio/rest/routes/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/routes/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/routes/v2/phone_number.py b/twilio/rest/routes/v2/phone_number.py index 222959bcfa..ad440fa966 100644 --- a/twilio/rest/routes/v2/phone_number.py +++ b/twilio/rest/routes/v2/phone_number.py @@ -1,292 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Routes + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PhoneNumberList(ListResource): - - def __init__(self, version): - """ - Initialize the PhoneNumberList - :param Version version: Version that contains the resource - :returns: twilio.rest.routes.v2.phone_number.PhoneNumberList - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: The phone number - - :returns: twilio.rest.routes.v2.phone_number.PhoneNumberContext - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - - def __call__(self, phone_number): - """ - Constructs a PhoneNumberContext - - :param phone_number: The phone number - - :returns: twilio.rest.routes.v2.phone_number.PhoneNumberContext - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, phone_number=phone_number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PhoneNumberPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.routes.v2.phone_number.PhoneNumberPage - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class PhoneNumberContext(InstanceContext): - - def __init__(self, version, phone_number): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param phone_number: The phone number - - :returns: twilio.rest.routes.v2.phone_number.PhoneNumberContext - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) + def __init__(self, version: V2, phone_number: str): + # TODO: needs autogenerated docs + super(PhoneNumberContextList, self).__init__(version) # Path Solution - self._solution = {'phone_number': phone_number, } - self._uri = '/PhoneNumbers/{phone_number}'.format(**self._solution) - - def update(self, voice_region=values.unset, friendly_name=values.unset): - """ - Update the PhoneNumberInstance - - :param unicode voice_region: The Inbound Processing Region used for this phone number for voice - :param unicode friendly_name: A human readable description of this resource. - - :returns: The updated PhoneNumberInstance - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - """ - data = values.of({'VoiceRegion': voice_region, 'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], ) - - def fetch(self): - """ - Fetch the PhoneNumberInstance - - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], ) + self._solution = { phone_number, } + self._uri = '/PhoneNumbers/${phone_number}' + + + def fetch(self): + + """ + Fetch the PhoneNumberInstance + + :returns: The fetched PhoneNumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PhoneNumberInstance( + self._version, + payload, + phone_number=self._solution['phone_number'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class PhoneNumberInstance(InstanceResource): - def __init__(self, version, payload, phone_number=None): - """ - Initialize the PhoneNumberInstance - :returns: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - """ +class PhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, phone_number: str): super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'phone_number': payload.get('phone_number'), - 'url': payload.get('url'), - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'voice_region': payload.get('voice_region'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'phone_number' = payload.get('phone_number'), + 'url' = payload.get('url'), + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'voice_region' = payload.get('voice_region'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'phone_number': phone_number or self._properties['phone_number'], } + self._solution = { + 'phone_number': phone_number or self._properties['phone_number'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberContext - """ if self._context is None: - self._context = PhoneNumberContext(self._version, phone_number=self._solution['phone_number'], ) + self._context = PhoneNumberContext( + self._version, + phone_number=self._solution['phone_number'], + ) return self._context - @property - def phone_number(self): - """ - :returns: The phone number - :rtype: unicode - """ - return self._properties['phone_number'] + - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies the Inbound Processing Region assignments for this phone number. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of the Inbound Processing Region assignments for this phone number. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def voice_region(self): - """ - :returns: The Inbound Processing Region used for this phone number for voice. - :rtype: unicode - """ - return self._properties['voice_region'] - - @property - def date_created(self): - """ - :returns: The date that this phone number was assigned an Inbound Processing Region. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): + def __repr__(self): """ - :returns: The date that the Inbound Processing Region was updated for this phone number. - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_updated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, voice_region=values.unset, friendly_name=values.unset): - """ - Update the PhoneNumberInstance - :param unicode voice_region: The Inbound Processing Region used for this phone number for voice - :param unicode friendly_name: A human readable description of this resource. - :returns: The updated PhoneNumberInstance - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - """ - return self._proxy.update(voice_region=voice_region, friendly_name=friendly_name, ) +class PhoneNumberListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(PhoneNumberListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the PhoneNumberInstance - - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.routes.v2.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/routes/v2/sip_domain.py b/twilio/rest/routes/v2/sip_domain.py index 7cb33d3376..6bd4dc7b6f 100644 --- a/twilio/rest/routes/v2/sip_domain.py +++ b/twilio/rest/routes/v2/sip_domain.py @@ -1,292 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Routes + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SipDomainList(ListResource): - - def __init__(self, version): - """ - Initialize the SipDomainList - :param Version version: Version that contains the resource - :returns: twilio.rest.routes.v2.sip_domain.SipDomainList - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainList - """ - super(SipDomainList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, sip_domain): - """ - Constructs a SipDomainContext - - :param sip_domain: The sip_domain - - :returns: twilio.rest.routes.v2.sip_domain.SipDomainContext - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainContext - """ - return SipDomainContext(self._version, sip_domain=sip_domain, ) - - def __call__(self, sip_domain): - """ - Constructs a SipDomainContext - - :param sip_domain: The sip_domain - - :returns: twilio.rest.routes.v2.sip_domain.SipDomainContext - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainContext - """ - return SipDomainContext(self._version, sip_domain=sip_domain, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SipDomainPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SipDomainPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.routes.v2.sip_domain.SipDomainPage - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainPage - """ - super(SipDomainPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SipDomainInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.routes.v2.sip_domain.SipDomainInstance - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainInstance - """ - return SipDomainInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SipDomainContext(InstanceContext): - - def __init__(self, version, sip_domain): - """ - Initialize the SipDomainContext - - :param Version version: Version that contains the resource - :param sip_domain: The sip_domain - - :returns: twilio.rest.routes.v2.sip_domain.SipDomainContext - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainContext - """ - super(SipDomainContext, self).__init__(version) + def __init__(self, version: V2, sip_domain: str): + # TODO: needs autogenerated docs + super(SipDomainContextList, self).__init__(version) # Path Solution - self._solution = {'sip_domain': sip_domain, } - self._uri = '/SipDomains/{sip_domain}'.format(**self._solution) - - def update(self, voice_region=values.unset, friendly_name=values.unset): - """ - Update the SipDomainInstance - - :param unicode voice_region: The voice_region - :param unicode friendly_name: The friendly_name - - :returns: The updated SipDomainInstance - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainInstance - """ - data = values.of({'VoiceRegion': voice_region, 'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SipDomainInstance(self._version, payload, sip_domain=self._solution['sip_domain'], ) - - def fetch(self): - """ - Fetch the SipDomainInstance - - :returns: The fetched SipDomainInstance - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SipDomainInstance(self._version, payload, sip_domain=self._solution['sip_domain'], ) + self._solution = { sip_domain, } + self._uri = '/SipDomains/${sip_domain}' + + + def fetch(self): + + """ + Fetch the SipDomainInstance + + :returns: The fetched SipDomainInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SipDomainInstance( + self._version, + payload, + sip_domain=self._solution['sip_domain'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SipDomainInstance(self._version, payload, sip_domain=self._solution['sip_domain'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SipDomainInstance(InstanceResource): - def __init__(self, version, payload, sip_domain=None): - """ - Initialize the SipDomainInstance - :returns: twilio.rest.routes.v2.sip_domain.SipDomainInstance - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainInstance - """ +class SipDomainInstance(InstanceResource): + def __init__(self, version, payload, sip_domain: str): super(SipDomainInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sip_domain': payload.get('sip_domain'), - 'url': payload.get('url'), - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'voice_region': payload.get('voice_region'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sip_domain' = payload.get('sip_domain'), + 'url' = payload.get('url'), + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'voice_region' = payload.get('voice_region'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'sip_domain': sip_domain or self._properties['sip_domain'], } + self._solution = { + 'sip_domain': sip_domain or self._properties['sip_domain'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SipDomainContext for this SipDomainInstance - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainContext - """ if self._context is None: - self._context = SipDomainContext(self._version, sip_domain=self._solution['sip_domain'], ) + self._context = SipDomainContext( + self._version, + sip_domain=self._solution['sip_domain'], + ) return self._context - @property - def sip_domain(self): - """ - :returns: The sip_domain - :rtype: unicode - """ - return self._properties['sip_domain'] + - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def voice_region(self): - """ - :returns: The voice_region - :rtype: unicode - """ - return self._properties['voice_region'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): + def __repr__(self): """ - :returns: The date_updated - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_updated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, voice_region=values.unset, friendly_name=values.unset): - """ - Update the SipDomainInstance - :param unicode voice_region: The voice_region - :param unicode friendly_name: The friendly_name - :returns: The updated SipDomainInstance - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainInstance - """ - return self._proxy.update(voice_region=voice_region, friendly_name=friendly_name, ) +class SipDomainListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(SipDomainListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the SipDomainInstance - - :returns: The fetched SipDomainInstance - :rtype: twilio.rest.routes.v2.sip_domain.SipDomainInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/routes/v2/trunk.py b/twilio/rest/routes/v2/trunk.py index 9e691b202d..5ccd76bb89 100644 --- a/twilio/rest/routes/v2/trunk.py +++ b/twilio/rest/routes/v2/trunk.py @@ -1,292 +1,134 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Routes + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TrunkList(ListResource): - - def __init__(self, version): - """ - Initialize the TrunkList - :param Version version: Version that contains the resource - :returns: twilio.rest.routes.v2.trunk.TrunkList - :rtype: twilio.rest.routes.v2.trunk.TrunkList - """ - super(TrunkList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, sip_trunk_domain): - """ - Constructs a TrunkContext - - :param sip_trunk_domain: The SIP Trunk - - :returns: twilio.rest.routes.v2.trunk.TrunkContext - :rtype: twilio.rest.routes.v2.trunk.TrunkContext - """ - return TrunkContext(self._version, sip_trunk_domain=sip_trunk_domain, ) - - def __call__(self, sip_trunk_domain): - """ - Constructs a TrunkContext - - :param sip_trunk_domain: The SIP Trunk - - :returns: twilio.rest.routes.v2.trunk.TrunkContext - :rtype: twilio.rest.routes.v2.trunk.TrunkContext - """ - return TrunkContext(self._version, sip_trunk_domain=sip_trunk_domain, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TrunkPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TrunkPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.routes.v2.trunk.TrunkPage - :rtype: twilio.rest.routes.v2.trunk.TrunkPage - """ - super(TrunkPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TrunkInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.routes.v2.trunk.TrunkInstance - :rtype: twilio.rest.routes.v2.trunk.TrunkInstance - """ - return TrunkInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TrunkContext(InstanceContext): - - def __init__(self, version, sip_trunk_domain): - """ - Initialize the TrunkContext - - :param Version version: Version that contains the resource - :param sip_trunk_domain: The SIP Trunk - - :returns: twilio.rest.routes.v2.trunk.TrunkContext - :rtype: twilio.rest.routes.v2.trunk.TrunkContext - """ - super(TrunkContext, self).__init__(version) + def __init__(self, version: V2, sip_trunk_domain: str): + # TODO: needs autogenerated docs + super(TrunkContextList, self).__init__(version) # Path Solution - self._solution = {'sip_trunk_domain': sip_trunk_domain, } - self._uri = '/Trunks/{sip_trunk_domain}'.format(**self._solution) - - def update(self, voice_region=values.unset, friendly_name=values.unset): - """ - Update the TrunkInstance - - :param unicode voice_region: The Inbound Processing Region used for this SIP Trunk for voice - :param unicode friendly_name: A human readable description of this resource. - - :returns: The updated TrunkInstance - :rtype: twilio.rest.routes.v2.trunk.TrunkInstance - """ - data = values.of({'VoiceRegion': voice_region, 'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return TrunkInstance(self._version, payload, sip_trunk_domain=self._solution['sip_trunk_domain'], ) - - def fetch(self): - """ - Fetch the TrunkInstance - - :returns: The fetched TrunkInstance - :rtype: twilio.rest.routes.v2.trunk.TrunkInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TrunkInstance(self._version, payload, sip_trunk_domain=self._solution['sip_trunk_domain'], ) + self._solution = { sip_trunk_domain, } + self._uri = '/Trunks/${sip_trunk_domain}' + + + def fetch(self): + + """ + Fetch the TrunkInstance + + :returns: The fetched TrunkInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TrunkInstance( + self._version, + payload, + sip_trunk_domain=self._solution['sip_trunk_domain'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return TrunkInstance(self._version, payload, sip_trunk_domain=self._solution['sip_trunk_domain'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TrunkInstance(InstanceResource): - def __init__(self, version, payload, sip_trunk_domain=None): - """ - Initialize the TrunkInstance - :returns: twilio.rest.routes.v2.trunk.TrunkInstance - :rtype: twilio.rest.routes.v2.trunk.TrunkInstance - """ +class TrunkInstance(InstanceResource): + def __init__(self, version, payload, sip_trunk_domain: str): super(TrunkInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sip_trunk_domain': payload.get('sip_trunk_domain'), - 'url': payload.get('url'), - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'voice_region': payload.get('voice_region'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), + self._properties = { + 'sip_trunk_domain' = payload.get('sip_trunk_domain'), + 'url' = payload.get('url'), + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'voice_region' = payload.get('voice_region'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), } - # Context self._context = None - self._solution = {'sip_trunk_domain': sip_trunk_domain or self._properties['sip_trunk_domain'], } + self._solution = { + 'sip_trunk_domain': sip_trunk_domain or self._properties['sip_trunk_domain'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TrunkContext for this TrunkInstance - :rtype: twilio.rest.routes.v2.trunk.TrunkContext - """ if self._context is None: - self._context = TrunkContext(self._version, sip_trunk_domain=self._solution['sip_trunk_domain'], ) + self._context = TrunkContext( + self._version, + sip_trunk_domain=self._solution['sip_trunk_domain'], + ) return self._context - @property - def sip_trunk_domain(self): - """ - :returns: The SIP Trunk - :rtype: unicode - """ - return self._properties['sip_trunk_domain'] + - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of the Inbound Processing Region assignments for this SIP Trunk. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def voice_region(self): - """ - :returns: The Inbound Processing Region used for this SIP Trunk for voice. - :rtype: unicode - """ - return self._properties['voice_region'] - - @property - def date_created(self): - """ - :returns: The date that this SIP Trunk was assigned an Inbound Processing Region. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): + def __repr__(self): """ - :returns: The date that the Inbound Processing Region was updated for this SIP Trunk. - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_updated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, voice_region=values.unset, friendly_name=values.unset): - """ - Update the TrunkInstance - :param unicode voice_region: The Inbound Processing Region used for this SIP Trunk for voice - :param unicode friendly_name: A human readable description of this resource. - :returns: The updated TrunkInstance - :rtype: twilio.rest.routes.v2.trunk.TrunkInstance - """ - return self._proxy.update(voice_region=voice_region, friendly_name=friendly_name, ) +class TrunkListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(TrunkListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the TrunkInstance - - :returns: The fetched TrunkInstance - :rtype: twilio.rest.routes.v2.trunk.TrunkInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/__init__.py b/twilio/rest/serverless/__init__.py index 5fcdd8b97c..590ba005a3 100644 --- a/twilio/rest/serverless/__init__.py +++ b/twilio/rest/serverless/__init__.py @@ -1,52 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.serverless.v1 import V1 + Twilio - Serverless + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Serverless(Domain): +from twilio.base.domain import Domain +from twilio.rest.Serverless.v1 import V1 +class Serverless(Domain): def __init__(self, twilio): """ Initialize the Serverless Domain :returns: Domain for Serverless - :rtype: twilio.rest.serverless.Serverless + :rtype: twilio.rest.v1.Serverless """ super(Serverless, self).__init__(twilio) - - self.base_url = 'https://serverless.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Serverless.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of serverless - :rtype: twilio.rest.serverless.v1.V1 + :returns: Versions v1 of Serverless + :rtype: twilio.rest.Serverless.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def services(self): """ - :rtype: twilio.rest.serverless.v1.service.ServiceList + :rtype: twilio.rest.v1.services """ return self.v1.services + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/serverless/v1/.openapi-generator-ignore b/twilio/rest/serverless/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/serverless/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/serverless/v1/.openapi-generator/FILES b/twilio/rest/serverless/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..4bff14f864 --- /dev/null +++ b/twilio/rest/serverless/v1/.openapi-generator/FILES @@ -0,0 +1,25 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +service.py +service/asset.py +service/asset/asset_version.py +service/build.py +service/build/build_status.py +service/environment.py +service/environment/deployment.py +service/environment/log.py +service/environment/variable.py +service/function.py +service/function/function_version.py +service/function/function_version/function_version_content.py diff --git a/twilio/rest/serverless/v1/.openapi-generator/VERSION b/twilio/rest/serverless/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/serverless/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/serverless/v1/service.py b/twilio/rest/serverless/v1/service.py new file mode 100644 index 0000000000..cb5c654abf --- /dev/null +++ b/twilio/rest/serverless/v1/service.py @@ -0,0 +1,186 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.asset import AssetListInstancefrom twilio.rest.service.build import BuildListInstancefrom twilio.rest.service.environment import EnvironmentListInstancefrom twilio.rest.service.function import FunctionListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._assets = None + self._builds = None + self._environments = None + self._functions = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'unique_name' = payload.get('unique_name'), + 'include_credentials' = payload.get('include_credentials'), + 'ui_editable' = payload.get('ui_editable'), + 'domain_base' = payload.get('domain_base'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def assets(self): + return self._proxy.assets + @property + def builds(self): + return self._proxy.builds + @property + def environments(self): + return self._proxy.environments + @property + def functions(self): + return self._proxy.functions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/serverless/v1/service/asset.py b/twilio/rest/serverless/v1/service/asset.py new file mode 100644 index 0000000000..c6a2ec0d04 --- /dev/null +++ b/twilio/rest/serverless/v1/service/asset.py @@ -0,0 +1,171 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.asset.asset_version import AssetVersionListInstance + + +class AssetContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AssetContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Assets/${sid}' + + self._asset_versions = None + + def delete(self): + + + """ + Deletes the AssetInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the AssetInstance + + :returns: The fetched AssetInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssetInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AssetInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AssetInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(AssetInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AssetContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def asset_versions(self): + return self._proxy.asset_versions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AssetListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(AssetListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Assets' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssetInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssetPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/serverless/v1/service/asset/asset_version.py b/twilio/rest/serverless/v1/service/asset/asset_version.py index 290422da77..e671f67cba 100644 --- a/twilio/rest/serverless/v1/service/asset/asset_version.py +++ b/twilio/rest/serverless/v1/service/asset/asset_version.py @@ -1,391 +1,135 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AssetVersionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, asset_sid): - """ - Initialize the AssetVersionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Asset Version resource is associated with - :param asset_sid: The SID of the Asset resource that is the parent of the Asset Version - - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionList - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionList - """ - super(AssetVersionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'asset_sid': asset_sid, } - self._uri = '/Services/{service_sid}/Assets/{asset_sid}/Versions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssetVersionInstance 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 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.serverless.v1.service.asset.asset_version.AssetVersionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssetVersionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.serverless.v1.service.asset.asset_version.AssetVersionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssetVersionInstance records from the API. - Request is executed immediately - - :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 AssetVersionInstance - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AssetVersionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssetVersionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssetVersionInstance - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssetVersionPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AssetVersionContext - - :param sid: The SID that identifies the Asset Version resource to fetch - - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionContext - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionContext - """ - return AssetVersionContext( - self._version, - service_sid=self._solution['service_sid'], - asset_sid=self._solution['asset_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AssetVersionContext - - :param sid: The SID that identifies the Asset Version resource to fetch - - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionContext - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionContext - """ - return AssetVersionContext( - self._version, - service_sid=self._solution['service_sid'], - asset_sid=self._solution['asset_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssetVersionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssetVersionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Asset Version resource is associated with - :param asset_sid: The SID of the Asset resource that is the parent of the Asset Version - - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionPage - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionPage - """ - super(AssetVersionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssetVersionInstance - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance - """ - return AssetVersionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - asset_sid=self._solution['asset_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AssetVersionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, asset_sid, sid): - """ - Initialize the AssetVersionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Asset Version resource from - :param asset_sid: The SID of the Asset resource that is the parent of the Asset Version resource to fetch - :param sid: The SID that identifies the Asset Version resource to fetch - - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionContext - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionContext - """ - super(AssetVersionContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, asset_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AssetVersionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'asset_sid': asset_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Assets/{asset_sid}/Versions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AssetVersionInstance - - :returns: The fetched AssetVersionInstance - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssetVersionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - asset_sid=self._solution['asset_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, asset_sid, sid, } + self._uri = '/Services/${service_sid}/Assets/${asset_sid}/Versions/${sid}' + + + def fetch(self): + + """ + Fetch the AssetVersionInstance + + :returns: The fetched AssetVersionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AssetVersionInstance( + self._version, + payload, + service_sidasset_sidsid=self._solution['service_sid''asset_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class AssetVersionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - class Visibility(object): - PUBLIC = "public" - PRIVATE = "private" - PROTECTED = "protected" - def __init__(self, version, payload, service_sid, asset_sid, sid=None): - """ - Initialize the AssetVersionInstance - - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance - """ +class AssetVersionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, asset_sid: str, sid: str): super(AssetVersionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'asset_sid': payload.get('asset_sid'), - 'path': payload.get('path'), - 'visibility': payload.get('visibility'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'asset_sid' = payload.get('asset_sid'), + 'path' = payload.get('path'), + 'visibility' = payload.get('visibility'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'asset_sid': asset_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'asset_sid': asset_sid or self._properties['asset_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssetVersionContext for this AssetVersionInstance - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionContext - """ if self._context is None: self._context = AssetVersionContext( self._version, - service_sid=self._solution['service_sid'], - asset_sid=self._solution['asset_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],asset_sid=self._solution['asset_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Asset Version resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Asset Version resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Asset Version resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def asset_sid(self): + def __repr__(self): """ - :returns: The SID of the Asset resource that is the parent of the Asset Version - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['asset_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def path(self): - """ - :returns: The URL-friendly string by which the Asset Version can be referenced - :rtype: unicode - """ - return self._properties['path'] - @property - def visibility(self): - """ - :returns: The access control that determines how the Asset Version can be accessed - :rtype: AssetVersionInstance.Visibility - """ - return self._properties['visibility'] - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Asset Version resource was created - :rtype: datetime - """ - return self._properties['date_created'] +class AssetVersionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, asset_sid: str): + # TODO: needs autogenerated docs + super(AssetVersionListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the Asset Version resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { service_sid, asset_sid, } + self._uri = '/Services/${service_sid}/Assets/${asset_sid}/Versions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the AssetVersionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched AssetVersionInstance - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionInstance - """ - return self._proxy.fetch() + return AssetVersionPage(self._version, payload, service_sid=self._solution['service_sid']asset_sid=self._solution['asset_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/build.py b/twilio/rest/serverless/v1/service/build.py new file mode 100644 index 0000000000..ed416a35d9 --- /dev/null +++ b/twilio/rest/serverless/v1/service/build.py @@ -0,0 +1,164 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.build.build_status import BuildStatusListInstance + + +class BuildContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BuildContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Builds/${sid}' + + self._build_status = None + + def delete(self): + + + """ + Deletes the BuildInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the BuildInstance + + :returns: The fetched BuildInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BuildInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class BuildInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(BuildInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'status' = payload.get('status'), + 'asset_versions' = payload.get('asset_versions'), + 'function_versions' = payload.get('function_versions'), + 'dependencies' = payload.get('dependencies'), + 'runtime' = payload.get('runtime'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = BuildContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def build_status(self): + return self._proxy.build_status + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class BuildListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(BuildListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Builds' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BuildPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/serverless/v1/service/build/build_status.py b/twilio/rest/serverless/v1/service/build/build_status.py index 83033bdba0..57be83229d 100644 --- a/twilio/rest/serverless/v1/service/build/build_status.py +++ b/twilio/rest/serverless/v1/service/build/build_status.py @@ -1,272 +1,120 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BuildStatusList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the BuildStatusList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Build resource is associated with - :param sid: The unique string that identifies the Build resource - - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusList - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusList - """ - super(BuildStatusList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - - def get(self): - """ - Constructs a BuildStatusContext - - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusContext - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusContext - """ - return BuildStatusContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __call__(self): - """ - Constructs a BuildStatusContext - - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusContext - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusContext - """ - return BuildStatusContext( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BuildStatusPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the BuildStatusPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Build resource is associated with - :param sid: The unique string that identifies the Build resource - - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusPage - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusPage - """ - super(BuildStatusPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BuildStatusInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusInstance - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusInstance - """ - return BuildStatusInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class BuildStatusContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the BuildStatusContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Build resource from - :param sid: The SID of the Build resource to fetch - - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusContext - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusContext - """ - super(BuildStatusContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BuildStatusContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Builds/{sid}/Status'.format(**self._solution) - - def fetch(self): - """ - Fetch the BuildStatusInstance - - :returns: The fetched BuildStatusInstance - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BuildStatusInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Builds/${sid}/Status' + + + def fetch(self): + + """ + Fetch the BuildStatusInstance + + :returns: The fetched BuildStatusInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BuildStatusInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class BuildStatusInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - BUILDING = "building" - COMPLETED = "completed" - FAILED = "failed" - - def __init__(self, version, payload, service_sid, sid): - """ - Initialize the BuildStatusInstance - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusInstance - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusInstance - """ +class BuildStatusInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(BuildStatusInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'status': payload.get('status'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'status' = payload.get('status'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid, } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BuildStatusContext for this BuildStatusInstance - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusContext - """ if self._context is None: self._context = BuildStatusContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Build resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Build resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def service_sid(self): + def __repr__(self): """ - :returns: The SID of the Service that the Build resource is associated with - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['service_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def status(self): - """ - :returns: The status of the Build - :rtype: BuildStatusInstance.Status - """ - return self._properties['status'] - @property - def url(self): - """ - :returns: The absolute URL of the Build Status resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the BuildStatusInstance +class BuildStatusListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BuildStatusListInstanceList, self).__init__(version) - :returns: The fetched BuildStatusInstance - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/environment.py b/twilio/rest/serverless/v1/service/environment.py new file mode 100644 index 0000000000..e399835881 --- /dev/null +++ b/twilio/rest/serverless/v1/service/environment.py @@ -0,0 +1,171 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.environment.deployment import DeploymentListInstancefrom twilio.rest.environment.log import LogListInstancefrom twilio.rest.environment.variable import VariableListInstance + + +class EnvironmentContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(EnvironmentContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Environments/${sid}' + + self._deployments = None + self._logs = None + self._variables = None + + def delete(self): + + + """ + Deletes the EnvironmentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the EnvironmentInstance + + :returns: The fetched EnvironmentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EnvironmentInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class EnvironmentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(EnvironmentInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'build_sid' = payload.get('build_sid'), + 'unique_name' = payload.get('unique_name'), + 'domain_suffix' = payload.get('domain_suffix'), + 'domain_name' = payload.get('domain_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = EnvironmentContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def deployments(self): + return self._proxy.deployments + @property + def logs(self): + return self._proxy.logs + @property + def variables(self): + return self._proxy.variables + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class EnvironmentListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(EnvironmentListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Environments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EnvironmentInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EnvironmentPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/serverless/v1/service/environment/deployment.py b/twilio/rest/serverless/v1/service/environment/deployment.py index dd0b5ec55b..53bf7c80de 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -1,406 +1,145 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DeploymentList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, environment_sid): - """ - Initialize the DeploymentList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Deployment resource is associated with - :param environment_sid: The SID of the Environment for the Deployment - - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentList - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentList - """ - super(DeploymentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'environment_sid': environment_sid, } - self._uri = '/Services/{service_sid}/Environments/{environment_sid}/Deployments'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DeploymentInstance 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 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.serverless.v1.service.environment.deployment.DeploymentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DeploymentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.serverless.v1.service.environment.deployment.DeploymentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DeploymentInstance records from the API. - Request is executed immediately - - :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 DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DeploymentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeploymentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DeploymentPage(self._version, response, self._solution) - - def create(self, build_sid=values.unset): - """ - Create the DeploymentInstance - - :param unicode build_sid: The SID of the Build for the Deployment - - :returns: The created DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentInstance - """ - data = values.of({'BuildSid': build_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return DeploymentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - ) - - def get(self, sid): - """ - Constructs a DeploymentContext - - :param sid: The SID that identifies the Deployment resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentContext - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentContext - """ - return DeploymentContext( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a DeploymentContext - - :param sid: The SID that identifies the Deployment resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentContext - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentContext - """ - return DeploymentContext( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DeploymentPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the DeploymentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Deployment resource is associated with - :param environment_sid: The SID of the Environment for the Deployment - - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentPage - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentPage - """ - super(DeploymentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeploymentInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentInstance - """ - return DeploymentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class DeploymentContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, environment_sid, sid): - """ - Initialize the DeploymentContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Deployment resource from - :param environment_sid: The SID of the Environment used by the Deployment to fetch - :param sid: The SID that identifies the Deployment resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentContext - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentContext - """ - super(DeploymentContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, environment_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DeploymentContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'environment_sid': environment_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Environments/{environment_sid}/Deployments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DeploymentInstance - - :returns: The fetched DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DeploymentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, environment_sid, sid, } + self._uri = '/Services/${service_sid}/Environments/${environment_sid}/Deployments/${sid}' + + + def fetch(self): + + """ + Fetch the DeploymentInstance + + :returns: The fetched DeploymentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DeploymentInstance( + self._version, + payload, + service_sidenvironment_sidsid=self._solution['service_sid''environment_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DeploymentInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, service_sid, environment_sid, sid=None): - """ - Initialize the DeploymentInstance - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentInstance - """ +class DeploymentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, environment_sid: str, sid: str): super(DeploymentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'environment_sid': payload.get('environment_sid'), - 'build_sid': payload.get('build_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'environment_sid' = payload.get('environment_sid'), + 'build_sid' = payload.get('build_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'environment_sid': environment_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'environment_sid': environment_sid or self._properties['environment_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeploymentContext for this DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentContext - """ if self._context is None: self._context = DeploymentContext( self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],environment_sid=self._solution['environment_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Deployment resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Deployment resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Deployment resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def environment_sid(self): - """ - :returns: The SID of the Environment for the Deployment - :rtype: unicode - """ - return self._properties['environment_sid'] - - @property - def build_sid(self): - """ - :returns: The SID of the Build for the deployment - :rtype: unicode - """ - return self._properties['build_sid'] + - @property - def date_created(self): + def __repr__(self): """ - :returns: The ISO 8601 date and time in GMT when the Deployment resource was created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Deployment resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The absolute URL of the Deployment resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the DeploymentInstance +class DeploymentListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, environment_sid: str): + # TODO: needs autogenerated docs + super(DeploymentListInstanceList, self).__init__(version) - :returns: The fetched DeploymentInstance - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, environment_sid, } + self._uri = '/Services/${service_sid}/Environments/${environment_sid}/Deployments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DeploymentInstance(self._version, payload, service_sid=self._solution['service_sid']environment_sid=self._solution['environment_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DeploymentPage(self._version, payload, service_sid=self._solution['service_sid']environment_sid=self._solution['environment_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/environment/log.py b/twilio/rest/serverless/v1/service/environment/log.py index f16141e1cb..ee1104f6b2 100644 --- a/twilio/rest/serverless/v1/service/environment/log.py +++ b/twilio/rest/serverless/v1/service/environment/log.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,447 +19,121 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class LogList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, environment_sid): - """ - Initialize the LogList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Log resource is associated with - :param environment_sid: The SID of the environment in which the log occurred - - :returns: twilio.rest.serverless.v1.service.environment.log.LogList - :rtype: twilio.rest.serverless.v1.service.environment.log.LogList - """ - super(LogList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'environment_sid': environment_sid, } - self._uri = '/Services/{service_sid}/Environments/{environment_sid}/Logs'.format(**self._solution) - - def stream(self, function_sid=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Streams LogInstance 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 function_sid: The SID of the function whose invocation produced the Log resources to read - :param datetime start_date: The date and time after which the Log resources must have been created. - :param datetime end_date: The date and time before which the Log resource must have been created. - :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.serverless.v1.service.environment.log.LogInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - function_sid=function_sid, - start_date=start_date, - end_date=end_date, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, function_sid=values.unset, start_date=values.unset, - end_date=values.unset, limit=None, page_size=None): - """ - Lists LogInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode function_sid: The SID of the function whose invocation produced the Log resources to read - :param datetime start_date: The date and time after which the Log resources must have been created. - :param datetime end_date: The date and time before which the Log resource must have been created. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.serverless.v1.service.environment.log.LogInstance] - """ - return list(self.stream( - function_sid=function_sid, - start_date=start_date, - end_date=end_date, - limit=limit, - page_size=page_size, - )) - - def page(self, function_sid=values.unset, start_date=values.unset, - end_date=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of LogInstance records from the API. - Request is executed immediately - - :param unicode function_sid: The SID of the function whose invocation produced the Log resources to read - :param datetime start_date: The date and time after which the Log resources must have been created. - :param datetime end_date: The date and time before which the Log resource must have been created. - :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 LogInstance - :rtype: twilio.rest.serverless.v1.service.environment.log.LogPage - """ - data = values.of({ - 'FunctionSid': function_sid, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return LogPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of LogInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of LogInstance - :rtype: twilio.rest.serverless.v1.service.environment.log.LogPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return LogPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a LogContext - - :param sid: The SID that identifies the Log resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.log.LogContext - :rtype: twilio.rest.serverless.v1.service.environment.log.LogContext - """ - return LogContext( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a LogContext - - :param sid: The SID that identifies the Log resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.log.LogContext - :rtype: twilio.rest.serverless.v1.service.environment.log.LogContext - """ - return LogContext( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class LogPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the LogPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Log resource is associated with - :param environment_sid: The SID of the environment in which the log occurred - - :returns: twilio.rest.serverless.v1.service.environment.log.LogPage - :rtype: twilio.rest.serverless.v1.service.environment.log.LogPage - """ - super(LogPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of LogInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.serverless.v1.service.environment.log.LogInstance - :rtype: twilio.rest.serverless.v1.service.environment.log.LogInstance - """ - return LogInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class LogContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, environment_sid, sid): - """ - Initialize the LogContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Log resource from - :param environment_sid: The SID of the environment with the Log resource to fetch - :param sid: The SID that identifies the Log resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.log.LogContext - :rtype: twilio.rest.serverless.v1.service.environment.log.LogContext - """ - super(LogContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, environment_sid: str, sid: str): + # TODO: needs autogenerated docs + super(LogContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'environment_sid': environment_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Environments/{environment_sid}/Logs/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the LogInstance - - :returns: The fetched LogInstance - :rtype: twilio.rest.serverless.v1.service.environment.log.LogInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return LogInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, environment_sid, sid, } + self._uri = '/Services/${service_sid}/Environments/${environment_sid}/Logs/${sid}' + + + def fetch(self): + + """ + Fetch the LogInstance + + :returns: The fetched LogInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return LogInstance( + self._version, + payload, + service_sidenvironment_sidsid=self._solution['service_sid''environment_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class LogInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Level(object): - INFO = "info" - WARN = "warn" - ERROR = "error" - - def __init__(self, version, payload, service_sid, environment_sid, sid=None): - """ - Initialize the LogInstance - :returns: twilio.rest.serverless.v1.service.environment.log.LogInstance - :rtype: twilio.rest.serverless.v1.service.environment.log.LogInstance - """ +class LogInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, environment_sid: str, sid: str): super(LogInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'environment_sid': payload.get('environment_sid'), - 'build_sid': payload.get('build_sid'), - 'deployment_sid': payload.get('deployment_sid'), - 'function_sid': payload.get('function_sid'), - 'request_sid': payload.get('request_sid'), - 'level': payload.get('level'), - 'message': payload.get('message'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'environment_sid' = payload.get('environment_sid'), + 'build_sid' = payload.get('build_sid'), + 'deployment_sid' = payload.get('deployment_sid'), + 'function_sid' = payload.get('function_sid'), + 'request_sid' = payload.get('request_sid'), + 'level' = payload.get('level'), + 'message' = payload.get('message'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'environment_sid': environment_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'environment_sid': environment_sid or self._properties['environment_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: LogContext for this LogInstance - :rtype: twilio.rest.serverless.v1.service.environment.log.LogContext - """ if self._context is None: self._context = LogContext( self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],environment_sid=self._solution['environment_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Log resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Log resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Log resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def environment_sid(self): - """ - :returns: The SID of the environment in which the log occurred - :rtype: unicode - """ - return self._properties['environment_sid'] - - @property - def build_sid(self): - """ - :returns: The SID of the build that corresponds to the log - :rtype: unicode - """ - return self._properties['build_sid'] - - @property - def deployment_sid(self): - """ - :returns: The SID of the deployment that corresponds to the log - :rtype: unicode - """ - return self._properties['deployment_sid'] + - @property - def function_sid(self): - """ - :returns: The SID of the function whose invocation produced the log - :rtype: unicode - """ - return self._properties['function_sid'] - - @property - def request_sid(self): + def __repr__(self): """ - :returns: The SID of the request associated with the log - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['request_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def level(self): - """ - :returns: The log level - :rtype: LogInstance.Level - """ - return self._properties['level'] - @property - def message(self): - """ - :returns: The log message - :rtype: unicode - """ - return self._properties['message'] - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Log resource was created - :rtype: datetime - """ - return self._properties['date_created'] +class LogListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, environment_sid: str): + # TODO: needs autogenerated docs + super(LogListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the Log resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { service_sid, environment_sid, } + self._uri = '/Services/${service_sid}/Environments/${environment_sid}/Logs' + + + def page(self, function_sid, start_date, end_date, page_size): + + data = values.of({ + 'function_sid': function_sid,'start_date': start_date,'end_date': end_date,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the LogInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched LogInstance - :rtype: twilio.rest.serverless.v1.service.environment.log.LogInstance - """ - return self._proxy.fetch() + return LogPage(self._version, payload, service_sid=self._solution['service_sid']environment_sid=self._solution['environment_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/environment/variable.py b/twilio/rest/serverless/v1/service/environment/variable.py index 12043bb7d1..40968f6adc 100644 --- a/twilio/rest/serverless/v1/service/environment/variable.py +++ b/twilio/rest/serverless/v1/service/environment/variable.py @@ -1,468 +1,168 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VariableList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, environment_sid): - """ - Initialize the VariableList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Variable resource is associated with - :param environment_sid: The SID of the Environment in which the Variable exists - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableList - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableList - """ - super(VariableList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'environment_sid': environment_sid, } - self._uri = '/Services/{service_sid}/Environments/{environment_sid}/Variables'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams VariableInstance 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 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.serverless.v1.service.environment.variable.VariableInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists VariableInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.serverless.v1.service.environment.variable.VariableInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of VariableInstance records from the API. - Request is executed immediately - - :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 VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariablePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return VariablePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of VariableInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariablePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return VariablePage(self._version, response, self._solution) - - def create(self, key, value): - """ - Create the VariableInstance - - :param unicode key: A string by which the Variable resource can be referenced - :param unicode value: A string that contains the actual value of the Variable - - :returns: The created VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - """ - data = values.of({'Key': key, 'Value': value, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - return VariableInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - ) - - def get(self, sid): - """ - Constructs a VariableContext - - :param sid: The SID of the Variable resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableContext - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableContext - """ - return VariableContext( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a VariableContext - - :param sid: The SID of the Variable resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableContext - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableContext - """ - return VariableContext( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class VariablePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the VariablePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Variable resource is associated with - :param environment_sid: The SID of the Environment in which the Variable exists - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariablePage - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariablePage - """ - super(VariablePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VariableInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - """ - return VariableInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class VariableContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, environment_sid, sid): - """ - Initialize the VariableContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Variable resource from - :param environment_sid: The SID of the Environment with the Variable resource to fetch - :param sid: The SID of the Variable resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableContext - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableContext - """ - super(VariableContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, environment_sid: str, sid: str): + # TODO: needs autogenerated docs + super(VariableContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'environment_sid': environment_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Environments/{environment_sid}/Variables/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the VariableInstance - - :returns: The fetched VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return VariableInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=self._solution['sid'], - ) - - def update(self, key=values.unset, value=values.unset): - """ - Update the VariableInstance - - :param unicode key: A string by which the Variable resource can be referenced - :param unicode value: A string that contains the actual value of the Variable - - :returns: The updated VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - """ - data = values.of({'Key': key, 'Value': value, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return VariableInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, environment_sid, sid, } + self._uri = '/Services/${service_sid}/Environments/${environment_sid}/Variables/${sid}' + + + def delete(self): + + + """ + Deletes the VariableInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the VariableInstance + + :returns: The fetched VariableInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return VariableInstance( + self._version, + payload, + service_sidenvironment_sidsid=self._solution['service_sid''environment_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the VariableInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return VariableInstance(self._version, payload, service_sid=self._solution['service_sid'], environment_sid=self._solution['environment_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class VariableInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, service_sid, environment_sid, sid=None): - """ - Initialize the VariableInstance - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - """ +class VariableInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, environment_sid: str, sid: str): super(VariableInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'environment_sid': payload.get('environment_sid'), - 'key': payload.get('key'), - 'value': payload.get('value'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'environment_sid' = payload.get('environment_sid'), + 'key' = payload.get('key'), + 'value' = payload.get('value'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'environment_sid': environment_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'environment_sid': environment_sid or self._properties['environment_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: VariableContext for this VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableContext - """ if self._context is None: self._context = VariableContext( self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['environment_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],environment_sid=self._solution['environment_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Variable resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Variable resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Variable resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def environment_sid(self): - """ - :returns: The SID of the Environment in which the Variable exists - :rtype: unicode - """ - return self._properties['environment_sid'] - - @property - def key(self): - """ - :returns: A string by which the Variable resource can be referenced - :rtype: unicode - """ - return self._properties['key'] - - @property - def value(self): - """ - :returns: A string that contains the actual value of the Variable - :rtype: unicode - """ - return self._properties['value'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Variable resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Variable resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Variable resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the VariableInstance + - :returns: The fetched VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, key=values.unset, value=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the VariableInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode key: A string by which the Variable resource can be referenced - :param unicode value: A string that contains the actual value of the Variable - :returns: The updated VariableInstance - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableInstance - """ - return self._proxy.update(key=key, value=value, ) - def delete(self): - """ - Deletes the VariableInstance +class VariableListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, environment_sid: str): + # TODO: needs autogenerated docs + super(VariableListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, environment_sid, } + self._uri = '/Services/${service_sid}/Environments/${environment_sid}/Variables' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return VariableInstance(self._version, payload, service_sid=self._solution['service_sid']environment_sid=self._solution['environment_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return VariablePage(self._version, payload, service_sid=self._solution['service_sid']environment_sid=self._solution['environment_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/function.py b/twilio/rest/serverless/v1/service/function.py new file mode 100644 index 0000000000..aa7e935386 --- /dev/null +++ b/twilio/rest/serverless/v1/service/function.py @@ -0,0 +1,171 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.function.function_version import FunctionVersionListInstance + + +class FunctionContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FunctionContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Functions/${sid}' + + self._function_versions = None + + def delete(self): + + + """ + Deletes the FunctionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FunctionInstance + + :returns: The fetched FunctionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FunctionInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FunctionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(FunctionInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FunctionContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def function_versions(self): + return self._proxy.function_versions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FunctionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(FunctionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Functions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FunctionPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/serverless/v1/service/function/function_version.py b/twilio/rest/serverless/v1/service/function/function_version.py new file mode 100644 index 0000000000..bb6dc7e96d --- /dev/null +++ b/twilio/rest/serverless/v1/service/function/function_version.py @@ -0,0 +1,140 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.function_version.function_version_content import FunctionVersionContentListInstance + + +class FunctionVersionContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, function_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FunctionVersionContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, function_sid, sid, } + self._uri = '/Services/${service_sid}/Functions/${function_sid}/Versions/${sid}' + + self._function_version_content = None + + def fetch(self): + + """ + Fetch the FunctionVersionInstance + + :returns: The fetched FunctionVersionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FunctionVersionInstance( + self._version, + payload, + service_sidfunction_sidsid=self._solution['service_sid''function_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FunctionVersionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, function_sid: str, sid: str): + super(FunctionVersionInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'function_sid' = payload.get('function_sid'), + 'path' = payload.get('path'), + 'visibility' = payload.get('visibility'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'function_sid': function_sid or self._properties['function_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FunctionVersionContext( + self._version, + service_sid=self._solution['service_sid'],function_sid=self._solution['function_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def function_version_content(self): + return self._proxy.function_version_content + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FunctionVersionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, function_sid: str): + # TODO: needs autogenerated docs + super(FunctionVersionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, function_sid, } + self._uri = '/Services/${service_sid}/Functions/${function_sid}/Versions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FunctionVersionPage(self._version, payload, service_sid=self._solution['service_sid']function_sid=self._solution['function_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py index 5f69c3666f..b77f2111cc 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py +++ b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py @@ -1,284 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Serverless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FunctionVersionContentList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, function_sid, sid): - """ - Initialize the FunctionVersionContentList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Function Version resource is associated with - :param function_sid: The SID of the Function that is the parent of the Function Version - :param sid: The unique string that identifies the Function Version resource - - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentList - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentList - """ - super(FunctionVersionContentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'function_sid': function_sid, 'sid': sid, } - def get(self): - """ - Constructs a FunctionVersionContentContext - - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentContext - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentContext - """ - return FunctionVersionContentContext( - self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], - ) - def __call__(self): - """ - Constructs a FunctionVersionContentContext - - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentContext - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentContext - """ - return FunctionVersionContentContext( - self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FunctionVersionContentPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FunctionVersionContentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Function Version resource is associated with - :param function_sid: The SID of the Function that is the parent of the Function Version - :param sid: The unique string that identifies the Function Version resource - - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentPage - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentPage - """ - super(FunctionVersionContentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FunctionVersionContentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentInstance - """ - return FunctionVersionContentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class FunctionVersionContentContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, function_sid, sid): - """ - Initialize the FunctionVersionContentContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Function Version content from - :param function_sid: The SID of the Function that is the parent of the Function Version content to fetch - :param sid: The SID that identifies the Function Version content to fetch - - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentContext - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentContext - """ - super(FunctionVersionContentContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, function_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FunctionVersionContentContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'function_sid': function_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Functions/{function_sid}/Versions/{sid}/Content'.format(**self._solution) - - def fetch(self): - """ - Fetch the FunctionVersionContentInstance - - :returns: The fetched FunctionVersionContentInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FunctionVersionContentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, function_sid, sid, } + self._uri = '/Services/${service_sid}/Functions/${function_sid}/Versions/${sid}/Content' + + + def fetch(self): + + """ + Fetch the FunctionVersionContentInstance + + :returns: The fetched FunctionVersionContentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FunctionVersionContentInstance( + self._version, + payload, + service_sidfunction_sidsid=self._solution['service_sid''function_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class FunctionVersionContentInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, service_sid, function_sid, sid): - """ - Initialize the FunctionVersionContentInstance - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentInstance - """ +class FunctionVersionContentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, function_sid: str, sid: str): super(FunctionVersionContentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'function_sid': payload.get('function_sid'), - 'content': payload.get('content'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'function_sid' = payload.get('function_sid'), + 'content' = payload.get('content'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'function_sid': function_sid, 'sid': sid, } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'function_sid': function_sid or self._properties['function_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FunctionVersionContentContext for this FunctionVersionContentInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentContext - """ if self._context is None: self._context = FunctionVersionContentContext( self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],function_sid=self._solution['function_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Function Version resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): + def __repr__(self): """ - :returns: The SID of the Account that created the Function Version resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['account_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Function Version resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - @property - def function_sid(self): - """ - :returns: The SID of the Function that is the parent of the Function Version - :rtype: unicode - """ - return self._properties['function_sid'] - @property - def content(self): - """ - :returns: The content of the Function Version resource - :rtype: unicode - """ - return self._properties['content'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the FunctionVersionContentInstance +class FunctionVersionContentListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, function_sid: str, sid: str): + # TODO: needs autogenerated docs + super(FunctionVersionContentListInstanceList, self).__init__(version) - :returns: The fetched FunctionVersionContentInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, function_sid, sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/__init__.py b/twilio/rest/studio/__init__.py index b54999d003..1002adde69 100644 --- a/twilio/rest/studio/__init__.py +++ b/twilio/rest/studio/__init__.py @@ -1,71 +1,62 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.studio.v1 import V1 -from twilio.rest.studio.v2 import V2 + Twilio - Studio + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Studio(Domain): +from twilio.base.domain import Domain +from twilio.rest.Studio.v2 import V2 +class Studio(Domain): def __init__(self, twilio): """ Initialize the Studio Domain :returns: Domain for Studio - :rtype: twilio.rest.studio.Studio + :rtype: twilio.rest.v2.Studio """ super(Studio, self).__init__(twilio) - - self.base_url = 'https://studio.twilio.com' - - # Versions - self._v1 = None - self._v2 = None - - @property - def v1(self): - """ - :returns: Version v1 of studio - :rtype: twilio.rest.studio.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + self.base_url = 'https://Studio.twilio.com' + self._V2 = None @property - def v2(self): + def V2(self): """ - :returns: Version v2 of studio - :rtype: twilio.rest.studio.v2.V2 + :returns: Versions v2 of Studio + :rtype: twilio.rest.Studio.v2 """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + @property def flows(self): """ - :rtype: twilio.rest.studio.v2.flow.FlowList + :rtype: twilio.rest.v2.flows """ return self.v2.flows + @property def flow_validate(self): """ - :rtype: twilio.rest.studio.v2.flow_validate.FlowValidateList + :rtype: twilio.rest.v2.flow_validate """ return self.v2.flow_validate + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/studio/v1/.openapi-generator-ignore b/twilio/rest/studio/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/studio/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/studio/v1/.openapi-generator/FILES b/twilio/rest/studio/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..c7c62a51a1 --- /dev/null +++ b/twilio/rest/studio/v1/.openapi-generator/FILES @@ -0,0 +1,19 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +flow.py +flow/engagement.py +flow/engagement/engagement_context.py +flow/engagement/step.py +flow/engagement/step/step_context.py +flow/execution.py +flow/execution/execution_context.py +flow/execution/execution_step.py +flow/execution/execution_step/execution_step_context.py diff --git a/twilio/rest/studio/v1/.openapi-generator/VERSION b/twilio/rest/studio/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/studio/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/studio/v1/flow.py b/twilio/rest/studio/v1/flow.py new file mode 100644 index 0000000000..700c645da4 --- /dev/null +++ b/twilio/rest/studio/v1/flow.py @@ -0,0 +1,155 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.flow.engagement import EngagementListInstancefrom twilio.rest.flow.execution import ExecutionListInstance + + +class FlowContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(FlowContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Flows/${sid}' + + self._engagements = None + self._executions = None + + def delete(self): + + + """ + Deletes the FlowInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FlowInstance + + :returns: The fetched FlowInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FlowInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FlowInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(FlowInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'version' = payload.get('version'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FlowContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def engagements(self): + return self._proxy.engagements + @property + def executions(self): + return self._proxy.executions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FlowListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(FlowListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Flows' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FlowPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v1/flow/engagement.py b/twilio/rest/studio/v1/flow/engagement.py new file mode 100644 index 0000000000..95a6a9f407 --- /dev/null +++ b/twilio/rest/studio/v1/flow/engagement.py @@ -0,0 +1,167 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.engagement.engagement_context import EngagementContextListInstancefrom twilio.rest.engagement.step import StepListInstance + + +class EngagementContext(InstanceContext): + def __init__(self, version: V1, flow_sid: str, sid: str): + # TODO: needs autogenerated docs + super(EngagementContextList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${sid}' + + self._engagement_context = None + self._steps = None + + def delete(self): + + + """ + Deletes the EngagementInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the EngagementInstance + + :returns: The fetched EngagementInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EngagementInstance( + self._version, + payload, + flow_sidsid=self._solution['flow_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class EngagementInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, sid: str): + super(EngagementInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'contact_sid' = payload.get('contact_sid'), + 'contact_channel_address' = payload.get('contact_channel_address'), + 'context' = payload.get('context'), + 'status' = payload.get('status'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = EngagementContext( + self._version, + flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def engagement_context(self): + return self._proxy.engagement_context + @property + def steps(self): + return self._proxy.steps + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class EngagementListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str): + # TODO: needs autogenerated docs + super(EngagementListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, } + self._uri = '/Flows/${flow_sid}/Engagements' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EngagementPage(self._version, payload, flow_sid=self._solution['flow_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v1/flow/engagement/engagement_context.py b/twilio/rest/studio/v1/flow/engagement/engagement_context.py index 2d60675080..4c4b8ec93f 100644 --- a/twilio/rest/studio/v1/flow/engagement/engagement_context.py +++ b/twilio/rest/studio/v1/flow/engagement/engagement_context.py @@ -1,259 +1,120 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class EngagementContextList(ListResource): - - def __init__(self, version, flow_sid, engagement_sid): - """ - Initialize the EngagementContextList - - :param Version version: Version that contains the resource - :param flow_sid: Flow SID - :param engagement_sid: Engagement SID - - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextList - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextList - """ - super(EngagementContextList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } - - def get(self): - """ - Constructs a EngagementContextContext - - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextContext - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextContext - """ - return EngagementContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - ) - - def __call__(self): - """ - Constructs a EngagementContextContext - - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextContext - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextContext - """ - return EngagementContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EngagementContextPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EngagementContextPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: Flow SID - :param engagement_sid: Engagement SID - - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextPage - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextPage - """ - super(EngagementContextPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EngagementContextInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextInstance - """ - return EngagementContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class EngagementContextContext(InstanceContext): - - def __init__(self, version, flow_sid, engagement_sid): - """ - Initialize the EngagementContextContext - - :param Version version: Version that contains the resource - :param flow_sid: Flow SID - :param engagement_sid: Engagement SID - - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextContext - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextContext - """ - super(EngagementContextContext, self).__init__(version) + def __init__(self, version: V1, flow_sid: str, engagement_sid: str): + # TODO: needs autogenerated docs + super(EngagementContextContextList, self).__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Context'.format(**self._solution) - - def fetch(self): - """ - Fetch the EngagementContextInstance - - :returns: The fetched EngagementContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EngagementContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - ) + self._solution = { flow_sid, engagement_sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Context' + + + def fetch(self): + + """ + Fetch the EngagementContextInstance + + :returns: The fetched EngagementContextInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EngagementContextInstance( + self._version, + payload, + flow_sidengagement_sid=self._solution['flow_sid''engagement_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class EngagementContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, engagement_sid): - """ - Initialize the EngagementContextInstance - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextInstance - """ +class EngagementContextInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, engagement_sid: str): super(EngagementContextInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'context': payload.get('context'), - 'engagement_sid': payload.get('engagement_sid'), - 'flow_sid': payload.get('flow_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'context' = payload.get('context'), + 'engagement_sid' = payload.get('engagement_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'engagement_sid': engagement_sid or self._properties['engagement_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EngagementContextContext for this EngagementContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextContext - """ if self._context is None: self._context = EngagementContextContext( self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], + flow_sid=self._solution['flow_sid'],engagement_sid=self._solution['engagement_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: Account SID - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def context(self): - """ - :returns: Flow state - :rtype: dict - """ - return self._properties['context'] + - @property - def engagement_sid(self): + def __repr__(self): """ - :returns: Engagement SID - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['engagement_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def flow_sid(self): - """ - :returns: Flow SID - :rtype: unicode - """ - return self._properties['flow_sid'] - @property - def url(self): - """ - :returns: The URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the EngagementContextInstance +class EngagementContextListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str, engagement_sid: str): + # TODO: needs autogenerated docs + super(EngagementContextListInstanceList, self).__init__(version) - :returns: The fetched EngagementContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { flow_sid, engagement_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow/engagement/step.py b/twilio/rest/studio/v1/flow/engagement/step.py new file mode 100644 index 0000000000..cc24a87122 --- /dev/null +++ b/twilio/rest/studio/v1/flow/engagement/step.py @@ -0,0 +1,143 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.step.step_context import StepContextListInstance + + +class StepContext(InstanceContext): + def __init__(self, version: V1, flow_sid: str, engagement_sid: str, sid: str): + # TODO: needs autogenerated docs + super(StepContextList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, engagement_sid, sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Steps/${sid}' + + self._step_context = None + + def fetch(self): + + """ + Fetch the StepInstance + + :returns: The fetched StepInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return StepInstance( + self._version, + payload, + flow_sidengagement_sidsid=self._solution['flow_sid''engagement_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class StepInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, engagement_sid: str, sid: str): + super(StepInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'engagement_sid' = payload.get('engagement_sid'), + 'name' = payload.get('name'), + 'context' = payload.get('context'), + 'transitioned_from' = payload.get('transitioned_from'), + 'transitioned_to' = payload.get('transitioned_to'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'engagement_sid': engagement_sid or self._properties['engagement_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = StepContext( + self._version, + flow_sid=self._solution['flow_sid'],engagement_sid=self._solution['engagement_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def step_context(self): + return self._proxy.step_context + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class StepListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str, engagement_sid: str): + # TODO: needs autogenerated docs + super(StepListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, engagement_sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Steps' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return StepPage(self._version, payload, flow_sid=self._solution['flow_sid']engagement_sid=self._solution['engagement_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v1/flow/engagement/step/step_context.py b/twilio/rest/studio/v1/flow/engagement/step/step_context.py index ec0afdd9b4..36bd100c79 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/step_context.py +++ b/twilio/rest/studio/v1/flow/engagement/step/step_context.py @@ -1,276 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class StepContextList(ListResource): - - def __init__(self, version, flow_sid, engagement_sid, step_sid): - """ - Initialize the StepContextList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param engagement_sid: The SID of the Engagement - :param step_sid: Step SID - - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList - """ - super(StepContextList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'step_sid': step_sid, } - def get(self): - """ - Constructs a StepContextContext - - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext - """ - return StepContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - step_sid=self._solution['step_sid'], - ) - def __call__(self): - """ - Constructs a StepContextContext - - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext - """ - return StepContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - step_sid=self._solution['step_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class StepContextPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the StepContextPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param engagement_sid: The SID of the Engagement - :param step_sid: Step SID - - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextPage - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextPage - """ - super(StepContextPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StepContextInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance - """ - return StepContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - step_sid=self._solution['step_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class StepContextContext(InstanceContext): - - def __init__(self, version, flow_sid, engagement_sid, step_sid): - """ - Initialize the StepContextContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param engagement_sid: The SID of the Engagement - :param step_sid: Step SID - - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext - """ - super(StepContextContext, self).__init__(version) + def __init__(self, version: V1, flow_sid: str, engagement_sid: str, step_sid: str): + # TODO: needs autogenerated docs + super(StepContextContextList, self).__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'step_sid': step_sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Steps/{step_sid}/Context'.format(**self._solution) - - def fetch(self): - """ - Fetch the StepContextInstance - - :returns: The fetched StepContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return StepContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - step_sid=self._solution['step_sid'], - ) + self._solution = { flow_sid, engagement_sid, step_sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Steps/${step_sid}/Context' + + + def fetch(self): + + """ + Fetch the StepContextInstance + + :returns: The fetched StepContextInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return StepContextInstance( + self._version, + payload, + flow_sidengagement_sidstep_sid=self._solution['flow_sid''engagement_sid''step_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class StepContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, engagement_sid, step_sid): - """ - Initialize the StepContextInstance - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance - """ +class StepContextInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, engagement_sid: str, step_sid: str): super(StepContextInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'context': payload.get('context'), - 'engagement_sid': payload.get('engagement_sid'), - 'flow_sid': payload.get('flow_sid'), - 'step_sid': payload.get('step_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'context' = payload.get('context'), + 'engagement_sid' = payload.get('engagement_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'step_sid' = payload.get('step_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'step_sid': step_sid, } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'engagement_sid': engagement_sid or self._properties['engagement_sid']'step_sid': step_sid or self._properties['step_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: StepContextContext for this StepContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextContext - """ if self._context is None: self._context = StepContextContext( self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - step_sid=self._solution['step_sid'], + flow_sid=self._solution['flow_sid'],engagement_sid=self._solution['engagement_sid'],step_sid=self._solution['step_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def context(self): + def __repr__(self): """ - :returns: The current state of the flow - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['context'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def engagement_sid(self): - """ - :returns: The SID of the Engagement - :rtype: unicode - """ - return self._properties['engagement_sid'] - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - @property - def step_sid(self): - """ - :returns: Step SID - :rtype: unicode - """ - return self._properties['step_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the StepContextInstance +class StepContextListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str, engagement_sid: str, step_sid: str): + # TODO: needs autogenerated docs + super(StepContextListInstanceList, self).__init__(version) - :returns: The fetched StepContextInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { flow_sid, engagement_sid, step_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow/execution.py b/twilio/rest/studio/v1/flow/execution.py new file mode 100644 index 0000000000..1077bf1f68 --- /dev/null +++ b/twilio/rest/studio/v1/flow/execution.py @@ -0,0 +1,178 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.execution.execution_context import ExecutionContextListInstancefrom twilio.rest.execution.execution_step import ExecutionStepListInstance + + +class ExecutionContext(InstanceContext): + def __init__(self, version: V1, flow_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ExecutionContextList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, sid, } + self._uri = '/Flows/${flow_sid}/Executions/${sid}' + + self._execution_context = None + self._steps = None + + def delete(self): + + + """ + Deletes the ExecutionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ExecutionInstance + + :returns: The fetched ExecutionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionInstance( + self._version, + payload, + flow_sidsid=self._solution['flow_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ExecutionInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, sid: str): + super(ExecutionInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'contact_sid' = payload.get('contact_sid'), + 'contact_channel_address' = payload.get('contact_channel_address'), + 'context' = payload.get('context'), + 'status' = payload.get('status'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ExecutionContext( + self._version, + flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def execution_context(self): + return self._proxy.execution_context + @property + def steps(self): + return self._proxy.steps + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ExecutionListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str): + # TODO: needs autogenerated docs + super(ExecutionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, } + self._uri = '/Flows/${flow_sid}/Executions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid']) + + + def page(self, date_created_from, date_created_to, page_size): + + data = values.of({ + 'date_created_from': date_created_from,'date_created_to': date_created_to,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ExecutionPage(self._version, payload, flow_sid=self._solution['flow_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v1/flow/execution/execution_context.py b/twilio/rest/studio/v1/flow/execution/execution_context.py index a05ae60fb2..e0589bbf5a 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_context.py @@ -1,259 +1,120 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class ExecutionContextList(ListResource): - - def __init__(self, version, flow_sid, execution_sid): - """ - Initialize the ExecutionContextList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList - """ - super(ExecutionContextList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } - - def get(self): - """ - Constructs a ExecutionContextContext - - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext - """ - return ExecutionContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __call__(self): - """ - Constructs a ExecutionContextContext - - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext - """ - return ExecutionContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionContextPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionContextPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextPage - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextPage - """ - super(ExecutionContextPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionContextInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance - """ - return ExecutionContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ExecutionContextContext(InstanceContext): - - def __init__(self, version, flow_sid, execution_sid): - """ - Initialize the ExecutionContextContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext - """ - super(ExecutionContextContext, self).__init__(version) + def __init__(self, version: V1, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super(ExecutionContextContextList, self).__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Context'.format(**self._solution) - - def fetch(self): - """ - Fetch the ExecutionContextInstance - - :returns: The fetched ExecutionContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) + self._solution = { flow_sid, execution_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Context' + + + def fetch(self): + + """ + Fetch the ExecutionContextInstance + + :returns: The fetched ExecutionContextInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionContextInstance( + self._version, + payload, + flow_sidexecution_sid=self._solution['flow_sid''execution_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ExecutionContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, execution_sid): - """ - Initialize the ExecutionContextInstance - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance - """ +class ExecutionContextInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str): super(ExecutionContextInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'context': payload.get('context'), - 'flow_sid': payload.get('flow_sid'), - 'execution_sid': payload.get('execution_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'context' = payload.get('context'), + 'flow_sid' = payload.get('flow_sid'), + 'execution_sid' = payload.get('execution_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'execution_sid': execution_sid or self._properties['execution_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionContextContext for this ExecutionContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextContext - """ if self._context is None: self._context = ExecutionContextContext( self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def context(self): - """ - :returns: The current state of the flow - :rtype: dict - """ - return self._properties['context'] + - @property - def flow_sid(self): + def __repr__(self): """ - :returns: The SID of the Flow - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['flow_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def execution_sid(self): - """ - :returns: The SID of the Execution - :rtype: unicode - """ - return self._properties['execution_sid'] - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the ExecutionContextInstance +class ExecutionContextListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super(ExecutionContextListInstanceList, self).__init__(version) - :returns: The fetched ExecutionContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { flow_sid, execution_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow/execution/execution_step.py b/twilio/rest/studio/v1/flow/execution/execution_step.py new file mode 100644 index 0000000000..37b4e58203 --- /dev/null +++ b/twilio/rest/studio/v1/flow/execution/execution_step.py @@ -0,0 +1,143 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.execution_step.execution_step_context import ExecutionStepContextListInstance + + +class ExecutionStepContext(InstanceContext): + def __init__(self, version: V1, flow_sid: str, execution_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepContextList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, execution_sid, sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${sid}' + + self._step_context = None + + def fetch(self): + + """ + Fetch the ExecutionStepInstance + + :returns: The fetched ExecutionStepInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionStepInstance( + self._version, + payload, + flow_sidexecution_sidsid=self._solution['flow_sid''execution_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ExecutionStepInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str, sid: str): + super(ExecutionStepInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'execution_sid' = payload.get('execution_sid'), + 'name' = payload.get('name'), + 'context' = payload.get('context'), + 'transitioned_from' = payload.get('transitioned_from'), + 'transitioned_to' = payload.get('transitioned_to'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'execution_sid': execution_sid or self._properties['execution_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ExecutionStepContext( + self._version, + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def step_context(self): + return self._proxy.step_context + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ExecutionStepListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, execution_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ExecutionStepPage(self._version, payload, flow_sid=self._solution['flow_sid']execution_sid=self._solution['execution_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py index b01551b05c..a706a78a11 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py @@ -1,276 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ExecutionStepContextList(ListResource): - - def __init__(self, version, flow_sid, execution_sid, step_sid): - """ - Initialize the ExecutionStepContextList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param step_sid: Step SID - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - """ - super(ExecutionStepContextList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'step_sid': step_sid, } - def get(self): - """ - Constructs a ExecutionStepContextContext - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ - return ExecutionStepContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) - def __call__(self): - """ - Constructs a ExecutionStepContextContext - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ - return ExecutionStepContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionStepContextPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionStepContextPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param step_sid: Step SID - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextPage - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextPage - """ - super(ExecutionStepContextPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionStepContextInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ - return ExecutionStepContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ExecutionStepContextContext(InstanceContext): - - def __init__(self, version, flow_sid, execution_sid, step_sid): - """ - Initialize the ExecutionStepContextContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param step_sid: Step SID - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ - super(ExecutionStepContextContext, self).__init__(version) + def __init__(self, version: V1, flow_sid: str, execution_sid: str, step_sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepContextContextList, self).__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'step_sid': step_sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Steps/{step_sid}/Context'.format(**self._solution) - - def fetch(self): - """ - Fetch the ExecutionStepContextInstance - - :returns: The fetched ExecutionStepContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionStepContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) + self._solution = { flow_sid, execution_sid, step_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${step_sid}/Context' + + + def fetch(self): + + """ + Fetch the ExecutionStepContextInstance + + :returns: The fetched ExecutionStepContextInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionStepContextInstance( + self._version, + payload, + flow_sidexecution_sidstep_sid=self._solution['flow_sid''execution_sid''step_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ExecutionStepContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, execution_sid, step_sid): - """ - Initialize the ExecutionStepContextInstance - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ +class ExecutionStepContextInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str, step_sid: str): super(ExecutionStepContextInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'context': payload.get('context'), - 'execution_sid': payload.get('execution_sid'), - 'flow_sid': payload.get('flow_sid'), - 'step_sid': payload.get('step_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'context' = payload.get('context'), + 'execution_sid' = payload.get('execution_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'step_sid' = payload.get('step_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'step_sid': step_sid, } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'execution_sid': execution_sid or self._properties['execution_sid']'step_sid': step_sid or self._properties['step_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionStepContextContext for this ExecutionStepContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ if self._context is None: self._context = ExecutionStepContextContext( self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],step_sid=self._solution['step_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def context(self): + def __repr__(self): """ - :returns: The current state of the flow - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['context'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def execution_sid(self): - """ - :returns: The SID of the Execution - :rtype: unicode - """ - return self._properties['execution_sid'] - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - @property - def step_sid(self): - """ - :returns: Step SID - :rtype: unicode - """ - return self._properties['step_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the ExecutionStepContextInstance +class ExecutionStepContextListInstance(ListResource): + def __init__(self, version: V1, flow_sid: str, execution_sid: str, step_sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepContextListInstanceList, self).__init__(version) - :returns: The fetched ExecutionStepContextInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { flow_sid, execution_sid, step_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/.openapi-generator-ignore b/twilio/rest/studio/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/studio/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/studio/v2/.openapi-generator/FILES b/twilio/rest/studio/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..d5bf902afe --- /dev/null +++ b/twilio/rest/studio/v2/.openapi-generator/FILES @@ -0,0 +1,17 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +flow.py +flow/execution.py +flow/execution/execution_context.py +flow/execution/execution_step.py +flow/execution/execution_step/execution_step_context.py +flow/flow_revision.py +flow/flow_test_user.py +flow_validate.py diff --git a/twilio/rest/studio/v2/.openapi-generator/VERSION b/twilio/rest/studio/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/studio/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/studio/v2/flow.py b/twilio/rest/studio/v2/flow.py new file mode 100644 index 0000000000..3e4fc6a5c6 --- /dev/null +++ b/twilio/rest/studio/v2/flow.py @@ -0,0 +1,186 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.flow.execution import ExecutionListInstancefrom twilio.rest.flow.flow_revision import FlowRevisionListInstancefrom twilio.rest.flow.flow_test_user import FlowTestUserListInstance + + +class FlowContext(InstanceContext): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(FlowContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Flows/${sid}' + + self._executions = None + self._revisions = None + self._test_users = None + + def delete(self): + + + """ + Deletes the FlowInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FlowInstance + + :returns: The fetched FlowInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FlowInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FlowInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FlowInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(FlowInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'definition' = payload.get('definition'), + 'status' = payload.get('status'), + 'revision' = payload.get('revision'), + 'commit_message' = payload.get('commit_message'), + 'valid' = payload.get('valid'), + 'errors' = payload.get('errors'), + 'warnings' = payload.get('warnings'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'webhook_url' = payload.get('webhook_url'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FlowContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def executions(self): + return self._proxy.executions + @property + def revisions(self): + return self._proxy.revisions + @property + def test_users(self): + return self._proxy.test_users + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FlowListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(FlowListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Flows' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FlowInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FlowPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v2/flow/execution.py b/twilio/rest/studio/v2/flow/execution.py new file mode 100644 index 0000000000..c7f59d396f --- /dev/null +++ b/twilio/rest/studio/v2/flow/execution.py @@ -0,0 +1,177 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.execution.execution_context import ExecutionContextListInstancefrom twilio.rest.execution.execution_step import ExecutionStepListInstance + + +class ExecutionContext(InstanceContext): + def __init__(self, version: V2, flow_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ExecutionContextList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, sid, } + self._uri = '/Flows/${flow_sid}/Executions/${sid}' + + self._execution_context = None + self._steps = None + + def delete(self): + + + """ + Deletes the ExecutionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ExecutionInstance + + :returns: The fetched ExecutionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionInstance( + self._version, + payload, + flow_sidsid=self._solution['flow_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ExecutionInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, sid: str): + super(ExecutionInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'contact_channel_address' = payload.get('contact_channel_address'), + 'context' = payload.get('context'), + 'status' = payload.get('status'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ExecutionContext( + self._version, + flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def execution_context(self): + return self._proxy.execution_context + @property + def steps(self): + return self._proxy.steps + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ExecutionListInstance(ListResource): + def __init__(self, version: V2, flow_sid: str): + # TODO: needs autogenerated docs + super(ExecutionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, } + self._uri = '/Flows/${flow_sid}/Executions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid']) + + + def page(self, date_created_from, date_created_to, page_size): + + data = values.of({ + 'date_created_from': date_created_from,'date_created_to': date_created_to,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ExecutionPage(self._version, payload, flow_sid=self._solution['flow_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v2/flow/execution/execution_context.py b/twilio/rest/studio/v2/flow/execution/execution_context.py index c3eafa5143..716ec1d414 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_context.py @@ -1,259 +1,120 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class ExecutionContextList(ListResource): - - def __init__(self, version, flow_sid, execution_sid): - """ - Initialize the ExecutionContextList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextList - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextList - """ - super(ExecutionContextList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } - - def get(self): - """ - Constructs a ExecutionContextContext - - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextContext - """ - return ExecutionContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __call__(self): - """ - Constructs a ExecutionContextContext - - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextContext - """ - return ExecutionContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionContextPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionContextPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextPage - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextPage - """ - super(ExecutionContextPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionContextInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextInstance - """ - return ExecutionContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ExecutionContextContext(InstanceContext): - - def __init__(self, version, flow_sid, execution_sid): - """ - Initialize the ExecutionContextContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextContext - """ - super(ExecutionContextContext, self).__init__(version) + def __init__(self, version: V2, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super(ExecutionContextContextList, self).__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Context'.format(**self._solution) - - def fetch(self): - """ - Fetch the ExecutionContextInstance - - :returns: The fetched ExecutionContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) + self._solution = { flow_sid, execution_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Context' + + + def fetch(self): + + """ + Fetch the ExecutionContextInstance + + :returns: The fetched ExecutionContextInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionContextInstance( + self._version, + payload, + flow_sidexecution_sid=self._solution['flow_sid''execution_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ExecutionContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, execution_sid): - """ - Initialize the ExecutionContextInstance - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextInstance - """ +class ExecutionContextInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str): super(ExecutionContextInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'context': payload.get('context'), - 'flow_sid': payload.get('flow_sid'), - 'execution_sid': payload.get('execution_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'context' = payload.get('context'), + 'flow_sid' = payload.get('flow_sid'), + 'execution_sid' = payload.get('execution_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'execution_sid': execution_sid or self._properties['execution_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionContextContext for this ExecutionContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextContext - """ if self._context is None: self._context = ExecutionContextContext( self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def context(self): - """ - :returns: The current state of the flow - :rtype: dict - """ - return self._properties['context'] + - @property - def flow_sid(self): + def __repr__(self): """ - :returns: The SID of the Flow - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['flow_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def execution_sid(self): - """ - :returns: The SID of the Execution - :rtype: unicode - """ - return self._properties['execution_sid'] - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the ExecutionContextInstance +class ExecutionContextListInstance(ListResource): + def __init__(self, version: V2, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super(ExecutionContextListInstanceList, self).__init__(version) - :returns: The fetched ExecutionContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { flow_sid, execution_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/flow/execution/execution_step.py b/twilio/rest/studio/v2/flow/execution/execution_step.py new file mode 100644 index 0000000000..2e1a8b7bdd --- /dev/null +++ b/twilio/rest/studio/v2/flow/execution/execution_step.py @@ -0,0 +1,143 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.execution_step.execution_step_context import ExecutionStepContextListInstance + + +class ExecutionStepContext(InstanceContext): + def __init__(self, version: V2, flow_sid: str, execution_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepContextList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, execution_sid, sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${sid}' + + self._step_context = None + + def fetch(self): + + """ + Fetch the ExecutionStepInstance + + :returns: The fetched ExecutionStepInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionStepInstance( + self._version, + payload, + flow_sidexecution_sidsid=self._solution['flow_sid''execution_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ExecutionStepInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str, sid: str): + super(ExecutionStepInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'execution_sid' = payload.get('execution_sid'), + 'name' = payload.get('name'), + 'context' = payload.get('context'), + 'transitioned_from' = payload.get('transitioned_from'), + 'transitioned_to' = payload.get('transitioned_to'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'execution_sid': execution_sid or self._properties['execution_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ExecutionStepContext( + self._version, + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def step_context(self): + return self._proxy.step_context + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ExecutionStepListInstance(ListResource): + def __init__(self, version: V2, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { flow_sid, execution_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ExecutionStepPage(self._version, payload, flow_sid=self._solution['flow_sid']execution_sid=self._solution['execution_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py index 969bc7d1ce..58a7cd75db 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py @@ -1,276 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ExecutionStepContextList(ListResource): - - def __init__(self, version, flow_sid, execution_sid, step_sid): - """ - Initialize the ExecutionStepContextList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param step_sid: Step SID - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - """ - super(ExecutionStepContextList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'step_sid': step_sid, } - def get(self): - """ - Constructs a ExecutionStepContextContext - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ - return ExecutionStepContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) - def __call__(self): - """ - Constructs a ExecutionStepContextContext - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ - return ExecutionStepContextContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionStepContextPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionStepContextPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param step_sid: Step SID - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextPage - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextPage - """ - super(ExecutionStepContextPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionStepContextInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ - return ExecutionStepContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ExecutionStepContextContext(InstanceContext): - - def __init__(self, version, flow_sid, execution_sid, step_sid): - """ - Initialize the ExecutionStepContextContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param step_sid: Step SID - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ - super(ExecutionStepContextContext, self).__init__(version) + def __init__(self, version: V2, flow_sid: str, execution_sid: str, step_sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepContextContextList, self).__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'step_sid': step_sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Steps/{step_sid}/Context'.format(**self._solution) - - def fetch(self): - """ - Fetch the ExecutionStepContextInstance - - :returns: The fetched ExecutionStepContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionStepContextInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], - ) + self._solution = { flow_sid, execution_sid, step_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${step_sid}/Context' + + + def fetch(self): + + """ + Fetch the ExecutionStepContextInstance + + :returns: The fetched ExecutionStepContextInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ExecutionStepContextInstance( + self._version, + payload, + flow_sidexecution_sidstep_sid=self._solution['flow_sid''execution_sid''step_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ExecutionStepContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, execution_sid, step_sid): - """ - Initialize the ExecutionStepContextInstance - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ +class ExecutionStepContextInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str, step_sid: str): super(ExecutionStepContextInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'context': payload.get('context'), - 'execution_sid': payload.get('execution_sid'), - 'flow_sid': payload.get('flow_sid'), - 'step_sid': payload.get('step_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'context' = payload.get('context'), + 'execution_sid' = payload.get('execution_sid'), + 'flow_sid' = payload.get('flow_sid'), + 'step_sid' = payload.get('step_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'step_sid': step_sid, } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid']'execution_sid': execution_sid or self._properties['execution_sid']'step_sid': step_sid or self._properties['step_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionStepContextContext for this ExecutionStepContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextContext - """ if self._context is None: self._context = ExecutionStepContextContext( self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['step_sid'], + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],step_sid=self._solution['step_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def context(self): + def __repr__(self): """ - :returns: The current state of the flow - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['context'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def execution_sid(self): - """ - :returns: The SID of the Execution - :rtype: unicode - """ - return self._properties['execution_sid'] - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - @property - def step_sid(self): - """ - :returns: Step SID - :rtype: unicode - """ - return self._properties['step_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the ExecutionStepContextInstance +class ExecutionStepContextListInstance(ListResource): + def __init__(self, version: V2, flow_sid: str, execution_sid: str, step_sid: str): + # TODO: needs autogenerated docs + super(ExecutionStepContextListInstanceList, self).__init__(version) - :returns: The fetched ExecutionStepContextInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { flow_sid, execution_sid, step_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/flow/flow_revision.py b/twilio/rest/studio/v2/flow/flow_revision.py index c33bceb4fb..37936683e2 100644 --- a/twilio/rest/studio/v2/flow/flow_revision.py +++ b/twilio/rest/studio/v2/flow/flow_revision.py @@ -1,394 +1,139 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FlowRevisionList(ListResource): - - def __init__(self, version, sid): - """ - Initialize the FlowRevisionList - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionList - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionList - """ - super(FlowRevisionList, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Flows/{sid}/Revisions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FlowRevisionInstance 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 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.studio.v2.flow.flow_revision.FlowRevisionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FlowRevisionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.studio.v2.flow.flow_revision.FlowRevisionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FlowRevisionInstance records from the API. - Request is executed immediately - - :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 FlowRevisionInstance - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FlowRevisionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FlowRevisionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FlowRevisionInstance - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FlowRevisionPage(self._version, response, self._solution) - def get(self, revision): - """ - Constructs a FlowRevisionContext - - :param revision: Specific Revision number or can be `LatestPublished` and `LatestRevision` - - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionContext - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionContext - """ - return FlowRevisionContext(self._version, sid=self._solution['sid'], revision=revision, ) - - def __call__(self, revision): - """ - Constructs a FlowRevisionContext - - :param revision: Specific Revision number or can be `LatestPublished` and `LatestRevision` - - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionContext - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionContext - """ - return FlowRevisionContext(self._version, sid=self._solution['sid'], revision=revision, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FlowRevisionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the FlowRevisionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionPage - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionPage - """ - super(FlowRevisionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FlowRevisionInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionInstance - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionInstance - """ - return FlowRevisionInstance(self._version, payload, sid=self._solution['sid'], ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class FlowRevisionContext(InstanceContext): - - def __init__(self, version, sid, revision): - """ - Initialize the FlowRevisionContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - :param revision: Specific Revision number or can be `LatestPublished` and `LatestRevision` - - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionContext - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionContext - """ - super(FlowRevisionContext, self).__init__(version) + def __init__(self, version: V2, sid: str, revision: str): + # TODO: needs autogenerated docs + super(FlowRevisionContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, 'revision': revision, } - self._uri = '/Flows/{sid}/Revisions/{revision}'.format(**self._solution) - - def fetch(self): - """ - Fetch the FlowRevisionInstance - - :returns: The fetched FlowRevisionInstance - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FlowRevisionInstance( - self._version, - payload, - sid=self._solution['sid'], - revision=self._solution['revision'], - ) + self._solution = { sid, revision, } + self._uri = '/Flows/${sid}/Revisions/${revision}' + + + def fetch(self): + + """ + Fetch the FlowRevisionInstance + + :returns: The fetched FlowRevisionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FlowRevisionInstance( + self._version, + payload, + sidrevision=self._solution['sid''revision'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FlowRevisionInstance(InstanceResource): - class Status(object): - DRAFT = "draft" - PUBLISHED = "published" - - def __init__(self, version, payload, sid, revision=None): - """ - Initialize the FlowRevisionInstance - - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionInstance - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionInstance - """ +class FlowRevisionInstance(InstanceResource): + def __init__(self, version, payload, sid: str, revision: str): super(FlowRevisionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'definition': payload.get('definition'), - 'status': payload.get('status'), - 'revision': deserialize.integer(payload.get('revision')), - 'commit_message': payload.get('commit_message'), - 'valid': payload.get('valid'), - 'errors': payload.get('errors'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'definition' = payload.get('definition'), + 'status' = payload.get('status'), + 'revision' = payload.get('revision'), + 'commit_message' = payload.get('commit_message'), + 'valid' = payload.get('valid'), + 'errors' = payload.get('errors'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid, 'revision': revision or self._properties['revision'], } + self._solution = { + 'sid': sid or self._properties['sid']'revision': revision or self._properties['revision'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FlowRevisionContext for this FlowRevisionInstance - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionContext - """ if self._context is None: self._context = FlowRevisionContext( self._version, - sid=self._solution['sid'], - revision=self._solution['revision'], + sid=self._solution['sid'],revision=self._solution['revision'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Flow - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def definition(self): - """ - :returns: JSON representation of flow definition - :rtype: dict - """ - return self._properties['definition'] - - @property - def status(self): - """ - :returns: The status of the Flow - :rtype: FlowRevisionInstance.Status - """ - return self._properties['status'] - - @property - def revision(self): - """ - :returns: The latest revision number of the Flow's definition - :rtype: unicode - """ - return self._properties['revision'] + - @property - def commit_message(self): - """ - :returns: Description of change made in the revision - :rtype: unicode - """ - return self._properties['commit_message'] - - @property - def valid(self): + def __repr__(self): """ - :returns: Boolean if the flow definition is valid - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['valid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def errors(self): - """ - :returns: List of error in the flow definition - :rtype: list[dict] - """ - return self._properties['errors'] - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] +class FlowRevisionListInstance(ListResource): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(FlowRevisionListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { sid, } + self._uri = '/Flows/${sid}/Revisions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def fetch(self): - """ - Fetch the FlowRevisionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched FlowRevisionInstance - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionInstance - """ - return self._proxy.fetch() + return FlowRevisionPage(self._version, payload, sid=self._solution['sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/flow/flow_test_user.py b/twilio/rest/studio/v2/flow/flow_test_user.py new file mode 100644 index 0000000000..cc4ea19cbd --- /dev/null +++ b/twilio/rest/studio/v2/flow/flow_test_user.py @@ -0,0 +1,129 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class FlowTestUserContext(InstanceContext): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(FlowTestUserContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Flows/${sid}/TestUsers' + + + def fetch(self): + + """ + Fetch the FlowTestUserInstance + + :returns: The fetched FlowTestUserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FlowTestUserInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FlowTestUserInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class FlowTestUserInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(FlowTestUserInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'test_users' = payload.get('test_users'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = FlowTestUserContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class FlowTestUserListInstance(ListResource): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(FlowTestUserListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/studio/v2/flow_validate.py b/twilio/rest/studio/v2/flow_validate.py index 0c1b851a6b..2cdcd5fcd1 100644 --- a/twilio/rest/studio/v2/flow_validate.py +++ b/twilio/rest/studio/v2/flow_validate.py @@ -1,142 +1,83 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Studio + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class FlowValidateList(ListResource): - def __init__(self, version): - """ - Initialize the FlowValidateList - - :param Version version: Version that contains the resource - :returns: twilio.rest.studio.v2.flow_validate.FlowValidateList - :rtype: twilio.rest.studio.v2.flow_validate.FlowValidateList - """ - super(FlowValidateList, self).__init__(version) - # Path Solution - self._solution = {} - self._uri = '/Flows/Validate'.format(**self._solution) - - def update(self, friendly_name, status, definition, - commit_message=values.unset): - """ - Update the FlowValidateInstance - - :param unicode friendly_name: The string that you assigned to describe the Flow - :param FlowValidateInstance.Status status: The status of the Flow - :param dict definition: JSON representation of flow definition - :param unicode commit_message: Description of change made in the revision +class FlowValidateInstance(InstanceResource): + def __init__(self, version, payload): + super(FlowValidateInstance, self).__init__(version) + self._properties = { + 'valid' = payload.get('valid'), + } - :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, - }) + self._context = None + self._solution = { + + } - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = FlowValidateContext( + self._version, + + ) + return self._context - return FlowValidateInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class FlowValidatePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the FlowValidatePage - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.studio.v2.flow_validate.FlowValidatePage - :rtype: twilio.rest.studio.v2.flow_validate.FlowValidatePage - """ - super(FlowValidatePage, self).__init__(version, response) +class FlowValidateListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(FlowValidateListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FlowValidateInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v2.flow_validate.FlowValidateInstance - :rtype: twilio.rest.studio.v2.flow_validate.FlowValidateInstance - """ - return FlowValidateInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Flows/Validate' + + + def update(self, body): + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class FlowValidateInstance(InstanceResource): - - class Status(object): - DRAFT = "draft" - PUBLISHED = "published" - - def __init__(self, version, payload): - """ - Initialize the FlowValidateInstance - - :returns: twilio.rest.studio.v2.flow_validate.FlowValidateInstance - :rtype: twilio.rest.studio.v2.flow_validate.FlowValidateInstance - """ - super(FlowValidateInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'valid': payload.get('valid'), } - - # Context - self._context = None - self._solution = {} - - @property - def valid(self): - """ - :returns: Boolean if the flow definition is valid - :rtype: bool - """ - return self._properties['valid'] + return '' - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/supersim/__init__.py b/twilio/rest/supersim/__init__.py index b4c7890ad8..92a31a2730 100644 --- a/twilio/rest/supersim/__init__.py +++ b/twilio/rest/supersim/__init__.py @@ -1,108 +1,118 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.supersim.v1 import V1 + Twilio - Supersim + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Supersim(Domain): +from twilio.base.domain import Domain +from twilio.rest.Supersim.v1 import V1 +class Supersim(Domain): def __init__(self, twilio): """ Initialize the Supersim Domain :returns: Domain for Supersim - :rtype: twilio.rest.supersim.Supersim + :rtype: twilio.rest.v1.Supersim """ super(Supersim, self).__init__(twilio) - - self.base_url = 'https://supersim.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Supersim.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of supersim - :rtype: twilio.rest.supersim.v1.V1 + :returns: Versions v1 of Supersim + :rtype: twilio.rest.Supersim.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def esim_profiles(self): """ - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileList + :rtype: twilio.rest.v1.esim_profiles """ return self.v1.esim_profiles + @property def fleets(self): """ - :rtype: twilio.rest.supersim.v1.fleet.FleetList + :rtype: twilio.rest.v1.fleets """ return self.v1.fleets + @property def ip_commands(self): """ - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandList + :rtype: twilio.rest.v1.ip_commands """ return self.v1.ip_commands + @property def networks(self): """ - :rtype: twilio.rest.supersim.v1.network.NetworkList + :rtype: twilio.rest.v1.networks """ return self.v1.networks + @property def network_access_profiles(self): """ - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileList + :rtype: twilio.rest.v1.network_access_profiles """ return self.v1.network_access_profiles + @property def settings_updates(self): """ - :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdateList + :rtype: twilio.rest.v1.settings_updates """ return self.v1.settings_updates + @property def sims(self): """ - :rtype: twilio.rest.supersim.v1.sim.SimList + :rtype: twilio.rest.v1.sims """ return self.v1.sims + @property def sms_commands(self): """ - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandList + :rtype: twilio.rest.v1.sms_commands """ return self.v1.sms_commands + @property def usage_records(self): """ - :rtype: twilio.rest.supersim.v1.usage_record.UsageRecordList + :rtype: twilio.rest.v1.usage_records """ return self.v1.usage_records + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/supersim/v1/.openapi-generator-ignore b/twilio/rest/supersim/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/supersim/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/supersim/v1/.openapi-generator/FILES b/twilio/rest/supersim/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..08e76ce87f --- /dev/null +++ b/twilio/rest/supersim/v1/.openapi-generator/FILES @@ -0,0 +1,25 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +esim_profile.py +fleet.py +ip_command.py +network.py +network_access_profile.py +network_access_profile/network_access_profile_network.py +settings_update.py +sim.py +sim/billing_period.py +sim/sim_ip_address.py +sms_command.py +usage_record.py diff --git a/twilio/rest/supersim/v1/.openapi-generator/VERSION b/twilio/rest/supersim/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/supersim/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index 454b5506c7..5950a1acd7 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -1,431 +1,149 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EsimProfileList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the EsimProfileList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.esim_profile.EsimProfileList - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileList - """ - super(EsimProfileList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/ESimProfiles'.format(**self._solution) - - def create(self, callback_url=values.unset, callback_method=values.unset, - eid=values.unset): - """ - Create the EsimProfileInstance - - :param unicode callback_url: The URL we should call after we have sent when the status of the eSIM Profile changes - :param unicode callback_method: The HTTP method we should use to call callback_url - :param unicode eid: Identifier of the eUICC that will claim the eSIM Profile - - :returns: The created EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileInstance - """ - data = values.of({'CallbackUrl': callback_url, 'CallbackMethod': callback_method, 'Eid': eid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return EsimProfileInstance(self._version, payload, ) - - def stream(self, eid=values.unset, sim_sid=values.unset, status=values.unset, - limit=None, page_size=None): - """ - Streams EsimProfileInstance 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 eid: List the eSIM Profiles that have been associated with an EId - :param unicode sim_sid: Find the eSIM Profile resource related to a Sim resource by providing the SIM SID - :param EsimProfileInstance.Status status: List the eSIM Profiles that are in a given status - :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.supersim.v1.esim_profile.EsimProfileInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(eid=eid, sim_sid=sim_sid, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, eid=values.unset, sim_sid=values.unset, status=values.unset, - limit=None, page_size=None): - """ - Lists EsimProfileInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode eid: List the eSIM Profiles that have been associated with an EId - :param unicode sim_sid: Find the eSIM Profile resource related to a Sim resource by providing the SIM SID - :param EsimProfileInstance.Status status: List the eSIM Profiles that are in a given status - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.esim_profile.EsimProfileInstance] - """ - return list(self.stream(eid=eid, sim_sid=sim_sid, status=status, limit=limit, page_size=page_size, )) - - def page(self, eid=values.unset, sim_sid=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EsimProfileInstance records from the API. - Request is executed immediately - - :param unicode eid: List the eSIM Profiles that have been associated with an EId - :param unicode sim_sid: Find the eSIM Profile resource related to a Sim resource by providing the SIM SID - :param EsimProfileInstance.Status status: List the eSIM Profiles that are in a given status - :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 EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfilePage - """ - data = values.of({ - 'Eid': eid, - 'SimSid': sim_sid, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EsimProfilePage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of EsimProfileInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfilePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EsimProfilePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EsimProfileContext - - :param sid: The SID of the eSIM Profile resource to fetch - - :returns: twilio.rest.supersim.v1.esim_profile.EsimProfileContext - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileContext - """ - return EsimProfileContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EsimProfileContext - - :param sid: The SID of the eSIM Profile resource to fetch - - :returns: twilio.rest.supersim.v1.esim_profile.EsimProfileContext - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileContext - """ - return EsimProfileContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EsimProfilePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the EsimProfilePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.supersim.v1.esim_profile.EsimProfilePage - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfilePage - """ - super(EsimProfilePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EsimProfileInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.supersim.v1.esim_profile.EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileInstance - """ - return EsimProfileInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class EsimProfileContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the EsimProfileContext - - :param Version version: Version that contains the resource - :param sid: The SID of the eSIM Profile resource to fetch - - :returns: twilio.rest.supersim.v1.esim_profile.EsimProfileContext - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileContext - """ - super(EsimProfileContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(EsimProfileContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/ESimProfiles/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EsimProfileInstance - - :returns: The fetched EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EsimProfileInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/ESimProfiles/${sid}' + + + def fetch(self): + + """ + Fetch the EsimProfileInstance + + :returns: The fetched EsimProfileInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EsimProfileInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class EsimProfileInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - class Status(object): - NEW = "new" - RESERVING = "reserving" - AVAILABLE = "available" - DOWNLOADED = "downloaded" - INSTALLED = "installed" - FAILED = "failed" - - def __init__(self, version, payload, sid=None): - """ - Initialize the EsimProfileInstance - :returns: twilio.rest.supersim.v1.esim_profile.EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileInstance - """ +class EsimProfileInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(EsimProfileInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'iccid': payload.get('iccid'), - 'sim_sid': payload.get('sim_sid'), - 'status': payload.get('status'), - 'eid': payload.get('eid'), - 'smdp_plus_address': payload.get('smdp_plus_address'), - 'error_code': payload.get('error_code'), - 'error_message': payload.get('error_message'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'iccid' = payload.get('iccid'), + 'sim_sid' = payload.get('sim_sid'), + 'status' = payload.get('status'), + 'eid' = payload.get('eid'), + 'smdp_plus_address' = payload.get('smdp_plus_address'), + 'error_code' = payload.get('error_code'), + 'error_message' = payload.get('error_message'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EsimProfileContext for this EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileContext - """ if self._context is None: - self._context = EsimProfileContext(self._version, sid=self._solution['sid'], ) + self._context = EsimProfileContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account to which the eSIM Profile resource belongs - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def iccid(self): - """ - :returns: The ICCID associated with the Sim resource - :rtype: unicode - """ - return self._properties['iccid'] - - @property - def sim_sid(self): - """ - :returns: The SID of the Sim resource that this eSIM Profile controls - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def status(self): - """ - :returns: The status of the eSIM Profile - :rtype: EsimProfileInstance.Status - """ - return self._properties['status'] - - @property - def eid(self): - """ - :returns: Identifier of the eUICC that can claim the eSIM Profile - :rtype: unicode - """ - return self._properties['eid'] - - @property - def smdp_plus_address(self): - """ - :returns: Address of the SM-DP+ server from which the Profile will be downloaded - :rtype: unicode - """ - return self._properties['smdp_plus_address'] - - @property - def error_code(self): - """ - :returns: Code indicating the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def error_message(self): - """ - :returns: Error message describing the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state - :rtype: unicode - """ - return self._properties['error_message'] + - @property - def date_created(self): + def __repr__(self): """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The absolute URL of the eSIM Profile resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the EsimProfileInstance +class EsimProfileListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(EsimProfileListInstanceList, self).__init__(version) - :returns: The fetched EsimProfileInstance - :rtype: twilio.rest.supersim.v1.esim_profile.EsimProfileInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/ESimProfiles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EsimProfileInstance(self._version, payload, ) + + + def page(self, eid, sim_sid, status, page_size): + + data = values.of({ + 'eid': eid,'sim_sid': sim_sid,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EsimProfilePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index c8377d1b06..431d7b6a29 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -1,526 +1,163 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FleetList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the FleetList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.fleet.FleetList - :rtype: twilio.rest.supersim.v1.fleet.FleetList - """ - super(FleetList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Fleets'.format(**self._solution) - - def create(self, network_access_profile, unique_name=values.unset, - data_enabled=values.unset, data_limit=values.unset, - ip_commands_url=values.unset, ip_commands_method=values.unset, - sms_commands_enabled=values.unset, sms_commands_url=values.unset, - sms_commands_method=values.unset): - """ - Create the FleetInstance - - :param unicode network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param bool data_enabled: Defines whether SIMs in the Fleet are capable of using data connectivity - :param unicode data_limit: The total data usage (download and upload combined) in Megabytes that each Super SIM resource assigned to the Fleet can consume - :param unicode ip_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device - :param unicode ip_commands_method: A string representing the HTTP method to use when making a request to `ip_commands_url` - :param bool sms_commands_enabled: Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands - :param unicode sms_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number - :param unicode sms_commands_method: A string representing the HTTP method to use when making a request to `sms_commands_url` - - :returns: The created FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetInstance - """ - data = values.of({ - 'NetworkAccessProfile': network_access_profile, - 'UniqueName': unique_name, - 'DataEnabled': data_enabled, - 'DataLimit': data_limit, - 'IpCommandsUrl': ip_commands_url, - 'IpCommandsMethod': ip_commands_method, - 'SmsCommandsEnabled': sms_commands_enabled, - 'SmsCommandsUrl': sms_commands_url, - 'SmsCommandsMethod': sms_commands_method, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FleetInstance(self._version, payload, ) - - def stream(self, network_access_profile=values.unset, limit=None, - page_size=None): - """ - Streams FleetInstance 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 network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :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.supersim.v1.fleet.FleetInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(network_access_profile=network_access_profile, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, network_access_profile=values.unset, limit=None, page_size=None): - """ - Lists FleetInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.fleet.FleetInstance] - """ - return list(self.stream( - network_access_profile=network_access_profile, - limit=limit, - page_size=page_size, - )) - - def page(self, network_access_profile=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of FleetInstance records from the API. - Request is executed immediately - - :param unicode network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :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 FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetPage - """ - data = values.of({ - 'NetworkAccessProfile': network_access_profile, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FleetPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FleetInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FleetPage(self._version, response, self._solution) - def get(self, sid): - """ - Constructs a FleetContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.fleet.FleetContext - :rtype: twilio.rest.supersim.v1.fleet.FleetContext - """ - return FleetContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FleetContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.fleet.FleetContext - :rtype: twilio.rest.supersim.v1.fleet.FleetContext - """ - return FleetContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FleetPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FleetPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.supersim.v1.fleet.FleetPage - :rtype: twilio.rest.supersim.v1.fleet.FleetPage - """ - super(FleetPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FleetInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.supersim.v1.fleet.FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetInstance - """ - return FleetInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class FleetContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the FleetContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.fleet.FleetContext - :rtype: twilio.rest.supersim.v1.fleet.FleetContext - """ - super(FleetContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(FleetContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Fleets/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the FleetInstance - - :returns: The fetched FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FleetInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, unique_name=values.unset, network_access_profile=values.unset, - ip_commands_url=values.unset, ip_commands_method=values.unset, - sms_commands_url=values.unset, sms_commands_method=values.unset, - data_limit=values.unset): - """ - Update the FleetInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :param unicode ip_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device - :param unicode ip_commands_method: A string representing the HTTP method to use when making a request to `ip_commands_url` - :param unicode sms_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number - :param unicode sms_commands_method: A string representing the HTTP method to use when making a request to `sms_commands_url` - :param unicode data_limit: The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume - - :returns: The updated FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'NetworkAccessProfile': network_access_profile, - 'IpCommandsUrl': ip_commands_url, - 'IpCommandsMethod': ip_commands_method, - 'SmsCommandsUrl': sms_commands_url, - 'SmsCommandsMethod': sms_commands_method, - 'DataLimit': data_limit, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return FleetInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Fleets/${sid}' + + + def fetch(self): + + """ + Fetch the FleetInstance + + :returns: The fetched FleetInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FleetInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return FleetInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FleetInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - class DataMetering(object): - PAYG = "payg" - - def __init__(self, version, payload, sid=None): - """ - Initialize the FleetInstance - - :returns: twilio.rest.supersim.v1.fleet.FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetInstance - """ +class FleetInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(FleetInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'data_enabled': payload.get('data_enabled'), - 'data_limit': deserialize.integer(payload.get('data_limit')), - 'data_metering': payload.get('data_metering'), - 'sms_commands_enabled': payload.get('sms_commands_enabled'), - 'sms_commands_url': payload.get('sms_commands_url'), - 'sms_commands_method': payload.get('sms_commands_method'), - 'network_access_profile_sid': payload.get('network_access_profile_sid'), - 'ip_commands_url': payload.get('ip_commands_url'), - 'ip_commands_method': payload.get('ip_commands_method'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'data_enabled' = payload.get('data_enabled'), + 'data_limit' = payload.get('data_limit'), + 'data_metering' = payload.get('data_metering'), + 'sms_commands_enabled' = payload.get('sms_commands_enabled'), + 'sms_commands_url' = payload.get('sms_commands_url'), + 'sms_commands_method' = payload.get('sms_commands_method'), + 'network_access_profile_sid' = payload.get('network_access_profile_sid'), + 'ip_commands_url' = payload.get('ip_commands_url'), + 'ip_commands_method' = payload.get('ip_commands_method'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FleetContext for this FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetContext - """ if self._context is None: - self._context = FleetContext(self._version, sid=self._solution['sid'], ) + self._context = FleetContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Fleet resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def data_enabled(self): - """ - :returns: Defines whether SIMs in the Fleet are capable of using data connectivity - :rtype: bool - """ - return self._properties['data_enabled'] - - @property - def data_limit(self): - """ - :returns: The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume - :rtype: unicode - """ - return self._properties['data_limit'] - - @property - def data_metering(self): - """ - :returns: The model by which a SIM is metered and billed - :rtype: FleetInstance.DataMetering - """ - return self._properties['data_metering'] - - @property - def sms_commands_enabled(self): - """ - :returns: Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands - :rtype: bool - """ - return self._properties['sms_commands_enabled'] - - @property - def sms_commands_url(self): - """ - :returns: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number - :rtype: unicode - """ - return self._properties['sms_commands_url'] - - @property - def sms_commands_method(self): - """ - :returns: A string representing the HTTP method to use when making a request to `sms_commands_url` - :rtype: unicode - """ - return self._properties['sms_commands_method'] + - @property - def network_access_profile_sid(self): - """ - :returns: The SID of the Network Access Profile of the Fleet - :rtype: unicode - """ - return self._properties['network_access_profile_sid'] - - @property - def ip_commands_url(self): - """ - :returns: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device - :rtype: unicode - """ - return self._properties['ip_commands_url'] - - @property - def ip_commands_method(self): - """ - :returns: A string representing the HTTP method to use when making a request to `ip_commands_url` - :rtype: unicode + def __repr__(self): """ - return self._properties['ip_commands_method'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the FleetInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetInstance - """ - return self._proxy.fetch() - def update(self, unique_name=values.unset, network_access_profile=values.unset, - ip_commands_url=values.unset, ip_commands_method=values.unset, - sms_commands_url=values.unset, sms_commands_method=values.unset, - data_limit=values.unset): - """ - Update the FleetInstance - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode network_access_profile: The SID or unique name of the Network Access Profile of the Fleet - :param unicode ip_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device - :param unicode ip_commands_method: A string representing the HTTP method to use when making a request to `ip_commands_url` - :param unicode sms_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number - :param unicode sms_commands_method: A string representing the HTTP method to use when making a request to `sms_commands_url` - :param unicode data_limit: The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume +class FleetListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(FleetListInstanceList, self).__init__(version) - :returns: The updated FleetInstance - :rtype: twilio.rest.supersim.v1.fleet.FleetInstance - """ - return self._proxy.update( - unique_name=unique_name, - network_access_profile=network_access_profile, - ip_commands_url=ip_commands_url, - ip_commands_method=ip_commands_method, - sms_commands_url=sms_commands_url, - sms_commands_method=sms_commands_method, - data_limit=data_limit, - ) + # Path Solution + self._solution = { } + self._uri = '/Fleets' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FleetInstance(self._version, payload, ) + + + def page(self, network_access_profile, page_size): + + data = values.of({ + 'network_access_profile': network_access_profile,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FleetPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/supersim/v1/ip_command.py b/twilio/rest/supersim/v1/ip_command.py index a5b83c4050..7df8983a10 100644 --- a/twilio/rest/supersim/v1/ip_command.py +++ b/twilio/rest/supersim/v1/ip_command.py @@ -1,473 +1,150 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class IpCommandList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the IpCommandList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.ip_command.IpCommandList - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandList - """ - super(IpCommandList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/IpCommands'.format(**self._solution) - - def create(self, sim, payload, device_port, payload_type=values.unset, - callback_url=values.unset, callback_method=values.unset): - """ - Create the IpCommandInstance - - :param unicode sim: The sid or unique_name of the Super SIM to send the IP Command to - :param unicode payload: The payload to be delivered to the device - :param unicode device_port: The device port to which the IP Command will be sent - :param IpCommandInstance.PayloadType payload_type: Indicates how the payload is encoded - :param unicode callback_url: The URL we should call after we have sent the IP Command - :param unicode callback_method: The HTTP method we should use to call callback_url - - :returns: The created IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandInstance - """ - data = values.of({ - 'Sim': sim, - 'Payload': payload, - 'DevicePort': device_port, - 'PayloadType': payload_type, - 'CallbackUrl': callback_url, - 'CallbackMethod': callback_method, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return IpCommandInstance(self._version, payload, ) - - def stream(self, sim=values.unset, sim_iccid=values.unset, status=values.unset, - direction=values.unset, limit=None, page_size=None): - """ - Streams IpCommandInstance 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 sim: The SID or unique name of the Sim resource that IP Command was sent to or from. - :param unicode sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from. - :param IpCommandInstance.Status status: The status of the IP Command - :param IpCommandInstance.Direction direction: The direction of the IP Command - :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.supersim.v1.ip_command.IpCommandInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - sim=sim, - sim_iccid=sim_iccid, - status=status, - direction=direction, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, sim=values.unset, sim_iccid=values.unset, status=values.unset, - direction=values.unset, limit=None, page_size=None): - """ - Lists IpCommandInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode sim: The SID or unique name of the Sim resource that IP Command was sent to or from. - :param unicode sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from. - :param IpCommandInstance.Status status: The status of the IP Command - :param IpCommandInstance.Direction direction: The direction of the IP Command - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.ip_command.IpCommandInstance] - """ - return list(self.stream( - sim=sim, - sim_iccid=sim_iccid, - status=status, - direction=direction, - limit=limit, - page_size=page_size, - )) - - def page(self, sim=values.unset, sim_iccid=values.unset, status=values.unset, - direction=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of IpCommandInstance records from the API. - Request is executed immediately - - :param unicode sim: The SID or unique name of the Sim resource that IP Command was sent to or from. - :param unicode sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from. - :param IpCommandInstance.Status status: The status of the IP Command - :param IpCommandInstance.Direction direction: The direction of the IP Command - :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 IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandPage - """ - data = values.of({ - 'Sim': sim, - 'SimIccid': sim_iccid, - 'Status': status, - 'Direction': direction, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return IpCommandPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpCommandInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpCommandPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a IpCommandContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.ip_command.IpCommandContext - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandContext - """ - return IpCommandContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IpCommandContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.ip_command.IpCommandContext - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandContext - """ - return IpCommandContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class IpCommandPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the IpCommandPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.supersim.v1.ip_command.IpCommandPage - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandPage - """ - super(IpCommandPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpCommandInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.supersim.v1.ip_command.IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandInstance - """ - return IpCommandInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class IpCommandContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the IpCommandContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.ip_command.IpCommandContext - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandContext - """ - super(IpCommandContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(IpCommandContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/IpCommands/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the IpCommandInstance - - :returns: The fetched IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return IpCommandInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/IpCommands/${sid}' + + + def fetch(self): + + """ + Fetch the IpCommandInstance + + :returns: The fetched IpCommandInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return IpCommandInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class IpCommandInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class Status(object): - QUEUED = "queued" - SENT = "sent" - RECEIVED = "received" - FAILED = "failed" - class Direction(object): - TO_SIM = "to_sim" - FROM_SIM = "from_sim" - class PayloadType(object): - TEXT = "text" - BINARY = "binary" - - def __init__(self, version, payload, sid=None): - """ - Initialize the IpCommandInstance - - :returns: twilio.rest.supersim.v1.ip_command.IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandInstance - """ +class IpCommandInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(IpCommandInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'sim_sid': payload.get('sim_sid'), - 'sim_iccid': payload.get('sim_iccid'), - 'status': payload.get('status'), - 'direction': payload.get('direction'), - 'device_ip': payload.get('device_ip'), - 'device_port': deserialize.integer(payload.get('device_port')), - 'payload_type': payload.get('payload_type'), - 'payload': payload.get('payload'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'sim_sid' = payload.get('sim_sid'), + 'sim_iccid' = payload.get('sim_iccid'), + 'status' = payload.get('status'), + 'direction' = payload.get('direction'), + 'device_ip' = payload.get('device_ip'), + 'device_port' = payload.get('device_port'), + 'payload_type' = payload.get('payload_type'), + 'payload' = payload.get('payload'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpCommandContext for this IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandContext - """ if self._context is None: - self._context = IpCommandContext(self._version, sid=self._solution['sid'], ) + self._context = IpCommandContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sim_sid(self): - """ - :returns: The SID of the Super SIM that this IP Command was sent to or from - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def sim_iccid(self): - """ - :returns: The ICCID of the Super SIM that this IP Command was sent to or from - :rtype: unicode - """ - return self._properties['sim_iccid'] - - @property - def status(self): - """ - :returns: The status of the IP Command - :rtype: IpCommandInstance.Status - """ - return self._properties['status'] - - @property - def direction(self): - """ - :returns: The direction of the IP Command - :rtype: IpCommandInstance.Direction - """ - return self._properties['direction'] - - @property - def device_ip(self): - """ - :returns: The IP address of the device that the IP Command was sent to or received from - :rtype: unicode - """ - return self._properties['device_ip'] - - @property - def device_port(self): - """ - :returns: The port that the IP Command either originated from or was sent to - :rtype: unicode - """ - return self._properties['device_port'] - - @property - def payload_type(self): - """ - :returns: The payload type of the IP Command - :rtype: IpCommandInstance.PayloadType - """ - return self._properties['payload_type'] - - @property - def payload(self): - """ - :returns: The payload of the IP Command sent to or from the Super SIM - :rtype: unicode - """ - return self._properties['payload'] - - @property - def date_created(self): + def __repr__(self): """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The absolute URL of the IP Command resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the IpCommandInstance +class IpCommandListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(IpCommandListInstanceList, self).__init__(version) - :returns: The fetched IpCommandInstance - :rtype: twilio.rest.supersim.v1.ip_command.IpCommandInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/IpCommands' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IpCommandInstance(self._version, payload, ) + + + def page(self, sim, sim_iccid, status, direction, page_size): + + data = values.of({ + 'sim': sim,'sim_iccid': sim_iccid,'status': status,'direction': direction,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IpCommandPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/supersim/v1/network.py b/twilio/rest/supersim/v1/network.py index 516426c5ee..783c759b23 100644 --- a/twilio/rest/supersim/v1/network.py +++ b/twilio/rest/supersim/v1/network.py @@ -1,347 +1,132 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NetworkList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the NetworkList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.network.NetworkList - :rtype: twilio.rest.supersim.v1.network.NetworkList - """ - super(NetworkList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Networks'.format(**self._solution) - - def stream(self, iso_country=values.unset, mcc=values.unset, mnc=values.unset, - limit=None, page_size=None): - """ - Streams NetworkInstance 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 iso_country: The ISO country code of the Network resources to read - :param unicode mcc: The MCC of Network resource identifiers to be read - :param unicode mnc: The MNC of Network resource identifiers to be read - :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.supersim.v1.network.NetworkInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(iso_country=iso_country, mcc=mcc, mnc=mnc, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, iso_country=values.unset, mcc=values.unset, mnc=values.unset, - limit=None, page_size=None): - """ - Lists NetworkInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode iso_country: The ISO country code of the Network resources to read - :param unicode mcc: The MCC of Network resource identifiers to be read - :param unicode mnc: The MNC of Network resource identifiers to be read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.network.NetworkInstance] - """ - return list(self.stream( - iso_country=iso_country, - mcc=mcc, - mnc=mnc, - limit=limit, - page_size=page_size, - )) - - def page(self, iso_country=values.unset, mcc=values.unset, mnc=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of NetworkInstance records from the API. - Request is executed immediately - - :param unicode iso_country: The ISO country code of the Network resources to read - :param unicode mcc: The MCC of Network resource identifiers to be read - :param unicode mnc: The MNC of Network resource identifiers to be read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of NetworkInstance - :rtype: twilio.rest.supersim.v1.network.NetworkPage - """ - data = values.of({ - 'IsoCountry': iso_country, - 'Mcc': mcc, - 'Mnc': mnc, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return NetworkPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NetworkInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NetworkInstance - :rtype: twilio.rest.supersim.v1.network.NetworkPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NetworkPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a NetworkContext - - :param sid: The SID of the Network resource to fetch - - :returns: twilio.rest.supersim.v1.network.NetworkContext - :rtype: twilio.rest.supersim.v1.network.NetworkContext - """ - return NetworkContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a NetworkContext - - :param sid: The SID of the Network resource to fetch - - :returns: twilio.rest.supersim.v1.network.NetworkContext - :rtype: twilio.rest.supersim.v1.network.NetworkContext - """ - return NetworkContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NetworkPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the NetworkPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.supersim.v1.network.NetworkPage - :rtype: twilio.rest.supersim.v1.network.NetworkPage - """ - super(NetworkPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NetworkInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.supersim.v1.network.NetworkInstance - :rtype: twilio.rest.supersim.v1.network.NetworkInstance - """ - return NetworkInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class NetworkContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the NetworkContext - - :param Version version: Version that contains the resource - :param sid: The SID of the Network resource to fetch - - :returns: twilio.rest.supersim.v1.network.NetworkContext - :rtype: twilio.rest.supersim.v1.network.NetworkContext - """ - super(NetworkContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(NetworkContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Networks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the NetworkInstance - - :returns: The fetched NetworkInstance - :rtype: twilio.rest.supersim.v1.network.NetworkInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return NetworkInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Networks/${sid}' + + + def fetch(self): + + """ + Fetch the NetworkInstance + + :returns: The fetched NetworkInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NetworkInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NetworkInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the NetworkInstance - - :returns: twilio.rest.supersim.v1.network.NetworkInstance - :rtype: twilio.rest.supersim.v1.network.NetworkInstance - """ +class NetworkInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(NetworkInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'url': payload.get('url'), - 'iso_country': payload.get('iso_country'), - 'identifiers': payload.get('identifiers'), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'url' = payload.get('url'), + 'iso_country' = payload.get('iso_country'), + 'identifiers' = payload.get('identifiers'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NetworkContext for this NetworkInstance - :rtype: twilio.rest.supersim.v1.network.NetworkContext - """ if self._context is None: - self._context = NetworkContext(self._version, sid=self._solution['sid'], ) + self._context = NetworkContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def friendly_name(self): + def __repr__(self): """ - :returns: A human readable identifier of this resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['friendly_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Network resource - :rtype: unicode - """ - return self._properties['url'] - @property - def iso_country(self): - """ - :returns: The ISO country code of the Network resource - :rtype: unicode - """ - return self._properties['iso_country'] - @property - def identifiers(self): - """ - :returns: The MCC/MNCs included in the Network resource - :rtype: list[dict] - """ - return self._properties['identifiers'] +class NetworkListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(NetworkListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the NetworkInstance + # Path Solution + self._solution = { } + self._uri = '/Networks' + + + def page(self, iso_country, mcc, mnc, page_size): + + data = values.of({ + 'iso_country': iso_country,'mcc': mcc,'mnc': mnc,'page_size': page_size, + }) - :returns: The fetched NetworkInstance - :rtype: twilio.rest.supersim.v1.network.NetworkInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return NetworkPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/supersim/v1/network_access_profile.py b/twilio/rest/supersim/v1/network_access_profile.py new file mode 100644 index 0000000000..bd393ed27b --- /dev/null +++ b/twilio/rest/supersim/v1/network_access_profile.py @@ -0,0 +1,159 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.network_access_profile.network_access_profile_network import NetworkAccessProfileNetworkListInstance + + +class NetworkAccessProfileContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(NetworkAccessProfileContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/NetworkAccessProfiles/${sid}' + + self._networks = None + + def fetch(self): + + """ + Fetch the NetworkAccessProfileInstance + + :returns: The fetched NetworkAccessProfileInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NetworkAccessProfileInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return NetworkAccessProfileInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class NetworkAccessProfileInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(NetworkAccessProfileInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = NetworkAccessProfileContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def networks(self): + return self._proxy.networks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class NetworkAccessProfileListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(NetworkAccessProfileListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/NetworkAccessProfiles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return NetworkAccessProfileInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return NetworkAccessProfilePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py index aa3e06fb1e..d47b8784ed 100644 --- a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py +++ b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py @@ -1,395 +1,154 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NetworkAccessProfileNetworkList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, network_access_profile_sid): - """ - Initialize the NetworkAccessProfileNetworkList - - :param Version version: Version that contains the resource - :param network_access_profile_sid: The unique string that identifies the Network Access Profile resource - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkList - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkList - """ - super(NetworkAccessProfileNetworkList, self).__init__(version) - - # Path Solution - self._solution = {'network_access_profile_sid': network_access_profile_sid, } - self._uri = '/NetworkAccessProfiles/{network_access_profile_sid}/Networks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams NetworkAccessProfileNetworkInstance 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 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.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists NetworkAccessProfileNetworkInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of NetworkAccessProfileNetworkInstance records from the API. - Request is executed immediately - - :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 NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return NetworkAccessProfileNetworkPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NetworkAccessProfileNetworkInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NetworkAccessProfileNetworkPage(self._version, response, self._solution) - - def create(self, network): - """ - Create the NetworkAccessProfileNetworkInstance - - :param unicode network: The SID that identifies the Network resource - - :returns: The created NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance - """ - data = values.of({'Network': network, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return NetworkAccessProfileNetworkInstance( - self._version, - payload, - network_access_profile_sid=self._solution['network_access_profile_sid'], - ) - - def get(self, sid): - """ - Constructs a NetworkAccessProfileNetworkContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkContext - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkContext - """ - return NetworkAccessProfileNetworkContext( - self._version, - network_access_profile_sid=self._solution['network_access_profile_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a NetworkAccessProfileNetworkContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkContext - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkContext - """ - return NetworkAccessProfileNetworkContext( - self._version, - network_access_profile_sid=self._solution['network_access_profile_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NetworkAccessProfileNetworkPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the NetworkAccessProfileNetworkPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param network_access_profile_sid: The unique string that identifies the Network Access Profile resource - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkPage - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkPage - """ - super(NetworkAccessProfileNetworkPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NetworkAccessProfileNetworkInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance - """ - return NetworkAccessProfileNetworkInstance( - self._version, - payload, - network_access_profile_sid=self._solution['network_access_profile_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class NetworkAccessProfileNetworkContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, network_access_profile_sid, sid): - """ - Initialize the NetworkAccessProfileNetworkContext - - :param Version version: Version that contains the resource - :param network_access_profile_sid: The unique string that identifies the Network Access Profile resource - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkContext - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkContext - """ - super(NetworkAccessProfileNetworkContext, self).__init__(version) + def __init__(self, version: V1, network_access_profile_sid: str, sid: str): + # TODO: needs autogenerated docs + super(NetworkAccessProfileNetworkContextList, self).__init__(version) # Path Solution - self._solution = {'network_access_profile_sid': network_access_profile_sid, 'sid': sid, } - self._uri = '/NetworkAccessProfiles/{network_access_profile_sid}/Networks/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the NetworkAccessProfileNetworkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the NetworkAccessProfileNetworkInstance - - :returns: The fetched NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return NetworkAccessProfileNetworkInstance( - self._version, - payload, - network_access_profile_sid=self._solution['network_access_profile_sid'], - sid=self._solution['sid'], - ) + self._solution = { network_access_profile_sid, sid, } + self._uri = '/NetworkAccessProfiles/${network_access_profile_sid}/Networks/${sid}' + + + def delete(self): + + + """ + Deletes the NetworkAccessProfileNetworkInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the NetworkAccessProfileNetworkInstance + + :returns: The fetched NetworkAccessProfileNetworkInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return NetworkAccessProfileNetworkInstance( + self._version, + payload, + network_access_profile_sidsid=self._solution['network_access_profile_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NetworkAccessProfileNetworkInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, network_access_profile_sid, sid=None): - """ - Initialize the NetworkAccessProfileNetworkInstance - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance - """ +class NetworkAccessProfileNetworkInstance(InstanceResource): + def __init__(self, version, payload, network_access_profile_sid: str, sid: str): super(NetworkAccessProfileNetworkInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'network_access_profile_sid': payload.get('network_access_profile_sid'), - 'friendly_name': payload.get('friendly_name'), - 'iso_country': payload.get('iso_country'), - 'identifiers': payload.get('identifiers'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'network_access_profile_sid' = payload.get('network_access_profile_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'iso_country' = payload.get('iso_country'), + 'identifiers' = payload.get('identifiers'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'network_access_profile_sid': network_access_profile_sid, - 'sid': sid or self._properties['sid'], + 'network_access_profile_sid': network_access_profile_sid or self._properties['network_access_profile_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NetworkAccessProfileNetworkContext for this NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkContext - """ if self._context is None: self._context = NetworkAccessProfileNetworkContext( self._version, - network_access_profile_sid=self._solution['network_access_profile_sid'], - sid=self._solution['sid'], + network_access_profile_sid=self._solution['network_access_profile_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def network_access_profile_sid(self): - """ - :returns: The unique string that identifies the Network Access Profile resource - :rtype: unicode - """ - return self._properties['network_access_profile_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable identifier of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of the Network resource - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def identifiers(self): - """ - :returns: The MCC/MNCs included in the resource - :rtype: list[dict] - """ - return self._properties['identifiers'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the NetworkAccessProfileNetworkInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the NetworkAccessProfileNetworkInstance +class NetworkAccessProfileNetworkListInstance(ListResource): + def __init__(self, version: V1, network_access_profile_sid: str): + # TODO: needs autogenerated docs + super(NetworkAccessProfileNetworkListInstanceList, self).__init__(version) - :returns: The fetched NetworkAccessProfileNetworkInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { network_access_profile_sid, } + self._uri = '/NetworkAccessProfiles/${network_access_profile_sid}/Networks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return NetworkAccessProfileNetworkInstance(self._version, payload, network_access_profile_sid=self._solution['network_access_profile_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return NetworkAccessProfileNetworkPage(self._version, payload, network_access_profile_sid=self._solution['network_access_profile_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/supersim/v1/settings_update.py b/twilio/rest/supersim/v1/settings_update.py index 4f125c4cc2..7e4627fdbe 100644 --- a/twilio/rest/supersim/v1/settings_update.py +++ b/twilio/rest/supersim/v1/settings_update.py @@ -1,282 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SettingsUpdateList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SettingsUpdateList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.settings_update.SettingsUpdateList - :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdateList - """ - super(SettingsUpdateList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/SettingsUpdates'.format(**self._solution) - - def stream(self, sim=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams SettingsUpdateInstance 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 sim: Filter the Settings Updates by Super SIM - :param SettingsUpdateInstance.Status status: Filter the Settings Updates by status - :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.supersim.v1.settings_update.SettingsUpdateInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(sim=sim, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, sim=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists SettingsUpdateInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - :param unicode sim: Filter the Settings Updates by Super SIM - :param SettingsUpdateInstance.Status status: Filter the Settings Updates by status - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.settings_update.SettingsUpdateInstance] - """ - return list(self.stream(sim=sim, status=status, limit=limit, page_size=page_size, )) - - def page(self, sim=values.unset, status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SettingsUpdateInstance records from the API. - Request is executed immediately - - :param unicode sim: Filter the Settings Updates by Super SIM - :param SettingsUpdateInstance.Status status: Filter the Settings Updates by status - :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 SettingsUpdateInstance - :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdatePage - """ - data = values.of({ - 'Sim': sim, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SettingsUpdatePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SettingsUpdateInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SettingsUpdateInstance - :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdatePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SettingsUpdatePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class SettingsUpdatePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the SettingsUpdatePage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.supersim.v1.settings_update.SettingsUpdatePage - :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdatePage - """ - super(SettingsUpdatePage, self).__init__(version, response) +class SettingsUpdateListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SettingsUpdateListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SettingsUpdateInstance + self._solution = { } + self._uri = '/SettingsUpdates' + + + def page(self, sim, status, page_size): + + data = values.of({ + 'sim': sim,'status': status,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.supersim.v1.settings_update.SettingsUpdateInstance - :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdateInstance - """ - return SettingsUpdateInstance(self._version, payload, ) + return SettingsUpdatePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class SettingsUpdateInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - SCHEDULED = "scheduled" - IN_PROGRESS = "in-progress" - SUCCESSFUL = "successful" - FAILED = "failed" - - def __init__(self, version, payload): - """ - Initialize the SettingsUpdateInstance - - :returns: twilio.rest.supersim.v1.settings_update.SettingsUpdateInstance - :rtype: twilio.rest.supersim.v1.settings_update.SettingsUpdateInstance - """ - super(SettingsUpdateInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'iccid': payload.get('iccid'), - 'sim_sid': payload.get('sim_sid'), - 'status': payload.get('status'), - 'packages': payload.get('packages'), - 'date_completed': deserialize.iso8601_datetime(payload.get('date_completed')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - } - - # Context - self._context = None - self._solution = {} - - @property - def sid(self): - """ - :returns: The unique identifier of this Settings Update - :rtype: unicode - """ - return self._properties['sid'] - - @property - def iccid(self): - """ - :returns: The ICCID associated with the SIM - :rtype: unicode - """ - return self._properties['iccid'] - - @property - def sim_sid(self): - """ - :returns: The SID of the Super SIM to which this Settings Update was applied - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def status(self): - """ - :returns: The Status of this Settings Update - :rtype: SettingsUpdateInstance.Status - """ - return self._properties['status'] - - @property - def packages(self): - """ - :returns: Array containing the different Settings Packages that will be applied to the SIM after the update completes - :rtype: list[dict] - """ - return self._properties['packages'] - - @property - def date_completed(self): - """ - :returns: The time when the update successfully completed and the new settings were applied to the SIM - :rtype: datetime - """ - return self._properties['date_completed'] + return '' - @property - def date_created(self): - """ - :returns: The date this Settings Update was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Settings Update was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/supersim/v1/sim.py b/twilio/rest/supersim/v1/sim.py new file mode 100644 index 0000000000..10c4e9c204 --- /dev/null +++ b/twilio/rest/supersim/v1/sim.py @@ -0,0 +1,166 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sim.billing_period import BillingPeriodListInstancefrom twilio.rest.sim.sim_ip_address import SimIpAddressListInstance + + +class SimContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SimContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Sims/${sid}' + + self._billing_periods = None + self._sim_ip_addresses = None + + def fetch(self): + + """ + Fetch the SimInstance + + :returns: The fetched SimInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SimInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SimInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SimInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(SimInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'iccid' = payload.get('iccid'), + 'status' = payload.get('status'), + 'fleet_sid' = payload.get('fleet_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SimContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def billing_periods(self): + return self._proxy.billing_periods + @property + def sim_ip_addresses(self): + return self._proxy.sim_ip_addresses + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SimListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SimListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Sims' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SimInstance(self._version, payload, ) + + + def page(self, status, fleet, iccid, page_size): + + data = values.of({ + 'status': status,'fleet': fleet,'iccid': iccid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SimPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/supersim/v1/sim/billing_period.py b/twilio/rest/supersim/v1/sim/billing_period.py index 8a0e93d676..abe92e6acd 100644 --- a/twilio/rest/supersim/v1/sim/billing_period.py +++ b/twilio/rest/supersim/v1/sim/billing_period.py @@ -1,262 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BillingPeriodList(ListResource): - - def __init__(self, version, sim_sid): - """ - Initialize the BillingPeriodList - - :param Version version: Version that contains the resource - :param sim_sid: The SID of the Super SIM the Billing Period belongs to - - :returns: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodList - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodList - """ - super(BillingPeriodList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/BillingPeriods'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams BillingPeriodInstance 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 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.supersim.v1.sim.billing_period.BillingPeriodInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists BillingPeriodInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.sim.billing_period.BillingPeriodInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BillingPeriodInstance records from the API. - Request is executed immediately - - :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 BillingPeriodInstance - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BillingPeriodPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BillingPeriodInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BillingPeriodInstance - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BillingPeriodPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class BillingPeriodPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the BillingPeriodPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The SID of the Super SIM the Billing Period belongs to - :returns: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodPage - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodPage - """ - super(BillingPeriodPage, self).__init__(version, response) +class BillingPeriodListInstance(ListResource): + def __init__(self, version: V1, sim_sid: str): + # TODO: needs autogenerated docs + super(BillingPeriodListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BillingPeriodInstance + self._solution = { sim_sid, } + self._uri = '/Sims/${sim_sid}/BillingPeriods' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodInstance - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodInstance - """ - return BillingPeriodInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) + return BillingPeriodPage(self._version, payload, sim_sid=self._solution['sim_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class BillingPeriodInstance(InstanceResource): - - class BpType(object): - READY = "ready" - ACTIVE = "active" - - def __init__(self, version, payload, sim_sid): - """ - Initialize the BillingPeriodInstance - - :returns: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodInstance - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodInstance - """ - super(BillingPeriodInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'sim_sid': payload.get('sim_sid'), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'period_type': payload.get('period_type'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - } - - # Context - self._context = None - self._solution = {'sim_sid': sim_sid, } - - @property - def sid(self): - """ - :returns: The SID of the Billing Period - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account the Super SIM belongs to - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sim_sid(self): - """ - :returns: The SID of the Super SIM the Billing Period belongs to - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def start_time(self): - """ - :returns: The start time of the Billing Period - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end time of the Billing Period - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def period_type(self): - """ - :returns: The type of the Billing Period - :rtype: BillingPeriodInstance.BpType - """ - return self._properties['period_type'] + return '' - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/supersim/v1/sim/sim_ip_address.py b/twilio/rest/supersim/v1/sim/sim_ip_address.py index f25df25d65..35d65d121b 100644 --- a/twilio/rest/supersim/v1/sim/sim_ip_address.py +++ b/twilio/rest/supersim/v1/sim/sim_ip_address.py @@ -1,213 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SimIpAddressList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sim_sid): - """ - Initialize the SimIpAddressList - - :param Version version: Version that contains the resource - :param sim_sid: The unique string that identifies the resource - - :returns: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressList - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressList - """ - super(SimIpAddressList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/IpAddresses'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SimIpAddressInstance 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 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.supersim.v1.sim.sim_ip_address.SimIpAddressInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) + Twilio - Supersim + This is the public Twilio REST API. - def list(self, limit=None, page_size=None): - """ - Lists SimIpAddressInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.sim.sim_ip_address.SimIpAddressInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SimIpAddressInstance records from the API. - Request is executed immediately - - :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 SimIpAddressInstance - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SimIpAddressPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SimIpAddressInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - :returns: Page of SimIpAddressInstance - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return SimIpAddressPage(self._version, response, self._solution) +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class SimIpAddressPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the SimIpAddressPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The unique string that identifies the resource - :returns: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressPage - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressPage - """ - super(SimIpAddressPage, self).__init__(version, response) +class SimIpAddressListInstance(ListResource): + def __init__(self, version: V1, sim_sid: str): + # TODO: needs autogenerated docs + super(SimIpAddressListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { sim_sid, } + self._uri = '/Sims/${sim_sid}/IpAddresses' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of SimIpAddressInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressInstance - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressInstance - """ - return SimIpAddressInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) + return SimIpAddressPage(self._version, payload, sim_sid=self._solution['sim_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class SimIpAddressInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class IpAddressVersion(object): - IPV4 = "IPv4" - IPV6 = "IPv6" - - def __init__(self, version, payload, sim_sid): - """ - Initialize the SimIpAddressInstance + return '' - :returns: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressInstance - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressInstance - """ - super(SimIpAddressInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'ip_address': payload.get('ip_address'), - 'ip_address_version': payload.get('ip_address_version'), - } - - # Context - self._context = None - self._solution = {'sim_sid': sim_sid, } - - @property - def ip_address(self): - """ - :returns: IP address assigned to the given Super SIM - :rtype: unicode - """ - return self._properties['ip_address'] - - @property - def ip_address_version(self): - """ - :returns: IP address version - :rtype: SimIpAddressInstance.IpAddressVersion - """ - return self._properties['ip_address_version'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/supersim/v1/sms_command.py b/twilio/rest/supersim/v1/sms_command.py index b8e5c4bbb7..3081692af9 100644 --- a/twilio/rest/supersim/v1/sms_command.py +++ b/twilio/rest/supersim/v1/sms_command.py @@ -1,419 +1,146 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SmsCommandList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SmsCommandList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.sms_command.SmsCommandList - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandList - """ - super(SmsCommandList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/SmsCommands'.format(**self._solution) - - def create(self, sim, payload, callback_method=values.unset, - callback_url=values.unset): - """ - Create the SmsCommandInstance - - :param unicode sim: The sid or unique_name of the SIM to send the SMS Command to - :param unicode payload: The message body of the SMS Command - :param unicode callback_method: The HTTP method we should use to call callback_url - :param unicode callback_url: The URL we should call after we have sent the command - - :returns: The created SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandInstance - """ - data = values.of({ - 'Sim': sim, - 'Payload': payload, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SmsCommandInstance(self._version, payload, ) - - def stream(self, sim=values.unset, status=values.unset, direction=values.unset, - limit=None, page_size=None): - """ - Streams SmsCommandInstance 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 sim: The SID or unique name of the Sim resource that SMS Command was sent to or from. - :param SmsCommandInstance.Status status: The status of the SMS Command - :param SmsCommandInstance.Direction direction: The direction of the SMS Command - :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.supersim.v1.sms_command.SmsCommandInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(sim=sim, status=status, direction=direction, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, sim=values.unset, status=values.unset, direction=values.unset, - limit=None, page_size=None): - """ - Lists SmsCommandInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode sim: The SID or unique name of the Sim resource that SMS Command was sent to or from. - :param SmsCommandInstance.Status status: The status of the SMS Command - :param SmsCommandInstance.Direction direction: The direction of the SMS Command - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.sms_command.SmsCommandInstance] - """ - return list(self.stream( - sim=sim, - status=status, - direction=direction, - limit=limit, - page_size=page_size, - )) - - def page(self, sim=values.unset, status=values.unset, direction=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SmsCommandInstance records from the API. - Request is executed immediately - - :param unicode sim: The SID or unique name of the Sim resource that SMS Command was sent to or from. - :param SmsCommandInstance.Status status: The status of the SMS Command - :param SmsCommandInstance.Direction direction: The direction of the SMS Command - :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 SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandPage - """ - data = values.of({ - 'Sim': sim, - 'Status': status, - 'Direction': direction, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SmsCommandPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SmsCommandInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SmsCommandPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SmsCommandContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.sms_command.SmsCommandContext - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandContext - """ - return SmsCommandContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SmsCommandContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.sms_command.SmsCommandContext - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandContext - """ - return SmsCommandContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SmsCommandPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SmsCommandPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.supersim.v1.sms_command.SmsCommandPage - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandPage - """ - super(SmsCommandPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SmsCommandInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.supersim.v1.sms_command.SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandInstance - """ - return SmsCommandInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class SmsCommandContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the SmsCommandContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.sms_command.SmsCommandContext - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandContext - """ - super(SmsCommandContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SmsCommandContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/SmsCommands/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SmsCommandInstance - - :returns: The fetched SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SmsCommandInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/SmsCommands/${sid}' + + + def fetch(self): + + """ + Fetch the SmsCommandInstance + + :returns: The fetched SmsCommandInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SmsCommandInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SmsCommandInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class Status(object): - QUEUED = "queued" - SENT = "sent" - DELIVERED = "delivered" - RECEIVED = "received" - FAILED = "failed" - class Direction(object): - TO_SIM = "to_sim" - FROM_SIM = "from_sim" - def __init__(self, version, payload, sid=None): - """ - Initialize the SmsCommandInstance - - :returns: twilio.rest.supersim.v1.sms_command.SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandInstance - """ +class SmsCommandInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(SmsCommandInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'sim_sid': payload.get('sim_sid'), - 'payload': payload.get('payload'), - 'status': payload.get('status'), - 'direction': payload.get('direction'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'sim_sid' = payload.get('sim_sid'), + 'payload' = payload.get('payload'), + 'status' = payload.get('status'), + 'direction' = payload.get('direction'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SmsCommandContext for this SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandContext - """ if self._context is None: - self._context = SmsCommandContext(self._version, sid=self._solution['sid'], ) + self._context = SmsCommandContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sim_sid(self): - """ - :returns: The SID of the SIM that this SMS Command was sent to or from - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def payload(self): - """ - :returns: The message body of the SMS Command sent to or from the SIM - :rtype: unicode - """ - return self._properties['payload'] - - @property - def status(self): - """ - :returns: The status of the SMS Command - :rtype: SmsCommandInstance.Status - """ - return self._properties['status'] - - @property - def direction(self): - """ - :returns: The direction of the SMS Command - :rtype: SmsCommandInstance.Direction - """ - return self._properties['direction'] + - @property - def date_created(self): + def __repr__(self): """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The absolute URL of the SMS Command resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the SmsCommandInstance +class SmsCommandListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SmsCommandListInstanceList, self).__init__(version) - :returns: The fetched SmsCommandInstance - :rtype: twilio.rest.supersim.v1.sms_command.SmsCommandInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/SmsCommands' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SmsCommandInstance(self._version, payload, ) + + + def page(self, sim, status, direction, page_size): + + data = values.of({ + 'sim': sim,'status': status,'direction': direction,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SmsCommandPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/supersim/v1/usage_record.py b/twilio/rest/supersim/v1/usage_record.py index 2139b4ba71..296695d4ba 100644 --- a/twilio/rest/supersim/v1/usage_record.py +++ b/twilio/rest/supersim/v1/usage_record.py @@ -1,370 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UsageRecordList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the UsageRecordList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.usage_record.UsageRecordList - :rtype: twilio.rest.supersim.v1.usage_record.UsageRecordList - """ - super(UsageRecordList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/UsageRecords'.format(**self._solution) - - def stream(self, sim=values.unset, fleet=values.unset, network=values.unset, - iso_country=values.unset, group=values.unset, - granularity=values.unset, start_time=values.unset, - end_time=values.unset, limit=None, page_size=None): - """ - Streams UsageRecordInstance 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 sim: SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. - :param unicode fleet: SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. - :param unicode network: SID of a Network resource. Only show UsageRecords representing usage on this network. - :param unicode iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. - :param UsageRecordInstance.Group group: Dimension over which to aggregate usage records. - :param UsageRecordInstance.Granularity granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. - :param datetime start_time: Only include usage that occurred at or after this time. - :param datetime end_time: Only include usage that occurred before this time (exclusive). - :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.supersim.v1.usage_record.UsageRecordInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - sim=sim, - fleet=fleet, - network=network, - iso_country=iso_country, - group=group, - granularity=granularity, - start_time=start_time, - end_time=end_time, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, sim=values.unset, fleet=values.unset, network=values.unset, - iso_country=values.unset, group=values.unset, granularity=values.unset, - start_time=values.unset, end_time=values.unset, limit=None, - page_size=None): - """ - Lists UsageRecordInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode sim: SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. - :param unicode fleet: SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. - :param unicode network: SID of a Network resource. Only show UsageRecords representing usage on this network. - :param unicode iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. - :param UsageRecordInstance.Group group: Dimension over which to aggregate usage records. - :param UsageRecordInstance.Granularity granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. - :param datetime start_time: Only include usage that occurred at or after this time. - :param datetime end_time: Only include usage that occurred before this time (exclusive). - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.supersim.v1.usage_record.UsageRecordInstance] - """ - return list(self.stream( - sim=sim, - fleet=fleet, - network=network, - iso_country=iso_country, - group=group, - granularity=granularity, - start_time=start_time, - end_time=end_time, - limit=limit, - page_size=page_size, - )) - def page(self, sim=values.unset, fleet=values.unset, network=values.unset, - iso_country=values.unset, group=values.unset, granularity=values.unset, - start_time=values.unset, end_time=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UsageRecordInstance records from the API. - Request is executed immediately - - :param unicode sim: SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. - :param unicode fleet: SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. - :param unicode network: SID of a Network resource. Only show UsageRecords representing usage on this network. - :param unicode iso_country: Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. - :param UsageRecordInstance.Group group: Dimension over which to aggregate usage records. - :param UsageRecordInstance.Granularity granularity: Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. - :param datetime start_time: Only include usage that occurred at or after this time. - :param datetime end_time: Only include usage that occurred before this time (exclusive). - :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 UsageRecordInstance - :rtype: twilio.rest.supersim.v1.usage_record.UsageRecordPage - """ - data = values.of({ - 'Sim': sim, - 'Fleet': fleet, - 'Network': network, - 'IsoCountry': iso_country, - 'Group': group, - 'Granularity': granularity, - 'StartTime': serialize.iso8601_datetime(start_time), - 'EndTime': serialize.iso8601_datetime(end_time), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UsageRecordPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UsageRecordInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UsageRecordInstance - :rtype: twilio.rest.supersim.v1.usage_record.UsageRecordPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UsageRecordPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class UsageRecordPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the UsageRecordPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.supersim.v1.usage_record.UsageRecordPage - :rtype: twilio.rest.supersim.v1.usage_record.UsageRecordPage - """ - super(UsageRecordPage, self).__init__(version, response) +class UsageRecordListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UsageRecordListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsageRecordInstance + self._solution = { } + self._uri = '/UsageRecords' + + + def page(self, sim, fleet, network, iso_country, group, granularity, start_time, end_time, page_size): + + data = values.of({ + 'sim': sim,'fleet': fleet,'network': network,'iso_country': iso_country,'group': group,'granularity': granularity,'start_time': start_time,'end_time': end_time,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.supersim.v1.usage_record.UsageRecordInstance - :rtype: twilio.rest.supersim.v1.usage_record.UsageRecordInstance - """ - return UsageRecordInstance(self._version, payload, ) + return UsageRecordPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class UsageRecordInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Granularity(object): - HOUR = "hour" - DAY = "day" - ALL = "all" - - class Group(object): - SIM = "sim" - FLEET = "fleet" - NETWORK = "network" - ISOCOUNTRY = "isoCountry" - - class SortBy(object): - TIME = "time" - - def __init__(self, version, payload): - """ - Initialize the UsageRecordInstance - - :returns: twilio.rest.supersim.v1.usage_record.UsageRecordInstance - :rtype: twilio.rest.supersim.v1.usage_record.UsageRecordInstance - """ - super(UsageRecordInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sim_sid': payload.get('sim_sid'), - 'network_sid': payload.get('network_sid'), - 'fleet_sid': payload.get('fleet_sid'), - 'iso_country': payload.get('iso_country'), - 'period': payload.get('period'), - 'data_upload': deserialize.integer(payload.get('data_upload')), - 'data_download': deserialize.integer(payload.get('data_download')), - 'data_total': deserialize.integer(payload.get('data_total')), - 'data_total_billed': deserialize.decimal(payload.get('data_total_billed')), - 'billed_unit': payload.get('billed_unit'), - } - - # Context - self._context = None - self._solution = {} - - @property - def account_sid(self): - """ - :returns: The SID of the Account that incurred the usage. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sim_sid(self): - """ - :returns: SID of a Sim resource to which the UsageRecord belongs. - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def network_sid(self): - """ - :returns: SID of the Network resource on which the usage occurred. - :rtype: unicode - """ - return self._properties['network_sid'] - - @property - def fleet_sid(self): - """ - :returns: SID of the Fleet resource on which the usage occurred. - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def iso_country(self): - """ - :returns: Alpha-2 ISO Country Code of the country the usage occurred in. - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def period(self): - """ - :returns: The time period for which the usage is reported. - :rtype: dict - """ - return self._properties['period'] - - @property - def data_upload(self): - """ - :returns: Total data uploaded in bytes, aggregated by the query parameters. - :rtype: unicode - """ - return self._properties['data_upload'] - - @property - def data_download(self): - """ - :returns: Total data downloaded in bytes, aggregated by the query parameters. - :rtype: unicode - """ - return self._properties['data_download'] - - @property - def data_total(self): - """ - :returns: Total of data_upload and data_download. - :rtype: unicode - """ - return self._properties['data_total'] - - @property - def data_total_billed(self): - """ - :returns: Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. - :rtype: unicode - """ - return self._properties['data_total_billed'] - - @property - def billed_unit(self): - """ - :returns: The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). - :rtype: unicode - """ - return self._properties['billed_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/sync/__init__.py b/twilio/rest/sync/__init__.py index 8592f0fbfa..8ad6795040 100644 --- a/twilio/rest/sync/__init__.py +++ b/twilio/rest/sync/__init__.py @@ -1,52 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.sync.v1 import V1 + Twilio - Sync + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Sync(Domain): +from twilio.base.domain import Domain +from twilio.rest.Sync.v1 import V1 +class Sync(Domain): def __init__(self, twilio): """ Initialize the Sync Domain :returns: Domain for Sync - :rtype: twilio.rest.sync.Sync + :rtype: twilio.rest.v1.Sync """ super(Sync, self).__init__(twilio) - - self.base_url = 'https://sync.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Sync.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of sync - :rtype: twilio.rest.sync.v1.V1 + :returns: Versions v1 of Sync + :rtype: twilio.rest.Sync.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def services(self): """ - :rtype: twilio.rest.sync.v1.service.ServiceList + :rtype: twilio.rest.v1.services """ return self.v1.services + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/sync/v1/.openapi-generator-ignore b/twilio/rest/sync/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/sync/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/sync/v1/.openapi-generator/FILES b/twilio/rest/sync/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..82a66d74a6 --- /dev/null +++ b/twilio/rest/sync/v1/.openapi-generator/FILES @@ -0,0 +1,23 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +service.py +service/document.py +service/document/document_permission.py +service/sync_list.py +service/sync_list/sync_list_item.py +service/sync_list/sync_list_permission.py +service/sync_map.py +service/sync_map/sync_map_item.py +service/sync_map/sync_map_permission.py +service/sync_stream.py +service/sync_stream/stream_message.py diff --git a/twilio/rest/sync/v1/.openapi-generator/VERSION b/twilio/rest/sync/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/sync/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/sync/v1/service.py b/twilio/rest/sync/v1/service.py new file mode 100644 index 0000000000..a1eadfbc13 --- /dev/null +++ b/twilio/rest/sync/v1/service.py @@ -0,0 +1,189 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.document import DocumentListInstancefrom twilio.rest.service.sync_list import SyncListListInstancefrom twilio.rest.service.sync_map import SyncMapListInstancefrom twilio.rest.service.sync_stream import SyncStreamListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._documents = None + self._sync_lists = None + self._sync_maps = None + self._sync_streams = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'webhook_url' = payload.get('webhook_url'), + 'webhooks_from_rest_enabled' = payload.get('webhooks_from_rest_enabled'), + 'reachability_webhooks_enabled' = payload.get('reachability_webhooks_enabled'), + 'acl_enabled' = payload.get('acl_enabled'), + 'reachability_debouncing_enabled' = payload.get('reachability_debouncing_enabled'), + 'reachability_debouncing_window' = payload.get('reachability_debouncing_window'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def documents(self): + return self._proxy.documents + @property + def sync_lists(self): + return self._proxy.sync_lists + @property + def sync_maps(self): + return self._proxy.sync_maps + @property + def sync_streams(self): + return self._proxy.sync_streams + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/sync/v1/service/document.py b/twilio/rest/sync/v1/service/document.py new file mode 100644 index 0000000000..9c84d0adee --- /dev/null +++ b/twilio/rest/sync/v1/service/document.py @@ -0,0 +1,175 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.document.document_permission import DocumentPermissionListInstance + + +class DocumentContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(DocumentContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Documents/${sid}' + + self._document_permissions = None + + def delete(self): + + + """ + Deletes the DocumentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DocumentInstance + + :returns: The fetched DocumentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DocumentInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class DocumentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(DocumentInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'revision' = payload.get('revision'), + 'data' = payload.get('data'), + 'date_expires' = payload.get('date_expires'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = DocumentContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def document_permissions(self): + return self._proxy.document_permissions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class DocumentListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(DocumentListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Documents' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DocumentPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py index ba70c2618e..2db05afbba 100644 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ b/twilio/rest/sync/v1/service/document/document_permission.py @@ -1,431 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DocumentPermissionList(ListResource): - - def __init__(self, version, service_sid, document_sid): - """ - Initialize the DocumentPermissionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - :param document_sid: The Sync Document SID - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - """ - super(DocumentPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentPermissionInstance 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 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.sync.v1.service.document.document_permission.DocumentPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.v1.service.document.document_permission.DocumentPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :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 DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DocumentPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPermissionPage(self._version, response, self._solution) - def get(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: The application-defined string that uniquely identifies the User's Document Permission resource to fetch - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __call__(self, identity): - """ - Constructs a DocumentPermissionContext - - :param identity: The application-defined string that uniquely identifies the User's Document Permission resource to fetch - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ - return DocumentPermissionContext( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=identity, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DocumentPermissionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - :param document_sid: The Sync Document SID - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionPage - """ - super(DocumentPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentPermissionInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class DocumentPermissionContext(InstanceContext): - - def __init__(self, version, service_sid, document_sid, identity): - """ - Initialize the DocumentPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Document Permission resource to fetch - :param document_sid: The SID of the Sync Document with the Document Permission resource to fetch - :param identity: The application-defined string that uniquely identifies the User's Document Permission resource to fetch - - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ - super(DocumentPermissionContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, document_sid: str, identity: str): + # TODO: needs autogenerated docs + super(DocumentPermissionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'document_sid': document_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Documents/{document_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch the DocumentPermissionInstance - - :returns: The fetched DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the DocumentPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance - - :param bool read: Read access - :param bool write: Write access - :param bool manage: Manage access - - :returns: The updated DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) + self._solution = { service_sid, document_sid, identity, } + self._uri = '/Services/${service_sid}/Documents/${document_sid}/Permissions/${identity}' + + + def delete(self): + + + """ + Deletes the DocumentPermissionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the DocumentPermissionInstance + + :returns: The fetched DocumentPermissionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return DocumentPermissionInstance( + self._version, + payload, + service_siddocument_sididentity=self._solution['service_sid''document_sid''identity'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return DocumentPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], - ) + return DocumentPermissionInstance(self._version, payload, service_sid=self._solution['service_sid'], document_sid=self._solution['document_sid'], identity=self._solution['identity'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DocumentPermissionInstance(InstanceResource): - def __init__(self, version, payload, service_sid, document_sid, identity=None): - """ - Initialize the DocumentPermissionInstance - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ +class DocumentPermissionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, document_sid: str, identity: str): super(DocumentPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'document_sid': payload.get('document_sid'), - 'identity': payload.get('identity'), - 'read': payload.get('read'), - 'write': payload.get('write'), - 'manage': payload.get('manage'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'document_sid' = payload.get('document_sid'), + 'identity' = payload.get('identity'), + 'read' = payload.get('read'), + 'write' = payload.get('write'), + 'manage' = payload.get('manage'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'document_sid': document_sid, - 'identity': identity or self._properties['identity'], + 'service_sid': service_sid or self._properties['service_sid']'document_sid': document_sid or self._properties['document_sid']'identity': identity or self._properties['identity'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentPermissionContext for this DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionContext - """ if self._context is None: self._context = DocumentPermissionContext( self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['document_sid'], - identity=self._solution['identity'], + service_sid=self._solution['service_sid'],document_sid=self._solution['document_sid'],identity=self._solution['identity'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def document_sid(self): - """ - :returns: The Sync Document SID - :rtype: unicode - """ - return self._properties['document_sid'] - - @property - def identity(self): - """ - :returns: The identity of the user to whom the Sync Document Permission applies - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access - :rtype: bool - """ - return self._properties['manage'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Sync Document Permission resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the DocumentPermissionInstance - :returns: The fetched DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the DocumentPermissionInstance +class DocumentPermissionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, document_sid: str): + # TODO: needs autogenerated docs + super(DocumentPermissionListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, document_sid, } + self._uri = '/Services/${service_sid}/Documents/${document_sid}/Permissions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def update(self, read, write, manage): - """ - Update the DocumentPermissionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param bool read: Read access - :param bool write: Write access - :param bool manage: Manage access - - :returns: The updated DocumentPermissionInstance - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionInstance - """ - return self._proxy.update(read, write, manage, ) + return DocumentPermissionPage(self._version, payload, service_sid=self._solution['service_sid']document_sid=self._solution['document_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_list.py b/twilio/rest/sync/v1/service/sync_list.py new file mode 100644 index 0000000000..a22615d6f4 --- /dev/null +++ b/twilio/rest/sync/v1/service/sync_list.py @@ -0,0 +1,178 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sync_list.sync_list_item import SyncListItemListInstancefrom twilio.rest.sync_list.sync_list_permission import SyncListPermissionListInstance + + +class SyncListContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SyncListContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Lists/${sid}' + + self._sync_list_items = None + self._sync_list_permissions = None + + def delete(self): + + + """ + Deletes the SyncListInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncListInstance + + :returns: The fetched SyncListInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncListInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SyncListInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(SyncListInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'revision' = payload.get('revision'), + 'date_expires' = payload.get('date_expires'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SyncListContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def sync_list_items(self): + return self._proxy.sync_list_items + @property + def sync_list_permissions(self): + return self._proxy.sync_list_permissions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SyncListListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(SyncListListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Lists' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncListPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py index 3c1c26d7e4..c28fb5d349 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,529 +19,152 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncListItemList(ListResource): - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListItemList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - :param list_sid: The SID of the Sync List that contains the List Item - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - """ - super(SyncListItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items'.format(**self._solution) - - def create(self, data, ttl=values.unset, item_ttl=values.unset, - collection_ttl=values.unset): - """ - Create the 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: The 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(method='POST', uri=self._uri, data=data, ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - - def stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncListItemInstance 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 SyncListItemInstance.QueryResultOrder order: The order to return the List Items - :param unicode from_: The index of the first Sync List Item resource to read - :param SyncListItemInstance.QueryFromBoundType bounds: Whether to include the List Item referenced by the from parameter - :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.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncListItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncListItemInstance.QueryResultOrder order: The order to return the List Items - :param unicode from_: The index of the first Sync List Item resource to read - :param SyncListItemInstance.QueryFromBoundType bounds: Whether to include the List Item referenced by the from parameter - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListItemInstance records from the API. - Request is executed immediately - - :param SyncListItemInstance.QueryResultOrder order: The order to return the List Items - :param unicode from_: The index of the first Sync List Item resource to read - :param SyncListItemInstance.QueryFromBoundType bounds: Whether to include the List Item referenced by the from parameter - :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 SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - """ - data = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncListItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListItemPage(self._version, response, self._solution) - - def get(self, index): - """ - Constructs a SyncListItemContext - - :param index: The index of the Sync List Item resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __call__(self, index): - """ - Constructs a SyncListItemContext - - :param index: The index of the Sync List Item resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ - return SyncListItemContext( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=index, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncListItemPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SyncListItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - :param list_sid: The SID of the Sync List that contains the List Item - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemPage - """ - super(SyncListItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of SyncListItemInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncListItemContext(InstanceContext): - - def __init__(self, version, service_sid, list_sid, index): - """ - Initialize the SyncListItemContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Sync List Item resource to fetch - :param list_sid: The SID of the Sync List with the Sync List Item resource to fetch - :param index: The index of the Sync List Item resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ - super(SyncListItemContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, list_sid: str, index: int): + # TODO: needs autogenerated docs + super(SyncListItemContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'index': index, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Items/{index}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncListItemInstance - - :returns: The fetched SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) - - def delete(self, if_match=values.unset): - """ - Deletes the SyncListItemInstance - - :param unicode if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, data=values.unset, ttl=values.unset, item_ttl=values.unset, - collection_ttl=values.unset, if_match=values.unset): - """ - Update the SyncListItemInstance + self._solution = { service_sid, list_sid, index, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Items/${index}' + + + def delete(self, if_match): + + + """ + Deletes the SyncListItemInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncListItemInstance + + :returns: The fetched SyncListItemInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncListItemInstance( + self._version, + payload, + service_sidlist_sidindex=self._solution['service_sid''list_sid''index'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - :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 - :param unicode if_match: The If-Match HTTP request header + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The 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, - }) - headers = values.of({'If-Match': if_match, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return SyncListItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], - ) + return SyncListItemInstance(self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], index=self._solution['index'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SyncListItemInstance(InstanceResource): + return '' - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - def __init__(self, version, payload, service_sid, list_sid, index=None): - """ - Initialize the SyncListItemInstance - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ +class SyncListItemInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, list_sid: str, index: int): super(SyncListItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'index': deserialize.integer(payload.get('index')), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'list_sid': payload.get('list_sid'), - 'url': payload.get('url'), - 'revision': payload.get('revision'), - 'data': payload.get('data'), - 'date_expires': deserialize.iso8601_datetime(payload.get('date_expires')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), + self._properties = { + 'index' = payload.get('index'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'list_sid' = payload.get('list_sid'), + 'url' = payload.get('url'), + 'revision' = payload.get('revision'), + 'data' = payload.get('data'), + 'date_expires' = payload.get('date_expires'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'index': index or self._properties['index'], + 'service_sid': service_sid or self._properties['service_sid']'list_sid': list_sid or self._properties['list_sid']'index': index or self._properties['index'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListItemContext for this SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemContext - """ if self._context is None: self._context = SyncListItemContext( self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - index=self._solution['index'], + service_sid=self._solution['service_sid'],list_sid=self._solution['list_sid'],index=self._solution['index'], ) return self._context - @property - def index(self): - """ - :returns: The automatically generated index of the List Item - :rtype: unicode - """ - return self._properties['index'] + - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: The SID of the Sync List that contains the List Item - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the List Item resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The current revision of the item, represented as a string - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: An arbitrary, schema-less object that the List Item stores - :rtype: dict - """ - return self._properties['data'] - - @property - def date_expires(self): - """ - :returns: The ISO 8601 date and time in GMT when the List Item expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The identity of the List Item's creator - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the SyncListItemInstance - - :returns: The fetched SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self, if_match=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the SyncListItemInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(if_match=if_match, ) - - def update(self, data=values.unset, ttl=values.unset, item_ttl=values.unset, - collection_ttl=values.unset, if_match=values.unset): - """ - Update the 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 - :param unicode if_match: The If-Match HTTP request header +class SyncListItemListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, list_sid: str): + # TODO: needs autogenerated docs + super(SyncListItemListInstanceList, self).__init__(version) - :returns: The updated SyncListItemInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance - """ - return self._proxy.update( - data=data, - ttl=ttl, - item_ttl=item_ttl, - collection_ttl=collection_ttl, - if_match=if_match, - ) + # Path Solution + self._solution = { service_sid, list_sid, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Items' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncListItemInstance(self._version, payload, service_sid=self._solution['service_sid']list_sid=self._solution['list_sid']) + + + def page(self, order, _from, bounds, page_size): + + data = values.of({ + 'order': order,'_from': _from,'bounds': bounds,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncListItemPage(self._version, payload, service_sid=self._solution['service_sid']list_sid=self._solution['list_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py index 05b3192b8b..3b475334fb 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py @@ -1,431 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncListPermissionList(ListResource): - - def __init__(self, version, service_sid, list_sid): - """ - Initialize the SyncListPermissionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - :param list_sid: The SID of the Sync List to which the Permission applies - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - """ - super(SyncListPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListPermissionInstance 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 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.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :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 SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncListPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPermissionPage(self._version, response, self._solution) - def get(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: The application-defined string that uniquely identifies the User's Sync List Permission resource to fetch - - :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, - ) - - def __call__(self, identity): - """ - Constructs a SyncListPermissionContext - - :param identity: The application-defined string that uniquely identifies the User's Sync List Permission resource to fetch - - :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, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncListPermissionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - :param list_sid: The SID of the Sync List to which the Permission applies - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionPage - """ - super(SyncListPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListPermissionInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :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'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncListPermissionContext(InstanceContext): - - def __init__(self, version, service_sid, list_sid, identity): - """ - Initialize the SyncListPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Sync List Permission resource to fetch - :param list_sid: The SID of the Sync List with the Sync List Permission resource to fetch - :param identity: The application-defined string that uniquely identifies the User's Sync List Permission resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - """ - super(SyncListPermissionContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, list_sid: str, identity: str): + # TODO: needs autogenerated docs + super(SyncListPermissionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'list_sid': list_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Lists/{list_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncListPermissionInstance - - :returns: The fetched SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncListPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - 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: The updated SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) + self._solution = { service_sid, list_sid, identity, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Permissions/${identity}' + + + def delete(self): + + + """ + Deletes the SyncListPermissionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncListPermissionInstance + + :returns: The fetched SyncListPermissionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncListPermissionInstance( + self._version, + payload, + service_sidlist_sididentity=self._solution['service_sid''list_sid''identity'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=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'], - ) + return SyncListPermissionInstance(self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], identity=self._solution['identity'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncListPermissionInstance(InstanceResource): - def __init__(self, version, payload, service_sid, list_sid, identity=None): - """ - Initialize the SyncListPermissionInstance - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ +class SyncListPermissionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, list_sid: str, identity: str): super(SyncListPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'list_sid': payload.get('list_sid'), - 'identity': payload.get('identity'), - 'read': payload.get('read'), - 'write': payload.get('write'), - 'manage': payload.get('manage'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'list_sid' = payload.get('list_sid'), + 'identity' = payload.get('identity'), + 'read' = payload.get('read'), + 'write' = payload.get('write'), + 'manage' = payload.get('manage'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'list_sid': list_sid, - 'identity': identity or self._properties['identity'], + 'service_sid': service_sid or self._properties['service_sid']'list_sid': list_sid or self._properties['list_sid']'identity': identity or self._properties['identity'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListPermissionContext for this SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext - """ if self._context is None: self._context = SyncListPermissionContext( self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['list_sid'], - identity=self._solution['identity'], + service_sid=self._solution['service_sid'],list_sid=self._solution['list_sid'],identity=self._solution['identity'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def list_sid(self): - """ - :returns: The SID of the Sync List to which the Permission applies - :rtype: unicode - """ - return self._properties['list_sid'] - - @property - def identity(self): - """ - :returns: The identity of the user to whom the Sync List Permission applies - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access - :rtype: bool - """ - return self._properties['manage'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Sync List Permission resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the SyncListPermissionInstance - :returns: The fetched SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the SyncListPermissionInstance +class SyncListPermissionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, list_sid: str): + # TODO: needs autogenerated docs + super(SyncListPermissionListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, list_sid, } + self._uri = '/Services/${service_sid}/Lists/${list_sid}/Permissions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def update(self, read, write, manage): - """ - Update the SyncListPermissionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param bool read: Read access - :param bool write: Write access - :param bool manage: Manage access - - :returns: The updated SyncListPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance - """ - return self._proxy.update(read, write, manage, ) + return SyncListPermissionPage(self._version, payload, service_sid=self._solution['service_sid']list_sid=self._solution['list_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_map.py b/twilio/rest/sync/v1/service/sync_map.py new file mode 100644 index 0000000000..354b88bd1d --- /dev/null +++ b/twilio/rest/sync/v1/service/sync_map.py @@ -0,0 +1,178 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sync_map.sync_map_item import SyncMapItemListInstancefrom twilio.rest.sync_map.sync_map_permission import SyncMapPermissionListInstance + + +class SyncMapContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SyncMapContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Maps/${sid}' + + self._sync_map_items = None + self._sync_map_permissions = None + + def delete(self): + + + """ + Deletes the SyncMapInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncMapInstance + + :returns: The fetched SyncMapInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncMapInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SyncMapInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(SyncMapInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'revision' = payload.get('revision'), + 'date_expires' = payload.get('date_expires'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SyncMapContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def sync_map_items(self): + return self._proxy.sync_map_items + @property + def sync_map_permissions(self): + return self._proxy.sync_map_permissions + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SyncMapListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(SyncMapListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Maps' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncMapPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py index 41baa916ff..4b17757fec 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,531 +19,152 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncMapItemList(ListResource): - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapItemList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - :param map_sid: The SID of the Sync Map that contains the Map Item - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - """ - super(SyncMapItemList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items'.format(**self._solution) - - 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 stream(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Streams SyncMapItemInstance 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 SyncMapItemInstance.QueryResultOrder order: How to order the Map Items returned by their key value - :param unicode from_: The index of the first Sync Map Item resource to read - :param SyncMapItemInstance.QueryFromBoundType bounds: Whether to include the Map Item referenced by the from parameter - :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.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, from_=from_, bounds=bounds, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, from_=values.unset, bounds=values.unset, - limit=None, page_size=None): - """ - Lists SyncMapItemInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SyncMapItemInstance.QueryResultOrder order: How to order the Map Items returned by their key value - :param unicode from_: The index of the first Sync Map Item resource to read - :param SyncMapItemInstance.QueryFromBoundType bounds: Whether to include the Map Item referenced by the from parameter - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance] - """ - return list(self.stream(order=order, from_=from_, bounds=bounds, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, from_=values.unset, bounds=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param SyncMapItemInstance.QueryResultOrder order: How to order the Map Items returned by their key value - :param unicode from_: The index of the first Sync Map Item resource to read - :param SyncMapItemInstance.QueryFromBoundType bounds: Whether to include the Map Item referenced by the from parameter - :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 SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - """ - data = values.of({ - 'Order': order, - 'From': from_, - 'Bounds': bounds, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncMapItemPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapItemInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapItemPage(self._version, response, self._solution) - - def get(self, key): - """ - Constructs a SyncMapItemContext - - :param key: The key value of the Sync Map Item resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.sync.v1.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, - ) - - def __call__(self, key): - """ - Constructs a SyncMapItemContext - - :param key: The key value of the Sync Map Item resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.sync.v1.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, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncMapItemPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapItemPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - :param map_sid: The SID of the Sync Map that contains the Map Item - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemPage - """ - super(SyncMapItemPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of SyncMapItemInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncMapItemContext(InstanceContext): - - def __init__(self, version, service_sid, map_sid, key): - """ - Initialize the SyncMapItemContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Sync Map Item resource to fetch - :param map_sid: The SID of the Sync Map with the Sync Map Item resource to fetch - :param key: The key value of the Sync Map Item resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - """ - super(SyncMapItemContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, map_sid: str, key: str): + # TODO: needs autogenerated docs + super(SyncMapItemContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'key': key, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Items/{key}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncMapItemInstance - - :returns: The fetched SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapItemInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], - ) - - def delete(self, if_match=values.unset): - """ - Deletes the SyncMapItemInstance - - :param unicode if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, data=values.unset, ttl=values.unset, item_ttl=values.unset, - collection_ttl=values.unset, if_match=values.unset): - """ - Update the SyncMapItemInstance + self._solution = { service_sid, map_sid, key, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Items/${key}' + + + def delete(self, if_match): + + + """ + Deletes the SyncMapItemInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncMapItemInstance + + :returns: The fetched SyncMapItemInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncMapItemInstance( + self._version, + payload, + service_sidmap_sidkey=self._solution['service_sid''map_sid''key'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - :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 + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :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'], - ) + return SyncMapItemInstance(self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SyncMapItemInstance(InstanceResource): + return '' - class QueryResultOrder(object): - ASC = "asc" - DESC = "desc" - class QueryFromBoundType(object): - INCLUSIVE = "inclusive" - EXCLUSIVE = "exclusive" - def __init__(self, version, payload, service_sid, map_sid, key=None): - """ - Initialize the SyncMapItemInstance - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ +class SyncMapItemInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, map_sid: str, key: str): super(SyncMapItemInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'key': payload.get('key'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'map_sid': payload.get('map_sid'), - 'url': payload.get('url'), - 'revision': payload.get('revision'), - 'data': payload.get('data'), - 'date_expires': deserialize.iso8601_datetime(payload.get('date_expires')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), + self._properties = { + 'key' = payload.get('key'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'map_sid' = payload.get('map_sid'), + 'url' = payload.get('url'), + 'revision' = payload.get('revision'), + 'data' = payload.get('data'), + 'date_expires' = payload.get('date_expires'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'key': key or self._properties['key'], + 'service_sid': service_sid or self._properties['service_sid']'map_sid': map_sid or self._properties['map_sid']'key': key or self._properties['key'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapItemContext for this SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemContext - """ if self._context is None: self._context = SyncMapItemContext( self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - key=self._solution['key'], + service_sid=self._solution['service_sid'],map_sid=self._solution['map_sid'],key=self._solution['key'], ) return self._context - @property - def key(self): - """ - :returns: The unique, user-defined key for the Map Item - :rtype: unicode - """ - return self._properties['key'] + - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: The SID of the Sync Map that contains the Map Item - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the Map Item resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def revision(self): - """ - :returns: The current revision of the Map Item, represented as a string - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: An arbitrary, schema-less object that the Map Item stores - :rtype: dict - """ - return self._properties['data'] - - @property - def date_expires(self): - """ - :returns: The ISO 8601 date and time in GMT when the Map Item expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The identity of the Map Item's creator - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the SyncMapItemInstance - - :returns: The fetched SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self, if_match=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the SyncMapItemInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode if_match: The If-Match HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(if_match=if_match, ) - - 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 +class SyncMapItemListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, map_sid: str): + # TODO: needs autogenerated docs + super(SyncMapItemListInstanceList, self).__init__(version) - :returns: The updated SyncMapItemInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance - """ - return self._proxy.update( - data=data, - ttl=ttl, - item_ttl=item_ttl, - collection_ttl=collection_ttl, - if_match=if_match, - ) + # Path Solution + self._solution = { service_sid, map_sid, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Items' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + 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 page(self, order, _from, bounds, page_size): + + data = values.of({ + 'order': order,'_from': _from,'bounds': bounds,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncMapItemPage(self._version, payload, service_sid=self._solution['service_sid']map_sid=self._solution['map_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py index a3e2a8b58a..f90661f95f 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py @@ -1,431 +1,157 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SyncMapPermissionList(ListResource): - - def __init__(self, version, service_sid, map_sid): - """ - Initialize the SyncMapPermissionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - :param map_sid: Sync Map SID - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - super(SyncMapPermissionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapPermissionInstance 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 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.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapPermissionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :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 SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncMapPermissionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapPermissionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPermissionPage(self._version, response, self._solution) - def get(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: The application-defined string that uniquely identifies the User's Sync Map Permission resource to fetch - - :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, - ) - - def __call__(self, identity): - """ - Constructs a SyncMapPermissionContext - - :param identity: The application-defined string that uniquely identifies the User's Sync Map Permission resource to fetch - - :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, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncMapPermissionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPermissionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - :param map_sid: Sync Map SID - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionPage - """ - super(SyncMapPermissionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapPermissionInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :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'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SyncMapPermissionContext(InstanceContext): - - def __init__(self, version, service_sid, map_sid, identity): - """ - Initialize the SyncMapPermissionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Sync Map Permission resource to fetch - :param map_sid: The SID of the Sync Map with the Sync Map Permission resource to fetch - :param identity: The application-defined string that uniquely identifies the User's Sync Map Permission resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ - super(SyncMapPermissionContext, self).__init__(version) + def __init__(self, version: V1, service_sid: str, map_sid: str, identity: str): + # TODO: needs autogenerated docs + super(SyncMapPermissionContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'map_sid': map_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Maps/{map_sid}/Permissions/{identity}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SyncMapPermissionInstance - - :returns: The fetched SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) - - def delete(self): - """ - Deletes the SyncMapPermissionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance - - :param bool read: Read access - :param bool write: Write access - :param bool manage: Manage access - - :returns: The updated SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) + self._solution = { service_sid, map_sid, identity, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Permissions/${identity}' + + + def delete(self): + + + """ + Deletes the SyncMapPermissionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncMapPermissionInstance + + :returns: The fetched SyncMapPermissionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncMapPermissionInstance( + self._version, + payload, + service_sidmap_sididentity=self._solution['service_sid''map_sid''identity'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return SyncMapPermissionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], - ) + return SyncMapPermissionInstance(self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], identity=self._solution['identity'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncMapPermissionInstance(InstanceResource): - def __init__(self, version, payload, service_sid, map_sid, identity=None): - """ - Initialize the SyncMapPermissionInstance - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ +class SyncMapPermissionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, map_sid: str, identity: str): super(SyncMapPermissionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'map_sid': payload.get('map_sid'), - 'identity': payload.get('identity'), - 'read': payload.get('read'), - 'write': payload.get('write'), - 'manage': payload.get('manage'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'map_sid' = payload.get('map_sid'), + 'identity' = payload.get('identity'), + 'read' = payload.get('read'), + 'write' = payload.get('write'), + 'manage' = payload.get('manage'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'map_sid': map_sid, - 'identity': identity or self._properties['identity'], + 'service_sid': service_sid or self._properties['service_sid']'map_sid': map_sid or self._properties['map_sid']'identity': identity or self._properties['identity'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapPermissionContext for this SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext - """ if self._context is None: self._context = SyncMapPermissionContext( self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['map_sid'], - identity=self._solution['identity'], + service_sid=self._solution['service_sid'],map_sid=self._solution['map_sid'],identity=self._solution['identity'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def map_sid(self): - """ - :returns: Sync Map SID - :rtype: unicode - """ - return self._properties['map_sid'] - - @property - def identity(self): - """ - :returns: The identity of the user to whom the Sync Document Permission applies - :rtype: unicode - """ - return self._properties['identity'] - - @property - def read(self): - """ - :returns: Read access - :rtype: bool - """ - return self._properties['read'] - - @property - def write(self): - """ - :returns: Write access - :rtype: bool - """ - return self._properties['write'] - - @property - def manage(self): - """ - :returns: Manage access - :rtype: bool - """ - return self._properties['manage'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Sync Map Permission resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the SyncMapPermissionInstance - :returns: The fetched SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the SyncMapPermissionInstance +class SyncMapPermissionListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, map_sid: str): + # TODO: needs autogenerated docs + super(SyncMapPermissionListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, map_sid, } + self._uri = '/Services/${service_sid}/Maps/${map_sid}/Permissions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def update(self, read, write, manage): - """ - Update the SyncMapPermissionInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param bool read: Read access - :param bool write: Write access - :param bool manage: Manage access - - :returns: The updated SyncMapPermissionInstance - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance - """ - return self._proxy.update(read, write, manage, ) + return SyncMapPermissionPage(self._version, payload, service_sid=self._solution['service_sid']map_sid=self._solution['map_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_stream.py b/twilio/rest/sync/v1/service/sync_stream.py new file mode 100644 index 0000000000..57e30732ff --- /dev/null +++ b/twilio/rest/sync/v1/service/sync_stream.py @@ -0,0 +1,173 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sync_stream.stream_message import StreamMessageListInstance + + +class SyncStreamContext(InstanceContext): + def __init__(self, version: V1, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SyncStreamContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Streams/${sid}' + + self._stream_messages = None + + def delete(self): + + + """ + Deletes the SyncStreamInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SyncStreamInstance + + :returns: The fetched SyncStreamInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SyncStreamInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SyncStreamInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(SyncStreamInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'date_expires' = payload.get('date_expires'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'created_by' = payload.get('created_by'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SyncStreamContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def stream_messages(self): + return self._proxy.stream_messages + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SyncStreamListInstance(ListResource): + def __init__(self, version: V1, service_sid: str): + # TODO: needs autogenerated docs + super(SyncStreamListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Streams' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncStreamPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/sync/v1/service/sync_stream/stream_message.py b/twilio/rest/sync/v1/service/sync_stream/stream_message.py index 460fc00400..775acb78cf 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -1,151 +1,90 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Sync + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class StreamMessageList(ListResource): - def __init__(self, version, service_sid, stream_sid): - """ - Initialize the StreamMessageList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - :param stream_sid: The unique string that identifies the resource - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - """ - super(StreamMessageList, self).__init__(version) - # Path Solution - self._solution = {'service_sid': service_sid, 'stream_sid': stream_sid, } - self._uri = '/Services/{service_sid}/Streams/{stream_sid}/Messages'.format(**self._solution) - - 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 +class StreamMessageInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, stream_sid: str): + super(StreamMessageInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'data' = payload.get('data'), + } - :returns: The created StreamMessageInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - """ - data = values.of({'Data': serialize.object(data), }) + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'stream_sid': stream_sid or self._properties['stream_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = StreamMessageContext( + self._version, + service_sid=self._solution['service_sid'],stream_sid=self._solution['stream_sid'], + ) + return self._context - return StreamMessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - stream_sid=self._solution['stream_sid'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class StreamMessagePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the StreamMessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - :param stream_sid: The unique string that identifies the resource - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessagePage - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessagePage - """ - super(StreamMessagePage, self).__init__(version, response) +class StreamMessageListInstance(ListResource): + def __init__(self, version: V1, service_sid: str, stream_sid: str): + # TODO: needs autogenerated docs + super(StreamMessageListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StreamMessageInstance + self._solution = { service_sid, stream_sid, } + self._uri = '/Services/${service_sid}/Streams/${stream_sid}/Messages' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - """ - return StreamMessageInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - stream_sid=self._solution['stream_sid'], - ) + return StreamMessageInstance(self._version, payload, service_sid=self._solution['service_sid']stream_sid=self._solution['stream_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + return '' -class StreamMessageInstance(InstanceResource): - - def __init__(self, version, payload, service_sid, stream_sid): - """ - Initialize the StreamMessageInstance - - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance - """ - super(StreamMessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'sid': payload.get('sid'), 'data': payload.get('data'), } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'stream_sid': stream_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def data(self): - """ - :returns: Stream Message body - :rtype: dict - """ - return self._properties['data'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/taskrouter/__init__.py b/twilio/rest/taskrouter/__init__.py index 0724e54d04..1d7d6108c8 100644 --- a/twilio/rest/taskrouter/__init__.py +++ b/twilio/rest/taskrouter/__init__.py @@ -1,52 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.taskrouter.v1 import V1 + Twilio - Taskrouter + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Taskrouter(Domain): +from twilio.base.domain import Domain +from twilio.rest.Taskrouter.v1 import V1 +class Taskrouter(Domain): def __init__(self, twilio): """ Initialize the Taskrouter Domain :returns: Domain for Taskrouter - :rtype: twilio.rest.taskrouter.Taskrouter + :rtype: twilio.rest.v1.Taskrouter """ super(Taskrouter, self).__init__(twilio) - - self.base_url = 'https://taskrouter.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Taskrouter.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of taskrouter - :rtype: twilio.rest.taskrouter.v1.V1 + :returns: Versions v1 of Taskrouter + :rtype: twilio.rest.Taskrouter.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def workspaces(self): """ - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceList + :rtype: twilio.rest.v1.workspaces """ return self.v1.workspaces + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/taskrouter/v1/.openapi-generator-ignore b/twilio/rest/taskrouter/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/taskrouter/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/taskrouter/v1/.openapi-generator/FILES b/twilio/rest/taskrouter/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..b8f10e9b4f --- /dev/null +++ b/twilio/rest/taskrouter/v1/.openapi-generator/FILES @@ -0,0 +1,51 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +workspace.py +workspace/activity.py +workspace/event.py +workspace/task.py +workspace/task/reservation.py +workspace/task_channel.py +workspace/task_queue.py +workspace/task_queue/task_queue_cumulative_statistics.py +workspace/task_queue/task_queue_real_time_statistics.py +workspace/task_queue/task_queue_statistics.py +workspace/task_queue/task_queues_statistics.py +workspace/worker.py +workspace/worker/reservation.py +workspace/worker/worker_channel.py +workspace/worker/worker_statistics.py +workspace/worker/workers_cumulative_statistics.py +workspace/worker/workers_real_time_statistics.py +workspace/worker/workers_statistics.py +workspace/workflow.py +workspace/workflow/workflow_cumulative_statistics.py +workspace/workflow/workflow_real_time_statistics.py +workspace/workflow/workflow_statistics.py +workspace/workspace_cumulative_statistics.py +workspace/workspace_real_time_statistics.py +workspace/workspace_statistics.py diff --git a/twilio/rest/taskrouter/v1/.openapi-generator/VERSION b/twilio/rest/taskrouter/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/taskrouter/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/taskrouter/v1/workspace.py b/twilio/rest/taskrouter/v1/workspace.py new file mode 100644 index 0000000000..83c235ebe8 --- /dev/null +++ b/twilio/rest/taskrouter/v1/workspace.py @@ -0,0 +1,214 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.workspace.activity import ActivityListInstancefrom twilio.rest.workspace.event import EventListInstancefrom twilio.rest.workspace.task import TaskListInstancefrom twilio.rest.workspace.task_channel import TaskChannelListInstancefrom twilio.rest.workspace.task_queue import TaskQueueListInstancefrom twilio.rest.workspace.worker import WorkerListInstancefrom twilio.rest.workspace.workflow import WorkflowListInstancefrom twilio.rest.workspace.workspace_cumulative_statistics import WorkspaceCumulativeStatisticsListInstancefrom twilio.rest.workspace.workspace_real_time_statistics import WorkspaceRealTimeStatisticsListInstancefrom twilio.rest.workspace.workspace_statistics import WorkspaceStatisticsListInstance + + +class WorkspaceContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(WorkspaceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Workspaces/${sid}' + + self._activities = None + self._events = None + self._tasks = None + self._task_channels = None + self._task_queues = None + self._workers = None + self._workflows = None + self._cumulative_statistics = None + self._real_time_statistics = None + self._statistics = None + + def delete(self): + + + """ + Deletes the WorkspaceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WorkspaceInstance + + :returns: The fetched WorkspaceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkspaceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return WorkspaceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class WorkspaceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(WorkspaceInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'default_activity_name' = payload.get('default_activity_name'), + 'default_activity_sid' = payload.get('default_activity_sid'), + 'event_callback_url' = payload.get('event_callback_url'), + 'events_filter' = payload.get('events_filter'), + 'friendly_name' = payload.get('friendly_name'), + 'multi_task_enabled' = payload.get('multi_task_enabled'), + 'sid' = payload.get('sid'), + 'timeout_activity_name' = payload.get('timeout_activity_name'), + 'timeout_activity_sid' = payload.get('timeout_activity_sid'), + 'prioritize_queue_order' = payload.get('prioritize_queue_order'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = WorkspaceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def activities(self): + return self._proxy.activities + @property + def events(self): + return self._proxy.events + @property + def tasks(self): + return self._proxy.tasks + @property + def task_channels(self): + return self._proxy.task_channels + @property + def task_queues(self): + return self._proxy.task_queues + @property + def workers(self): + return self._proxy.workers + @property + def workflows(self): + return self._proxy.workflows + @property + def cumulative_statistics(self): + return self._proxy.cumulative_statistics + @property + def real_time_statistics(self): + return self._proxy.real_time_statistics + @property + def statistics(self): + return self._proxy.statistics + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class WorkspaceListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(WorkspaceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Workspaces' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WorkspaceInstance(self._version, payload, ) + + + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WorkspacePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index a8cefb6897..b8256948eb 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -1,448 +1,168 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ActivityList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the ActivityList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Activity - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - """ - super(ActivityList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Activities'.format(**self._solution) - - def stream(self, friendly_name=values.unset, available=values.unset, limit=None, - page_size=None): - """ - Streams ActivityInstance 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 friendly_name: The friendly_name of the Activity resources to read - :param unicode available: Whether to return activities that are available or unavailable - :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.taskrouter.v1.workspace.activity.ActivityInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, available=available, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, available=values.unset, limit=None, - page_size=None): - """ - Lists ActivityInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name of the Activity resources to read - :param unicode available: Whether to return activities that are available or unavailable - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.taskrouter.v1.workspace.activity.ActivityInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - available=available, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, available=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ActivityInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name of the Activity resources to read - :param unicode available: Whether to return activities that are available or unavailable - :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 ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Available': available, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ActivityPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ActivityInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ActivityPage(self._version, response, self._solution) - - def create(self, friendly_name, available=values.unset): - """ - Create the ActivityInstance - - :param unicode friendly_name: A string to describe the Activity resource - :param bool available: Whether the Worker should be eligible to receive a Task when it occupies the Activity - - :returns: The created ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Available': available, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ActivityInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - def get(self, sid): - """ - Constructs a ActivityContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ - return ActivityContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ActivityContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ - return ActivityContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ActivityPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ActivityPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Activity - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityPage - """ - super(ActivityPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ActivityInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - return ActivityInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ActivityContext(InstanceContext): - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the ActivityContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Activity resources to fetch - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ - super(ActivityContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ActivityContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Activities/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ActivityInstance - - :returns: The fetched ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ActivityInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset): - """ - Update the ActivityInstance - - :param unicode friendly_name: A string to describe the Activity resource - - :returns: The updated ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ActivityInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) + self._solution = { workspace_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Activities/${sid}' + + + def delete(self): + + + """ + Deletes the ActivityInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ActivityInstance + + :returns: The fetched ActivityInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ActivityInstance( + self._version, + payload, + workspace_sidsid=self._solution['workspace_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the ActivityInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return ActivityInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ActivityInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the ActivityInstance - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ +class ActivityInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): super(ActivityInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'available': payload.get('available'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'available' = payload.get('available'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ActivityContext for this ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityContext - """ if self._context is None: self._context = ActivityContext( self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def available(self): - """ - :returns: Whether the Worker should be eligible to receive a Task when it occupies the Activity - :rtype: bool - """ - return self._properties['available'] + - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Activity resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the Activity - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the Activity resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ActivityInstance - - :returns: The fetched ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ActivityInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the Activity resource - :returns: The updated ActivityInstance - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - def delete(self): - """ - Deletes the ActivityInstance +class ActivityListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(ActivityListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Activities' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ActivityInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def page(self, friendly_name, available, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'available': available,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ActivityPage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/event.py b/twilio/rest/taskrouter/v1/workspace/event.py index 7a689b5159..8f3c57c836 100644 --- a/twilio/rest/taskrouter/v1/workspace/event.py +++ b/twilio/rest/taskrouter/v1/workspace/event.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,515 +19,126 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EventList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the EventList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Event - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventList - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventList - """ - super(EventList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Events'.format(**self._solution) - - def stream(self, end_date=values.unset, event_type=values.unset, - minutes=values.unset, reservation_sid=values.unset, - start_date=values.unset, task_queue_sid=values.unset, - task_sid=values.unset, worker_sid=values.unset, - workflow_sid=values.unset, task_channel=values.unset, - sid=values.unset, limit=None, page_size=None): - """ - Streams EventInstance 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 datetime end_date: Only include usage that occurred on or before this date - :param unicode event_type: The type of Events to read - :param unicode minutes: The period of events to read in minutes - :param unicode reservation_sid: The SID of the Reservation with the Events to read - :param datetime start_date: Only include Events from on or after this date - :param unicode task_queue_sid: The SID of the TaskQueue with the Events to read - :param unicode task_sid: The SID of the Task with the Events to read - :param unicode worker_sid: The SID of the Worker with the Events to read - :param unicode workflow_sid: The SID of the Worker with the Events to read - :param unicode task_channel: The TaskChannel with the Events to read - :param unicode sid: The unique string that identifies the resource - :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.taskrouter.v1.workspace.event.EventInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - end_date=end_date, - event_type=event_type, - minutes=minutes, - reservation_sid=reservation_sid, - start_date=start_date, - task_queue_sid=task_queue_sid, - task_sid=task_sid, - worker_sid=worker_sid, - workflow_sid=workflow_sid, - task_channel=task_channel, - sid=sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, end_date=values.unset, event_type=values.unset, - minutes=values.unset, reservation_sid=values.unset, - start_date=values.unset, task_queue_sid=values.unset, - task_sid=values.unset, worker_sid=values.unset, - workflow_sid=values.unset, task_channel=values.unset, sid=values.unset, - limit=None, page_size=None): - """ - Lists EventInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode event_type: The type of Events to read - :param unicode minutes: The period of events to read in minutes - :param unicode reservation_sid: The SID of the Reservation with the Events to read - :param datetime start_date: Only include Events from on or after this date - :param unicode task_queue_sid: The SID of the TaskQueue with the Events to read - :param unicode task_sid: The SID of the Task with the Events to read - :param unicode worker_sid: The SID of the Worker with the Events to read - :param unicode workflow_sid: The SID of the Worker with the Events to read - :param unicode task_channel: The TaskChannel with the Events to read - :param unicode sid: The unique string that identifies the resource - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.taskrouter.v1.workspace.event.EventInstance] - """ - return list(self.stream( - end_date=end_date, - event_type=event_type, - minutes=minutes, - reservation_sid=reservation_sid, - start_date=start_date, - task_queue_sid=task_queue_sid, - task_sid=task_sid, - worker_sid=worker_sid, - workflow_sid=workflow_sid, - task_channel=task_channel, - sid=sid, - limit=limit, - page_size=page_size, - )) - - def page(self, end_date=values.unset, event_type=values.unset, - minutes=values.unset, reservation_sid=values.unset, - start_date=values.unset, task_queue_sid=values.unset, - task_sid=values.unset, worker_sid=values.unset, - workflow_sid=values.unset, task_channel=values.unset, sid=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EventInstance records from the API. - Request is executed immediately - - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode event_type: The type of Events to read - :param unicode minutes: The period of events to read in minutes - :param unicode reservation_sid: The SID of the Reservation with the Events to read - :param datetime start_date: Only include Events from on or after this date - :param unicode task_queue_sid: The SID of the TaskQueue with the Events to read - :param unicode task_sid: The SID of the Task with the Events to read - :param unicode worker_sid: The SID of the Worker with the Events to read - :param unicode workflow_sid: The SID of the Worker with the Events to read - :param unicode task_channel: The TaskChannel with the Events to read - :param unicode sid: The unique string that identifies the resource - :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 EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage - """ - data = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'EventType': event_type, - 'Minutes': minutes, - 'ReservationSid': reservation_sid, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskQueueSid': task_queue_sid, - 'TaskSid': task_sid, - 'WorkerSid': worker_sid, - 'WorkflowSid': workflow_sid, - 'TaskChannel': task_channel, - 'Sid': sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EventPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EventInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EventPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EventContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ - return EventContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EventContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ - return EventContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.page import Page -class EventPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EventPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Event - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventPage - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage - """ - super(EventPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EventInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.taskrouter.v1.workspace.event.EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ - return EventInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class EventContext(InstanceContext): - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the EventContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Event to fetch - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ - super(EventContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super(EventContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Events/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EventInstance - - :returns: The fetched EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EventInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) + self._solution = { workspace_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Events/${sid}' + + + def fetch(self): + + """ + Fetch the EventInstance + + :returns: The fetched EventInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EventInstance( + self._version, + payload, + workspace_sidsid=self._solution['workspace_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class EventInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the EventInstance - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ +class EventInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): super(EventInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'actor_sid': payload.get('actor_sid'), - 'actor_type': payload.get('actor_type'), - 'actor_url': payload.get('actor_url'), - 'description': payload.get('description'), - 'event_data': payload.get('event_data'), - 'event_date': deserialize.iso8601_datetime(payload.get('event_date')), - 'event_date_ms': deserialize.integer(payload.get('event_date_ms')), - 'event_type': payload.get('event_type'), - 'resource_sid': payload.get('resource_sid'), - 'resource_type': payload.get('resource_type'), - 'resource_url': payload.get('resource_url'), - 'sid': payload.get('sid'), - 'source': payload.get('source'), - 'source_ip_address': payload.get('source_ip_address'), - 'url': payload.get('url'), - 'workspace_sid': payload.get('workspace_sid'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'actor_sid' = payload.get('actor_sid'), + 'actor_type' = payload.get('actor_type'), + 'actor_url' = payload.get('actor_url'), + 'description' = payload.get('description'), + 'event_data' = payload.get('event_data'), + 'event_date' = payload.get('event_date'), + 'event_date_ms' = payload.get('event_date_ms'), + 'event_type' = payload.get('event_type'), + 'resource_sid' = payload.get('resource_sid'), + 'resource_type' = payload.get('resource_type'), + 'resource_url' = payload.get('resource_url'), + 'sid' = payload.get('sid'), + 'source' = payload.get('source'), + 'source_ip_address' = payload.get('source_ip_address'), + 'url' = payload.get('url'), + 'workspace_sid' = payload.get('workspace_sid'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EventContext for this EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext - """ if self._context is None: self._context = EventContext( self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def actor_sid(self): - """ - :returns: The SID of the resource that triggered the event - :rtype: unicode - """ - return self._properties['actor_sid'] - - @property - def actor_type(self): - """ - :returns: The type of resource that triggered the event - :rtype: unicode - """ - return self._properties['actor_type'] - - @property - def actor_url(self): - """ - :returns: The absolute URL of the resource that triggered the event - :rtype: unicode - """ - return self._properties['actor_url'] - - @property - def description(self): - """ - :returns: A description of the event - :rtype: unicode - """ - return self._properties['description'] - - @property - def event_data(self): - """ - :returns: Data about the event - :rtype: dict - """ - return self._properties['event_data'] - - @property - def event_date(self): - """ - :returns: The time the event was sent - :rtype: datetime - """ - return self._properties['event_date'] - - @property - def event_date_ms(self): - """ - :returns: The time the event was sent in milliseconds - :rtype: unicode - """ - return self._properties['event_date_ms'] - - @property - def event_type(self): - """ - :returns: The identifier for the event - :rtype: unicode - """ - return self._properties['event_type'] - - @property - def resource_sid(self): - """ - :returns: The SID of the object the event is most relevant to - :rtype: unicode - """ - return self._properties['resource_sid'] + - @property - def resource_type(self): - """ - :returns: The type of object the event is most relevant to - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def resource_url(self): - """ - :returns: The URL of the resource the event is most relevant to - :rtype: unicode - """ - return self._properties['resource_url'] - - @property - def sid(self): + def __repr__(self): """ - :returns: The unique string that identifies the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def source(self): - """ - :returns: Where the Event originated - :rtype: unicode - """ - return self._properties['source'] - @property - def source_ip_address(self): - """ - :returns: The IP from which the Event originated - :rtype: unicode - """ - return self._properties['source_ip_address'] - @property - def url(self): - """ - :returns: The absolute URL of the Event resource - :rtype: unicode - """ - return self._properties['url'] +class EventListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(EventListInstanceList, self).__init__(version) - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the Event - :rtype: unicode - """ - return self._properties['workspace_sid'] + # Path Solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Events' + + + def page(self, end_date, event_type, minutes, reservation_sid, start_date, task_queue_sid, task_sid, worker_sid, workflow_sid, task_channel, sid, page_size): + + data = values.of({ + 'end_date': end_date,'event_type': event_type,'minutes': minutes,'reservation_sid': reservation_sid,'start_date': start_date,'task_queue_sid': task_queue_sid,'task_sid': task_sid,'worker_sid': worker_sid,'workflow_sid': workflow_sid,'task_channel': task_channel,'sid': sid,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the EventInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched EventInstance - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance - """ - return self._proxy.fetch() + return EventPage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task.py b/twilio/rest/taskrouter/v1/workspace/task.py new file mode 100644 index 0000000000..7204e86ee8 --- /dev/null +++ b/twilio/rest/taskrouter/v1/workspace/task.py @@ -0,0 +1,184 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.task.reservation import ReservationListInstance + + +class TaskContext(InstanceContext): + def __init__(self, version: V1, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TaskContextList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Tasks/${sid}' + + self._reservations = None + + def delete(self, if_match): + + + """ + Deletes the TaskInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TaskInstance + + :returns: The fetched TaskInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskInstance( + self._version, + payload, + workspace_sidsid=self._solution['workspace_sid''sid'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class TaskInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super(TaskInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'age' = payload.get('age'), + 'assignment_status' = payload.get('assignment_status'), + 'attributes' = payload.get('attributes'), + 'addons' = payload.get('addons'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'task_queue_entered_date' = payload.get('task_queue_entered_date'), + 'priority' = payload.get('priority'), + 'reason' = payload.get('reason'), + 'sid' = payload.get('sid'), + 'task_queue_sid' = payload.get('task_queue_sid'), + 'task_queue_friendly_name' = payload.get('task_queue_friendly_name'), + 'task_channel_sid' = payload.get('task_channel_sid'), + 'task_channel_unique_name' = payload.get('task_channel_unique_name'), + 'timeout' = payload.get('timeout'), + 'workflow_sid' = payload.get('workflow_sid'), + 'workflow_friendly_name' = payload.get('workflow_friendly_name'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = TaskContext( + self._version, + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def reservations(self): + return self._proxy.reservations + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class TaskListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(TaskListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Tasks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def page(self, priority, assignment_status, workflow_sid, workflow_name, task_queue_sid, task_queue_name, evaluate_task_attributes, ordering, has_addons, page_size): + + data = values.of({ + 'priority': priority,'assignment_status': assignment_status,'workflow_sid': workflow_sid,'workflow_name': workflow_name,'task_queue_sid': task_queue_sid,'task_queue_name': task_queue_name,'evaluate_task_attributes': evaluate_task_attributes,'ordering': ordering,'has_addons': has_addons,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TaskPage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index b9bced3ef7..a757595bec 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,763 +19,131 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ReservationList(ListResource): - - def __init__(self, version, workspace_sid, task_sid): - """ - Initialize the ReservationList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that this task is contained within. - :param task_sid: The SID of the reserved Task resource - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - """ - super(ReservationList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_sid': task_sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks/{task_sid}/Reservations'.format(**self._solution) - - def stream(self, reservation_status=values.unset, worker_sid=values.unset, - limit=None, page_size=None): - """ - Streams ReservationInstance 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 ReservationInstance.Status reservation_status: Returns the list of reservations for a task with a specified ReservationStatus - :param unicode worker_sid: The SID of the reserved Worker resource to read - :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.taskrouter.v1.workspace.task.reservation.ReservationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - reservation_status=reservation_status, - worker_sid=worker_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, reservation_status=values.unset, worker_sid=values.unset, - limit=None, page_size=None): - """ - Lists ReservationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ReservationInstance.Status reservation_status: Returns the list of reservations for a task with a specified ReservationStatus - :param unicode worker_sid: The SID of the reserved Worker resource to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.taskrouter.v1.workspace.task.reservation.ReservationInstance] - """ - return list(self.stream( - reservation_status=reservation_status, - worker_sid=worker_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, reservation_status=values.unset, worker_sid=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ReservationInstance records from the API. - Request is executed immediately - - :param ReservationInstance.Status reservation_status: Returns the list of reservations for a task with a specified ReservationStatus - :param unicode worker_sid: The SID of the reserved Worker resource to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - """ - data = values.of({ - 'ReservationStatus': reservation_status, - 'WorkerSid': worker_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ReservationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ReservationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ReservationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ReservationContext - :param sid: The SID of the TaskReservation resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ReservationContext - - :param sid: The SID of the TaskReservation resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ReservationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ReservationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that this task is contained within. - :param task_sid: The SID of the reserved Task resource - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationPage - """ - super(ReservationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ReservationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ReservationContext(InstanceContext): - - def __init__(self, version, workspace_sid, task_sid, sid): - """ - Initialize the ReservationContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the TaskReservation resource to fetch - :param task_sid: The SID of the reserved Task resource with the TaskReservation resource to fetch - :param sid: The SID of the TaskReservation resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ - super(ReservationContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, task_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ReservationContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_sid': task_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks/{task_sid}/Reservations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ReservationInstance - - :returns: The fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) - - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset, supervisor_mode=values.unset, - supervisor=values.unset, - end_conference_on_customer_exit=values.unset, - beep_on_customer_entrance=values.unset, if_match=values.unset): - """ - Update the ReservationInstance - - :param ReservationInstance.Status reservation_status: The new status of the reservation - :param unicode worker_activity_sid: The new worker activity SID if rejecting a reservation - :param unicode instruction: The assignment instruction for reservation - :param unicode dequeue_post_work_activity_sid: The SID of the Activity resource to start after executing a Dequeue instruction - :param unicode dequeue_from: The Caller ID of the call to the worker when executing a Dequeue instruction - :param unicode dequeue_record: Whether to record both legs of a call when executing a Dequeue instruction - :param unicode dequeue_timeout: Timeout for call when executing a Dequeue instruction - :param unicode dequeue_to: The Contact URI of the worker when executing a Dequeue instruction - :param unicode dequeue_status_callback_url: The Callback URL for completed call event when executing a Dequeue instruction - :param unicode call_from: The Caller ID of the outbound call when executing a Call instruction - :param unicode call_record: Whether to record both legs of a call when executing a Call instruction - :param unicode call_timeout: Timeout for call when executing a Call instruction - :param unicode call_to: The Contact URI of the worker when executing a Call instruction - :param unicode call_url: TwiML URI executed on answering the worker's leg as a result of the Call instruction - :param unicode call_status_callback_url: The URL to call for the completed call event when executing a Call instruction - :param bool call_accept: Whether to accept a reservation when executing a Call instruction - :param unicode redirect_call_sid: The Call SID of the call parked in the queue when executing a Redirect instruction - :param bool redirect_accept: Whether the reservation should be accepted when executing a Redirect instruction - :param unicode redirect_url: TwiML URI to redirect the call to when executing the Redirect instruction - :param unicode to: The Contact URI of the worker when executing a Conference instruction - :param unicode from_: The Caller ID of the call to the worker when executing a Conference instruction - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param list[ReservationInstance.CallStatus] status_callback_event: The call progress events that we will send to status_callback - :param unicode timeout: Timeout for call when executing a Conference instruction - :param bool record: Whether to record the participant and their conferences - :param bool muted: Whether to mute the agent - :param unicode beep: Whether to play a notification beep when the participant joins - :param bool start_conference_on_enter: Whether the conference starts when the participant joins the conference - :param bool end_conference_on_exit: Whether to end the conference when the agent leaves - :param unicode wait_url: URL that hosts pre-conference hold music - :param unicode wait_method: The HTTP method we should use to call `wait_url` - :param bool early_media: Whether agents can hear the state of the outbound call - :param unicode max_participants: The maximum number of agent conference participants - :param unicode conference_status_callback: The callback URL for conference events - :param unicode conference_status_callback_method: HTTP method for requesting `conference_status_callback` URL - :param list[ReservationInstance.ConferenceEvent] conference_status_callback_event: The conference status events that we will send to conference_status_callback - :param unicode conference_record: Whether to record the conference the participant is joining - :param unicode conference_trim: How to trim leading and trailing silence from your recorded conference audio files - :param unicode recording_channels: Specify `mono` or `dual` recording channels - :param unicode recording_status_callback: The URL that we should call using the `recording_status_callback_method` when the recording status changes - :param unicode recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback` - :param unicode conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available - :param unicode conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback` - :param unicode region: The region where we should mix the conference audio - :param unicode sip_auth_username: The SIP username used for authentication - :param unicode sip_auth_password: The SIP password for authentication - :param list[unicode] dequeue_status_callback_event: The Call progress events sent via webhooks as a result of a Dequeue instruction - :param unicode post_work_activity_sid: The new worker activity SID after executing a Conference instruction - :param ReservationInstance.SupervisorMode supervisor_mode: The Supervisor mode when executing the Supervise instruction - :param unicode supervisor: The Supervisor SID/URI when executing the Supervise instruction - :param bool end_conference_on_customer_exit: Whether to end the conference when the customer leaves - :param bool beep_on_customer_entrance: Whether to play a notification beep when the customer joins - :param unicode if_match: The If-Match HTTP request header - - :returns: The updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - data = values.of({ - 'ReservationStatus': reservation_status, - 'WorkerActivitySid': worker_activity_sid, - 'Instruction': instruction, - 'DequeuePostWorkActivitySid': dequeue_post_work_activity_sid, - 'DequeueFrom': dequeue_from, - 'DequeueRecord': dequeue_record, - 'DequeueTimeout': dequeue_timeout, - 'DequeueTo': dequeue_to, - 'DequeueStatusCallbackUrl': dequeue_status_callback_url, - 'CallFrom': call_from, - 'CallRecord': call_record, - 'CallTimeout': call_timeout, - 'CallTo': call_to, - 'CallUrl': call_url, - 'CallStatusCallbackUrl': call_status_callback_url, - 'CallAccept': call_accept, - 'RedirectCallSid': redirect_call_sid, - 'RedirectAccept': redirect_accept, - 'RedirectUrl': redirect_url, - 'To': to, - 'From': from_, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'Timeout': timeout, - 'Record': record, - 'Muted': muted, - 'Beep': beep, - 'StartConferenceOnEnter': start_conference_on_enter, - 'EndConferenceOnExit': end_conference_on_exit, - 'WaitUrl': wait_url, - 'WaitMethod': wait_method, - 'EarlyMedia': early_media, - 'MaxParticipants': max_participants, - 'ConferenceStatusCallback': conference_status_callback, - 'ConferenceStatusCallbackMethod': conference_status_callback_method, - 'ConferenceStatusCallbackEvent': serialize.map(conference_status_callback_event, lambda e: e), - 'ConferenceRecord': conference_record, - 'ConferenceTrim': conference_trim, - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'ConferenceRecordingStatusCallback': conference_recording_status_callback, - 'ConferenceRecordingStatusCallbackMethod': conference_recording_status_callback_method, - 'Region': region, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'DequeueStatusCallbackEvent': serialize.map(dequeue_status_callback_event, lambda e: e), - 'PostWorkActivitySid': post_work_activity_sid, - 'SupervisorMode': supervisor_mode, - 'Supervisor': supervisor, - 'EndConferenceOnCustomerExit': end_conference_on_customer_exit, - 'BeepOnCustomerEntrance': beep_on_customer_entrance, - }) - headers = values.of({'If-Match': if_match, }) + self._solution = { workspace_sid, task_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Tasks/${task_sid}/Reservations/${sid}' + + + def fetch(self): + + """ + Fetch the ReservationInstance + + :returns: The fetched ReservationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ReservationInstance( + self._version, + payload, + workspace_sidtask_sidsid=self._solution['workspace_sid''task_sid''sid'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], - ) + return ReservationInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], task_sid=self._solution['task_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ReservationInstance(InstanceResource): - - class Status(object): - PENDING = "pending" - ACCEPTED = "accepted" - REJECTED = "rejected" - TIMEOUT = "timeout" - CANCELED = "canceled" - RESCINDED = "rescinded" - WRAPPING = "wrapping" - COMPLETED = "completed" - - class CallStatus(object): - INITIATED = "initiated" - RINGING = "ringing" - ANSWERED = "answered" - COMPLETED = "completed" + return '' - class ConferenceEvent(object): - START = "start" - END = "end" - JOIN = "join" - LEAVE = "leave" - MUTE = "mute" - HOLD = "hold" - SPEAKER = "speaker" - class SupervisorMode(object): - MONITOR = "monitor" - WHISPER = "whisper" - BARGE = "barge" - def __init__(self, version, payload, workspace_sid, task_sid, sid=None): - """ - Initialize the ReservationInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ +class ReservationInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, task_sid: str, sid: str): super(ReservationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'reservation_status': payload.get('reservation_status'), - 'sid': payload.get('sid'), - 'task_sid': payload.get('task_sid'), - 'worker_name': payload.get('worker_name'), - 'worker_sid': payload.get('worker_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'reservation_status' = payload.get('reservation_status'), + 'sid' = payload.get('sid'), + 'task_sid' = payload.get('task_sid'), + 'worker_name' = payload.get('worker_name'), + 'worker_sid' = payload.get('worker_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None self._solution = { - 'workspace_sid': workspace_sid, - 'task_sid': task_sid, - 'sid': sid or self._properties['sid'], + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'task_sid': task_sid or self._properties['task_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ReservationContext for this ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationContext - """ if self._context is None: self._context = ReservationContext( self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['task_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],task_sid=self._solution['task_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def reservation_status(self): - """ - :returns: The current status of the reservation - :rtype: ReservationInstance.Status - """ - return self._properties['reservation_status'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_sid(self): - """ - :returns: The SID of the reserved Task resource - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def worker_name(self): - """ - :returns: The friendly_name of the Worker that is reserved - :rtype: unicode - """ - return self._properties['worker_name'] - - @property - def worker_sid(self): - """ - :returns: The SID of the reserved Worker resource - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that this task is contained within. - :rtype: unicode - """ - return self._properties['workspace_sid'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the TaskReservation reservation - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the ReservationInstance - :returns: The fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - return self._proxy.fetch() +class ReservationListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, task_sid: str): + # TODO: needs autogenerated docs + super(ReservationListInstanceList, self).__init__(version) - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset, supervisor_mode=values.unset, - supervisor=values.unset, - end_conference_on_customer_exit=values.unset, - beep_on_customer_entrance=values.unset, if_match=values.unset): - """ - Update the ReservationInstance + # Path Solution + self._solution = { workspace_sid, task_sid, } + self._uri = '/Workspaces/${workspace_sid}/Tasks/${task_sid}/Reservations' + + + def page(self, reservation_status, worker_sid, page_size): + + data = values.of({ + 'reservation_status': reservation_status,'worker_sid': worker_sid,'page_size': page_size, + }) - :param ReservationInstance.Status reservation_status: The new status of the reservation - :param unicode worker_activity_sid: The new worker activity SID if rejecting a reservation - :param unicode instruction: The assignment instruction for reservation - :param unicode dequeue_post_work_activity_sid: The SID of the Activity resource to start after executing a Dequeue instruction - :param unicode dequeue_from: The Caller ID of the call to the worker when executing a Dequeue instruction - :param unicode dequeue_record: Whether to record both legs of a call when executing a Dequeue instruction - :param unicode dequeue_timeout: Timeout for call when executing a Dequeue instruction - :param unicode dequeue_to: The Contact URI of the worker when executing a Dequeue instruction - :param unicode dequeue_status_callback_url: The Callback URL for completed call event when executing a Dequeue instruction - :param unicode call_from: The Caller ID of the outbound call when executing a Call instruction - :param unicode call_record: Whether to record both legs of a call when executing a Call instruction - :param unicode call_timeout: Timeout for call when executing a Call instruction - :param unicode call_to: The Contact URI of the worker when executing a Call instruction - :param unicode call_url: TwiML URI executed on answering the worker's leg as a result of the Call instruction - :param unicode call_status_callback_url: The URL to call for the completed call event when executing a Call instruction - :param bool call_accept: Whether to accept a reservation when executing a Call instruction - :param unicode redirect_call_sid: The Call SID of the call parked in the queue when executing a Redirect instruction - :param bool redirect_accept: Whether the reservation should be accepted when executing a Redirect instruction - :param unicode redirect_url: TwiML URI to redirect the call to when executing the Redirect instruction - :param unicode to: The Contact URI of the worker when executing a Conference instruction - :param unicode from_: The Caller ID of the call to the worker when executing a Conference instruction - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param list[ReservationInstance.CallStatus] status_callback_event: The call progress events that we will send to status_callback - :param unicode timeout: Timeout for call when executing a Conference instruction - :param bool record: Whether to record the participant and their conferences - :param bool muted: Whether to mute the agent - :param unicode beep: Whether to play a notification beep when the participant joins - :param bool start_conference_on_enter: Whether the conference starts when the participant joins the conference - :param bool end_conference_on_exit: Whether to end the conference when the agent leaves - :param unicode wait_url: URL that hosts pre-conference hold music - :param unicode wait_method: The HTTP method we should use to call `wait_url` - :param bool early_media: Whether agents can hear the state of the outbound call - :param unicode max_participants: The maximum number of agent conference participants - :param unicode conference_status_callback: The callback URL for conference events - :param unicode conference_status_callback_method: HTTP method for requesting `conference_status_callback` URL - :param list[ReservationInstance.ConferenceEvent] conference_status_callback_event: The conference status events that we will send to conference_status_callback - :param unicode conference_record: Whether to record the conference the participant is joining - :param unicode conference_trim: How to trim leading and trailing silence from your recorded conference audio files - :param unicode recording_channels: Specify `mono` or `dual` recording channels - :param unicode recording_status_callback: The URL that we should call using the `recording_status_callback_method` when the recording status changes - :param unicode recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback` - :param unicode conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available - :param unicode conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback` - :param unicode region: The region where we should mix the conference audio - :param unicode sip_auth_username: The SIP username used for authentication - :param unicode sip_auth_password: The SIP password for authentication - :param list[unicode] dequeue_status_callback_event: The Call progress events sent via webhooks as a result of a Dequeue instruction - :param unicode post_work_activity_sid: The new worker activity SID after executing a Conference instruction - :param ReservationInstance.SupervisorMode supervisor_mode: The Supervisor mode when executing the Supervise instruction - :param unicode supervisor: The Supervisor SID/URI when executing the Supervise instruction - :param bool end_conference_on_customer_exit: Whether to end the conference when the customer leaves - :param bool beep_on_customer_entrance: Whether to play a notification beep when the customer joins - :param unicode if_match: The If-Match HTTP request header + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationInstance - """ - return self._proxy.update( - reservation_status=reservation_status, - worker_activity_sid=worker_activity_sid, - instruction=instruction, - dequeue_post_work_activity_sid=dequeue_post_work_activity_sid, - dequeue_from=dequeue_from, - dequeue_record=dequeue_record, - dequeue_timeout=dequeue_timeout, - dequeue_to=dequeue_to, - dequeue_status_callback_url=dequeue_status_callback_url, - call_from=call_from, - call_record=call_record, - call_timeout=call_timeout, - call_to=call_to, - call_url=call_url, - call_status_callback_url=call_status_callback_url, - call_accept=call_accept, - redirect_call_sid=redirect_call_sid, - redirect_accept=redirect_accept, - redirect_url=redirect_url, - to=to, - from_=from_, - status_callback=status_callback, - status_callback_method=status_callback_method, - status_callback_event=status_callback_event, - timeout=timeout, - record=record, - muted=muted, - beep=beep, - start_conference_on_enter=start_conference_on_enter, - end_conference_on_exit=end_conference_on_exit, - wait_url=wait_url, - wait_method=wait_method, - early_media=early_media, - max_participants=max_participants, - conference_status_callback=conference_status_callback, - conference_status_callback_method=conference_status_callback_method, - conference_status_callback_event=conference_status_callback_event, - conference_record=conference_record, - conference_trim=conference_trim, - recording_channels=recording_channels, - recording_status_callback=recording_status_callback, - recording_status_callback_method=recording_status_callback_method, - conference_recording_status_callback=conference_recording_status_callback, - conference_recording_status_callback_method=conference_recording_status_callback_method, - region=region, - sip_auth_username=sip_auth_username, - sip_auth_password=sip_auth_password, - dequeue_status_callback_event=dequeue_status_callback_event, - post_work_activity_sid=post_work_activity_sid, - supervisor_mode=supervisor_mode, - supervisor=supervisor, - end_conference_on_customer_exit=end_conference_on_customer_exit, - beep_on_customer_entrance=beep_on_customer_entrance, - if_match=if_match, - ) + return ReservationPage(self._version, payload, workspace_sid=self._solution['workspace_sid']task_sid=self._solution['task_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index ab4277cc4a..f06f197902 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -1,453 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskChannelList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskChannelList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Task Channel - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - """ - super(TaskChannelList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskChannels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TaskChannelInstance 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 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.taskrouter.v1.workspace.task_channel.TaskChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TaskChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.taskrouter.v1.workspace.task_channel.TaskChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TaskChannelInstance records from the API. - Request is executed immediately - - :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 TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TaskChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskChannelPage(self._version, response, self._solution) - - def create(self, friendly_name, unique_name, - channel_optimized_routing=values.unset): - """ - Create the TaskChannelInstance - - :param unicode friendly_name: A string to describe the Task Channel resource - :param unicode unique_name: An application-defined string that uniquely identifies the Task Channel - :param bool channel_optimized_routing: Whether the Task Channel should prioritize Workers that have been idle - - :returns: The created TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'ChannelOptimizedRouting': channel_optimized_routing, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TaskChannelInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - def get(self, sid): - """ - Constructs a TaskChannelContext - - :param sid: The SID of the Task Channel resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ - return TaskChannelContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskChannelContext - - :param sid: The SID of the Task Channel resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ - return TaskChannelContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TaskChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Task Channel - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelPage - """ - super(TaskChannelPage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of TaskChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - return TaskChannelInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskChannelContext(InstanceContext): - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the TaskChannelContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Task Channel to fetch - :param sid: The SID of the Task Channel resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ - super(TaskChannelContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TaskChannelContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskChannels/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the TaskChannelInstance - - :returns: The fetched TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, - channel_optimized_routing=values.unset): - """ - Update the TaskChannelInstance - - :param unicode friendly_name: A string to describe the Task Channel resource - :param bool channel_optimized_routing: Whether the TaskChannel should prioritize Workers that have been idle - - :returns: The updated TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ChannelOptimizedRouting': channel_optimized_routing, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return TaskChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) + self._solution = { workspace_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskChannels/${sid}' + + + def delete(self): + + + """ + Deletes the TaskChannelInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TaskChannelInstance + + :returns: The fetched TaskChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskChannelInstance( + self._version, + payload, + workspace_sidsid=self._solution['workspace_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the TaskChannelInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return TaskChannelInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TaskChannelInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the TaskChannelInstance - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ +class TaskChannelInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): super(TaskChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'workspace_sid': payload.get('workspace_sid'), - 'channel_optimized_routing': payload.get('channel_optimized_routing'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'workspace_sid' = payload.get('workspace_sid'), + 'channel_optimized_routing' = payload.get('channel_optimized_routing'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskChannelContext for this TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelContext - """ if self._context is None: self._context = TaskChannelContext( self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the Task Channel - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the Task Channel - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def channel_optimized_routing(self): - """ - :returns: Whether the Task Channel will prioritize Workers that have been idle - :rtype: bool - """ - return self._properties['channel_optimized_routing'] - - @property - def url(self): - """ - :returns: The absolute URL of the Task Channel resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the TaskChannelInstance - - :returns: The fetched TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, - channel_optimized_routing=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the TaskChannelInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the Task Channel resource - :param bool channel_optimized_routing: Whether the TaskChannel should prioritize Workers that have been idle - :returns: The updated TaskChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - channel_optimized_routing=channel_optimized_routing, - ) - def delete(self): - """ - Deletes the TaskChannelInstance +class TaskChannelListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(TaskChannelListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskChannels' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TaskChannelInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TaskChannelPage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue.py b/twilio/rest/taskrouter/v1/workspace/task_queue.py new file mode 100644 index 0000000000..3eb8e8e11e --- /dev/null +++ b/twilio/rest/taskrouter/v1/workspace/task_queue.py @@ -0,0 +1,187 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.task_queue.task_queue_cumulative_statistics import TaskQueueCumulativeStatisticsListInstancefrom twilio.rest.task_queue.task_queue_real_time_statistics import TaskQueueRealTimeStatisticsListInstancefrom twilio.rest.task_queue.task_queue_statistics import TaskQueueStatisticsListInstancefrom twilio.rest.task_queue.task_queues_statistics import TaskQueuesStatisticsListInstance + + +class TaskQueueContext(InstanceContext): + def __init__(self, version: V1, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TaskQueueContextList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues/${sid}' + + self._cumulative_statistics = None + self._real_time_statistics = None + self._statistics = None + + def delete(self): + + + """ + Deletes the TaskQueueInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TaskQueueInstance + + :returns: The fetched TaskQueueInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskQueueInstance( + self._version, + payload, + workspace_sidsid=self._solution['workspace_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class TaskQueueInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super(TaskQueueInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assignment_activity_sid' = payload.get('assignment_activity_sid'), + 'assignment_activity_name' = payload.get('assignment_activity_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'max_reserved_workers' = payload.get('max_reserved_workers'), + 'reservation_activity_sid' = payload.get('reservation_activity_sid'), + 'reservation_activity_name' = payload.get('reservation_activity_name'), + 'sid' = payload.get('sid'), + 'target_workers' = payload.get('target_workers'), + 'task_order' = payload.get('task_order'), + 'url' = payload.get('url'), + 'workspace_sid' = payload.get('workspace_sid'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = TaskQueueContext( + self._version, + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def cumulative_statistics(self): + return self._proxy.cumulative_statistics + @property + def real_time_statistics(self): + return self._proxy.real_time_statistics + @property + def statistics(self): + return self._proxy.statistics + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class TaskQueueListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(TaskQueueListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues' + + self._statistics = None + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def page(self, friendly_name, evaluate_worker_attributes, worker_sid, ordering, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'evaluate_worker_attributes': evaluate_worker_attributes,'worker_sid': worker_sid,'ordering': ordering,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TaskQueuePage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py index 14bc9383b6..7da4de720f 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,433 +19,119 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskQueueCumulativeStatisticsList(ListResource): - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :param task_queue_sid: The SID of the TaskQueue from which these statistics were calculated - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - """ - super(TaskQueueCumulativeStatisticsList, self).__init__(version) - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - 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'], - ) - - def __call__(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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskQueueCumulativeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueueCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :param task_queue_sid: The SID of the TaskQueue from which these statistics were calculated - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsPage - """ - super(TaskQueueCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskQueueCumulativeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the TaskQueue to fetch - :param task_queue_sid: The SID of the TaskQueue for which to fetch statistics - - :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 - """ - super(TaskQueueCumulativeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, task_queue_sid: str): + # TODO: needs autogenerated docs + super(TaskQueueCumulativeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{task_queue_sid}/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the TaskQueueCumulativeStatisticsInstance - - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on - - :returns: The fetched TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - """ - data = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return TaskQueueCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) + self._solution = { workspace_sid, task_queue_sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues/${task_queue_sid}/CumulativeStatistics' + + + def fetch(self, end_date, minutes, start_date, task_channel, split_by_wait_time): + + """ + Fetch the TaskQueueCumulativeStatisticsInstance + + :returns: The fetched TaskQueueCumulativeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskQueueCumulativeStatisticsInstance( + self._version, + payload, + workspace_sidtask_queue_sid=self._solution['workspace_sid''task_queue_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TaskQueueCumulativeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueCumulativeStatisticsInstance - :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 - """ +class TaskQueueCumulativeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, task_queue_sid: str): super(TaskQueueCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'avg_task_acceptance_time': deserialize.integer(payload.get('avg_task_acceptance_time')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'reservations_created': deserialize.integer(payload.get('reservations_created')), - 'reservations_accepted': deserialize.integer(payload.get('reservations_accepted')), - 'reservations_rejected': deserialize.integer(payload.get('reservations_rejected')), - 'reservations_timed_out': deserialize.integer(payload.get('reservations_timed_out')), - 'reservations_canceled': deserialize.integer(payload.get('reservations_canceled')), - 'reservations_rescinded': deserialize.integer(payload.get('reservations_rescinded')), - 'split_by_wait_time': payload.get('split_by_wait_time'), - 'task_queue_sid': payload.get('task_queue_sid'), - 'wait_duration_until_accepted': payload.get('wait_duration_until_accepted'), - 'wait_duration_until_canceled': payload.get('wait_duration_until_canceled'), - 'wait_duration_in_queue_until_accepted': payload.get('wait_duration_in_queue_until_accepted'), - 'tasks_canceled': deserialize.integer(payload.get('tasks_canceled')), - 'tasks_completed': deserialize.integer(payload.get('tasks_completed')), - 'tasks_deleted': deserialize.integer(payload.get('tasks_deleted')), - 'tasks_entered': deserialize.integer(payload.get('tasks_entered')), - 'tasks_moved': deserialize.integer(payload.get('tasks_moved')), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'avg_task_acceptance_time' = payload.get('avg_task_acceptance_time'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'reservations_created' = payload.get('reservations_created'), + 'reservations_accepted' = payload.get('reservations_accepted'), + 'reservations_rejected' = payload.get('reservations_rejected'), + 'reservations_timed_out' = payload.get('reservations_timed_out'), + 'reservations_canceled' = payload.get('reservations_canceled'), + 'reservations_rescinded' = payload.get('reservations_rescinded'), + 'split_by_wait_time' = payload.get('split_by_wait_time'), + 'task_queue_sid' = payload.get('task_queue_sid'), + 'wait_duration_until_accepted' = payload.get('wait_duration_until_accepted'), + 'wait_duration_until_canceled' = payload.get('wait_duration_until_canceled'), + 'wait_duration_in_queue_until_accepted' = payload.get('wait_duration_in_queue_until_accepted'), + 'tasks_canceled' = payload.get('tasks_canceled'), + 'tasks_completed' = payload.get('tasks_completed'), + 'tasks_deleted' = payload.get('tasks_deleted'), + 'tasks_entered' = payload.get('tasks_entered'), + 'tasks_moved' = payload.get('tasks_moved'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'task_queue_sid': task_queue_sid or self._properties['task_queue_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueCumulativeStatisticsContext for this TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext - """ if self._context is None: self._context = TaskQueueCumulativeStatisticsContext( self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], + workspace_sid=self._solution['workspace_sid'],task_queue_sid=self._solution['task_queue_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def avg_task_acceptance_time(self): - """ - :returns: The average time in seconds between Task creation and acceptance - :rtype: unicode - """ - return self._properties['avg_task_acceptance_time'] + - @property - def start_time(self): - """ - :returns: The beginning of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def reservations_created(self): - """ - :returns: The total number of Reservations created for Tasks in the TaskQueue - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The total number of Reservations accepted for Tasks in the TaskQueue - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The total number of Reservations rejected for Tasks in the TaskQueue - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The total number of Reservations that timed out for Tasks in the TaskQueue - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The total number of Reservations canceled for Tasks in the TaskQueue - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The total number of Reservations rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] - - @property - def split_by_wait_time(self): - """ - :returns: A list of objects that describe the Tasks canceled and reservations accepted above and below the specified thresholds - :rtype: dict - """ - return self._properties['split_by_wait_time'] - - @property - def task_queue_sid(self): - """ - :returns: The SID of the TaskQueue from which these statistics were calculated - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def wait_duration_until_accepted(self): - """ - :returns: The wait duration statistics for Tasks accepted while in the TaskQueue - :rtype: dict - """ - return self._properties['wait_duration_until_accepted'] - - @property - def wait_duration_until_canceled(self): - """ - :returns: The wait duration statistics for Tasks canceled while in the TaskQueue - :rtype: dict - """ - return self._properties['wait_duration_until_canceled'] - - @property - def wait_duration_in_queue_until_accepted(self): - """ - :returns: The relative wait duration statistics for Tasks accepted while in the TaskQueue - :rtype: dict - """ - return self._properties['wait_duration_in_queue_until_accepted'] - - @property - def tasks_canceled(self): - """ - :returns: The total number of Tasks canceled in the TaskQueue - :rtype: unicode - """ - return self._properties['tasks_canceled'] - - @property - def tasks_completed(self): - """ - :returns: The total number of Tasks completed in the TaskQueue - :rtype: unicode - """ - return self._properties['tasks_completed'] - - @property - def tasks_deleted(self): - """ - :returns: The total number of Tasks deleted in the TaskQueue - :rtype: unicode - """ - return self._properties['tasks_deleted'] - - @property - def tasks_entered(self): - """ - :returns: The total number of Tasks entered into the TaskQueue - :rtype: unicode - """ - return self._properties['tasks_entered'] - - @property - def tasks_moved(self): - """ - :returns: The total number of Tasks that were moved from one queue to another - :rtype: unicode - """ - return self._properties['tasks_moved'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the TaskQueue - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the TaskQueue statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the TaskQueueCumulativeStatisticsInstance - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on +class TaskQueueCumulativeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, task_queue_sid: str): + # TODO: needs autogenerated docs + super(TaskQueueCumulativeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched TaskQueueCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) + # Path Solution + self._solution = { workspace_sid, task_queue_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py index 4d28568a4a..a981d99091 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py @@ -1,347 +1,129 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskQueueRealTimeStatisticsList(ListResource): - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueRealTimeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :param task_queue_sid: The SID of the TaskQueue from which these statistics were calculated - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - """ - super(TaskQueueRealTimeStatisticsList, self).__init__(version) - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - def get(self): - """ - Constructs a TaskQueueRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ - return TaskQueueRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __call__(self): - """ - Constructs a TaskQueueRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ - return TaskQueueRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskQueueRealTimeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueueRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :param task_queue_sid: The SID of the TaskQueue from which these statistics were calculated - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsPage - """ - super(TaskQueueRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueueRealTimeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ - return TaskQueueRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskQueueRealTimeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the TaskQueue to fetch - :param task_queue_sid: The SID of the TaskQueue for which to fetch statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ - super(TaskQueueRealTimeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, task_queue_sid: str): + # TODO: needs autogenerated docs + super(TaskQueueRealTimeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{task_queue_sid}/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch the TaskQueueRealTimeStatisticsInstance - - :param unicode task_channel: The TaskChannel for which to fetch statistics - - :returns: The fetched TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ - data = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return TaskQueueRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) + self._solution = { workspace_sid, task_queue_sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues/${task_queue_sid}/RealTimeStatistics' + + + def fetch(self, task_channel): + + """ + Fetch the TaskQueueRealTimeStatisticsInstance + + :returns: The fetched TaskQueueRealTimeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskQueueRealTimeStatisticsInstance( + self._version, + payload, + workspace_sidtask_queue_sid=self._solution['workspace_sid''task_queue_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TaskQueueRealTimeStatisticsInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueRealTimeStatisticsInstance - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ +class TaskQueueRealTimeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, task_queue_sid: str): super(TaskQueueRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'activity_statistics': payload.get('activity_statistics'), - 'longest_task_waiting_age': deserialize.integer(payload.get('longest_task_waiting_age')), - 'longest_task_waiting_sid': payload.get('longest_task_waiting_sid'), - 'longest_relative_task_age_in_queue': deserialize.integer(payload.get('longest_relative_task_age_in_queue')), - 'longest_relative_task_sid_in_queue': payload.get('longest_relative_task_sid_in_queue'), - 'task_queue_sid': payload.get('task_queue_sid'), - 'tasks_by_priority': payload.get('tasks_by_priority'), - 'tasks_by_status': payload.get('tasks_by_status'), - 'total_available_workers': deserialize.integer(payload.get('total_available_workers')), - 'total_eligible_workers': deserialize.integer(payload.get('total_eligible_workers')), - 'total_tasks': deserialize.integer(payload.get('total_tasks')), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'activity_statistics' = payload.get('activity_statistics'), + 'longest_task_waiting_age' = payload.get('longest_task_waiting_age'), + 'longest_task_waiting_sid' = payload.get('longest_task_waiting_sid'), + 'longest_relative_task_age_in_queue' = payload.get('longest_relative_task_age_in_queue'), + 'longest_relative_task_sid_in_queue' = payload.get('longest_relative_task_sid_in_queue'), + 'task_queue_sid' = payload.get('task_queue_sid'), + 'tasks_by_priority' = payload.get('tasks_by_priority'), + 'tasks_by_status' = payload.get('tasks_by_status'), + 'total_available_workers' = payload.get('total_available_workers'), + 'total_eligible_workers' = payload.get('total_eligible_workers'), + 'total_tasks' = payload.get('total_tasks'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'task_queue_sid': task_queue_sid or self._properties['task_queue_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueRealTimeStatisticsContext for this TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsContext - """ if self._context is None: self._context = TaskQueueRealTimeStatisticsContext( self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], + workspace_sid=self._solution['workspace_sid'],task_queue_sid=self._solution['task_queue_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def activity_statistics(self): - """ - :returns: The number of current Workers by Activity - :rtype: list[dict] - """ - return self._properties['activity_statistics'] - - @property - def longest_task_waiting_age(self): - """ - :returns: The age of the longest waiting Task - :rtype: unicode - """ - return self._properties['longest_task_waiting_age'] - - @property - def longest_task_waiting_sid(self): - """ - :returns: The SID of the longest waiting Task - :rtype: unicode - """ - return self._properties['longest_task_waiting_sid'] - - @property - def longest_relative_task_age_in_queue(self): - """ - :returns: The relative age in the TaskQueue for the longest waiting Task. - :rtype: unicode - """ - return self._properties['longest_relative_task_age_in_queue'] - - @property - def longest_relative_task_sid_in_queue(self): - """ - :returns: The SID of the Task waiting in the TaskQueue the longest. - :rtype: unicode - """ - return self._properties['longest_relative_task_sid_in_queue'] - - @property - def task_queue_sid(self): - """ - :returns: The SID of the TaskQueue from which these statistics were calculated - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def tasks_by_priority(self): - """ - :returns: The number of Tasks by priority - :rtype: dict - """ - return self._properties['tasks_by_priority'] - - @property - def tasks_by_status(self): - """ - :returns: The number of Tasks by their current status - :rtype: dict - """ - return self._properties['tasks_by_status'] - - @property - def total_available_workers(self): - """ - :returns: The total number of Workers available for Tasks in the TaskQueue - :rtype: unicode - """ - return self._properties['total_available_workers'] - - @property - def total_eligible_workers(self): - """ - :returns: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state - :rtype: unicode - """ - return self._properties['total_eligible_workers'] - - @property - def total_tasks(self): - """ - :returns: The total number of Tasks - :rtype: unicode - """ - return self._properties['total_tasks'] + - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the TaskQueue - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the TaskQueue statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, task_channel=values.unset): - """ - Fetch the TaskQueueRealTimeStatisticsInstance - :param unicode task_channel: The TaskChannel for which to fetch statistics +class TaskQueueRealTimeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, task_queue_sid: str): + # TODO: needs autogenerated docs + super(TaskQueueRealTimeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched TaskQueueRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) + # Path Solution + self._solution = { workspace_sid, task_queue_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py index 0305b26d8e..29bd3349cc 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py @@ -1,299 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskQueueStatisticsList(ListResource): - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :param task_queue_sid: The SID of the TaskQueue from which these statistics were calculated - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - """ - super(TaskQueueStatisticsList, self).__init__(version) - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - - def get(self): - """ - Constructs a TaskQueueStatisticsContext - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ - return TaskQueueStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __call__(self): - """ - Constructs a TaskQueueStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ - return TaskQueueStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskQueueStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueueStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :param task_queue_sid: The SID of the TaskQueue from which these statistics were calculated - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsPage - """ - super(TaskQueueStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueueStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ - return TaskQueueStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TaskQueueStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the TaskQueue to fetch - :param task_queue_sid: The SID of the TaskQueue for which to fetch statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ - super(TaskQueueStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, task_queue_sid: str): + # TODO: needs autogenerated docs + super(TaskQueueStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{task_queue_sid}/Statistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the TaskQueueStatisticsInstance - - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate real-time and cumulative statistics for the specified TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on - - :returns: The fetched TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ - data = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return TaskQueueStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], - ) + self._solution = { workspace_sid, task_queue_sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues/${task_queue_sid}/Statistics' + + + def fetch(self, end_date, minutes, start_date, task_channel, split_by_wait_time): + + """ + Fetch the TaskQueueStatisticsInstance + + :returns: The fetched TaskQueueStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TaskQueueStatisticsInstance( + self._version, + payload, + workspace_sidtask_queue_sid=self._solution['workspace_sid''task_queue_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TaskQueueStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid, task_queue_sid): - """ - Initialize the TaskQueueStatisticsInstance - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ +class TaskQueueStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, task_queue_sid: str): super(TaskQueueStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'cumulative': payload.get('cumulative'), - 'realtime': payload.get('realtime'), - 'task_queue_sid': payload.get('task_queue_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'cumulative' = payload.get('cumulative'), + 'realtime' = payload.get('realtime'), + 'task_queue_sid' = payload.get('task_queue_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'task_queue_sid': task_queue_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'task_queue_sid': task_queue_sid or self._properties['task_queue_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueStatisticsContext for this TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsContext - """ if self._context is None: self._context = TaskQueueStatisticsContext( self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['task_queue_sid'], + workspace_sid=self._solution['workspace_sid'],task_queue_sid=self._solution['task_queue_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: An object that contains the cumulative statistics for the TaskQueue - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def realtime(self): - """ - :returns: An object that contains the real-time statistics for the TaskQueue - :rtype: dict - """ - return self._properties['realtime'] + - @property - def task_queue_sid(self): - """ - :returns: The SID of the TaskQueue from which these statistics were calculated - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the TaskQueue - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the TaskQueue statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the TaskQueueStatisticsInstance - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate real-time and cumulative statistics for the specified TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on +class TaskQueueStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, task_queue_sid: str): + # TODO: needs autogenerated docs + super(TaskQueueStatisticsListInstanceList, self).__init__(version) - :returns: The fetched TaskQueueStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) + # Path Solution + self._solution = { workspace_sid, task_queue_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py index de5f361a10..33f9a9e341 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py @@ -1,289 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TaskQueuesStatisticsList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskQueuesStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - """ - super(TaskQueuesStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/Statistics'.format(**self._solution) - - def stream(self, end_date=values.unset, friendly_name=values.unset, - minutes=values.unset, start_date=values.unset, - task_channel=values.unset, split_by_wait_time=values.unset, - limit=None, page_size=None): - """ - Streams TaskQueuesStatisticsInstance 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 datetime end_date: Only calculate statistics from on or before this date - :param unicode friendly_name: The friendly_name of the TaskQueue statistics to read - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate statistics on this TaskChannel. - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on - :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.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - end_date=end_date, - friendly_name=friendly_name, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - def list(self, end_date=values.unset, friendly_name=values.unset, - minutes=values.unset, start_date=values.unset, - task_channel=values.unset, split_by_wait_time=values.unset, limit=None, - page_size=None): - """ - Lists TaskQueuesStatisticsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode friendly_name: The friendly_name of the TaskQueue statistics to read - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate statistics on this TaskChannel. - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance] - """ - return list(self.stream( - end_date=end_date, - friendly_name=friendly_name, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - limit=limit, - page_size=page_size, - )) - - def page(self, end_date=values.unset, friendly_name=values.unset, - minutes=values.unset, start_date=values.unset, - task_channel=values.unset, split_by_wait_time=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TaskQueuesStatisticsInstance records from the API. - Request is executed immediately - - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode friendly_name: The friendly_name of the TaskQueue statistics to read - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate statistics on this TaskChannel. - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on - :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 TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - """ - data = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'FriendlyName': friendly_name, - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TaskQueuesStatisticsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskQueuesStatisticsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskQueuesStatisticsPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class TaskQueuesStatisticsPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the TaskQueuesStatisticsPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsPage - """ - super(TaskQueuesStatisticsPage, self).__init__(version, response) +class TaskQueuesStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(TaskQueuesStatisticsListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues/Statistics' + + + def page(self, end_date, friendly_name, minutes, start_date, task_channel, split_by_wait_time, page_size): + + data = values.of({ + 'end_date': end_date,'friendly_name': friendly_name,'minutes': minutes,'start_date': start_date,'task_channel': task_channel,'split_by_wait_time': split_by_wait_time,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of TaskQueuesStatisticsInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - """ - return TaskQueuesStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) + return TaskQueuesStatisticsPage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class TaskQueuesStatisticsInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the TaskQueuesStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance - """ - super(TaskQueuesStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'cumulative': payload.get('cumulative'), - 'realtime': payload.get('realtime'), - 'task_queue_sid': payload.get('task_queue_sid'), - 'workspace_sid': payload.get('workspace_sid'), - } - - # Context - self._context = None - self._solution = {'workspace_sid': workspace_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: An object that contains the cumulative statistics for the TaskQueues - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def realtime(self): - """ - :returns: An object that contains the real-time statistics for the TaskQueues - :rtype: dict - """ - return self._properties['realtime'] - - @property - def task_queue_sid(self): - """ - :returns: The SID of the TaskQueue from which these statistics were calculated - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the TaskQueues - :rtype: unicode - """ - return self._properties['workspace_sid'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/taskrouter/v1/workspace/worker.py b/twilio/rest/taskrouter/v1/workspace/worker.py new file mode 100644 index 0000000000..f393f25a29 --- /dev/null +++ b/twilio/rest/taskrouter/v1/workspace/worker.py @@ -0,0 +1,187 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.worker.reservation import ReservationListInstancefrom twilio.rest.worker.worker_channel import WorkerChannelListInstancefrom twilio.rest.worker.worker_statistics import WorkerStatisticsListInstancefrom twilio.rest.worker.workers_cumulative_statistics import WorkersCumulativeStatisticsListInstancefrom twilio.rest.worker.workers_real_time_statistics import WorkersRealTimeStatisticsListInstancefrom twilio.rest.worker.workers_statistics import WorkersStatisticsListInstance + + +class WorkerContext(InstanceContext): + def __init__(self, version: V1, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WorkerContextList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/${sid}' + + self._reservations = None + self._worker_channels = None + self._statistics = None + + def delete(self, if_match): + + + """ + Deletes the WorkerInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WorkerInstance + + :returns: The fetched WorkerInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkerInstance( + self._version, + payload, + workspace_sidsid=self._solution['workspace_sid''sid'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class WorkerInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super(WorkerInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'activity_name' = payload.get('activity_name'), + 'activity_sid' = payload.get('activity_sid'), + 'attributes' = payload.get('attributes'), + 'available' = payload.get('available'), + 'date_created' = payload.get('date_created'), + 'date_status_changed' = payload.get('date_status_changed'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = WorkerContext( + self._version, + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def reservations(self): + return self._proxy.reservations + @property + def worker_channels(self): + return self._proxy.worker_channels + @property + def statistics(self): + return self._proxy.statistics + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class WorkerListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkerListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers' + + self._cumulative_statistics = None + self._real_time_statistics = None + self._statistics = None + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def page(self, activity_name, activity_sid, available, friendly_name, target_workers_expression, task_queue_name, task_queue_sid, ordering, page_size): + + data = values.of({ + 'activity_name': activity_name,'activity_sid': activity_sid,'available': available,'friendly_name': friendly_name,'target_workers_expression': target_workers_expression,'task_queue_name': task_queue_name,'task_queue_sid': task_queue_sid,'ordering': ordering,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WorkerPage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index e4ae8649ca..6d55714908 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,732 +19,131 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ReservationList(ListResource): - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the ReservationList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that this worker is contained within. - :param worker_sid: The SID of the reserved Worker resource - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - """ - super(ReservationList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Reservations'.format(**self._solution) - - def stream(self, reservation_status=values.unset, limit=None, page_size=None): - """ - Streams ReservationInstance 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 ReservationInstance.Status reservation_status: Returns the list of reservations for a worker with a specified ReservationStatus - :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.taskrouter.v1.workspace.worker.reservation.ReservationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(reservation_status=reservation_status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, reservation_status=values.unset, limit=None, page_size=None): - """ - Lists ReservationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ReservationInstance.Status reservation_status: Returns the list of reservations for a worker with a specified ReservationStatus - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.taskrouter.v1.workspace.worker.reservation.ReservationInstance] - """ - return list(self.stream(reservation_status=reservation_status, limit=limit, page_size=page_size, )) - - def page(self, reservation_status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ReservationInstance records from the API. - Request is executed immediately - - :param ReservationInstance.Status reservation_status: Returns the list of reservations for a worker with a specified ReservationStatus - :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 ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - """ - data = values.of({ - 'ReservationStatus': reservation_status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ReservationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ReservationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ReservationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ReservationContext - - :param sid: The SID of the WorkerReservation resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ReservationContext - - :param sid: The SID of the WorkerReservation resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ - return ReservationContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ReservationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ReservationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that this worker is contained within. - :param worker_sid: The SID of the reserved Worker resource - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationPage - """ - super(ReservationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ReservationInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ReservationContext(InstanceContext): - - def __init__(self, version, workspace_sid, worker_sid, sid): - """ - Initialize the ReservationContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the WorkerReservation resource to fetch - :param worker_sid: The SID of the reserved Worker resource with the WorkerReservation resource to fetch - :param sid: The SID of the WorkerReservation resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ - super(ReservationContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, worker_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ReservationContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Reservations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ReservationInstance - - :returns: The fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset, - end_conference_on_customer_exit=values.unset, - beep_on_customer_entrance=values.unset, if_match=values.unset): - """ - Update the ReservationInstance - - :param ReservationInstance.Status reservation_status: The new status of the reservation - :param unicode worker_activity_sid: The new worker activity SID if rejecting a reservation - :param unicode instruction: The assignment instruction for the reservation - :param unicode dequeue_post_work_activity_sid: The SID of the Activity resource to start after executing a Dequeue instruction - :param unicode dequeue_from: The caller ID of the call to the worker when executing a Dequeue instruction - :param unicode dequeue_record: Whether to record both legs of a call when executing a Dequeue instruction - :param unicode dequeue_timeout: The timeout for call when executing a Dequeue instruction - :param unicode dequeue_to: The contact URI of the worker when executing a Dequeue instruction - :param unicode dequeue_status_callback_url: The callback URL for completed call event when executing a Dequeue instruction - :param unicode call_from: The Caller ID of the outbound call when executing a Call instruction - :param unicode call_record: Whether to record both legs of a call when executing a Call instruction - :param unicode call_timeout: The timeout for a call when executing a Call instruction - :param unicode call_to: The contact URI of the worker when executing a Call instruction - :param unicode call_url: TwiML URI executed on answering the worker's leg as a result of the Call instruction - :param unicode call_status_callback_url: The URL to call for the completed call event when executing a Call instruction - :param bool call_accept: Whether to accept a reservation when executing a Call instruction - :param unicode redirect_call_sid: The Call SID of the call parked in the queue when executing a Redirect instruction - :param bool redirect_accept: Whether the reservation should be accepted when executing a Redirect instruction - :param unicode redirect_url: TwiML URI to redirect the call to when executing the Redirect instruction - :param unicode to: The Contact URI of the worker when executing a Conference instruction - :param unicode from_: The caller ID of the call to the worker when executing a Conference instruction - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param list[ReservationInstance.CallStatus] status_callback_event: The call progress events that we will send to status_callback - :param unicode timeout: The timeout for a call when executing a Conference instruction - :param bool record: Whether to record the participant and their conferences - :param bool muted: Whether to mute the agent - :param unicode beep: Whether to play a notification beep when the participant joins - :param bool start_conference_on_enter: Whether the conference starts when the participant joins the conference - :param bool end_conference_on_exit: Whether to end the conference when the agent leaves - :param unicode wait_url: URL that hosts pre-conference hold music - :param unicode wait_method: The HTTP method we should use to call `wait_url` - :param bool early_media: Whether agents can hear the state of the outbound call - :param unicode max_participants: The maximum number of agent conference participants - :param unicode conference_status_callback: The callback URL for conference events - :param unicode conference_status_callback_method: HTTP method for requesting `conference_status_callback` URL - :param list[ReservationInstance.ConferenceEvent] conference_status_callback_event: The conference status events that we will send to conference_status_callback - :param unicode conference_record: Whether to record the conference the participant is joining - :param unicode conference_trim: Whether to trim leading and trailing silence from your recorded conference audio files - :param unicode recording_channels: Specify `mono` or `dual` recording channels - :param unicode recording_status_callback: The URL that we should call using the `recording_status_callback_method` when the recording status changes - :param unicode recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback` - :param unicode conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available - :param unicode conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback` - :param unicode region: The region where we should mix the conference audio - :param unicode sip_auth_username: The SIP username used for authentication - :param unicode sip_auth_password: The SIP password for authentication - :param list[unicode] dequeue_status_callback_event: The call progress events sent via webhooks as a result of a Dequeue instruction - :param unicode post_work_activity_sid: The new worker activity SID after executing a Conference instruction - :param bool end_conference_on_customer_exit: Whether to end the conference when the customer leaves - :param bool beep_on_customer_entrance: Whether to play a notification beep when the customer joins - :param unicode if_match: The If-Match HTTP request header - - :returns: The updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - data = values.of({ - 'ReservationStatus': reservation_status, - 'WorkerActivitySid': worker_activity_sid, - 'Instruction': instruction, - 'DequeuePostWorkActivitySid': dequeue_post_work_activity_sid, - 'DequeueFrom': dequeue_from, - 'DequeueRecord': dequeue_record, - 'DequeueTimeout': dequeue_timeout, - 'DequeueTo': dequeue_to, - 'DequeueStatusCallbackUrl': dequeue_status_callback_url, - 'CallFrom': call_from, - 'CallRecord': call_record, - 'CallTimeout': call_timeout, - 'CallTo': call_to, - 'CallUrl': call_url, - 'CallStatusCallbackUrl': call_status_callback_url, - 'CallAccept': call_accept, - 'RedirectCallSid': redirect_call_sid, - 'RedirectAccept': redirect_accept, - 'RedirectUrl': redirect_url, - 'To': to, - 'From': from_, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'Timeout': timeout, - 'Record': record, - 'Muted': muted, - 'Beep': beep, - 'StartConferenceOnEnter': start_conference_on_enter, - 'EndConferenceOnExit': end_conference_on_exit, - 'WaitUrl': wait_url, - 'WaitMethod': wait_method, - 'EarlyMedia': early_media, - 'MaxParticipants': max_participants, - 'ConferenceStatusCallback': conference_status_callback, - 'ConferenceStatusCallbackMethod': conference_status_callback_method, - 'ConferenceStatusCallbackEvent': serialize.map(conference_status_callback_event, lambda e: e), - 'ConferenceRecord': conference_record, - 'ConferenceTrim': conference_trim, - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'ConferenceRecordingStatusCallback': conference_recording_status_callback, - 'ConferenceRecordingStatusCallbackMethod': conference_recording_status_callback_method, - 'Region': region, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'DequeueStatusCallbackEvent': serialize.map(dequeue_status_callback_event, lambda e: e), - 'PostWorkActivitySid': post_work_activity_sid, - 'EndConferenceOnCustomerExit': end_conference_on_customer_exit, - 'BeepOnCustomerEntrance': beep_on_customer_entrance, - }) - headers = values.of({'If-Match': if_match, }) + self._solution = { workspace_sid, worker_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/${worker_sid}/Reservations/${sid}' + + + def fetch(self): + + """ + Fetch the ReservationInstance + + :returns: The fetched ReservationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ReservationInstance( + self._version, + payload, + workspace_sidworker_sidsid=self._solution['workspace_sid''worker_sid''sid'], + ) + + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ReservationInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) + return ReservationInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], worker_sid=self._solution['worker_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ReservationInstance(InstanceResource): - - class Status(object): - PENDING = "pending" - ACCEPTED = "accepted" - REJECTED = "rejected" - TIMEOUT = "timeout" - CANCELED = "canceled" - RESCINDED = "rescinded" - WRAPPING = "wrapping" - COMPLETED = "completed" + return '' - class CallStatus(object): - INITIATED = "initiated" - RINGING = "ringing" - ANSWERED = "answered" - COMPLETED = "completed" - class ConferenceEvent(object): - START = "start" - END = "end" - JOIN = "join" - LEAVE = "leave" - MUTE = "mute" - HOLD = "hold" - SPEAKER = "speaker" - def __init__(self, version, payload, workspace_sid, worker_sid, sid=None): - """ - Initialize the ReservationInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ +class ReservationInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, worker_sid: str, sid: str): super(ReservationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'reservation_status': payload.get('reservation_status'), - 'sid': payload.get('sid'), - 'task_sid': payload.get('task_sid'), - 'worker_name': payload.get('worker_name'), - 'worker_sid': payload.get('worker_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'reservation_status' = payload.get('reservation_status'), + 'sid' = payload.get('sid'), + 'task_sid' = payload.get('task_sid'), + 'worker_name' = payload.get('worker_name'), + 'worker_sid' = payload.get('worker_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), } - # Context self._context = None self._solution = { - 'workspace_sid': workspace_sid, - 'worker_sid': worker_sid, - 'sid': sid or self._properties['sid'], + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'worker_sid': worker_sid or self._properties['worker_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ReservationContext for this ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationContext - """ if self._context is None: self._context = ReservationContext( self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],worker_sid=self._solution['worker_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def reservation_status(self): - """ - :returns: The current status of the reservation - :rtype: ReservationInstance.Status - """ - return self._properties['reservation_status'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_sid(self): - """ - :returns: The SID of the reserved Task resource - :rtype: unicode - """ - return self._properties['task_sid'] - - @property - def worker_name(self): - """ - :returns: The friendly_name of the Worker that is reserved - :rtype: unicode - """ - return self._properties['worker_name'] - - @property - def worker_sid(self): - """ - :returns: The SID of the reserved Worker resource - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that this worker is contained within. - :rtype: unicode - """ - return self._properties['workspace_sid'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the WorkerReservation resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the ReservationInstance - :returns: The fetched ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - return self._proxy.fetch() +class ReservationListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, worker_sid: str): + # TODO: needs autogenerated docs + super(ReservationListInstanceList, self).__init__(version) - def update(self, reservation_status=values.unset, - worker_activity_sid=values.unset, instruction=values.unset, - dequeue_post_work_activity_sid=values.unset, - dequeue_from=values.unset, dequeue_record=values.unset, - dequeue_timeout=values.unset, dequeue_to=values.unset, - dequeue_status_callback_url=values.unset, call_from=values.unset, - call_record=values.unset, call_timeout=values.unset, - call_to=values.unset, call_url=values.unset, - call_status_callback_url=values.unset, call_accept=values.unset, - redirect_call_sid=values.unset, redirect_accept=values.unset, - redirect_url=values.unset, to=values.unset, from_=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - status_callback_event=values.unset, timeout=values.unset, - record=values.unset, muted=values.unset, beep=values.unset, - start_conference_on_enter=values.unset, - end_conference_on_exit=values.unset, wait_url=values.unset, - wait_method=values.unset, early_media=values.unset, - max_participants=values.unset, - conference_status_callback=values.unset, - conference_status_callback_method=values.unset, - conference_status_callback_event=values.unset, - conference_record=values.unset, conference_trim=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - conference_recording_status_callback=values.unset, - conference_recording_status_callback_method=values.unset, - region=values.unset, sip_auth_username=values.unset, - sip_auth_password=values.unset, - dequeue_status_callback_event=values.unset, - post_work_activity_sid=values.unset, - end_conference_on_customer_exit=values.unset, - beep_on_customer_entrance=values.unset, if_match=values.unset): - """ - Update the ReservationInstance + # Path Solution + self._solution = { workspace_sid, worker_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/${worker_sid}/Reservations' + + + def page(self, reservation_status, page_size): + + data = values.of({ + 'reservation_status': reservation_status,'page_size': page_size, + }) - :param ReservationInstance.Status reservation_status: The new status of the reservation - :param unicode worker_activity_sid: The new worker activity SID if rejecting a reservation - :param unicode instruction: The assignment instruction for the reservation - :param unicode dequeue_post_work_activity_sid: The SID of the Activity resource to start after executing a Dequeue instruction - :param unicode dequeue_from: The caller ID of the call to the worker when executing a Dequeue instruction - :param unicode dequeue_record: Whether to record both legs of a call when executing a Dequeue instruction - :param unicode dequeue_timeout: The timeout for call when executing a Dequeue instruction - :param unicode dequeue_to: The contact URI of the worker when executing a Dequeue instruction - :param unicode dequeue_status_callback_url: The callback URL for completed call event when executing a Dequeue instruction - :param unicode call_from: The Caller ID of the outbound call when executing a Call instruction - :param unicode call_record: Whether to record both legs of a call when executing a Call instruction - :param unicode call_timeout: The timeout for a call when executing a Call instruction - :param unicode call_to: The contact URI of the worker when executing a Call instruction - :param unicode call_url: TwiML URI executed on answering the worker's leg as a result of the Call instruction - :param unicode call_status_callback_url: The URL to call for the completed call event when executing a Call instruction - :param bool call_accept: Whether to accept a reservation when executing a Call instruction - :param unicode redirect_call_sid: The Call SID of the call parked in the queue when executing a Redirect instruction - :param bool redirect_accept: Whether the reservation should be accepted when executing a Redirect instruction - :param unicode redirect_url: TwiML URI to redirect the call to when executing the Redirect instruction - :param unicode to: The Contact URI of the worker when executing a Conference instruction - :param unicode from_: The caller ID of the call to the worker when executing a Conference instruction - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param list[ReservationInstance.CallStatus] status_callback_event: The call progress events that we will send to status_callback - :param unicode timeout: The timeout for a call when executing a Conference instruction - :param bool record: Whether to record the participant and their conferences - :param bool muted: Whether to mute the agent - :param unicode beep: Whether to play a notification beep when the participant joins - :param bool start_conference_on_enter: Whether the conference starts when the participant joins the conference - :param bool end_conference_on_exit: Whether to end the conference when the agent leaves - :param unicode wait_url: URL that hosts pre-conference hold music - :param unicode wait_method: The HTTP method we should use to call `wait_url` - :param bool early_media: Whether agents can hear the state of the outbound call - :param unicode max_participants: The maximum number of agent conference participants - :param unicode conference_status_callback: The callback URL for conference events - :param unicode conference_status_callback_method: HTTP method for requesting `conference_status_callback` URL - :param list[ReservationInstance.ConferenceEvent] conference_status_callback_event: The conference status events that we will send to conference_status_callback - :param unicode conference_record: Whether to record the conference the participant is joining - :param unicode conference_trim: Whether to trim leading and trailing silence from your recorded conference audio files - :param unicode recording_channels: Specify `mono` or `dual` recording channels - :param unicode recording_status_callback: The URL that we should call using the `recording_status_callback_method` when the recording status changes - :param unicode recording_status_callback_method: The HTTP method we should use when we call `recording_status_callback` - :param unicode conference_recording_status_callback: The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available - :param unicode conference_recording_status_callback_method: The HTTP method we should use to call `conference_recording_status_callback` - :param unicode region: The region where we should mix the conference audio - :param unicode sip_auth_username: The SIP username used for authentication - :param unicode sip_auth_password: The SIP password for authentication - :param list[unicode] dequeue_status_callback_event: The call progress events sent via webhooks as a result of a Dequeue instruction - :param unicode post_work_activity_sid: The new worker activity SID after executing a Conference instruction - :param bool end_conference_on_customer_exit: Whether to end the conference when the customer leaves - :param bool beep_on_customer_entrance: Whether to play a notification beep when the customer joins - :param unicode if_match: The If-Match HTTP request header + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated ReservationInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationInstance - """ - return self._proxy.update( - reservation_status=reservation_status, - worker_activity_sid=worker_activity_sid, - instruction=instruction, - dequeue_post_work_activity_sid=dequeue_post_work_activity_sid, - dequeue_from=dequeue_from, - dequeue_record=dequeue_record, - dequeue_timeout=dequeue_timeout, - dequeue_to=dequeue_to, - dequeue_status_callback_url=dequeue_status_callback_url, - call_from=call_from, - call_record=call_record, - call_timeout=call_timeout, - call_to=call_to, - call_url=call_url, - call_status_callback_url=call_status_callback_url, - call_accept=call_accept, - redirect_call_sid=redirect_call_sid, - redirect_accept=redirect_accept, - redirect_url=redirect_url, - to=to, - from_=from_, - status_callback=status_callback, - status_callback_method=status_callback_method, - status_callback_event=status_callback_event, - timeout=timeout, - record=record, - muted=muted, - beep=beep, - start_conference_on_enter=start_conference_on_enter, - end_conference_on_exit=end_conference_on_exit, - wait_url=wait_url, - wait_method=wait_method, - early_media=early_media, - max_participants=max_participants, - conference_status_callback=conference_status_callback, - conference_status_callback_method=conference_status_callback_method, - conference_status_callback_event=conference_status_callback_event, - conference_record=conference_record, - conference_trim=conference_trim, - recording_channels=recording_channels, - recording_status_callback=recording_status_callback, - recording_status_callback_method=recording_status_callback_method, - conference_recording_status_callback=conference_recording_status_callback, - conference_recording_status_callback_method=conference_recording_status_callback_method, - region=region, - sip_auth_username=sip_auth_username, - sip_auth_password=sip_auth_password, - dequeue_status_callback_event=dequeue_status_callback_event, - post_work_activity_sid=post_work_activity_sid, - end_conference_on_customer_exit=end_conference_on_customer_exit, - beep_on_customer_entrance=beep_on_customer_entrance, - if_match=if_match, - ) + return ReservationPage(self._version, payload, workspace_sid=self._solution['workspace_sid']worker_sid=self._solution['worker_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py index 3b2e848bcc..a77dcd4cbb 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py @@ -1,457 +1,151 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkerChannelList(ListResource): - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the WorkerChannelList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the WorkerChannel - :param worker_sid: The SID of the Worker that contains the WorkerChannel - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - """ - super(WorkerChannelList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams WorkerChannelInstance 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 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.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists WorkerChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WorkerChannelInstance records from the API. - Request is executed immediately - - :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 WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WorkerChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkerChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkerChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a WorkerChannelContext - - :param sid: The SID of the to fetch - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ - return WorkerChannelContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a WorkerChannelContext - - :param sid: The SID of the to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ - return WorkerChannelContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkerChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkerChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the WorkerChannel - :param worker_sid: The SID of the Worker that contains the WorkerChannel - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelPage - """ - super(WorkerChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkerChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - return WorkerChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkerChannelContext(InstanceContext): - - def __init__(self, version, workspace_sid, worker_sid, sid): - """ - Initialize the WorkerChannelContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the WorkerChannel to fetch - :param worker_sid: The SID of the Worker with the WorkerChannel to fetch - :param sid: The SID of the to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ - super(WorkerChannelContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, worker_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WorkerChannelContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Channels/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the WorkerChannelInstance - - :returns: The fetched WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WorkerChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) - - def update(self, capacity=values.unset, available=values.unset): - """ - Update the WorkerChannelInstance - - :param unicode capacity: The total number of Tasks that the Worker should handle for the TaskChannel type - :param bool available: Whether the WorkerChannel is available - - :returns: The updated WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - data = values.of({'Capacity': capacity, 'Available': available, }) + self._solution = { workspace_sid, worker_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/${worker_sid}/Channels/${sid}' + + + def fetch(self): + + """ + Fetch the WorkerChannelInstance + + :returns: The fetched WorkerChannelInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkerChannelInstance( + self._version, + payload, + workspace_sidworker_sidsid=self._solution['workspace_sid''worker_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return WorkerChannelInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], - ) + return WorkerChannelInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], worker_sid=self._solution['worker_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkerChannelInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid, worker_sid, sid=None): - """ - Initialize the WorkerChannelInstance - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ +class WorkerChannelInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, worker_sid: str, sid: str): super(WorkerChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assigned_tasks': deserialize.integer(payload.get('assigned_tasks')), - 'available': payload.get('available'), - 'available_capacity_percentage': deserialize.integer(payload.get('available_capacity_percentage')), - 'configured_capacity': deserialize.integer(payload.get('configured_capacity')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'sid': payload.get('sid'), - 'task_channel_sid': payload.get('task_channel_sid'), - 'task_channel_unique_name': payload.get('task_channel_unique_name'), - 'worker_sid': payload.get('worker_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assigned_tasks' = payload.get('assigned_tasks'), + 'available' = payload.get('available'), + 'available_capacity_percentage' = payload.get('available_capacity_percentage'), + 'configured_capacity' = payload.get('configured_capacity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'sid' = payload.get('sid'), + 'task_channel_sid' = payload.get('task_channel_sid'), + 'task_channel_unique_name' = payload.get('task_channel_unique_name'), + 'worker_sid' = payload.get('worker_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'workspace_sid': workspace_sid, - 'worker_sid': worker_sid, - 'sid': sid or self._properties['sid'], + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'worker_sid': worker_sid or self._properties['worker_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkerChannelContext for this WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelContext - """ if self._context is None: self._context = WorkerChannelContext( self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],worker_sid=self._solution['worker_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assigned_tasks(self): - """ - :returns: The total number of Tasks assigned to Worker for the TaskChannel type - :rtype: unicode - """ - return self._properties['assigned_tasks'] - - @property - def available(self): - """ - :returns: Whether the Worker should receive Tasks of the TaskChannel type - :rtype: bool - """ - return self._properties['available'] - - @property - def available_capacity_percentage(self): - """ - :returns: The current available capacity between 0 to 100 for the TaskChannel - :rtype: unicode - """ - return self._properties['available_capacity_percentage'] - - @property - def configured_capacity(self): - """ - :returns: The current configured capacity for the WorkerChannel - :rtype: unicode - """ - return self._properties['configured_capacity'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_channel_sid(self): - """ - :returns: The SID of the TaskChannel - :rtype: unicode - """ - return self._properties['task_channel_sid'] - - @property - def task_channel_unique_name(self): - """ - :returns: The unique name of the TaskChannel, such as 'voice' or 'sms' - :rtype: unicode - """ - return self._properties['task_channel_unique_name'] - - @property - def worker_sid(self): - """ - :returns: The SID of the Worker that contains the WorkerChannel - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the WorkerChannel - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the WorkerChannel resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the WorkerChannelInstance - :returns: The fetched WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - return self._proxy.fetch() +class WorkerChannelListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, worker_sid: str): + # TODO: needs autogenerated docs + super(WorkerChannelListInstanceList, self).__init__(version) - def update(self, capacity=values.unset, available=values.unset): - """ - Update the WorkerChannelInstance + # Path Solution + self._solution = { workspace_sid, worker_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/${worker_sid}/Channels' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param unicode capacity: The total number of Tasks that the Worker should handle for the TaskChannel type - :param bool available: Whether the WorkerChannel is available + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated WorkerChannelInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelInstance - """ - return self._proxy.update(capacity=capacity, available=available, ) + return WorkerChannelPage(self._version, payload, workspace_sid=self._solution['workspace_sid']worker_sid=self._solution['worker_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py index 54ffb9d2a9..75725d64c8 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py @@ -1,284 +1,120 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkerStatisticsList(ListResource): - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the WorkerStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the WorkerChannel - :param worker_sid: The SID of the Worker that contains the WorkerChannel - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - """ - super(WorkerStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - 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'], - ) - def __call__(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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkerStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkerStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the WorkerChannel - :param worker_sid: The SID of the Worker that contains the WorkerChannel - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsPage - """ - super(WorkerStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkerStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid, worker_sid): - """ - Initialize the WorkerStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the WorkerChannel to fetch - :param worker_sid: The SID of the Worker with the WorkerChannel to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - """ - super(WorkerStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, worker_sid: str): + # TODO: needs autogenerated docs + super(WorkerStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{worker_sid}/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset): - """ - Fetch the WorkerStatisticsInstance - - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode task_channel: Only calculate statistics on this TaskChannel - - :returns: The fetched WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - """ - data = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskChannel': task_channel, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkerStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], - ) + self._solution = { workspace_sid, worker_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/${worker_sid}/Statistics' + + + def fetch(self, minutes, start_date, end_date, task_channel): + + """ + Fetch the WorkerStatisticsInstance + + :returns: The fetched WorkerStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkerStatisticsInstance( + self._version, + payload, + workspace_sidworker_sid=self._solution['workspace_sid''worker_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class WorkerStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid, worker_sid): - """ - Initialize the WorkerStatisticsInstance - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance - """ +class WorkerStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, worker_sid: str): super(WorkerStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'cumulative': payload.get('cumulative'), - 'worker_sid': payload.get('worker_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'cumulative' = payload.get('cumulative'), + 'worker_sid' = payload.get('worker_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'worker_sid': worker_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'worker_sid': worker_sid or self._properties['worker_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkerStatisticsContext for this WorkerStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext - """ if self._context is None: self._context = WorkerStatisticsContext( self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['worker_sid'], + workspace_sid=self._solution['workspace_sid'],worker_sid=self._solution['worker_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: An object that contains the cumulative statistics for the Worker - :rtype: dict - """ - return self._properties['cumulative'] + - @property - def worker_sid(self): - """ - :returns: The SID of the Worker that contains the WorkerChannel - :rtype: unicode - """ - return self._properties['worker_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the WorkerChannel - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the WorkerChannel statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset): - """ - Fetch the WorkerStatisticsInstance - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode task_channel: Only calculate statistics on this TaskChannel +class WorkerStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, worker_sid: str): + # TODO: needs autogenerated docs + super(WorkerStatisticsListInstanceList, self).__init__(version) - :returns: The 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, - ) + # Path Solution + self._solution = { workspace_sid, worker_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py index 1ca4b9895c..5daf5dbd5d 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,200 +19,73 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class WorkersCumulativeStatisticsList(ListResource): - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - """ - super(WorkersCumulativeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkersCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ - return WorkersCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __call__(self): - """ - Constructs a WorkersCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ - return WorkersCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkersCumulativeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkersCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsPage - """ - super(WorkersCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkersCumulativeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ - return WorkersCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkersCumulativeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ - super(WorkersCumulativeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkersCumulativeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset): - """ - Fetch the WorkersCumulativeStatisticsInstance - - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel - - :returns: The fetched WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ - data = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkersCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/CumulativeStatistics' + + + def fetch(self, end_date, minutes, start_date, task_channel): + + """ + Fetch the WorkersCumulativeStatisticsInstance + + :returns: The fetched WorkersCumulativeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkersCumulativeStatisticsInstance( + self._version, + payload, + workspace_sid=self._solution['workspace_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkersCumulativeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkersCumulativeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ +class WorkersCumulativeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str): super(WorkersCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'activity_durations': payload.get('activity_durations'), - 'reservations_created': deserialize.integer(payload.get('reservations_created')), - 'reservations_accepted': deserialize.integer(payload.get('reservations_accepted')), - 'reservations_rejected': deserialize.integer(payload.get('reservations_rejected')), - 'reservations_timed_out': deserialize.integer(payload.get('reservations_timed_out')), - 'reservations_canceled': deserialize.integer(payload.get('reservations_canceled')), - 'reservations_rescinded': deserialize.integer(payload.get('reservations_rescinded')), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'activity_durations' = payload.get('activity_durations'), + 'reservations_created' = payload.get('reservations_created'), + 'reservations_accepted' = payload.get('reservations_accepted'), + 'reservations_rejected' = payload.get('reservations_rejected'), + 'reservations_timed_out' = payload.get('reservations_timed_out'), + 'reservations_canceled' = payload.get('reservations_canceled'), + 'reservations_rescinded' = payload.get('reservations_rescinded'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkersCumulativeStatisticsContext for this WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsContext - """ if self._context is None: self._context = WorkersCumulativeStatisticsContext( self._version, @@ -213,128 +93,35 @@ def _proxy(self): ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def start_time(self): - """ - :returns: The beginning of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def activity_durations(self): - """ - :returns: The minimum, average, maximum, and total time that Workers spent in each Activity - :rtype: list[dict] - """ - return self._properties['activity_durations'] - - @property - def reservations_created(self): - """ - :returns: The total number of Reservations that were created - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The total number of Reservations that were accepted - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The total number of Reservations that were rejected - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The total number of Reservations that were timed out - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The total number of Reservations that were canceled - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The total number of Reservations that were rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the Workers - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workers statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset): - """ - Fetch the WorkersCumulativeStatisticsInstance - :param datetime end_date: Only calculate statistics from on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel +class WorkersCumulativeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkersCumulativeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkersCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - ) + # Path Solution + self._solution = { workspace_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py index 5c477c8541..d6ddb7d23c 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py @@ -1,194 +1,84 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkersRealTimeStatisticsList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersRealTimeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - """ - super(WorkersRealTimeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - def get(self): - """ - Constructs a WorkersRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ - return WorkersRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - def __call__(self): - """ - Constructs a WorkersRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ - return WorkersRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkersRealTimeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkersRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsPage - """ - super(WorkersRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkersRealTimeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ - return WorkersRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkersRealTimeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ - super(WorkersRealTimeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkersRealTimeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch the WorkersRealTimeStatisticsInstance - - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel - - :returns: The fetched WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ - data = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkersRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/RealTimeStatistics' + + + def fetch(self, task_channel): + + """ + Fetch the WorkersRealTimeStatisticsInstance + + :returns: The fetched WorkersRealTimeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkersRealTimeStatisticsInstance( + self._version, + payload, + workspace_sid=self._solution['workspace_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkersRealTimeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkersRealTimeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ +class WorkersRealTimeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str): super(WorkersRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'activity_statistics': payload.get('activity_statistics'), - 'total_workers': deserialize.integer(payload.get('total_workers')), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'activity_statistics' = payload.get('activity_statistics'), + 'total_workers' = payload.get('total_workers'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkersRealTimeStatisticsContext for this WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsContext - """ if self._context is None: self._context = WorkersRealTimeStatisticsContext( self._version, @@ -196,63 +86,35 @@ def _proxy(self): ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def activity_statistics(self): - """ - :returns: The number of current Workers by Activity - :rtype: list[dict] - """ - return self._properties['activity_statistics'] - - @property - def total_workers(self): - """ - :returns: The total number of Workers - :rtype: unicode - """ - return self._properties['total_workers'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the Workers - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workers statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, task_channel=values.unset): - """ - Fetch the WorkersRealTimeStatisticsInstance - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel +class WorkersRealTimeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkersRealTimeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkersRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) + # Path Solution + self._solution = { workspace_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py index 3cde26af90..de40bde61c 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py @@ -1,205 +1,84 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkersStatisticsList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Worker - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - """ - super(WorkersStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - def get(self): - """ - Constructs a WorkersStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ - return WorkersStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - def __call__(self): - """ - Constructs a WorkersStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ - return WorkersStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkersStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkersStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Worker - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsPage - """ - super(WorkersStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkersStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkersStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Worker to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ - super(WorkersStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkersStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_queue_sid=values.unset, - task_queue_name=values.unset, friendly_name=values.unset, - task_channel=values.unset): - """ - Fetch the WorkersStatisticsInstance - - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only calculate statistics from this date and time and earlier - :param unicode task_queue_sid: The SID of the TaskQueue for which to fetch Worker statistics - :param unicode task_queue_name: The friendly_name of the TaskQueue for which to fetch Worker statistics - :param unicode friendly_name: Only include Workers with `friendly_name` values that match this parameter - :param unicode task_channel: Only calculate statistics on this TaskChannel - - :returns: The fetched WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - """ - data = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskQueueSid': task_queue_sid, - 'TaskQueueName': task_queue_name, - 'FriendlyName': friendly_name, - 'TaskChannel': task_channel, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkersStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/Statistics' + + + def fetch(self, minutes, start_date, end_date, task_queue_sid, task_queue_name, friendly_name, task_channel): + + """ + Fetch the WorkersStatisticsInstance + + :returns: The fetched WorkersStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkersStatisticsInstance( + self._version, + payload, + workspace_sid=self._solution['workspace_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkersStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkersStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - """ +class WorkersStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str): super(WorkersStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'realtime': payload.get('realtime'), - 'cumulative': payload.get('cumulative'), - 'account_sid': payload.get('account_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'realtime' = payload.get('realtime'), + 'cumulative' = payload.get('cumulative'), + 'account_sid' = payload.get('account_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkersStatisticsContext for this WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsContext - """ if self._context is None: self._context = WorkersStatisticsContext( self._version, @@ -207,80 +86,35 @@ def _proxy(self): ) return self._context - @property - def realtime(self): - """ - :returns: An object that contains the real-time statistics for the Worker - :rtype: dict - """ - return self._properties['realtime'] + - @property - def cumulative(self): - """ - :returns: An object that contains the cumulative statistics for the Worker - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the Worker - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Worker statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_queue_sid=values.unset, - task_queue_name=values.unset, friendly_name=values.unset, - task_channel=values.unset): - """ - Fetch the WorkersStatisticsInstance - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only calculate statistics from this date and time and earlier - :param unicode task_queue_sid: The SID of the TaskQueue for which to fetch Worker statistics - :param unicode task_queue_name: The friendly_name of the TaskQueue for which to fetch Worker statistics - :param unicode friendly_name: Only include Workers with `friendly_name` values that match this parameter - :param unicode task_channel: Only calculate statistics on this TaskChannel +class WorkersStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkersStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkersStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance - """ - return self._proxy.fetch( - minutes=minutes, - start_date=start_date, - end_date=end_date, - task_queue_sid=task_queue_sid, - task_queue_name=task_queue_name, - friendly_name=friendly_name, - task_channel=task_channel, - ) + # Path Solution + self._solution = { workspace_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workflow.py b/twilio/rest/taskrouter/v1/workspace/workflow.py new file mode 100644 index 0000000000..14a3d3ed9c --- /dev/null +++ b/twilio/rest/taskrouter/v1/workspace/workflow.py @@ -0,0 +1,184 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.workflow.workflow_cumulative_statistics import WorkflowCumulativeStatisticsListInstancefrom twilio.rest.workflow.workflow_real_time_statistics import WorkflowRealTimeStatisticsListInstancefrom twilio.rest.workflow.workflow_statistics import WorkflowStatisticsListInstance + + +class WorkflowContext(InstanceContext): + def __init__(self, version: V1, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WorkflowContextList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, sid, } + self._uri = '/Workspaces/${workspace_sid}/Workflows/${sid}' + + self._cumulative_statistics = None + self._real_time_statistics = None + self._statistics = None + + def delete(self): + + + """ + Deletes the WorkflowInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WorkflowInstance + + :returns: The fetched WorkflowInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkflowInstance( + self._version, + payload, + workspace_sidsid=self._solution['workspace_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class WorkflowInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super(WorkflowInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'assignment_callback_url' = payload.get('assignment_callback_url'), + 'configuration' = payload.get('configuration'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'document_content_type' = payload.get('document_content_type'), + 'fallback_assignment_callback_url' = payload.get('fallback_assignment_callback_url'), + 'friendly_name' = payload.get('friendly_name'), + 'sid' = payload.get('sid'), + 'task_reservation_timeout' = payload.get('task_reservation_timeout'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = WorkflowContext( + self._version, + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def cumulative_statistics(self): + return self._proxy.cumulative_statistics + @property + def real_time_statistics(self): + return self._proxy.real_time_statistics + @property + def statistics(self): + return self._proxy.statistics + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class WorkflowListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkflowListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workflows' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WorkflowPage(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py index ef2047f09e..db5ba6541d 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,433 +19,119 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkflowCumulativeStatisticsList(ListResource): - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Workflow. - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - """ - super(WorkflowCumulativeStatisticsList, self).__init__(version) - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - def get(self): - """ - Constructs a WorkflowCumulativeStatisticsContext - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ - return WorkflowCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __call__(self): - """ - Constructs a WorkflowCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ - return WorkflowCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkflowCumulativeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkflowCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Workflow. - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsPage - """ - super(WorkflowCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkflowCumulativeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ - return WorkflowCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkflowCumulativeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the resource to fetch - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ - super(WorkflowCumulativeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, workflow_sid: str): + # TODO: needs autogenerated docs + super(WorkflowCumulativeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{workflow_sid}/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkflowCumulativeStatisticsInstance - - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on - - :returns: The fetched WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ - data = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkflowCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) + self._solution = { workspace_sid, workflow_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workflows/${workflow_sid}/CumulativeStatistics' + + + def fetch(self, end_date, minutes, start_date, task_channel, split_by_wait_time): + + """ + Fetch the WorkflowCumulativeStatisticsInstance + + :returns: The fetched WorkflowCumulativeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkflowCumulativeStatisticsInstance( + self._version, + payload, + workspace_sidworkflow_sid=self._solution['workspace_sid''workflow_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class WorkflowCumulativeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid, workflow_sid): - """ - Initialize the WorkflowCumulativeStatisticsInstance - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ +class WorkflowCumulativeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, workflow_sid: str): super(WorkflowCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'avg_task_acceptance_time': deserialize.integer(payload.get('avg_task_acceptance_time')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'reservations_created': deserialize.integer(payload.get('reservations_created')), - 'reservations_accepted': deserialize.integer(payload.get('reservations_accepted')), - 'reservations_rejected': deserialize.integer(payload.get('reservations_rejected')), - 'reservations_timed_out': deserialize.integer(payload.get('reservations_timed_out')), - 'reservations_canceled': deserialize.integer(payload.get('reservations_canceled')), - 'reservations_rescinded': deserialize.integer(payload.get('reservations_rescinded')), - 'split_by_wait_time': payload.get('split_by_wait_time'), - 'wait_duration_until_accepted': payload.get('wait_duration_until_accepted'), - 'wait_duration_until_canceled': payload.get('wait_duration_until_canceled'), - 'tasks_canceled': deserialize.integer(payload.get('tasks_canceled')), - 'tasks_completed': deserialize.integer(payload.get('tasks_completed')), - 'tasks_entered': deserialize.integer(payload.get('tasks_entered')), - 'tasks_deleted': deserialize.integer(payload.get('tasks_deleted')), - 'tasks_moved': deserialize.integer(payload.get('tasks_moved')), - 'tasks_timed_out_in_workflow': deserialize.integer(payload.get('tasks_timed_out_in_workflow')), - 'workflow_sid': payload.get('workflow_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'avg_task_acceptance_time' = payload.get('avg_task_acceptance_time'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'reservations_created' = payload.get('reservations_created'), + 'reservations_accepted' = payload.get('reservations_accepted'), + 'reservations_rejected' = payload.get('reservations_rejected'), + 'reservations_timed_out' = payload.get('reservations_timed_out'), + 'reservations_canceled' = payload.get('reservations_canceled'), + 'reservations_rescinded' = payload.get('reservations_rescinded'), + 'split_by_wait_time' = payload.get('split_by_wait_time'), + 'wait_duration_until_accepted' = payload.get('wait_duration_until_accepted'), + 'wait_duration_until_canceled' = payload.get('wait_duration_until_canceled'), + 'tasks_canceled' = payload.get('tasks_canceled'), + 'tasks_completed' = payload.get('tasks_completed'), + 'tasks_entered' = payload.get('tasks_entered'), + 'tasks_deleted' = payload.get('tasks_deleted'), + 'tasks_moved' = payload.get('tasks_moved'), + 'tasks_timed_out_in_workflow' = payload.get('tasks_timed_out_in_workflow'), + 'workflow_sid' = payload.get('workflow_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'workflow_sid': workflow_sid or self._properties['workflow_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowCumulativeStatisticsContext for this WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsContext - """ if self._context is None: self._context = WorkflowCumulativeStatisticsContext( self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], + workspace_sid=self._solution['workspace_sid'],workflow_sid=self._solution['workflow_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def avg_task_acceptance_time(self): - """ - :returns: The average time in seconds between Task creation and acceptance - :rtype: unicode - """ - return self._properties['avg_task_acceptance_time'] + - @property - def start_time(self): - """ - :returns: The beginning of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def reservations_created(self): - """ - :returns: The total number of Reservations that were created for Workers - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The total number of Reservations accepted by Workers - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The total number of Reservations that were rejected - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The total number of Reservations that were timed out - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The total number of Reservations that were canceled - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The total number of Reservations that were rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] - - @property - def split_by_wait_time(self): - """ - :returns: A list of objects that describe the Tasks canceled and reservations accepted above and below the specified thresholds - :rtype: dict - """ - return self._properties['split_by_wait_time'] - - @property - def wait_duration_until_accepted(self): - """ - :returns: The wait duration statistics for Tasks that were accepted - :rtype: dict - """ - return self._properties['wait_duration_until_accepted'] - - @property - def wait_duration_until_canceled(self): - """ - :returns: The wait duration statistics for Tasks that were canceled - :rtype: dict - """ - return self._properties['wait_duration_until_canceled'] - - @property - def tasks_canceled(self): - """ - :returns: The total number of Tasks that were canceled - :rtype: unicode - """ - return self._properties['tasks_canceled'] - - @property - def tasks_completed(self): - """ - :returns: The total number of Tasks that were completed - :rtype: unicode - """ - return self._properties['tasks_completed'] - - @property - def tasks_entered(self): - """ - :returns: The total number of Tasks that entered the Workflow - :rtype: unicode - """ - return self._properties['tasks_entered'] - - @property - def tasks_deleted(self): - """ - :returns: The total number of Tasks that were deleted - :rtype: unicode - """ - return self._properties['tasks_deleted'] - - @property - def tasks_moved(self): - """ - :returns: The total number of Tasks that were moved from one queue to another - :rtype: unicode - """ - return self._properties['tasks_moved'] - - @property - def tasks_timed_out_in_workflow(self): - """ - :returns: The total number of Tasks that were timed out of their Workflows - :rtype: unicode - """ - return self._properties['tasks_timed_out_in_workflow'] - - @property - def workflow_sid(self): - """ - :returns: Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the Workflow. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workflow statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkflowCumulativeStatisticsInstance - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on +class WorkflowCumulativeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, workflow_sid: str): + # TODO: needs autogenerated docs + super(WorkflowCumulativeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkflowCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) + # Path Solution + self._solution = { workspace_sid, workflow_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py index a94175fa61..8f6f566e31 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py @@ -1,302 +1,124 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkflowRealTimeStatisticsList(ListResource): - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowRealTimeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Workflow. - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - """ - super(WorkflowRealTimeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - 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'], - ) - - def __call__(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'], - ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkflowRealTimeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkflowRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Workflow. - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsPage - """ - super(WorkflowRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkflowRealTimeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Workflow to fetch - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - """ - super(WorkflowRealTimeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, workflow_sid: str): + # TODO: needs autogenerated docs + super(WorkflowRealTimeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{workflow_sid}/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch the WorkflowRealTimeStatisticsInstance - - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel - - :returns: The fetched WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - """ - data = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkflowRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) + self._solution = { workspace_sid, workflow_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workflows/${workflow_sid}/RealTimeStatistics' + + + def fetch(self, task_channel): + + """ + Fetch the WorkflowRealTimeStatisticsInstance + + :returns: The fetched WorkflowRealTimeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkflowRealTimeStatisticsInstance( + self._version, + payload, + workspace_sidworkflow_sid=self._solution['workspace_sid''workflow_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkflowRealTimeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid, workflow_sid): - """ - Initialize the WorkflowRealTimeStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - """ +class WorkflowRealTimeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, workflow_sid: str): super(WorkflowRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'longest_task_waiting_age': deserialize.integer(payload.get('longest_task_waiting_age')), - 'longest_task_waiting_sid': payload.get('longest_task_waiting_sid'), - 'tasks_by_priority': payload.get('tasks_by_priority'), - 'tasks_by_status': payload.get('tasks_by_status'), - 'total_tasks': deserialize.integer(payload.get('total_tasks')), - 'workflow_sid': payload.get('workflow_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'longest_task_waiting_age' = payload.get('longest_task_waiting_age'), + 'longest_task_waiting_sid' = payload.get('longest_task_waiting_sid'), + 'tasks_by_priority' = payload.get('tasks_by_priority'), + 'tasks_by_status' = payload.get('tasks_by_status'), + 'total_tasks' = payload.get('total_tasks'), + 'workflow_sid' = payload.get('workflow_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'workflow_sid': workflow_sid or self._properties['workflow_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowRealTimeStatisticsContext for this WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext - """ if self._context is None: self._context = WorkflowRealTimeStatisticsContext( self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], + workspace_sid=self._solution['workspace_sid'],workflow_sid=self._solution['workflow_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def longest_task_waiting_age(self): - """ - :returns: The age of the longest waiting Task - :rtype: unicode - """ - return self._properties['longest_task_waiting_age'] - - @property - def longest_task_waiting_sid(self): - """ - :returns: The SID of the longest waiting Task - :rtype: unicode - """ - return self._properties['longest_task_waiting_sid'] - - @property - def tasks_by_priority(self): - """ - :returns: The number of Tasks by priority - :rtype: dict - """ - return self._properties['tasks_by_priority'] - - @property - def tasks_by_status(self): - """ - :returns: The number of Tasks by their current status - :rtype: dict - """ - return self._properties['tasks_by_status'] + - @property - def total_tasks(self): - """ - :returns: The total number of Tasks - :rtype: unicode - """ - return self._properties['total_tasks'] - - @property - def workflow_sid(self): - """ - :returns: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the Workflow. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workflow statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, task_channel=values.unset): - """ - Fetch the WorkflowRealTimeStatisticsInstance - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel +class WorkflowRealTimeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, workflow_sid: str): + # TODO: needs autogenerated docs + super(WorkflowRealTimeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkflowRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) + # Path Solution + self._solution = { workspace_sid, workflow_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py index 5e4055ddb5..21da0e21d7 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py @@ -1,299 +1,121 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkflowStatisticsList(ListResource): - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Workflow - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - """ - super(WorkflowStatisticsList, self).__init__(version) - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - - def get(self): - """ - Constructs a WorkflowStatisticsContext - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ - return WorkflowStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __call__(self): - """ - Constructs a WorkflowStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ - return WorkflowStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkflowStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkflowStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Workflow - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsPage - """ - super(WorkflowStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkflowStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ - return WorkflowStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkflowStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid, workflow_sid): - """ - Initialize the WorkflowStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Workflow to fetch - :param workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ - super(WorkflowStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str, workflow_sid: str): + # TODO: needs autogenerated docs + super(WorkflowStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{workflow_sid}/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkflowStatisticsInstance - - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only calculate statistics from this date and time and earlier - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel. - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on - - :returns: The fetched WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ - data = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkflowStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], - ) + self._solution = { workspace_sid, workflow_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workflows/${workflow_sid}/Statistics' + + + def fetch(self, minutes, start_date, end_date, task_channel, split_by_wait_time): + + """ + Fetch the WorkflowStatisticsInstance + + :returns: The fetched WorkflowStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkflowStatisticsInstance( + self._version, + payload, + workspace_sidworkflow_sid=self._solution['workspace_sid''workflow_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class WorkflowStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid, workflow_sid): - """ - Initialize the WorkflowStatisticsInstance - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ +class WorkflowStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, workflow_sid: str): super(WorkflowStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'cumulative': payload.get('cumulative'), - 'realtime': payload.get('realtime'), - 'workflow_sid': payload.get('workflow_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'cumulative' = payload.get('cumulative'), + 'realtime' = payload.get('realtime'), + 'workflow_sid' = payload.get('workflow_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'workflow_sid': workflow_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid']'workflow_sid': workflow_sid or self._properties['workflow_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowStatisticsContext for this WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsContext - """ if self._context is None: self._context = WorkflowStatisticsContext( self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['workflow_sid'], + workspace_sid=self._solution['workspace_sid'],workflow_sid=self._solution['workflow_sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def cumulative(self): - """ - :returns: An object that contains the cumulative statistics for the Workflow - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def realtime(self): - """ - :returns: An object that contains the real-time statistics for the Workflow - :rtype: dict - """ - return self._properties['realtime'] + - @property - def workflow_sid(self): - """ - :returns: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace that contains the Workflow - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workflow statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkflowStatisticsInstance - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only calculate statistics from this date and time and earlier - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel. - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on +class WorkflowStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str, workflow_sid: str): + # TODO: needs autogenerated docs + super(WorkflowStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkflowStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance - """ - return self._proxy.fetch( - minutes=minutes, - start_date=start_date, - end_date=end_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) + # Path Solution + self._solution = { workspace_sid, workflow_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py index e83547ad57..81c12419bd 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,212 +19,82 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkspaceCumulativeStatisticsList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceCumulativeStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - """ - super(WorkspaceCumulativeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkspaceCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ - return WorkspaceCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __call__(self): - """ - Constructs a WorkspaceCumulativeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ - return WorkspaceCumulativeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkspaceCumulativeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkspaceCumulativeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsPage - """ - super(WorkspaceCumulativeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkspaceCumulativeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ - return WorkspaceCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkspaceCumulativeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceCumulativeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ - super(WorkspaceCumulativeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkspaceCumulativeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/CumulativeStatistics'.format(**self._solution) - - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkspaceCumulativeStatisticsInstance - - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on - - :returns: The fetched WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ - data = values.of({ - 'EndDate': serialize.iso8601_datetime(end_date), - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkspaceCumulativeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/CumulativeStatistics' + + + def fetch(self, end_date, minutes, start_date, task_channel, split_by_wait_time): + + """ + Fetch the WorkspaceCumulativeStatisticsInstance + + :returns: The fetched WorkspaceCumulativeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkspaceCumulativeStatisticsInstance( + self._version, + payload, + workspace_sid=self._solution['workspace_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkspaceCumulativeStatisticsInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkspaceCumulativeStatisticsInstance - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ +class WorkspaceCumulativeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str): super(WorkspaceCumulativeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'avg_task_acceptance_time': deserialize.integer(payload.get('avg_task_acceptance_time')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'reservations_created': deserialize.integer(payload.get('reservations_created')), - 'reservations_accepted': deserialize.integer(payload.get('reservations_accepted')), - 'reservations_rejected': deserialize.integer(payload.get('reservations_rejected')), - 'reservations_timed_out': deserialize.integer(payload.get('reservations_timed_out')), - 'reservations_canceled': deserialize.integer(payload.get('reservations_canceled')), - 'reservations_rescinded': deserialize.integer(payload.get('reservations_rescinded')), - 'split_by_wait_time': payload.get('split_by_wait_time'), - 'wait_duration_until_accepted': payload.get('wait_duration_until_accepted'), - 'wait_duration_until_canceled': payload.get('wait_duration_until_canceled'), - 'tasks_canceled': deserialize.integer(payload.get('tasks_canceled')), - 'tasks_completed': deserialize.integer(payload.get('tasks_completed')), - 'tasks_created': deserialize.integer(payload.get('tasks_created')), - 'tasks_deleted': deserialize.integer(payload.get('tasks_deleted')), - 'tasks_moved': deserialize.integer(payload.get('tasks_moved')), - 'tasks_timed_out_in_workflow': deserialize.integer(payload.get('tasks_timed_out_in_workflow')), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'avg_task_acceptance_time' = payload.get('avg_task_acceptance_time'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'reservations_created' = payload.get('reservations_created'), + 'reservations_accepted' = payload.get('reservations_accepted'), + 'reservations_rejected' = payload.get('reservations_rejected'), + 'reservations_timed_out' = payload.get('reservations_timed_out'), + 'reservations_canceled' = payload.get('reservations_canceled'), + 'reservations_rescinded' = payload.get('reservations_rescinded'), + 'split_by_wait_time' = payload.get('split_by_wait_time'), + 'wait_duration_until_accepted' = payload.get('wait_duration_until_accepted'), + 'wait_duration_until_canceled' = payload.get('wait_duration_until_canceled'), + 'tasks_canceled' = payload.get('tasks_canceled'), + 'tasks_completed' = payload.get('tasks_completed'), + 'tasks_created' = payload.get('tasks_created'), + 'tasks_deleted' = payload.get('tasks_deleted'), + 'tasks_moved' = payload.get('tasks_moved'), + 'tasks_timed_out_in_workflow' = payload.get('tasks_timed_out_in_workflow'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceCumulativeStatisticsContext for this WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsContext - """ if self._context is None: self._context = WorkspaceCumulativeStatisticsContext( self._version, @@ -225,203 +102,35 @@ def _proxy(self): ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def avg_task_acceptance_time(self): - """ - :returns: The average time in seconds between Task creation and acceptance - :rtype: unicode - """ - return self._properties['avg_task_acceptance_time'] - - @property - def start_time(self): - """ - :returns: The beginning of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end of the interval during which these statistics were calculated - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def reservations_created(self): - """ - :returns: The total number of Reservations that were created for Workers - :rtype: unicode - """ - return self._properties['reservations_created'] - - @property - def reservations_accepted(self): - """ - :returns: The total number of Reservations accepted by Workers - :rtype: unicode - """ - return self._properties['reservations_accepted'] - - @property - def reservations_rejected(self): - """ - :returns: The total number of Reservations that were rejected - :rtype: unicode - """ - return self._properties['reservations_rejected'] - - @property - def reservations_timed_out(self): - """ - :returns: The total number of Reservations that were timed out - :rtype: unicode - """ - return self._properties['reservations_timed_out'] - - @property - def reservations_canceled(self): - """ - :returns: The total number of Reservations that were canceled - :rtype: unicode - """ - return self._properties['reservations_canceled'] - - @property - def reservations_rescinded(self): - """ - :returns: The total number of Reservations that were rescinded - :rtype: unicode - """ - return self._properties['reservations_rescinded'] + - @property - def split_by_wait_time(self): - """ - :returns: A list of objects that describe the Tasks canceled and reservations accepted above and below the specified thresholds - :rtype: dict - """ - return self._properties['split_by_wait_time'] - - @property - def wait_duration_until_accepted(self): - """ - :returns: The wait duration statistics for Tasks that were accepted - :rtype: dict - """ - return self._properties['wait_duration_until_accepted'] - - @property - def wait_duration_until_canceled(self): - """ - :returns: The wait duration statistics for Tasks that were canceled - :rtype: dict - """ - return self._properties['wait_duration_until_canceled'] - - @property - def tasks_canceled(self): - """ - :returns: The total number of Tasks that were canceled - :rtype: unicode - """ - return self._properties['tasks_canceled'] - - @property - def tasks_completed(self): - """ - :returns: The total number of Tasks that were completed - :rtype: unicode - """ - return self._properties['tasks_completed'] - - @property - def tasks_created(self): - """ - :returns: The total number of Tasks created - :rtype: unicode - """ - return self._properties['tasks_created'] - - @property - def tasks_deleted(self): - """ - :returns: The total number of Tasks that were deleted - :rtype: unicode - """ - return self._properties['tasks_deleted'] - - @property - def tasks_moved(self): - """ - :returns: The total number of Tasks that were moved from one queue to another - :rtype: unicode - """ - return self._properties['tasks_moved'] - - @property - def tasks_timed_out_in_workflow(self): - """ - :returns: The total number of Tasks that were timed out of their Workflows - :rtype: unicode - """ - return self._properties['tasks_timed_out_in_workflow'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workspace statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, end_date=values.unset, minutes=values.unset, - start_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkspaceCumulativeStatisticsInstance - :param datetime end_date: Only include usage that occurred on or before this date - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param unicode task_channel: Only calculate cumulative statistics on this TaskChannel - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on +class WorkspaceCumulativeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkspaceCumulativeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkspaceCumulativeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsInstance - """ - return self._proxy.fetch( - end_date=end_date, - minutes=minutes, - start_date=start_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) + # Path Solution + self._solution = { workspace_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py index 0f8afb66da..13e9a8c5dd 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py @@ -1,199 +1,89 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkspaceRealTimeStatisticsList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceRealTimeStatisticsList - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - """ - super(WorkspaceRealTimeStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - - def get(self): - """ - Constructs a WorkspaceRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ - return WorkspaceRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - def __call__(self): - """ - Constructs a WorkspaceRealTimeStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ - return WorkspaceRealTimeStatisticsContext( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkspaceRealTimeStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkspaceRealTimeStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsPage - """ - super(WorkspaceRealTimeStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkspaceRealTimeStatisticsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ - return WorkspaceRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkspaceRealTimeStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceRealTimeStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ - super(WorkspaceRealTimeStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkspaceRealTimeStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/RealTimeStatistics'.format(**self._solution) - - def fetch(self, task_channel=values.unset): - """ - Fetch the WorkspaceRealTimeStatisticsInstance - - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel - - :returns: The fetched WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ - data = values.of({'TaskChannel': task_channel, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkspaceRealTimeStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/RealTimeStatistics' + + + def fetch(self, task_channel): + + """ + Fetch the WorkspaceRealTimeStatisticsInstance + + :returns: The fetched WorkspaceRealTimeStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkspaceRealTimeStatisticsInstance( + self._version, + payload, + workspace_sid=self._solution['workspace_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class WorkspaceRealTimeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkspaceRealTimeStatisticsInstance - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ +class WorkspaceRealTimeStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str): super(WorkspaceRealTimeStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'activity_statistics': payload.get('activity_statistics'), - 'longest_task_waiting_age': deserialize.integer(payload.get('longest_task_waiting_age')), - 'longest_task_waiting_sid': payload.get('longest_task_waiting_sid'), - 'tasks_by_priority': payload.get('tasks_by_priority'), - 'tasks_by_status': payload.get('tasks_by_status'), - 'total_tasks': deserialize.integer(payload.get('total_tasks')), - 'total_workers': deserialize.integer(payload.get('total_workers')), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'activity_statistics' = payload.get('activity_statistics'), + 'longest_task_waiting_age' = payload.get('longest_task_waiting_age'), + 'longest_task_waiting_sid' = payload.get('longest_task_waiting_sid'), + 'tasks_by_priority' = payload.get('tasks_by_priority'), + 'tasks_by_status' = payload.get('tasks_by_status'), + 'total_tasks' = payload.get('total_tasks'), + 'total_workers' = payload.get('total_workers'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceRealTimeStatisticsContext for this WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsContext - """ if self._context is None: self._context = WorkspaceRealTimeStatisticsContext( self._version, @@ -201,103 +91,35 @@ def _proxy(self): ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def activity_statistics(self): - """ - :returns: The number of current Workers by Activity - :rtype: list[dict] - """ - return self._properties['activity_statistics'] + - @property - def longest_task_waiting_age(self): - """ - :returns: The age of the longest waiting Task - :rtype: unicode - """ - return self._properties['longest_task_waiting_age'] - - @property - def longest_task_waiting_sid(self): - """ - :returns: The SID of the longest waiting Task - :rtype: unicode - """ - return self._properties['longest_task_waiting_sid'] - - @property - def tasks_by_priority(self): - """ - :returns: The number of Tasks by priority - :rtype: dict - """ - return self._properties['tasks_by_priority'] - - @property - def tasks_by_status(self): - """ - :returns: The number of Tasks by their current status - :rtype: dict - """ - return self._properties['tasks_by_status'] - - @property - def total_tasks(self): - """ - :returns: The total number of Tasks - :rtype: unicode - """ - return self._properties['total_tasks'] - - @property - def total_workers(self): - """ - :returns: The total number of Workers in the Workspace - :rtype: unicode - """ - return self._properties['total_workers'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workspace statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, task_channel=values.unset): - """ - Fetch the WorkspaceRealTimeStatisticsInstance - :param unicode task_channel: Only calculate real-time statistics on this TaskChannel +class WorkspaceRealTimeStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkspaceRealTimeStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkspaceRealTimeStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsInstance - """ - return self._proxy.fetch(task_channel=task_channel, ) + # Path Solution + self._solution = { workspace_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py index 20cf81bd66..2c3b0f69ca 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py @@ -1,200 +1,84 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WorkspaceStatisticsList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceStatisticsList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - """ - super(WorkspaceStatisticsList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - def get(self): - """ - Constructs a WorkspaceStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ - return WorkspaceStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - def __call__(self): - """ - Constructs a WorkspaceStatisticsContext - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ - return WorkspaceStatisticsContext(self._version, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkspaceStatisticsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkspaceStatisticsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsPage - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsPage - """ - super(WorkspaceStatisticsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WorkspaceStatisticsContext(InstanceContext): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkspaceStatisticsContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ - super(WorkspaceStatisticsContext, self).__init__(version) + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkspaceStatisticsContextList, self).__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Statistics'.format(**self._solution) - - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkspaceStatisticsInstance - - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only calculate statistics from this date and time and earlier - :param unicode task_channel: Only calculate statistics on this TaskChannel. - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on - - :returns: The fetched WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - """ - data = values.of({ - 'Minutes': minutes, - 'StartDate': serialize.iso8601_datetime(start_date), - 'EndDate': serialize.iso8601_datetime(end_date), - 'TaskChannel': task_channel, - 'SplitByWaitTime': split_by_wait_time, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return WorkspaceStatisticsInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - ) + self._solution = { workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Statistics' + + + def fetch(self, minutes, start_date, end_date, task_channel, split_by_wait_time): + + """ + Fetch the WorkspaceStatisticsInstance + + :returns: The fetched WorkspaceStatisticsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WorkspaceStatisticsInstance( + self._version, + payload, + workspace_sid=self._solution['workspace_sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkspaceStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid): - """ - Initialize the WorkspaceStatisticsInstance - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - """ +class WorkspaceStatisticsInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str): super(WorkspaceStatisticsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'realtime': payload.get('realtime'), - 'cumulative': payload.get('cumulative'), - 'account_sid': payload.get('account_sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), + self._properties = { + 'realtime' = payload.get('realtime'), + 'cumulative' = payload.get('cumulative'), + 'account_sid' = payload.get('account_sid'), + 'workspace_sid' = payload.get('workspace_sid'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceStatisticsContext for this WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsContext - """ if self._context is None: self._context = WorkspaceStatisticsContext( self._version, @@ -202,75 +86,35 @@ def _proxy(self): ) return self._context - @property - def realtime(self): - """ - :returns: n object that contains the real-time statistics for the Workspace - :rtype: dict - """ - return self._properties['realtime'] + - @property - def cumulative(self): - """ - :returns: An object that contains the cumulative statistics for the Workspace - :rtype: dict - """ - return self._properties['cumulative'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def workspace_sid(self): + def __repr__(self): """ - :returns: The SID of the Workspace - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['workspace_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Workspace statistics resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, minutes=values.unset, start_date=values.unset, - end_date=values.unset, task_channel=values.unset, - split_by_wait_time=values.unset): - """ - Fetch the WorkspaceStatisticsInstance - :param unicode minutes: Only calculate statistics since this many minutes in the past - :param datetime start_date: Only calculate statistics from on or after this date - :param datetime end_date: Only calculate statistics from this date and time and earlier - :param unicode task_channel: Only calculate statistics on this TaskChannel. - :param unicode split_by_wait_time: A comma separated list of values that describes the thresholds to calculate statistics on +class WorkspaceStatisticsListInstance(ListResource): + def __init__(self, version: V1, workspace_sid: str): + # TODO: needs autogenerated docs + super(WorkspaceStatisticsListInstanceList, self).__init__(version) - :returns: The fetched WorkspaceStatisticsInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance - """ - return self._proxy.fetch( - minutes=minutes, - start_date=start_date, - end_date=end_date, - task_channel=task_channel, - split_by_wait_time=split_by_wait_time, - ) + # Path Solution + self._solution = { workspace_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trunking/__init__.py b/twilio/rest/trunking/__init__.py index 32ef7cea96..13f2694bce 100644 --- a/twilio/rest/trunking/__init__.py +++ b/twilio/rest/trunking/__init__.py @@ -1,52 +1,54 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.trunking.v1 import V1 + Twilio - Trunking + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Trunking(Domain): +from twilio.base.domain import Domain +from twilio.rest.Trunking.v1 import V1 +class Trunking(Domain): def __init__(self, twilio): """ Initialize the Trunking Domain :returns: Domain for Trunking - :rtype: twilio.rest.trunking.Trunking + :rtype: twilio.rest.v1.Trunking """ super(Trunking, self).__init__(twilio) - - self.base_url = 'https://trunking.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Trunking.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of trunking - :rtype: twilio.rest.trunking.v1.V1 + :returns: Versions v1 of Trunking + :rtype: twilio.rest.Trunking.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def trunks(self): """ - :rtype: twilio.rest.trunking.v1.trunk.TrunkList + :rtype: twilio.rest.v1.trunks """ return self.v1.trunks + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/trunking/v1/.openapi-generator-ignore b/twilio/rest/trunking/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/trunking/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/trunking/v1/.openapi-generator/FILES b/twilio/rest/trunking/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..efd5de9b14 --- /dev/null +++ b/twilio/rest/trunking/v1/.openapi-generator/FILES @@ -0,0 +1,13 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +trunk.py +trunk/credential_list.py +trunk/ip_access_control_list.py +trunk/origination_url.py +trunk/phone_number.py +trunk/recording.py diff --git a/twilio/rest/trunking/v1/.openapi-generator/VERSION b/twilio/rest/trunking/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/trunking/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/trunking/v1/trunk.py b/twilio/rest/trunking/v1/trunk.py new file mode 100644 index 0000000000..37b7a9b65e --- /dev/null +++ b/twilio/rest/trunking/v1/trunk.py @@ -0,0 +1,196 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trunking + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.trunk.credential_list import CredentialListListInstancefrom twilio.rest.trunk.ip_access_control_list import IpAccessControlListListInstancefrom twilio.rest.trunk.origination_url import OriginationUrlListInstancefrom twilio.rest.trunk.phone_number import PhoneNumberListInstancefrom twilio.rest.trunk.recording import RecordingListInstance + + +class TrunkContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(TrunkContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Trunks/${sid}' + + self._credentials_lists = None + self._ip_access_control_lists = None + self._origination_urls = None + self._phone_numbers = None + self._recordings = None + + def delete(self): + + + """ + Deletes the TrunkInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TrunkInstance + + :returns: The fetched TrunkInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TrunkInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return TrunkInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class TrunkInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(TrunkInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'domain_name' = payload.get('domain_name'), + 'disaster_recovery_method' = payload.get('disaster_recovery_method'), + 'disaster_recovery_url' = payload.get('disaster_recovery_url'), + 'friendly_name' = payload.get('friendly_name'), + 'secure' = payload.get('secure'), + 'recording' = payload.get('recording'), + 'transfer_mode' = payload.get('transfer_mode'), + 'transfer_caller_id' = payload.get('transfer_caller_id'), + 'cnam_lookup_enabled' = payload.get('cnam_lookup_enabled'), + 'auth_type' = payload.get('auth_type'), + 'auth_type_set' = payload.get('auth_type_set'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'sid' = payload.get('sid'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = TrunkContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def credentials_lists(self): + return self._proxy.credentials_lists + @property + def ip_access_control_lists(self): + return self._proxy.ip_access_control_lists + @property + def origination_urls(self): + return self._proxy.origination_urls + @property + def phone_numbers(self): + return self._proxy.phone_numbers + @property + def recordings(self): + return self._proxy.recordings + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class TrunkListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(TrunkListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Trunks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TrunkInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TrunkPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py index 7bc073c2de..6e408cb435 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -1,378 +1,155 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trunking + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CredentialListList(ListResource): - - def __init__(self, version, trunk_sid): - """ - Initialize the CredentialListList - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk the credential list in associated with - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - """ - super(CredentialListList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/CredentialLists'.format(**self._solution) - - def create(self, credential_list_sid): - """ - Create the CredentialListInstance - - :param unicode credential_list_sid: The SID of the Credential List that you want to associate with the trunk - - :returns: The created CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - data = values.of({'CredentialListSid': credential_list_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialListInstance 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 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.trunking.v1.trunk.credential_list.CredentialListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trunking.v1.trunk.credential_list.CredentialListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialListInstance records from the API. - Request is executed immediately - - :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 CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CredentialListContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialListContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialListPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CredentialListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The SID of the Trunk the credential list in associated with - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListPage - """ - super(CredentialListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialListInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - return CredentialListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CredentialListContext(InstanceContext): - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the CredentialListContext - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk from which to fetch the credential list - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ - super(CredentialListContext, self).__init__(version) + def __init__(self, version: V1, trunk_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CredentialListContextList, self).__init__(version) # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/CredentialLists/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CredentialListInstance - - :returns: The fetched CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialListInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CredentialListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { trunk_sid, sid, } + self._uri = '/Trunks/${trunk_sid}/CredentialLists/${sid}' + + + def delete(self): + + + """ + Deletes the CredentialListInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CredentialListInstance + + :returns: The fetched CredentialListInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CredentialListInstance( + self._version, + payload, + trunk_sidsid=self._solution['trunk_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class CredentialListInstance(InstanceResource): - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the CredentialListInstance - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ +class CredentialListInstance(InstanceResource): + def __init__(self, version, payload, trunk_sid: str, sid: str): super(CredentialListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'trunk_sid': payload.get('trunk_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'trunk_sid' = payload.get('trunk_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'trunk_sid': trunk_sid or self._properties['trunk_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialListContext for this CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListContext - """ if self._context is None: self._context = CredentialListContext( self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], + trunk_sid=self._solution['trunk_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk the credential list in associated with - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the CredentialListInstance - :returns: The fetched CredentialListInstance - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the CredentialListInstance +class CredentialListListInstance(ListResource): + def __init__(self, version: V1, trunk_sid: str): + # TODO: needs autogenerated docs + super(CredentialListListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { trunk_sid, } + self._uri = '/Trunks/${trunk_sid}/CredentialLists' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialListPage(self._version, payload, trunk_sid=self._solution['trunk_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py index 20272f748d..7b6bc57647 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -1,378 +1,155 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trunking + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class IpAccessControlListList(ListResource): - - def __init__(self, version, trunk_sid): - """ - Initialize the IpAccessControlListList - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk the resource is associated with - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - """ - super(IpAccessControlListList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/IpAccessControlLists'.format(**self._solution) - - def create(self, ip_access_control_list_sid): - """ - Create the IpAccessControlListInstance - - :param unicode ip_access_control_list_sid: The SID of the IP Access Control List that you want to associate with the trunk - - :returns: The created IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - data = values.of({'IpAccessControlListSid': ip_access_control_list_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return IpAccessControlListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAccessControlListInstance 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 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.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAccessControlListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :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 IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class IpAccessControlListPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the IpAccessControlListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The SID of the Trunk the resource is associated with - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListPage - """ - super(IpAccessControlListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAccessControlListInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - return IpAccessControlListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class IpAccessControlListContext(InstanceContext): - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the IpAccessControlListContext - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk from which to fetch the IP Access Control List - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ - super(IpAccessControlListContext, self).__init__(version) + def __init__(self, version: V1, trunk_sid: str, sid: str): + # TODO: needs autogenerated docs + super(IpAccessControlListContextList, self).__init__(version) # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/IpAccessControlLists/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the IpAccessControlListInstance - - :returns: The fetched IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return IpAccessControlListInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the IpAccessControlListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { trunk_sid, sid, } + self._uri = '/Trunks/${trunk_sid}/IpAccessControlLists/${sid}' + + + def delete(self): + + + """ + Deletes the IpAccessControlListInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the IpAccessControlListInstance + + :returns: The fetched IpAccessControlListInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return IpAccessControlListInstance( + self._version, + payload, + trunk_sidsid=self._solution['trunk_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class IpAccessControlListInstance(InstanceResource): - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the IpAccessControlListInstance - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ +class IpAccessControlListInstance(InstanceResource): + def __init__(self, version, payload, trunk_sid: str, sid: str): super(IpAccessControlListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'trunk_sid': payload.get('trunk_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'trunk_sid' = payload.get('trunk_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'trunk_sid': trunk_sid or self._properties['trunk_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAccessControlListContext for this IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListContext - """ if self._context is None: self._context = IpAccessControlListContext( self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], + trunk_sid=self._solution['trunk_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk the resource is associated with - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the IpAccessControlListInstance - :returns: The fetched IpAccessControlListInstance - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the IpAccessControlListInstance +class IpAccessControlListListInstance(ListResource): + def __init__(self, version: V1, trunk_sid: str): + # TODO: needs autogenerated docs + super(IpAccessControlListListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { trunk_sid, } + self._uri = '/Trunks/${trunk_sid}/IpAccessControlLists' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IpAccessControlListInstance(self._version, payload, trunk_sid=self._solution['trunk_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IpAccessControlListPage(self._version, payload, trunk_sid=self._solution['trunk_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index 8f411eaaa1..2ac736bfbd 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -1,479 +1,170 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trunking + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class OriginationUrlList(ListResource): - - def __init__(self, version, trunk_sid): - """ - Initialize the OriginationUrlList - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk that owns the Origination URL - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - """ - super(OriginationUrlList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/OriginationUrls'.format(**self._solution) - - def create(self, weight, priority, enabled, friendly_name, sip_url): - """ - Create the OriginationUrlInstance - - :param unicode weight: The value that determines the relative load the URI should receive compared to others with the same priority - :param unicode priority: The relative importance of the URI - :param bool enabled: Whether the URL is enabled - :param unicode friendly_name: A string to describe the resource - :param unicode sip_url: The SIP address you want Twilio to route your Origination calls to - :returns: The created OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - data = values.of({ - 'Weight': weight, - 'Priority': priority, - 'Enabled': enabled, - 'FriendlyName': friendly_name, - 'SipUrl': sip_url, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return OriginationUrlInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams OriginationUrlInstance 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 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.trunking.v1.trunk.origination_url.OriginationUrlInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists OriginationUrlInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trunking.v1.trunk.origination_url.OriginationUrlInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of OriginationUrlInstance records from the API. - Request is executed immediately - - :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 OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return OriginationUrlPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of OriginationUrlInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return OriginationUrlPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a OriginationUrlContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ - return OriginationUrlContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a OriginationUrlContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ - return OriginationUrlContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class OriginationUrlPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the OriginationUrlPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The SID of the Trunk that owns the Origination URL - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlPage - """ - super(OriginationUrlPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of OriginationUrlInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - return OriginationUrlInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class OriginationUrlContext(InstanceContext): - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the OriginationUrlContext - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk from which to fetch the OriginationUrl - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ - super(OriginationUrlContext, self).__init__(version) + def __init__(self, version: V1, trunk_sid: str, sid: str): + # TODO: needs autogenerated docs + super(OriginationUrlContextList, self).__init__(version) # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/OriginationUrls/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the OriginationUrlInstance - - :returns: The fetched OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return OriginationUrlInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the OriginationUrlInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, weight=values.unset, priority=values.unset, - enabled=values.unset, friendly_name=values.unset, - sip_url=values.unset): - """ - Update the OriginationUrlInstance + self._solution = { trunk_sid, sid, } + self._uri = '/Trunks/${trunk_sid}/OriginationUrls/${sid}' + + + def delete(self): + + + """ + Deletes the OriginationUrlInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the OriginationUrlInstance + + :returns: The fetched OriginationUrlInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return OriginationUrlInstance( + self._version, + payload, + trunk_sidsid=self._solution['trunk_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :param unicode weight: The value that determines the relative load the URI should receive compared to others with the same priority - :param unicode priority: The relative importance of the URI - :param bool enabled: Whether the URL is enabled - :param unicode friendly_name: A string to describe the resource - :param unicode sip_url: The SIP address you want Twilio to route your Origination calls to + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The updated OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - data = values.of({ - 'Weight': weight, - 'Priority': priority, - 'Enabled': enabled, - 'FriendlyName': friendly_name, - 'SipUrl': sip_url, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return OriginationUrlInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) + return OriginationUrlInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class OriginationUrlInstance(InstanceResource): - - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the OriginationUrlInstance - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ +class OriginationUrlInstance(InstanceResource): + def __init__(self, version, payload, trunk_sid: str, sid: str): super(OriginationUrlInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'trunk_sid': payload.get('trunk_sid'), - 'weight': deserialize.integer(payload.get('weight')), - 'enabled': payload.get('enabled'), - 'sip_url': payload.get('sip_url'), - 'friendly_name': payload.get('friendly_name'), - 'priority': deserialize.integer(payload.get('priority')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'trunk_sid' = payload.get('trunk_sid'), + 'weight' = payload.get('weight'), + 'enabled' = payload.get('enabled'), + 'sip_url' = payload.get('sip_url'), + 'friendly_name' = payload.get('friendly_name'), + 'priority' = payload.get('priority'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'trunk_sid': trunk_sid or self._properties['trunk_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: OriginationUrlContext for this OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext - """ if self._context is None: self._context = OriginationUrlContext( self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], + trunk_sid=self._solution['trunk_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk that owns the Origination URL - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def weight(self): - """ - :returns: The value that determines the relative load the URI should receive compared to others with the same priority - :rtype: unicode - """ - return self._properties['weight'] - - @property - def enabled(self): - """ - :returns: Whether the URL is enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def sip_url(self): - """ - :returns: The SIP address you want Twilio to route your Origination calls to - :rtype: unicode - """ - return self._properties['sip_url'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def priority(self): - """ - :returns: The relative importance of the URI - :rtype: unicode - """ - return self._properties['priority'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + - def fetch(self): - """ - Fetch the OriginationUrlInstance - - :returns: The fetched OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the OriginationUrlInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, weight=values.unset, priority=values.unset, - enabled=values.unset, friendly_name=values.unset, - sip_url=values.unset): - """ - Update the OriginationUrlInstance - :param unicode weight: The value that determines the relative load the URI should receive compared to others with the same priority - :param unicode priority: The relative importance of the URI - :param bool enabled: Whether the URL is enabled - :param unicode friendly_name: A string to describe the resource - :param unicode sip_url: The SIP address you want Twilio to route your Origination calls to +class OriginationUrlListInstance(ListResource): + def __init__(self, version: V1, trunk_sid: str): + # TODO: needs autogenerated docs + super(OriginationUrlListInstanceList, self).__init__(version) - :returns: The updated OriginationUrlInstance - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlInstance - """ - return self._proxy.update( - weight=weight, - priority=priority, - enabled=enabled, - friendly_name=friendly_name, - sip_url=sip_url, - ) + # Path Solution + self._solution = { trunk_sid, } + self._uri = '/Trunks/${trunk_sid}/OriginationUrls' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return OriginationUrlInstance(self._version, payload, trunk_sid=self._solution['trunk_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return OriginationUrlPage(self._version, payload, trunk_sid=self._solution['trunk_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py index 2dbc274a4c..4766dfff20 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -1,555 +1,174 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trunking + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class PhoneNumberList(ListResource): - - def __init__(self, version, trunk_sid): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk that handles calls to the phone number - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/PhoneNumbers'.format(**self._solution) - - def create(self, phone_number_sid): - """ - Create the PhoneNumberInstance - - :param unicode phone_number_sid: The SID of the Incoming Phone Number that you want to associate with the trunk - - :returns: The created PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - data = values.of({'PhoneNumberSid': phone_number_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return PhoneNumberInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams PhoneNumberInstance 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 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.trunking.v1.trunk.phone_number.PhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trunking.v1.trunk.phone_number.PhoneNumberInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PhoneNumberInstance records from the API. - Request is executed immediately - - :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 PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PhoneNumberPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PhoneNumberContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ - return PhoneNumberContext(self._version, trunk_sid=self._solution['trunk_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PhoneNumberPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The SID of the Trunk that handles calls to the phone number - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class PhoneNumberContext(InstanceContext): - - def __init__(self, version, trunk_sid, sid): - """ - Initialize the PhoneNumberContext - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk from which to fetch the PhoneNumber resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ - super(PhoneNumberContext, self).__init__(version) + def __init__(self, version: V1, trunk_sid: str, sid: str): + # TODO: needs autogenerated docs + super(PhoneNumberContextList, self).__init__(version) # Path Solution - self._solution = {'trunk_sid': trunk_sid, 'sid': sid, } - self._uri = '/Trunks/{trunk_sid}/PhoneNumbers/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the PhoneNumberInstance - - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PhoneNumberInstance( - self._version, - payload, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the PhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { trunk_sid, sid, } + self._uri = '/Trunks/${trunk_sid}/PhoneNumbers/${sid}' + + + def delete(self): + + + """ + Deletes the PhoneNumberInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the PhoneNumberInstance + + :returns: The fetched PhoneNumberInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PhoneNumberInstance( + self._version, + payload, + trunk_sidsid=self._solution['trunk_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PhoneNumberInstance(InstanceResource): - - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - def __init__(self, version, payload, trunk_sid, sid=None): - """ - Initialize the PhoneNumberInstance - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ +class PhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, trunk_sid: str, sid: str): super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'address_requirements': payload.get('address_requirements'), - 'api_version': payload.get('api_version'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'links': payload.get('links'), - 'phone_number': payload.get('phone_number'), - 'sid': payload.get('sid'), - 'sms_application_sid': payload.get('sms_application_sid'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'trunk_sid': payload.get('trunk_sid'), - 'url': payload.get('url'), - 'voice_application_sid': payload.get('voice_application_sid'), - 'voice_caller_id_lookup': payload.get('voice_caller_id_lookup'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'address_requirements' = payload.get('address_requirements'), + 'api_version' = payload.get('api_version'), + 'beta' = payload.get('beta'), + 'capabilities' = payload.get('capabilities'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'links' = payload.get('links'), + 'phone_number' = payload.get('phone_number'), + 'sid' = payload.get('sid'), + 'sms_application_sid' = payload.get('sms_application_sid'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'trunk_sid' = payload.get('trunk_sid'), + 'url' = payload.get('url'), + 'voice_application_sid' = payload.get('voice_application_sid'), + 'voice_caller_id_lookup' = payload.get('voice_caller_id_lookup'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), } - # Context self._context = None - self._solution = {'trunk_sid': trunk_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'trunk_sid': trunk_sid or self._properties['trunk_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PhoneNumberContext for this PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberContext - """ if self._context is None: self._context = PhoneNumberContext( self._version, - trunk_sid=self._solution['trunk_sid'], - sid=self._solution['sid'], + trunk_sid=self._solution['trunk_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_requirements(self): - """ - :returns: Whether the phone number requires an Address registered with Twilio - :rtype: PhoneNumberInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] + - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: dict - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The SID of the application that handles SMS messages sent to the phone number - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The HTTP method used with sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The URL we call when the phone number receives an incoming SMS message - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk that handles calls to the phone number - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def voice_application_sid(self): - """ - :returns: The SID of the application that handles calls to the phone number - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Whether to lookup the caller's name - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method that we use to call voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs in TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method used with the voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): + def __repr__(self): """ - :returns: The URL we call when the phone number receives a call - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['voice_url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the PhoneNumberInstance - :returns: The fetched PhoneNumberInstance - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the PhoneNumberInstance +class PhoneNumberListInstance(ListResource): + def __init__(self, version: V1, trunk_sid: str): + # TODO: needs autogenerated docs + super(PhoneNumberListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { trunk_sid, } + self._uri = '/Trunks/${trunk_sid}/PhoneNumbers' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return PhoneNumberInstance(self._version, payload, trunk_sid=self._solution['trunk_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PhoneNumberPage(self._version, payload, trunk_sid=self._solution['trunk_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trunking/v1/trunk/recording.py b/twilio/rest/trunking/v1/trunk/recording.py index bc2de09d8c..fc512c41cc 100644 --- a/twilio/rest/trunking/v1/trunk/recording.py +++ b/twilio/rest/trunking/v1/trunk/recording.py @@ -1,243 +1,128 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Trunking + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -class RecordingList(ListResource): - - def __init__(self, version, trunk_sid): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - :param trunk_sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingList - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - - def get(self): - """ - Constructs a RecordingContext - - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingContext - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingContext - """ - return RecordingContext(self._version, trunk_sid=self._solution['trunk_sid'], ) - - def __call__(self): - """ - Constructs a RecordingContext - - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingContext - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingContext - """ - return RecordingContext(self._version, trunk_sid=self._solution['trunk_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trunk_sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingPage - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - """ - return RecordingInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class RecordingContext(InstanceContext): - - def __init__(self, version, trunk_sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param trunk_sid: The SID of the Trunk from which to fetch the recording settings. - - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingContext - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) + def __init__(self, version: V1, trunk_sid: str): + # TODO: needs autogenerated docs + super(RecordingContextList, self).__init__(version) # Path Solution - self._solution = {'trunk_sid': trunk_sid, } - self._uri = '/Trunks/{trunk_sid}/Recording'.format(**self._solution) - - def fetch(self): - """ - Fetch the RecordingInstance - - :returns: The fetched RecordingInstance - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RecordingInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) - - def update(self, mode=values.unset, trim=values.unset): - """ - Update the RecordingInstance - - :param RecordingInstance.RecordingMode mode: The recording mode for the trunk. - :param RecordingInstance.RecordingTrim trim: The recording trim setting for the trunk. - - :returns: The updated RecordingInstance - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - """ - data = values.of({'Mode': mode, 'Trim': trim, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RecordingInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) + self._solution = { trunk_sid, } + self._uri = '/Trunks/${trunk_sid}/Recording' + + + def fetch(self): + + """ + Fetch the RecordingInstance + + :returns: The fetched RecordingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RecordingInstance( + self._version, + payload, + trunk_sid=self._solution['trunk_sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RecordingInstance(self._version, payload, trunk_sid=self._solution['trunk_sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RecordingInstance(InstanceResource): - - class RecordingMode(object): - DO_NOT_RECORD = "do-not-record" - RECORD_FROM_RINGING = "record-from-ringing" - RECORD_FROM_ANSWER = "record-from-answer" - RECORD_FROM_RINGING_DUAL = "record-from-ringing-dual" - RECORD_FROM_ANSWER_DUAL = "record-from-answer-dual" + return '' - class RecordingTrim(object): - TRIM_SILENCE = "trim-silence" - DO_NOT_TRIM = "do-not-trim" - def __init__(self, version, payload, trunk_sid): - """ - Initialize the RecordingInstance - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - """ +class RecordingInstance(InstanceResource): + def __init__(self, version, payload, trunk_sid: str): super(RecordingInstance, self).__init__(version) + self._properties = { + 'mode' = payload.get('mode'), + 'trim' = payload.get('trim'), + } - # Marshaled Properties - self._properties = {'mode': payload.get('mode'), 'trim': payload.get('trim'), } - - # Context self._context = None - self._solution = {'trunk_sid': trunk_sid, } + self._solution = { + 'trunk_sid': trunk_sid or self._properties['trunk_sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingContext - """ if self._context is None: - self._context = RecordingContext(self._version, trunk_sid=self._solution['trunk_sid'], ) + self._context = RecordingContext( + self._version, + trunk_sid=self._solution['trunk_sid'], + ) return self._context - @property - def mode(self): - """ - :returns: The recording mode for the trunk. - :rtype: RecordingInstance.RecordingMode - """ - return self._properties['mode'] + - @property - def trim(self): - """ - :returns: The recording trim setting for the trunk. - :rtype: RecordingInstance.RecordingTrim + def __repr__(self): """ - return self._properties['trim'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the RecordingInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched RecordingInstance - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - """ - return self._proxy.fetch() - def update(self, mode=values.unset, trim=values.unset): - """ - Update the RecordingInstance - :param RecordingInstance.RecordingMode mode: The recording mode for the trunk. - :param RecordingInstance.RecordingTrim trim: The recording trim setting for the trunk. +class RecordingListInstance(ListResource): + def __init__(self, version: V1, trunk_sid: str): + # TODO: needs autogenerated docs + super(RecordingListInstanceList, self).__init__(version) - :returns: The updated RecordingInstance - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingInstance - """ - return self._proxy.update(mode=mode, trim=trim, ) + # Path Solution + self._solution = { trunk_sid, } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/__init__.py b/twilio/rest/trusthub/__init__.py index 8112cd46ae..c951531205 100644 --- a/twilio/rest/trusthub/__init__.py +++ b/twilio/rest/trusthub/__init__.py @@ -1,94 +1,102 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.trusthub.v1 import V1 + Twilio - Trusthub + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Trusthub(Domain): +from twilio.base.domain import Domain +from twilio.rest.Trusthub.v1 import V1 +class Trusthub(Domain): def __init__(self, twilio): """ Initialize the Trusthub Domain :returns: Domain for Trusthub - :rtype: twilio.rest.trusthub.Trusthub + :rtype: twilio.rest.v1.Trusthub """ super(Trusthub, self).__init__(twilio) - - self.base_url = 'https://trusthub.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Trusthub.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of trusthub - :rtype: twilio.rest.trusthub.v1.V1 + :returns: Versions v1 of Trusthub + :rtype: twilio.rest.Trusthub.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def customer_profiles(self): """ - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesList + :rtype: twilio.rest.v1.customer_profiles """ return self.v1.customer_profiles + @property def end_users(self): """ - :rtype: twilio.rest.trusthub.v1.end_user.EndUserList + :rtype: twilio.rest.v1.end_users """ return self.v1.end_users + @property def end_user_types(self): """ - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeList + :rtype: twilio.rest.v1.end_user_types """ return self.v1.end_user_types + @property def policies(self): """ - :rtype: twilio.rest.trusthub.v1.policies.PoliciesList + :rtype: twilio.rest.v1.policies """ return self.v1.policies + @property def supporting_documents(self): """ - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentList + :rtype: twilio.rest.v1.supporting_documents """ return self.v1.supporting_documents + @property def supporting_document_types(self): """ - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeList + :rtype: twilio.rest.v1.supporting_document_types """ return self.v1.supporting_document_types + @property def trust_products(self): """ - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsList + :rtype: twilio.rest.v1.trust_products """ return self.v1.trust_products + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/trusthub/v1/.openapi-generator-ignore b/twilio/rest/trusthub/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/trusthub/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/trusthub/v1/.openapi-generator/FILES b/twilio/rest/trusthub/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..ac1329a6db --- /dev/null +++ b/twilio/rest/trusthub/v1/.openapi-generator/FILES @@ -0,0 +1,27 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +customer_profiles.py +customer_profiles/customer_profiles_channel_endpoint_assignment.py +customer_profiles/customer_profiles_entity_assignments.py +customer_profiles/customer_profiles_evaluations.py +end_user.py +end_user_type.py +policies.py +supporting_document.py +supporting_document_type.py +trust_products.py +trust_products/trust_products_channel_endpoint_assignment.py +trust_products/trust_products_entity_assignments.py +trust_products/trust_products_evaluations.py diff --git a/twilio/rest/trusthub/v1/.openapi-generator/VERSION b/twilio/rest/trusthub/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/trusthub/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/trusthub/v1/customer_profiles.py b/twilio/rest/trusthub/v1/customer_profiles.py new file mode 100644 index 0000000000..9dfcd411c6 --- /dev/null +++ b/twilio/rest/trusthub/v1/customer_profiles.py @@ -0,0 +1,183 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.customer_profiles.customer_profiles_channel_endpoint_assignment import CustomerProfilesChannelEndpointAssignmentListInstancefrom twilio.rest.customer_profiles.customer_profiles_entity_assignments import CustomerProfilesEntityAssignmentsListInstancefrom twilio.rest.customer_profiles.customer_profiles_evaluations import CustomerProfilesEvaluationsListInstance + + +class CustomerProfilesContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CustomerProfilesContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/CustomerProfiles/${sid}' + + self._customer_profiles_channel_endpoint_assignment = None + self._customer_profiles_entity_assignments = None + self._customer_profiles_evaluations = None + + def delete(self): + + + """ + Deletes the CustomerProfilesInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CustomerProfilesInstance + + :returns: The fetched CustomerProfilesInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CustomerProfilesInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CustomerProfilesInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CustomerProfilesInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(CustomerProfilesInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'policy_sid' = payload.get('policy_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'valid_until' = payload.get('valid_until'), + 'email' = payload.get('email'), + 'status_callback' = payload.get('status_callback'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CustomerProfilesContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def customer_profiles_channel_endpoint_assignment(self): + return self._proxy.customer_profiles_channel_endpoint_assignment + @property + def customer_profiles_entity_assignments(self): + return self._proxy.customer_profiles_entity_assignments + @property + def customer_profiles_evaluations(self): + return self._proxy.customer_profiles_evaluations + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CustomerProfilesListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CustomerProfilesListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/CustomerProfiles' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CustomerProfilesInstance(self._version, payload, ) + + + def page(self, status, friendly_name, policy_sid, page_size): + + data = values.of({ + 'status': status,'friendly_name': friendly_name,'policy_sid': policy_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CustomerProfilesPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py index c6db1c7579..1fc7c320a5 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py @@ -1,425 +1,155 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CustomerProfilesChannelEndpointAssignmentList(ListResource): - - def __init__(self, version, customer_profile_sid): - """ - Initialize the CustomerProfilesChannelEndpointAssignmentList - - :param Version version: Version that contains the resource - :param customer_profile_sid: The unique string that identifies the CustomerProfile resource. - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentList - """ - super(CustomerProfilesChannelEndpointAssignmentList, self).__init__(version) - - # Path Solution - self._solution = {'customer_profile_sid': customer_profile_sid, } - self._uri = '/CustomerProfiles/{customer_profile_sid}/ChannelEndpointAssignments'.format(**self._solution) - - def create(self, channel_endpoint_type, channel_endpoint_sid): - """ - Create the CustomerProfilesChannelEndpointAssignmentInstance - - :param unicode channel_endpoint_type: The type of channel endpoint - :param unicode channel_endpoint_sid: The sid of an channel endpoint - - :returns: The created CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance - """ - data = values.of({ - 'ChannelEndpointType': channel_endpoint_type, - 'ChannelEndpointSid': channel_endpoint_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CustomerProfilesChannelEndpointAssignmentInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - ) - - def stream(self, channel_endpoint_sid=values.unset, - channel_endpoint_sids=values.unset, limit=None, page_size=None): - """ - Streams CustomerProfilesChannelEndpointAssignmentInstance 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 channel_endpoint_sid: The sid of an channel endpoint - :param unicode channel_endpoint_sids: comma separated list of channel endpoint sids - :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.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - channel_endpoint_sid=channel_endpoint_sid, - channel_endpoint_sids=channel_endpoint_sids, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, channel_endpoint_sid=values.unset, - channel_endpoint_sids=values.unset, limit=None, page_size=None): - """ - Lists CustomerProfilesChannelEndpointAssignmentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode channel_endpoint_sid: The sid of an channel endpoint - :param unicode channel_endpoint_sids: comma separated list of channel endpoint sids - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance] - """ - return list(self.stream( - channel_endpoint_sid=channel_endpoint_sid, - channel_endpoint_sids=channel_endpoint_sids, - limit=limit, - page_size=page_size, - )) - - def page(self, channel_endpoint_sid=values.unset, - channel_endpoint_sids=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance records from the API. - Request is executed immediately - - :param unicode channel_endpoint_sid: The sid of an channel endpoint - :param unicode channel_endpoint_sids: comma separated list of channel endpoint sids - :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 CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentPage - """ - data = values.of({ - 'ChannelEndpointSid': channel_endpoint_sid, - 'ChannelEndpointSids': channel_endpoint_sids, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CustomerProfilesChannelEndpointAssignmentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CustomerProfilesChannelEndpointAssignmentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CustomerProfilesChannelEndpointAssignmentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CustomerProfilesChannelEndpointAssignmentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentContext - """ - return CustomerProfilesChannelEndpointAssignmentContext( - self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a CustomerProfilesChannelEndpointAssignmentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentContext - """ - return CustomerProfilesChannelEndpointAssignmentContext( - self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CustomerProfilesChannelEndpointAssignmentPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CustomerProfilesChannelEndpointAssignmentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param customer_profile_sid: The unique string that identifies the CustomerProfile resource. - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentPage - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentPage - """ - super(CustomerProfilesChannelEndpointAssignmentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CustomerProfilesChannelEndpointAssignmentInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance - """ - return CustomerProfilesChannelEndpointAssignmentInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CustomerProfilesChannelEndpointAssignmentContext(InstanceContext): - - def __init__(self, version, customer_profile_sid, sid): - """ - Initialize the CustomerProfilesChannelEndpointAssignmentContext - - :param Version version: Version that contains the resource - :param customer_profile_sid: The unique string that identifies the resource. - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentContext - """ - super(CustomerProfilesChannelEndpointAssignmentContext, self).__init__(version) + def __init__(self, version: V1, customer_profile_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CustomerProfilesChannelEndpointAssignmentContextList, self).__init__(version) # Path Solution - self._solution = {'customer_profile_sid': customer_profile_sid, 'sid': sid, } - self._uri = '/CustomerProfiles/{customer_profile_sid}/ChannelEndpointAssignments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CustomerProfilesChannelEndpointAssignmentInstance - - :returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CustomerProfilesChannelEndpointAssignmentInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CustomerProfilesChannelEndpointAssignmentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { customer_profile_sid, sid, } + self._uri = '/CustomerProfiles/${customer_profile_sid}/ChannelEndpointAssignments/${sid}' + + + def delete(self): + + + """ + Deletes the CustomerProfilesChannelEndpointAssignmentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CustomerProfilesChannelEndpointAssignmentInstance + + :returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CustomerProfilesChannelEndpointAssignmentInstance( + self._version, + payload, + customer_profile_sidsid=self._solution['customer_profile_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CustomerProfilesChannelEndpointAssignmentInstance(InstanceResource): - - def __init__(self, version, payload, customer_profile_sid, sid=None): - """ - Initialize the CustomerProfilesChannelEndpointAssignmentInstance - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance - """ +class CustomerProfilesChannelEndpointAssignmentInstance(InstanceResource): + def __init__(self, version, payload, customer_profile_sid: str, sid: str): super(CustomerProfilesChannelEndpointAssignmentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'customer_profile_sid': payload.get('customer_profile_sid'), - 'account_sid': payload.get('account_sid'), - 'channel_endpoint_type': payload.get('channel_endpoint_type'), - 'channel_endpoint_sid': payload.get('channel_endpoint_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'customer_profile_sid' = payload.get('customer_profile_sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_endpoint_type' = payload.get('channel_endpoint_type'), + 'channel_endpoint_sid' = payload.get('channel_endpoint_sid'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'customer_profile_sid': customer_profile_sid, - 'sid': sid or self._properties['sid'], + 'customer_profile_sid': customer_profile_sid or self._properties['customer_profile_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CustomerProfilesChannelEndpointAssignmentContext for this CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentContext - """ if self._context is None: self._context = CustomerProfilesChannelEndpointAssignmentContext( self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=self._solution['sid'], + customer_profile_sid=self._solution['customer_profile_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def customer_profile_sid(self): - """ - :returns: The unique string that identifies the CustomerProfile resource. - :rtype: unicode - """ - return self._properties['customer_profile_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_endpoint_type(self): - """ - :returns: The type of channel endpoint - :rtype: unicode - """ - return self._properties['channel_endpoint_type'] - - @property - def channel_endpoint_sid(self): - """ - :returns: The sid of an channel endpoint - :rtype: unicode - """ - return self._properties['channel_endpoint_sid'] + - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Identity resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the CustomerProfilesChannelEndpointAssignmentInstance - :returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the CustomerProfilesChannelEndpointAssignmentInstance +class CustomerProfilesChannelEndpointAssignmentListInstance(ListResource): + def __init__(self, version: V1, customer_profile_sid: str): + # TODO: needs autogenerated docs + super(CustomerProfilesChannelEndpointAssignmentListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { customer_profile_sid, } + self._uri = '/CustomerProfiles/${customer_profile_sid}/ChannelEndpointAssignments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CustomerProfilesChannelEndpointAssignmentInstance(self._version, payload, customer_profile_sid=self._solution['customer_profile_sid']) + + + def page(self, channel_endpoint_sid, channel_endpoint_sids, page_size): + + data = values.of({ + 'channel_endpoint_sid': channel_endpoint_sid,'channel_endpoint_sids': channel_endpoint_sids,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CustomerProfilesChannelEndpointAssignmentPage(self._version, payload, customer_profile_sid=self._solution['customer_profile_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py index a942f377dc..215027d832 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py @@ -1,388 +1,154 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CustomerProfilesEntityAssignmentsList(ListResource): - - def __init__(self, version, customer_profile_sid): - """ - Initialize the CustomerProfilesEntityAssignmentsList - - :param Version version: Version that contains the resource - :param customer_profile_sid: The unique string that identifies the CustomerProfile resource. - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsList - """ - super(CustomerProfilesEntityAssignmentsList, self).__init__(version) - - # Path Solution - self._solution = {'customer_profile_sid': customer_profile_sid, } - self._uri = '/CustomerProfiles/{customer_profile_sid}/EntityAssignments'.format(**self._solution) - - def create(self, object_sid): - """ - Create the CustomerProfilesEntityAssignmentsInstance - - :param unicode object_sid: The sid of an object bag - - :returns: The created CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance - """ - data = values.of({'ObjectSid': object_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CustomerProfilesEntityAssignmentsInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams CustomerProfilesEntityAssignmentsInstance 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 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.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CustomerProfilesEntityAssignmentsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CustomerProfilesEntityAssignmentsInstance records from the API. - Request is executed immediately - - :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 CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CustomerProfilesEntityAssignmentsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CustomerProfilesEntityAssignmentsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CustomerProfilesEntityAssignmentsPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CustomerProfilesEntityAssignmentsContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsContext - """ - return CustomerProfilesEntityAssignmentsContext( - self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a CustomerProfilesEntityAssignmentsContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsContext - """ - return CustomerProfilesEntityAssignmentsContext( - self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CustomerProfilesEntityAssignmentsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CustomerProfilesEntityAssignmentsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param customer_profile_sid: The unique string that identifies the CustomerProfile resource. - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsPage - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsPage - """ - super(CustomerProfilesEntityAssignmentsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CustomerProfilesEntityAssignmentsInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance - """ - return CustomerProfilesEntityAssignmentsInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CustomerProfilesEntityAssignmentsContext(InstanceContext): - - def __init__(self, version, customer_profile_sid, sid): - """ - Initialize the CustomerProfilesEntityAssignmentsContext - - :param Version version: Version that contains the resource - :param customer_profile_sid: The unique string that identifies the resource. - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsContext - """ - super(CustomerProfilesEntityAssignmentsContext, self).__init__(version) + def __init__(self, version: V1, customer_profile_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CustomerProfilesEntityAssignmentsContextList, self).__init__(version) # Path Solution - self._solution = {'customer_profile_sid': customer_profile_sid, 'sid': sid, } - self._uri = '/CustomerProfiles/{customer_profile_sid}/EntityAssignments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CustomerProfilesEntityAssignmentsInstance - - :returns: The fetched CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CustomerProfilesEntityAssignmentsInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the CustomerProfilesEntityAssignmentsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { customer_profile_sid, sid, } + self._uri = '/CustomerProfiles/${customer_profile_sid}/EntityAssignments/${sid}' + + + def delete(self): + + + """ + Deletes the CustomerProfilesEntityAssignmentsInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CustomerProfilesEntityAssignmentsInstance + + :returns: The fetched CustomerProfilesEntityAssignmentsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CustomerProfilesEntityAssignmentsInstance( + self._version, + payload, + customer_profile_sidsid=self._solution['customer_profile_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CustomerProfilesEntityAssignmentsInstance(InstanceResource): - def __init__(self, version, payload, customer_profile_sid, sid=None): - """ - Initialize the CustomerProfilesEntityAssignmentsInstance - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance - """ +class CustomerProfilesEntityAssignmentsInstance(InstanceResource): + def __init__(self, version, payload, customer_profile_sid: str, sid: str): super(CustomerProfilesEntityAssignmentsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'customer_profile_sid': payload.get('customer_profile_sid'), - 'account_sid': payload.get('account_sid'), - 'object_sid': payload.get('object_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'customer_profile_sid' = payload.get('customer_profile_sid'), + 'account_sid' = payload.get('account_sid'), + 'object_sid' = payload.get('object_sid'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'customer_profile_sid': customer_profile_sid, - 'sid': sid or self._properties['sid'], + 'customer_profile_sid': customer_profile_sid or self._properties['customer_profile_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CustomerProfilesEntityAssignmentsContext for this CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsContext - """ if self._context is None: self._context = CustomerProfilesEntityAssignmentsContext( self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=self._solution['sid'], + customer_profile_sid=self._solution['customer_profile_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def customer_profile_sid(self): - """ - :returns: The unique string that identifies the CustomerProfile resource. - :rtype: unicode - """ - return self._properties['customer_profile_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def object_sid(self): - """ - :returns: The sid of an object bag - :rtype: unicode - """ - return self._properties['object_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Identity resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the CustomerProfilesEntityAssignmentsInstance - :returns: The fetched CustomerProfilesEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the CustomerProfilesEntityAssignmentsInstance +class CustomerProfilesEntityAssignmentsListInstance(ListResource): + def __init__(self, version: V1, customer_profile_sid: str): + # TODO: needs autogenerated docs + super(CustomerProfilesEntityAssignmentsListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { customer_profile_sid, } + self._uri = '/CustomerProfiles/${customer_profile_sid}/EntityAssignments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CustomerProfilesEntityAssignmentsInstance(self._version, payload, customer_profile_sid=self._solution['customer_profile_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CustomerProfilesEntityAssignmentsPage(self._version, payload, customer_profile_sid=self._solution['customer_profile_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py index 4aaef7c211..99fc658eca 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py @@ -1,392 +1,145 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CustomerProfilesEvaluationsList(ListResource): - - def __init__(self, version, customer_profile_sid): - """ - Initialize the CustomerProfilesEvaluationsList - - :param Version version: Version that contains the resource - :param customer_profile_sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsList - """ - super(CustomerProfilesEvaluationsList, self).__init__(version) - - # Path Solution - self._solution = {'customer_profile_sid': customer_profile_sid, } - self._uri = '/CustomerProfiles/{customer_profile_sid}/Evaluations'.format(**self._solution) - - def create(self, policy_sid): - """ - Create the CustomerProfilesEvaluationsInstance - - :param unicode policy_sid: The unique string of a policy - - :returns: The created CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance - """ - data = values.of({'PolicySid': policy_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CustomerProfilesEvaluationsInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams CustomerProfilesEvaluationsInstance 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 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.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CustomerProfilesEvaluationsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CustomerProfilesEvaluationsInstance records from the API. - Request is executed immediately - - :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 CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CustomerProfilesEvaluationsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CustomerProfilesEvaluationsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CustomerProfilesEvaluationsPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CustomerProfilesEvaluationsContext - - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsContext - """ - return CustomerProfilesEvaluationsContext( - self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a CustomerProfilesEvaluationsContext - - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsContext - """ - return CustomerProfilesEvaluationsContext( - self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CustomerProfilesEvaluationsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CustomerProfilesEvaluationsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param customer_profile_sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsPage - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsPage - """ - super(CustomerProfilesEvaluationsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of CustomerProfilesEvaluationsInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance - """ - return CustomerProfilesEvaluationsInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class CustomerProfilesEvaluationsContext(InstanceContext): - - def __init__(self, version, customer_profile_sid, sid): - """ - Initialize the CustomerProfilesEvaluationsContext - - :param Version version: Version that contains the resource - :param customer_profile_sid: The unique string that identifies the resource - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsContext - """ - super(CustomerProfilesEvaluationsContext, self).__init__(version) + def __init__(self, version: V1, customer_profile_sid: str, sid: str): + # TODO: needs autogenerated docs + super(CustomerProfilesEvaluationsContextList, self).__init__(version) # Path Solution - self._solution = {'customer_profile_sid': customer_profile_sid, 'sid': sid, } - self._uri = '/CustomerProfiles/{customer_profile_sid}/Evaluations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CustomerProfilesEvaluationsInstance - - :returns: The fetched CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CustomerProfilesEvaluationsInstance( - self._version, - payload, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=self._solution['sid'], - ) + self._solution = { customer_profile_sid, sid, } + self._uri = '/CustomerProfiles/${customer_profile_sid}/Evaluations/${sid}' + + + def fetch(self): + + """ + Fetch the CustomerProfilesEvaluationsInstance + + :returns: The fetched CustomerProfilesEvaluationsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CustomerProfilesEvaluationsInstance( + self._version, + payload, + customer_profile_sidsid=self._solution['customer_profile_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CustomerProfilesEvaluationsInstance(InstanceResource): + return '' - class Status(object): - COMPLIANT = "compliant" - NONCOMPLIANT = "noncompliant" - def __init__(self, version, payload, customer_profile_sid, sid=None): - """ - Initialize the CustomerProfilesEvaluationsInstance - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance - """ +class CustomerProfilesEvaluationsInstance(InstanceResource): + def __init__(self, version, payload, customer_profile_sid: str, sid: str): super(CustomerProfilesEvaluationsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'policy_sid': payload.get('policy_sid'), - 'customer_profile_sid': payload.get('customer_profile_sid'), - 'status': payload.get('status'), - 'results': payload.get('results'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'policy_sid' = payload.get('policy_sid'), + 'customer_profile_sid' = payload.get('customer_profile_sid'), + 'status' = payload.get('status'), + 'results' = payload.get('results'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'customer_profile_sid': customer_profile_sid, - 'sid': sid or self._properties['sid'], + 'customer_profile_sid': customer_profile_sid or self._properties['customer_profile_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CustomerProfilesEvaluationsContext for this CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsContext - """ if self._context is None: self._context = CustomerProfilesEvaluationsContext( self._version, - customer_profile_sid=self._solution['customer_profile_sid'], - sid=self._solution['sid'], + customer_profile_sid=self._solution['customer_profile_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Evaluation resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def policy_sid(self): - """ - :returns: The unique string of a policy - :rtype: unicode - """ - return self._properties['policy_sid'] - - @property - def customer_profile_sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['customer_profile_sid'] - - @property - def status(self): - """ - :returns: The compliance status of the Evaluation resource - :rtype: CustomerProfilesEvaluationsInstance.Status - """ - return self._properties['status'] + - @property - def results(self): + def __repr__(self): """ - :returns: The results of the Evaluation resource - :rtype: list[dict] + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['results'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the CustomerProfilesEvaluationsInstance +class CustomerProfilesEvaluationsListInstance(ListResource): + def __init__(self, version: V1, customer_profile_sid: str): + # TODO: needs autogenerated docs + super(CustomerProfilesEvaluationsListInstanceList, self).__init__(version) - :returns: The fetched CustomerProfilesEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { customer_profile_sid, } + self._uri = '/CustomerProfiles/${customer_profile_sid}/Evaluations' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CustomerProfilesEvaluationsInstance(self._version, payload, customer_profile_sid=self._solution['customer_profile_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CustomerProfilesEvaluationsPage(self._version, payload, customer_profile_sid=self._solution['customer_profile_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/end_user.py b/twilio/rest/trusthub/v1/end_user.py index 2acb145dbc..0bbba0d9a6 100644 --- a/twilio/rest/trusthub/v1/end_user.py +++ b/twilio/rest/trusthub/v1/end_user.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,399 +19,149 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EndUserList(ListResource): - - def __init__(self, version): - """ - Initialize the EndUserList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trusthub.v1.end_user.EndUserList - :rtype: twilio.rest.trusthub.v1.end_user.EndUserList - """ - super(EndUserList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/EndUsers'.format(**self._solution) - - def create(self, friendly_name, type, attributes=values.unset): - """ - Create the EndUserInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode type: The type of end user of the Bundle resource - :param dict attributes: The set of parameters that compose the End User resource - - :returns: The created EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Attributes': serialize.object(attributes), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return EndUserInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams EndUserInstance 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 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.trusthub.v1.end_user.EndUserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EndUserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.end_user.EndUserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EndUserInstance records from the API. - Request is executed immediately - - :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 EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EndUserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EndUserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EndUserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EndUserContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.end_user.EndUserContext - :rtype: twilio.rest.trusthub.v1.end_user.EndUserContext - """ - return EndUserContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EndUserContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.end_user.EndUserContext - :rtype: twilio.rest.trusthub.v1.end_user.EndUserContext - """ - return EndUserContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.page import Page -class EndUserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EndUserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.trusthub.v1.end_user.EndUserPage - :rtype: twilio.rest.trusthub.v1.end_user.EndUserPage - """ - super(EndUserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EndUserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.end_user.EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserInstance - """ - return EndUserInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class EndUserContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the EndUserContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.end_user.EndUserContext - :rtype: twilio.rest.trusthub.v1.end_user.EndUserContext - """ - super(EndUserContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(EndUserContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/EndUsers/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EndUserInstance - - :returns: The fetched EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EndUserInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, attributes=values.unset): - """ - Update the EndUserInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the End User resource - - :returns: The updated EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Attributes': serialize.object(attributes), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return EndUserInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the EndUserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/EndUsers/${sid}' + + + def delete(self): + + + """ + Deletes the EndUserInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the EndUserInstance + + :returns: The fetched EndUserInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EndUserInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return EndUserInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class EndUserInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the EndUserInstance - :returns: twilio.rest.trusthub.v1.end_user.EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserInstance - """ +class EndUserInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(EndUserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'type': payload.get('type'), - 'attributes': payload.get('attributes'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'type' = payload.get('type'), + 'attributes' = payload.get('attributes'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EndUserContext for this EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserContext - """ if self._context is None: - self._context = EndUserContext(self._version, sid=self._solution['sid'], ) + self._context = EndUserContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def type(self): - """ - :returns: The type of end user of the Bundle resource - :rtype: unicode - """ - return self._properties['type'] - - @property - def attributes(self): - """ - :returns: The set of parameters that compose the End Users resource - :rtype: dict - """ - return self._properties['attributes'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the End User resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the EndUserInstance - - :returns: The fetched EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, attributes=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the EndUserInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the End User resource - :returns: The updated EndUserInstance - :rtype: twilio.rest.trusthub.v1.end_user.EndUserInstance - """ - return self._proxy.update(friendly_name=friendly_name, attributes=attributes, ) - def delete(self): - """ - Deletes the EndUserInstance +class EndUserListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(EndUserListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/EndUsers' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EndUserInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EndUserPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/end_user_type.py b/twilio/rest/trusthub/v1/end_user_type.py index 912894f748..26f4b472fe 100644 --- a/twilio/rest/trusthub/v1/end_user_type.py +++ b/twilio/rest/trusthub/v1/end_user_type.py @@ -1,314 +1,132 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class EndUserTypeList(ListResource): - - def __init__(self, version): - """ - Initialize the EndUserTypeList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trusthub.v1.end_user_type.EndUserTypeList - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeList - """ - super(EndUserTypeList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/EndUserTypes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams EndUserTypeInstance 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 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.trusthub.v1.end_user_type.EndUserTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EndUserTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.end_user_type.EndUserTypeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EndUserTypeInstance records from the API. - Request is executed immediately - - :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 EndUserTypeInstance - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EndUserTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EndUserTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EndUserTypeInstance - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EndUserTypePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a EndUserTypeContext - - :param sid: The unique string that identifies the End-User Type resource - - :returns: twilio.rest.trusthub.v1.end_user_type.EndUserTypeContext - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeContext - """ - return EndUserTypeContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EndUserTypeContext - - :param sid: The unique string that identifies the End-User Type resource - - :returns: twilio.rest.trusthub.v1.end_user_type.EndUserTypeContext - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeContext - """ - return EndUserTypeContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EndUserTypePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EndUserTypePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.trusthub.v1.end_user_type.EndUserTypePage - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypePage - """ - super(EndUserTypePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EndUserTypeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.end_user_type.EndUserTypeInstance - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeInstance - """ - return EndUserTypeInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class EndUserTypeContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the EndUserTypeContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the End-User Type resource - - :returns: twilio.rest.trusthub.v1.end_user_type.EndUserTypeContext - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeContext - """ - super(EndUserTypeContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(EndUserTypeContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/EndUserTypes/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the EndUserTypeInstance - - :returns: The fetched EndUserTypeInstance - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EndUserTypeInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/EndUserTypes/${sid}' + + + def fetch(self): + + """ + Fetch the EndUserTypeInstance + + :returns: The fetched EndUserTypeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EndUserTypeInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class EndUserTypeInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the EndUserTypeInstance - - :returns: twilio.rest.trusthub.v1.end_user_type.EndUserTypeInstance - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeInstance - """ +class EndUserTypeInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(EndUserTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'machine_name': payload.get('machine_name'), - 'fields': payload.get('fields'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'machine_name' = payload.get('machine_name'), + 'fields' = payload.get('fields'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EndUserTypeContext for this EndUserTypeInstance - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeContext - """ if self._context is None: - self._context = EndUserTypeContext(self._version, sid=self._solution['sid'], ) + self._context = EndUserTypeContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the End-User Type resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def friendly_name(self): + def __repr__(self): """ - :returns: A human-readable description of the End-User Type resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['friendly_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def machine_name(self): - """ - :returns: A machine-readable description of the End-User Type resource - :rtype: unicode - """ - return self._properties['machine_name'] - @property - def fields(self): - """ - :returns: The required information for creating an End-User. - :rtype: list[dict] - """ - return self._properties['fields'] - @property - def url(self): - """ - :returns: The absolute URL of the End-User Type resource - :rtype: unicode - """ - return self._properties['url'] +class EndUserTypeListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(EndUserTypeListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the EndUserTypeInstance + # Path Solution + self._solution = { } + self._uri = '/EndUserTypes' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :returns: The fetched EndUserTypeInstance - :rtype: twilio.rest.trusthub.v1.end_user_type.EndUserTypeInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EndUserTypePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/policies.py b/twilio/rest/trusthub/v1/policies.py index eacdace3f7..864fd5e7f5 100644 --- a/twilio/rest/trusthub/v1/policies.py +++ b/twilio/rest/trusthub/v1/policies.py @@ -1,309 +1,131 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PoliciesList(ListResource): - - def __init__(self, version): - """ - Initialize the PoliciesList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trusthub.v1.policies.PoliciesList - :rtype: twilio.rest.trusthub.v1.policies.PoliciesList - """ - super(PoliciesList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Policies'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams PoliciesInstance 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 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.trusthub.v1.policies.PoliciesInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PoliciesInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.policies.PoliciesInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PoliciesInstance records from the API. - Request is executed immediately - - :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 PoliciesInstance - :rtype: twilio.rest.trusthub.v1.policies.PoliciesPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PoliciesPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PoliciesInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PoliciesInstance - :rtype: twilio.rest.trusthub.v1.policies.PoliciesPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PoliciesPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PoliciesContext - - :param sid: The unique string that identifies the Policy resource - - :returns: twilio.rest.trusthub.v1.policies.PoliciesContext - :rtype: twilio.rest.trusthub.v1.policies.PoliciesContext - """ - return PoliciesContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PoliciesContext - - :param sid: The unique string that identifies the Policy resource - - :returns: twilio.rest.trusthub.v1.policies.PoliciesContext - :rtype: twilio.rest.trusthub.v1.policies.PoliciesContext - """ - return PoliciesContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PoliciesPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PoliciesPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.trusthub.v1.policies.PoliciesPage - :rtype: twilio.rest.trusthub.v1.policies.PoliciesPage - """ - super(PoliciesPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PoliciesInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.policies.PoliciesInstance - :rtype: twilio.rest.trusthub.v1.policies.PoliciesInstance - """ - return PoliciesInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class PoliciesContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the PoliciesContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the Policy resource - - :returns: twilio.rest.trusthub.v1.policies.PoliciesContext - :rtype: twilio.rest.trusthub.v1.policies.PoliciesContext - """ - super(PoliciesContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(PoliciesContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Policies/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the PoliciesInstance - - :returns: The fetched PoliciesInstance - :rtype: twilio.rest.trusthub.v1.policies.PoliciesInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PoliciesInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Policies/${sid}' + + + def fetch(self): + + """ + Fetch the PoliciesInstance + + :returns: The fetched PoliciesInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PoliciesInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PoliciesInstance(InstanceResource): - - class EndUserType(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - - def __init__(self, version, payload, sid=None): - """ - Initialize the PoliciesInstance - :returns: twilio.rest.trusthub.v1.policies.PoliciesInstance - :rtype: twilio.rest.trusthub.v1.policies.PoliciesInstance - """ +class PoliciesInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(PoliciesInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'requirements': payload.get('requirements'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'requirements' = payload.get('requirements'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PoliciesContext for this PoliciesInstance - :rtype: twilio.rest.trusthub.v1.policies.PoliciesContext - """ if self._context is None: - self._context = PoliciesContext(self._version, sid=self._solution['sid'], ) + self._context = PoliciesContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Policy resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def friendly_name(self): + def __repr__(self): """ - :returns: A human-readable description of the Policy resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['friendly_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def requirements(self): - """ - :returns: The sid of a Policy object that dictates requirements - :rtype: dict - """ - return self._properties['requirements'] - @property - def url(self): - """ - :returns: The absolute URL of the Policy resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the PoliciesInstance +class PoliciesListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(PoliciesListInstanceList, self).__init__(version) - :returns: The fetched PoliciesInstance - :rtype: twilio.rest.trusthub.v1.policies.PoliciesInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Policies' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PoliciesPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index 0a256ea520..582e5c55b6 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,425 +19,151 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SupportingDocumentList(ListResource): - - def __init__(self, version): - """ - Initialize the SupportingDocumentList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentList - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentList - """ - super(SupportingDocumentList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/SupportingDocuments'.format(**self._solution) - - def create(self, friendly_name, type, attributes=values.unset): - """ - Create the SupportingDocumentInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode type: The type of the Supporting Document - :param dict attributes: The set of parameters that compose the Supporting Documents resource - - :returns: The created SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Type': type, - 'Attributes': serialize.object(attributes), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SupportingDocumentInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams SupportingDocumentInstance 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 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.trusthub.v1.supporting_document.SupportingDocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SupportingDocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.supporting_document.SupportingDocumentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SupportingDocumentInstance records from the API. - Request is executed immediately - - :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 SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SupportingDocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SupportingDocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SupportingDocumentPage(self._version, response, self._solution) - def get(self, sid): - """ - Constructs a SupportingDocumentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext - """ - return SupportingDocumentContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SupportingDocumentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext - """ - return SupportingDocumentContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SupportingDocumentPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SupportingDocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentPage - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentPage - """ - super(SupportingDocumentPage, self).__init__(version, response) +from twilio.base.page import Page - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of SupportingDocumentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - """ - return SupportingDocumentInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SupportingDocumentContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the SupportingDocumentContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext - """ - super(SupportingDocumentContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SupportingDocumentContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/SupportingDocuments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SupportingDocumentInstance - - :returns: The fetched SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SupportingDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, attributes=values.unset): - """ - Update the SupportingDocumentInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the Supporting Document resource - - :returns: The updated SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Attributes': serialize.object(attributes), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SupportingDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the SupportingDocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/SupportingDocuments/${sid}' + + + def delete(self): + + + """ + Deletes the SupportingDocumentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SupportingDocumentInstance + + :returns: The fetched SupportingDocumentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SupportingDocumentInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SupportingDocumentInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SupportingDocumentInstance(InstanceResource): + return '' - class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - REJECTED = "rejected" - APPROVED = "approved" - EXPIRED = "expired" - PROVISIONALLY_APPROVED = "provisionally-approved" - def __init__(self, version, payload, sid=None): - """ - Initialize the SupportingDocumentInstance - :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - """ +class SupportingDocumentInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(SupportingDocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'mime_type': payload.get('mime_type'), - 'status': payload.get('status'), - 'type': payload.get('type'), - 'attributes': payload.get('attributes'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'mime_type' = payload.get('mime_type'), + 'status' = payload.get('status'), + 'type' = payload.get('type'), + 'attributes' = payload.get('attributes'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SupportingDocumentContext for this SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext - """ if self._context is None: - self._context = SupportingDocumentContext(self._version, sid=self._solution['sid'], ) + self._context = SupportingDocumentContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def mime_type(self): - """ - :returns: The image type of the file - :rtype: unicode - """ - return self._properties['mime_type'] - - @property - def status(self): - """ - :returns: The verification status of the Supporting Document resource - :rtype: SupportingDocumentInstance.Status - """ - return self._properties['status'] - - @property - def type(self): - """ - :returns: The type of the Supporting Document - :rtype: unicode - """ - return self._properties['type'] - - @property - def attributes(self): - """ - :returns: The set of parameters that compose the Supporting Documents resource - :rtype: dict - """ - return self._properties['attributes'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Supporting Document resource - :rtype: unicode - """ - return self._properties['url'] + - def fetch(self): - """ - Fetch the SupportingDocumentInstance - - :returns: The fetched SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, attributes=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the SupportingDocumentInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: The string that you assigned to describe the resource - :param dict attributes: The set of parameters that compose the Supporting Document resource - :returns: The updated SupportingDocumentInstance - :rtype: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentInstance - """ - return self._proxy.update(friendly_name=friendly_name, attributes=attributes, ) - def delete(self): - """ - Deletes the SupportingDocumentInstance +class SupportingDocumentListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SupportingDocumentListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/SupportingDocuments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SupportingDocumentInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SupportingDocumentPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/supporting_document_type.py b/twilio/rest/trusthub/v1/supporting_document_type.py index 18e4388214..124033f714 100644 --- a/twilio/rest/trusthub/v1/supporting_document_type.py +++ b/twilio/rest/trusthub/v1/supporting_document_type.py @@ -1,314 +1,132 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SupportingDocumentTypeList(ListResource): - - def __init__(self, version): - """ - Initialize the SupportingDocumentTypeList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeList - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeList - """ - super(SupportingDocumentTypeList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/SupportingDocumentTypes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SupportingDocumentTypeInstance 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 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.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SupportingDocumentTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SupportingDocumentTypeInstance records from the API. - Request is executed immediately - - :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 SupportingDocumentTypeInstance - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SupportingDocumentTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SupportingDocumentTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SupportingDocumentTypeInstance - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SupportingDocumentTypePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SupportingDocumentTypeContext - - :param sid: The unique string that identifies the Supporting Document Type resource - - :returns: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeContext - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeContext - """ - return SupportingDocumentTypeContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SupportingDocumentTypeContext - - :param sid: The unique string that identifies the Supporting Document Type resource - - :returns: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeContext - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeContext - """ - return SupportingDocumentTypeContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SupportingDocumentTypePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SupportingDocumentTypePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypePage - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypePage - """ - super(SupportingDocumentTypePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SupportingDocumentTypeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance - """ - return SupportingDocumentTypeInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class SupportingDocumentTypeContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the SupportingDocumentTypeContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the Supporting Document Type resource - - :returns: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeContext - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeContext - """ - super(SupportingDocumentTypeContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SupportingDocumentTypeContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/SupportingDocumentTypes/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SupportingDocumentTypeInstance - - :returns: The fetched SupportingDocumentTypeInstance - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SupportingDocumentTypeInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/SupportingDocumentTypes/${sid}' + + + def fetch(self): + + """ + Fetch the SupportingDocumentTypeInstance + + :returns: The fetched SupportingDocumentTypeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SupportingDocumentTypeInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SupportingDocumentTypeInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the SupportingDocumentTypeInstance - - :returns: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance - """ +class SupportingDocumentTypeInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(SupportingDocumentTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'machine_name': payload.get('machine_name'), - 'fields': payload.get('fields'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'machine_name' = payload.get('machine_name'), + 'fields' = payload.get('fields'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SupportingDocumentTypeContext for this SupportingDocumentTypeInstance - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeContext - """ if self._context is None: - self._context = SupportingDocumentTypeContext(self._version, sid=self._solution['sid'], ) + self._context = SupportingDocumentTypeContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Supporting Document Type resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def friendly_name(self): + def __repr__(self): """ - :returns: A human-readable description of the Supporting Document Type resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['friendly_name'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def machine_name(self): - """ - :returns: The machine-readable description of the Supporting Document Type resource - :rtype: unicode - """ - return self._properties['machine_name'] - @property - def fields(self): - """ - :returns: The required information for creating a Supporting Document - :rtype: list[dict] - """ - return self._properties['fields'] - @property - def url(self): - """ - :returns: The absolute URL of the Supporting Document Type resource - :rtype: unicode - """ - return self._properties['url'] +class SupportingDocumentTypeListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SupportingDocumentTypeListInstanceList, self).__init__(version) - def fetch(self): - """ - Fetch the SupportingDocumentTypeInstance + # Path Solution + self._solution = { } + self._uri = '/SupportingDocumentTypes' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :returns: The fetched SupportingDocumentTypeInstance - :rtype: twilio.rest.trusthub.v1.supporting_document_type.SupportingDocumentTypeInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SupportingDocumentTypePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/trust_products.py b/twilio/rest/trusthub/v1/trust_products.py new file mode 100644 index 0000000000..17a7f132d7 --- /dev/null +++ b/twilio/rest/trusthub/v1/trust_products.py @@ -0,0 +1,183 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.trust_products.trust_products_channel_endpoint_assignment import TrustProductsChannelEndpointAssignmentListInstancefrom twilio.rest.trust_products.trust_products_entity_assignments import TrustProductsEntityAssignmentsListInstancefrom twilio.rest.trust_products.trust_products_evaluations import TrustProductsEvaluationsListInstance + + +class TrustProductsContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(TrustProductsContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/TrustProducts/${sid}' + + self._trust_products_channel_endpoint_assignment = None + self._trust_products_entity_assignments = None + self._trust_products_evaluations = None + + def delete(self): + + + """ + Deletes the TrustProductsInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TrustProductsInstance + + :returns: The fetched TrustProductsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TrustProductsInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return TrustProductsInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class TrustProductsInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(TrustProductsInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'policy_sid' = payload.get('policy_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'valid_until' = payload.get('valid_until'), + 'email' = payload.get('email'), + 'status_callback' = payload.get('status_callback'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = TrustProductsContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def trust_products_channel_endpoint_assignment(self): + return self._proxy.trust_products_channel_endpoint_assignment + @property + def trust_products_entity_assignments(self): + return self._proxy.trust_products_entity_assignments + @property + def trust_products_evaluations(self): + return self._proxy.trust_products_evaluations + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class TrustProductsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(TrustProductsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/TrustProducts' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TrustProductsInstance(self._version, payload, ) + + + def page(self, status, friendly_name, policy_sid, page_size): + + data = values.of({ + 'status': status,'friendly_name': friendly_name,'policy_sid': policy_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TrustProductsPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py index 86e92656eb..dc0efed9e6 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py @@ -1,422 +1,155 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TrustProductsChannelEndpointAssignmentList(ListResource): - - def __init__(self, version, trust_product_sid): - """ - Initialize the TrustProductsChannelEndpointAssignmentList - - :param Version version: Version that contains the resource - :param trust_product_sid: The unique string that identifies the CustomerProfile resource. - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentList - """ - super(TrustProductsChannelEndpointAssignmentList, self).__init__(version) - - # Path Solution - self._solution = {'trust_product_sid': trust_product_sid, } - self._uri = '/TrustProducts/{trust_product_sid}/ChannelEndpointAssignments'.format(**self._solution) - - def create(self, channel_endpoint_type, channel_endpoint_sid): - """ - Create the TrustProductsChannelEndpointAssignmentInstance - - :param unicode channel_endpoint_type: The type of channel endpoint - :param unicode channel_endpoint_sid: The sid of an channel endpoint - - :returns: The created TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance - """ - data = values.of({ - 'ChannelEndpointType': channel_endpoint_type, - 'ChannelEndpointSid': channel_endpoint_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TrustProductsChannelEndpointAssignmentInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - ) - - def stream(self, channel_endpoint_sid=values.unset, - channel_endpoint_sids=values.unset, limit=None, page_size=None): - """ - Streams TrustProductsChannelEndpointAssignmentInstance 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 channel_endpoint_sid: The sid of an channel endpoint - :param unicode channel_endpoint_sids: comma separated list of channel endpoint sids - :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.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - channel_endpoint_sid=channel_endpoint_sid, - channel_endpoint_sids=channel_endpoint_sids, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, channel_endpoint_sid=values.unset, - channel_endpoint_sids=values.unset, limit=None, page_size=None): - """ - Lists TrustProductsChannelEndpointAssignmentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode channel_endpoint_sid: The sid of an channel endpoint - :param unicode channel_endpoint_sids: comma separated list of channel endpoint sids - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance] - """ - return list(self.stream( - channel_endpoint_sid=channel_endpoint_sid, - channel_endpoint_sids=channel_endpoint_sids, - limit=limit, - page_size=page_size, - )) - - def page(self, channel_endpoint_sid=values.unset, - channel_endpoint_sids=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TrustProductsChannelEndpointAssignmentInstance records from the API. - Request is executed immediately - - :param unicode channel_endpoint_sid: The sid of an channel endpoint - :param unicode channel_endpoint_sids: comma separated list of channel endpoint sids - :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 TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentPage - """ - data = values.of({ - 'ChannelEndpointSid': channel_endpoint_sid, - 'ChannelEndpointSids': channel_endpoint_sids, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TrustProductsChannelEndpointAssignmentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TrustProductsChannelEndpointAssignmentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TrustProductsChannelEndpointAssignmentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TrustProductsChannelEndpointAssignmentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentContext - """ - return TrustProductsChannelEndpointAssignmentContext( - self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a TrustProductsChannelEndpointAssignmentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentContext - """ - return TrustProductsChannelEndpointAssignmentContext( - self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TrustProductsChannelEndpointAssignmentPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TrustProductsChannelEndpointAssignmentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trust_product_sid: The unique string that identifies the CustomerProfile resource. - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentPage - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentPage - """ - super(TrustProductsChannelEndpointAssignmentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TrustProductsChannelEndpointAssignmentInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance - """ - return TrustProductsChannelEndpointAssignmentInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class TrustProductsChannelEndpointAssignmentContext(InstanceContext): - - def __init__(self, version, trust_product_sid, sid): - """ - Initialize the TrustProductsChannelEndpointAssignmentContext - - :param Version version: Version that contains the resource - :param trust_product_sid: The unique string that identifies the resource. - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentContext - """ - super(TrustProductsChannelEndpointAssignmentContext, self).__init__(version) + def __init__(self, version: V1, trust_product_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TrustProductsChannelEndpointAssignmentContextList, self).__init__(version) # Path Solution - self._solution = {'trust_product_sid': trust_product_sid, 'sid': sid, } - self._uri = '/TrustProducts/{trust_product_sid}/ChannelEndpointAssignments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the TrustProductsChannelEndpointAssignmentInstance - - :returns: The fetched TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TrustProductsChannelEndpointAssignmentInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TrustProductsChannelEndpointAssignmentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { trust_product_sid, sid, } + self._uri = '/TrustProducts/${trust_product_sid}/ChannelEndpointAssignments/${sid}' + + + def delete(self): + + + """ + Deletes the TrustProductsChannelEndpointAssignmentInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TrustProductsChannelEndpointAssignmentInstance + + :returns: The fetched TrustProductsChannelEndpointAssignmentInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TrustProductsChannelEndpointAssignmentInstance( + self._version, + payload, + trust_product_sidsid=self._solution['trust_product_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TrustProductsChannelEndpointAssignmentInstance(InstanceResource): - def __init__(self, version, payload, trust_product_sid, sid=None): - """ - Initialize the TrustProductsChannelEndpointAssignmentInstance - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance - """ +class TrustProductsChannelEndpointAssignmentInstance(InstanceResource): + def __init__(self, version, payload, trust_product_sid: str, sid: str): super(TrustProductsChannelEndpointAssignmentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'trust_product_sid': payload.get('trust_product_sid'), - 'account_sid': payload.get('account_sid'), - 'channel_endpoint_type': payload.get('channel_endpoint_type'), - 'channel_endpoint_sid': payload.get('channel_endpoint_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'trust_product_sid' = payload.get('trust_product_sid'), + 'account_sid' = payload.get('account_sid'), + 'channel_endpoint_type' = payload.get('channel_endpoint_type'), + 'channel_endpoint_sid' = payload.get('channel_endpoint_sid'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'trust_product_sid': trust_product_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'trust_product_sid': trust_product_sid or self._properties['trust_product_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TrustProductsChannelEndpointAssignmentContext for this TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentContext - """ if self._context is None: self._context = TrustProductsChannelEndpointAssignmentContext( self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=self._solution['sid'], + trust_product_sid=self._solution['trust_product_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trust_product_sid(self): - """ - :returns: The unique string that identifies the CustomerProfile resource. - :rtype: unicode - """ - return self._properties['trust_product_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def channel_endpoint_type(self): - """ - :returns: The type of channel endpoint - :rtype: unicode - """ - return self._properties['channel_endpoint_type'] - - @property - def channel_endpoint_sid(self): - """ - :returns: The sid of an channel endpoint - :rtype: unicode - """ - return self._properties['channel_endpoint_sid'] + - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Identity resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the TrustProductsChannelEndpointAssignmentInstance - :returns: The fetched TrustProductsChannelEndpointAssignmentInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the TrustProductsChannelEndpointAssignmentInstance +class TrustProductsChannelEndpointAssignmentListInstance(ListResource): + def __init__(self, version: V1, trust_product_sid: str): + # TODO: needs autogenerated docs + super(TrustProductsChannelEndpointAssignmentListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { trust_product_sid, } + self._uri = '/TrustProducts/${trust_product_sid}/ChannelEndpointAssignments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TrustProductsChannelEndpointAssignmentInstance(self._version, payload, trust_product_sid=self._solution['trust_product_sid']) + + + def page(self, channel_endpoint_sid, channel_endpoint_sids, page_size): + + data = values.of({ + 'channel_endpoint_sid': channel_endpoint_sid,'channel_endpoint_sids': channel_endpoint_sids,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TrustProductsChannelEndpointAssignmentPage(self._version, payload, trust_product_sid=self._solution['trust_product_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py index 74b2e21a3c..c8bb40aa88 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py @@ -1,385 +1,154 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TrustProductsEntityAssignmentsList(ListResource): - - def __init__(self, version, trust_product_sid): - """ - Initialize the TrustProductsEntityAssignmentsList - - :param Version version: Version that contains the resource - :param trust_product_sid: The unique string that identifies the TrustProduct resource. - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsList - """ - super(TrustProductsEntityAssignmentsList, self).__init__(version) - - # Path Solution - self._solution = {'trust_product_sid': trust_product_sid, } - self._uri = '/TrustProducts/{trust_product_sid}/EntityAssignments'.format(**self._solution) - - def create(self, object_sid): - """ - Create the TrustProductsEntityAssignmentsInstance - - :param unicode object_sid: The sid of an object bag - - :returns: The created TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance - """ - data = values.of({'ObjectSid': object_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TrustProductsEntityAssignmentsInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams TrustProductsEntityAssignmentsInstance 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 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.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TrustProductsEntityAssignmentsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TrustProductsEntityAssignmentsInstance records from the API. - Request is executed immediately - - :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 TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TrustProductsEntityAssignmentsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TrustProductsEntityAssignmentsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TrustProductsEntityAssignmentsPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TrustProductsEntityAssignmentsContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsContext - """ - return TrustProductsEntityAssignmentsContext( - self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a TrustProductsEntityAssignmentsContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsContext - """ - return TrustProductsEntityAssignmentsContext( - self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TrustProductsEntityAssignmentsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TrustProductsEntityAssignmentsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trust_product_sid: The unique string that identifies the TrustProduct resource. - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsPage - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsPage - """ - super(TrustProductsEntityAssignmentsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of TrustProductsEntityAssignmentsInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance - """ - return TrustProductsEntityAssignmentsInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TrustProductsEntityAssignmentsContext(InstanceContext): - - def __init__(self, version, trust_product_sid, sid): - """ - Initialize the TrustProductsEntityAssignmentsContext - - :param Version version: Version that contains the resource - :param trust_product_sid: The unique string that identifies the resource. - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsContext - """ - super(TrustProductsEntityAssignmentsContext, self).__init__(version) + def __init__(self, version: V1, trust_product_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TrustProductsEntityAssignmentsContextList, self).__init__(version) # Path Solution - self._solution = {'trust_product_sid': trust_product_sid, 'sid': sid, } - self._uri = '/TrustProducts/{trust_product_sid}/EntityAssignments/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the TrustProductsEntityAssignmentsInstance - - :returns: The fetched TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TrustProductsEntityAssignmentsInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TrustProductsEntityAssignmentsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { trust_product_sid, sid, } + self._uri = '/TrustProducts/${trust_product_sid}/EntityAssignments/${sid}' + + + def delete(self): + + + """ + Deletes the TrustProductsEntityAssignmentsInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the TrustProductsEntityAssignmentsInstance + + :returns: The fetched TrustProductsEntityAssignmentsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TrustProductsEntityAssignmentsInstance( + self._version, + payload, + trust_product_sidsid=self._solution['trust_product_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TrustProductsEntityAssignmentsInstance(InstanceResource): - - def __init__(self, version, payload, trust_product_sid, sid=None): - """ - Initialize the TrustProductsEntityAssignmentsInstance - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance - """ +class TrustProductsEntityAssignmentsInstance(InstanceResource): + def __init__(self, version, payload, trust_product_sid: str, sid: str): super(TrustProductsEntityAssignmentsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'trust_product_sid': payload.get('trust_product_sid'), - 'account_sid': payload.get('account_sid'), - 'object_sid': payload.get('object_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'trust_product_sid' = payload.get('trust_product_sid'), + 'account_sid' = payload.get('account_sid'), + 'object_sid' = payload.get('object_sid'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'trust_product_sid': trust_product_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'trust_product_sid': trust_product_sid or self._properties['trust_product_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TrustProductsEntityAssignmentsContext for this TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsContext - """ if self._context is None: self._context = TrustProductsEntityAssignmentsContext( self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=self._solution['sid'], + trust_product_sid=self._solution['trust_product_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def trust_product_sid(self): - """ - :returns: The unique string that identifies the TrustProduct resource. - :rtype: unicode - """ - return self._properties['trust_product_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def object_sid(self): - """ - :returns: The sid of an object bag - :rtype: unicode - """ - return self._properties['object_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the Identity resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the TrustProductsEntityAssignmentsInstance - :returns: The fetched TrustProductsEntityAssignmentsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the TrustProductsEntityAssignmentsInstance +class TrustProductsEntityAssignmentsListInstance(ListResource): + def __init__(self, version: V1, trust_product_sid: str): + # TODO: needs autogenerated docs + super(TrustProductsEntityAssignmentsListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { trust_product_sid, } + self._uri = '/TrustProducts/${trust_product_sid}/EntityAssignments' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TrustProductsEntityAssignmentsInstance(self._version, payload, trust_product_sid=self._solution['trust_product_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TrustProductsEntityAssignmentsPage(self._version, payload, trust_product_sid=self._solution['trust_product_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py index 8a99f7eaad..70dd094714 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py @@ -1,389 +1,145 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TrustProductsEvaluationsList(ListResource): - - def __init__(self, version, trust_product_sid): - """ - Initialize the TrustProductsEvaluationsList - - :param Version version: Version that contains the resource - :param trust_product_sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsList - """ - super(TrustProductsEvaluationsList, self).__init__(version) - - # Path Solution - self._solution = {'trust_product_sid': trust_product_sid, } - self._uri = '/TrustProducts/{trust_product_sid}/Evaluations'.format(**self._solution) - - def create(self, policy_sid): - """ - Create the TrustProductsEvaluationsInstance - - :param unicode policy_sid: The unique string of a policy - - :returns: The created TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance - """ - data = values.of({'PolicySid': policy_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TrustProductsEvaluationsInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams TrustProductsEvaluationsInstance 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 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.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TrustProductsEvaluationsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TrustProductsEvaluationsInstance records from the API. - Request is executed immediately - - :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 TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TrustProductsEvaluationsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TrustProductsEvaluationsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TrustProductsEvaluationsPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TrustProductsEvaluationsContext - - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsContext - """ - return TrustProductsEvaluationsContext( - self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a TrustProductsEvaluationsContext - - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsContext - """ - return TrustProductsEvaluationsContext( - self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TrustProductsEvaluationsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TrustProductsEvaluationsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param trust_product_sid: The unique string that identifies the resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsPage - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsPage - """ - super(TrustProductsEvaluationsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - def get_instance(self, payload): - """ - Build an instance of TrustProductsEvaluationsInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance - """ - return TrustProductsEvaluationsInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class TrustProductsEvaluationsContext(InstanceContext): - - def __init__(self, version, trust_product_sid, sid): - """ - Initialize the TrustProductsEvaluationsContext - - :param Version version: Version that contains the resource - :param trust_product_sid: The unique string that identifies the resource - :param sid: The unique string that identifies the Evaluation resource - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsContext - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsContext - """ - super(TrustProductsEvaluationsContext, self).__init__(version) + def __init__(self, version: V1, trust_product_sid: str, sid: str): + # TODO: needs autogenerated docs + super(TrustProductsEvaluationsContextList, self).__init__(version) # Path Solution - self._solution = {'trust_product_sid': trust_product_sid, 'sid': sid, } - self._uri = '/TrustProducts/{trust_product_sid}/Evaluations/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the TrustProductsEvaluationsInstance - - :returns: The fetched TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TrustProductsEvaluationsInstance( - self._version, - payload, - trust_product_sid=self._solution['trust_product_sid'], - sid=self._solution['sid'], - ) + self._solution = { trust_product_sid, sid, } + self._uri = '/TrustProducts/${trust_product_sid}/Evaluations/${sid}' + + + def fetch(self): + + """ + Fetch the TrustProductsEvaluationsInstance + + :returns: The fetched TrustProductsEvaluationsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return TrustProductsEvaluationsInstance( + self._version, + payload, + trust_product_sidsid=self._solution['trust_product_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class TrustProductsEvaluationsInstance(InstanceResource): + return '' - class Status(object): - COMPLIANT = "compliant" - NONCOMPLIANT = "noncompliant" - def __init__(self, version, payload, trust_product_sid, sid=None): - """ - Initialize the TrustProductsEvaluationsInstance - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance - """ +class TrustProductsEvaluationsInstance(InstanceResource): + def __init__(self, version, payload, trust_product_sid: str, sid: str): super(TrustProductsEvaluationsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'policy_sid': payload.get('policy_sid'), - 'trust_product_sid': payload.get('trust_product_sid'), - 'status': payload.get('status'), - 'results': payload.get('results'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'policy_sid' = payload.get('policy_sid'), + 'trust_product_sid' = payload.get('trust_product_sid'), + 'status' = payload.get('status'), + 'results' = payload.get('results'), + 'date_created' = payload.get('date_created'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'trust_product_sid': trust_product_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'trust_product_sid': trust_product_sid or self._properties['trust_product_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TrustProductsEvaluationsContext for this TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsContext - """ if self._context is None: self._context = TrustProductsEvaluationsContext( self._version, - trust_product_sid=self._solution['trust_product_sid'], - sid=self._solution['sid'], + trust_product_sid=self._solution['trust_product_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the Evaluation resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def policy_sid(self): - """ - :returns: The unique string of a policy - :rtype: unicode - """ - return self._properties['policy_sid'] - - @property - def trust_product_sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['trust_product_sid'] - - @property - def status(self): - """ - :returns: The compliance status of the Evaluation resource - :rtype: TrustProductsEvaluationsInstance.Status - """ - return self._properties['status'] + - @property - def results(self): + def __repr__(self): """ - :returns: The results of the Evaluation resource - :rtype: list[dict] + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['results'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the TrustProductsEvaluationsInstance +class TrustProductsEvaluationsListInstance(ListResource): + def __init__(self, version: V1, trust_product_sid: str): + # TODO: needs autogenerated docs + super(TrustProductsEvaluationsListInstanceList, self).__init__(version) - :returns: The fetched TrustProductsEvaluationsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { trust_product_sid, } + self._uri = '/TrustProducts/${trust_product_sid}/Evaluations' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return TrustProductsEvaluationsInstance(self._version, payload, trust_product_sid=self._solution['trust_product_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return TrustProductsEvaluationsPage(self._version, payload, trust_product_sid=self._solution['trust_product_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/__init__.py b/twilio/rest/verify/__init__.py index 1dae555fd8..c5c464691f 100644 --- a/twilio/rest/verify/__init__.py +++ b/twilio/rest/verify/__init__.py @@ -1,87 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.verify.v2 import V2 + Twilio - Verify + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Verify(Domain): +from twilio.base.domain import Domain +from twilio.rest.Verify.v2 import V2 +class Verify(Domain): def __init__(self, twilio): """ Initialize the Verify Domain :returns: Domain for Verify - :rtype: twilio.rest.verify.Verify + :rtype: twilio.rest.v2.Verify """ super(Verify, self).__init__(twilio) - - self.base_url = 'https://verify.twilio.com' - - # Versions - self._v2 = None + self.base_url = 'https://Verify.twilio.com' + self._V2 = None @property - def v2(self): + def V2(self): """ - :returns: Version v2 of verify - :rtype: twilio.rest.verify.v2.V2 + :returns: Versions v2 of Verify + :rtype: twilio.rest.Verify.v2 """ - if self._v2 is None: - self._v2 = V2(self) - return self._v2 + if self._V2 is None: + self._V2 = V2(self) + return self._V2 + @property def forms(self): """ - :rtype: twilio.rest.verify.v2.form.FormList + :rtype: twilio.rest.v2.forms """ return self.v2.forms + @property def safelist(self): """ - :rtype: twilio.rest.verify.v2.safelist.SafelistList + :rtype: twilio.rest.v2.safelist """ return self.v2.safelist + @property def services(self): """ - :rtype: twilio.rest.verify.v2.service.ServiceList + :rtype: twilio.rest.v2.services """ return self.v2.services + @property - def verification_attempts(self): + def templates(self): """ - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptList + :rtype: twilio.rest.v2.templates """ - return self.v2.verification_attempts + return self.v2.templates + @property - def verification_attempts_summary(self): + def verification_attempts(self): """ - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryList + :rtype: twilio.rest.v2.verification_attempts """ - return self.v2.verification_attempts_summary + return self.v2.verification_attempts + @property - def templates(self): + def verification_attempts_summary(self): """ - :rtype: twilio.rest.verify.v2.template.TemplateList + :rtype: twilio.rest.v2.verification_attempts_summary """ - return self.v2.templates + return self.v2.verification_attempts_summary + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/verify/v2/.openapi-generator-ignore b/twilio/rest/verify/v2/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/verify/v2/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/verify/v2/.openapi-generator/FILES b/twilio/rest/verify/v2/.openapi-generator/FILES new file mode 100644 index 0000000000..fad229baeb --- /dev/null +++ b/twilio/rest/verify/v2/.openapi-generator/FILES @@ -0,0 +1,37 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +form.py +safelist.py +service.py +service/access_token.py +service/entity.py +service/entity/challenge.py +service/entity/challenge/notification.py +service/entity/factor.py +service/entity/new_factor.py +service/messaging_configuration.py +service/rate_limit.py +service/rate_limit/bucket.py +service/verification.py +service/verification_check.py +service/webhook.py +template.py +verification_attempt.py +verification_attempts_summary.py diff --git a/twilio/rest/verify/v2/.openapi-generator/VERSION b/twilio/rest/verify/v2/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/verify/v2/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/verify/v2/form.py b/twilio/rest/verify/v2/form.py index c5205741da..23ba976e97 100644 --- a/twilio/rest/verify/v2/form.py +++ b/twilio/rest/verify/v2/form.py @@ -1,238 +1,119 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FormList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the FormList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.verify.v2.form.FormList - :rtype: twilio.rest.verify.v2.form.FormList - """ - super(FormList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, form_type): - """ - Constructs a FormContext - - :param form_type: The Type of this Form - - :returns: twilio.rest.verify.v2.form.FormContext - :rtype: twilio.rest.verify.v2.form.FormContext - """ - return FormContext(self._version, form_type=form_type, ) - - def __call__(self, form_type): - """ - Constructs a FormContext - - :param form_type: The Type of this Form - - :returns: twilio.rest.verify.v2.form.FormContext - :rtype: twilio.rest.verify.v2.form.FormContext - """ - return FormContext(self._version, form_type=form_type, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FormPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FormPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.verify.v2.form.FormPage - :rtype: twilio.rest.verify.v2.form.FormPage - """ - super(FormPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FormInstance - - :param dict payload: Payload response from the API - :returns: twilio.rest.verify.v2.form.FormInstance - :rtype: twilio.rest.verify.v2.form.FormInstance - """ - return FormInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class FormContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, form_type): - """ - Initialize the FormContext - - :param Version version: Version that contains the resource - :param form_type: The Type of this Form - - :returns: twilio.rest.verify.v2.form.FormContext - :rtype: twilio.rest.verify.v2.form.FormContext - """ - super(FormContext, self).__init__(version) + def __init__(self, version: V2, form_type: FormFormTypes): + # TODO: needs autogenerated docs + super(FormContextList, self).__init__(version) # Path Solution - self._solution = {'form_type': form_type, } - self._uri = '/Forms/{form_type}'.format(**self._solution) - - def fetch(self): - """ - Fetch the FormInstance - - :returns: The fetched FormInstance - :rtype: twilio.rest.verify.v2.form.FormInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FormInstance(self._version, payload, form_type=self._solution['form_type'], ) + self._solution = { form_type, } + self._uri = '/Forms/${form_type}' + + + def fetch(self): + + """ + Fetch the FormInstance + + :returns: The fetched FormInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FormInstance( + self._version, + payload, + form_type=self._solution['form_type'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class FormInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + return '' - class FormTypes(object): - FORM_PUSH = "form-push" - def __init__(self, version, payload, form_type=None): - """ - Initialize the FormInstance - :returns: twilio.rest.verify.v2.form.FormInstance - :rtype: twilio.rest.verify.v2.form.FormInstance - """ +class FormInstance(InstanceResource): + def __init__(self, version, payload, form_type: FormFormTypes): super(FormInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'form_type': payload.get('form_type'), - 'forms': payload.get('forms'), - 'form_meta': payload.get('form_meta'), - 'url': payload.get('url'), + self._properties = { + 'form_type' = payload.get('form_type'), + 'forms' = payload.get('forms'), + 'form_meta' = payload.get('form_meta'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'form_type': form_type or self._properties['form_type'], } + self._solution = { + 'form_type': form_type or self._properties['form_type'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FormContext for this FormInstance - :rtype: twilio.rest.verify.v2.form.FormContext - """ if self._context is None: - self._context = FormContext(self._version, form_type=self._solution['form_type'], ) + self._context = FormContext( + self._version, + form_type=self._solution['form_type'], + ) return self._context - @property - def form_type(self): - """ - :returns: The Type of this Form - :rtype: FormInstance.FormTypes - """ - return self._properties['form_type'] + - @property - def forms(self): + def __repr__(self): """ - :returns: Object that contains the available forms for this type. - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['forms'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def form_meta(self): - """ - :returns: Additional information for the available forms for this type. - :rtype: dict - """ - return self._properties['form_meta'] - @property - def url(self): - """ - :returns: The URL to access the forms for this type. - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the FormInstance +class FormListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(FormListInstanceList, self).__init__(version) - :returns: The fetched FormInstance - :rtype: twilio.rest.verify.v2.form.FormInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/safelist.py b/twilio/rest/verify/v2/safelist.py index f49148d8e6..e10dd472dd 100644 --- a/twilio/rest/verify/v2/safelist.py +++ b/twilio/rest/verify/v2/safelist.py @@ -1,260 +1,139 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SafelistList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SafelistList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.verify.v2.safelist.SafelistList - :rtype: twilio.rest.verify.v2.safelist.SafelistList - """ - super(SafelistList, self).__init__(version) - # Path Solution - self._solution = {} - self._uri = '/SafeList/Numbers'.format(**self._solution) - - def create(self, phone_number): - """ - Create the SafelistInstance - :param unicode phone_number: The phone number to be added in SafeList. - - :returns: The created SafelistInstance - :rtype: twilio.rest.verify.v2.safelist.SafelistInstance - """ - data = values.of({'PhoneNumber': phone_number, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SafelistInstance(self._version, payload, ) - - def get(self, phone_number): - """ - Constructs a SafelistContext - - :param phone_number: The phone number to be fetched from SafeList. - - :returns: twilio.rest.verify.v2.safelist.SafelistContext - :rtype: twilio.rest.verify.v2.safelist.SafelistContext - """ - return SafelistContext(self._version, phone_number=phone_number, ) - - def __call__(self, phone_number): - """ - Constructs a SafelistContext - - :param phone_number: The phone number to be fetched from SafeList. - - :returns: twilio.rest.verify.v2.safelist.SafelistContext - :rtype: twilio.rest.verify.v2.safelist.SafelistContext - """ - return SafelistContext(self._version, phone_number=phone_number, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SafelistPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SafelistPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.verify.v2.safelist.SafelistPage - :rtype: twilio.rest.verify.v2.safelist.SafelistPage - """ - super(SafelistPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SafelistInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.safelist.SafelistInstance - :rtype: twilio.rest.verify.v2.safelist.SafelistInstance - """ - return SafelistInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SafelistContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, phone_number): - """ - Initialize the SafelistContext - - :param Version version: Version that contains the resource - :param phone_number: The phone number to be fetched from SafeList. - - :returns: twilio.rest.verify.v2.safelist.SafelistContext - :rtype: twilio.rest.verify.v2.safelist.SafelistContext - """ - super(SafelistContext, self).__init__(version) + def __init__(self, version: V2, phone_number: str): + # TODO: needs autogenerated docs + super(SafelistContextList, self).__init__(version) # Path Solution - self._solution = {'phone_number': phone_number, } - self._uri = '/SafeList/Numbers/{phone_number}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SafelistInstance - - :returns: The fetched SafelistInstance - :rtype: twilio.rest.verify.v2.safelist.SafelistInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SafelistInstance(self._version, payload, phone_number=self._solution['phone_number'], ) - - def delete(self): - """ - Deletes the SafelistInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { phone_number, } + self._uri = '/SafeList/Numbers/${phone_number}' + + + def delete(self): + + + """ + Deletes the SafelistInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SafelistInstance + + :returns: The fetched SafelistInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SafelistInstance( + self._version, + payload, + phone_number=self._solution['phone_number'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SafelistInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, phone_number=None): - """ - Initialize the SafelistInstance - :returns: twilio.rest.verify.v2.safelist.SafelistInstance - :rtype: twilio.rest.verify.v2.safelist.SafelistInstance - """ +class SafelistInstance(InstanceResource): + def __init__(self, version, payload, phone_number: str): super(SafelistInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'phone_number': payload.get('phone_number'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'phone_number' = payload.get('phone_number'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'phone_number': phone_number or self._properties['phone_number'], } + self._solution = { + 'phone_number': phone_number or self._properties['phone_number'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SafelistContext for this SafelistInstance - :rtype: twilio.rest.verify.v2.safelist.SafelistContext - """ if self._context is None: - self._context = SafelistContext(self._version, phone_number=self._solution['phone_number'], ) + self._context = SafelistContext( + self._version, + phone_number=self._solution['phone_number'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource. - :rtype: unicode - """ - return self._properties['sid'] + - @property - def phone_number(self): + def __repr__(self): """ - :returns: The phone number in SafeList. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['phone_number'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the SafeList resource. - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the SafelistInstance - :returns: The fetched SafelistInstance - :rtype: twilio.rest.verify.v2.safelist.SafelistInstance - """ - return self._proxy.fetch() +class SafelistListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(SafelistListInstanceList, self).__init__(version) - def delete(self): - """ - Deletes the SafelistInstance + # Path Solution + self._solution = { } + self._uri = '/SafeList/Numbers' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SafelistInstance(self._version, payload, ) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service.py b/twilio/rest/verify/v2/service.py new file mode 100644 index 0000000000..91d9d5ede8 --- /dev/null +++ b/twilio/rest/verify/v2/service.py @@ -0,0 +1,205 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.service.access_token import AccessTokenListInstancefrom twilio.rest.service.entity import EntityListInstancefrom twilio.rest.service.messaging_configuration import MessagingConfigurationListInstancefrom twilio.rest.service.rate_limit import RateLimitListInstancefrom twilio.rest.service.verification import VerificationListInstancefrom twilio.rest.service.verification_check import VerificationCheckListInstancefrom twilio.rest.service.webhook import WebhookListInstance + + +class ServiceContext(InstanceContext): + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(ServiceContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Services/${sid}' + + self._access_tokens = None + self._entities = None + self._messaging_configurations = None + self._rate_limits = None + self._verifications = None + self._verification_checks = None + self._webhooks = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance + + :returns: The fetched ServiceInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ServiceInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ServiceInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'code_length' = payload.get('code_length'), + 'lookup_enabled' = payload.get('lookup_enabled'), + 'psd2_enabled' = payload.get('psd2_enabled'), + 'skip_sms_to_landlines' = payload.get('skip_sms_to_landlines'), + 'dtmf_input_required' = payload.get('dtmf_input_required'), + 'tts_name' = payload.get('tts_name'), + 'do_not_share_warning_enabled' = payload.get('do_not_share_warning_enabled'), + 'custom_code_enabled' = payload.get('custom_code_enabled'), + 'push' = payload.get('push'), + 'totp' = payload.get('totp'), + 'default_template_sid' = payload.get('default_template_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def access_tokens(self): + return self._proxy.access_tokens + @property + def entities(self): + return self._proxy.entities + @property + def messaging_configurations(self): + return self._proxy.messaging_configurations + @property + def rate_limits(self): + return self._proxy.rate_limits + @property + def verifications(self): + return self._proxy.verifications + @property + def verification_checks(self): + return self._proxy.verification_checks + @property + def webhooks(self): + return self._proxy.webhooks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ServiceListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(ServiceListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Services' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/verify/v2/service/access_token.py b/twilio/rest/verify/v2/service/access_token.py index 2a992c8f74..6d0ff5fe50 100644 --- a/twilio/rest/verify/v2/service/access_token.py +++ b/twilio/rest/verify/v2/service/access_token.py @@ -1,322 +1,135 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AccessTokenList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the AccessTokenList - - :param Version version: Version that contains the resource - :param service_sid: Verify Service Sid. - - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenList - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenList - """ - super(AccessTokenList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/AccessTokens'.format(**self._solution) - - def create(self, identity, factor_type, factor_friendly_name=values.unset, - ttl=values.unset): - """ - Create the AccessTokenInstance - - :param unicode identity: Unique external identifier of the Entity - :param AccessTokenInstance.FactorTypes factor_type: The Type of this Factor - :param unicode factor_friendly_name: The factor friendly name - :param unicode ttl: How long, in seconds, the access token is valid. - :returns: The created AccessTokenInstance - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenInstance - """ - data = values.of({ - 'Identity': identity, - 'FactorType': factor_type, - 'FactorFriendlyName': factor_friendly_name, - 'Ttl': ttl, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AccessTokenInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a AccessTokenContext - - :param sid: A string that uniquely identifies this Access Token. - - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenContext - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenContext - """ - return AccessTokenContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - def __call__(self, sid): - """ - Constructs a AccessTokenContext - - :param sid: A string that uniquely identifies this Access Token. - - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenContext - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenContext - """ - return AccessTokenContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AccessTokenPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AccessTokenPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Verify Service Sid. - - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenPage - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenPage - """ - super(AccessTokenPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AccessTokenInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenInstance - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenInstance - """ - return AccessTokenInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class AccessTokenContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the AccessTokenContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param sid: A string that uniquely identifies this Access Token. - - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenContext - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenContext - """ - super(AccessTokenContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AccessTokenContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/AccessTokens/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the AccessTokenInstance - - :returns: The fetched AccessTokenInstance - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AccessTokenInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/AccessTokens/${sid}' + + + def fetch(self): + + """ + Fetch the AccessTokenInstance + + :returns: The fetched AccessTokenInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return AccessTokenInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AccessTokenInstance(InstanceResource): + return '' - class FactorTypes(object): - PUSH = "push" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the AccessTokenInstance - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenInstance - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenInstance - """ +class AccessTokenInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(AccessTokenInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'entity_identity': payload.get('entity_identity'), - 'factor_type': payload.get('factor_type'), - 'factor_friendly_name': payload.get('factor_friendly_name'), - 'token': payload.get('token'), - 'url': payload.get('url'), - 'ttl': deserialize.integer(payload.get('ttl')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'entity_identity' = payload.get('entity_identity'), + 'factor_type' = payload.get('factor_type'), + 'factor_friendly_name' = payload.get('factor_friendly_name'), + 'token' = payload.get('token'), + 'url' = payload.get('url'), + 'ttl' = payload.get('ttl'), + 'date_created' = payload.get('date_created'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AccessTokenContext for this AccessTokenInstance - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenContext - """ if self._context is None: self._context = AccessTokenContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Access Token. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Verify Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] + - @property - def entity_identity(self): + def __repr__(self): """ - :returns: Unique external identifier of the Entity - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['entity_identity'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def factor_type(self): - """ - :returns: The Type of the Factor - :rtype: AccessTokenInstance.FactorTypes - """ - return self._properties['factor_type'] - @property - def factor_friendly_name(self): - """ - :returns: A human readable description of this factor. - :rtype: unicode - """ - return self._properties['factor_friendly_name'] - @property - def token(self): - """ - :returns: Generated access token. - :rtype: unicode - """ - return self._properties['token'] +class AccessTokenListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(AccessTokenListInstanceList, self).__init__(version) - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def ttl(self): - """ - :returns: How long, in seconds, the access token is valid. - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def date_created(self): - """ - :returns: The date this access token was created - :rtype: datetime - """ - return self._properties['date_created'] + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/AccessTokens' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def fetch(self): - """ - Fetch the AccessTokenInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The fetched AccessTokenInstance - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenInstance - """ - return self._proxy.fetch() + return AccessTokenInstance(self._version, payload, service_sid=self._solution['service_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/entity.py b/twilio/rest/verify/v2/service/entity.py new file mode 100644 index 0000000000..87bb68c729 --- /dev/null +++ b/twilio/rest/verify/v2/service/entity.py @@ -0,0 +1,168 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.entity.challenge import ChallengeListInstancefrom twilio.rest.entity.factor import FactorListInstancefrom twilio.rest.entity.new_factor import NewFactorListInstance + + +class EntityContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, identity: str): + # TODO: needs autogenerated docs + super(EntityContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, identity, } + self._uri = '/Services/${service_sid}/Entities/${identity}' + + self._challenges = None + self._factors = None + self._new_factors = None + + def delete(self): + + + """ + Deletes the EntityInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the EntityInstance + + :returns: The fetched EntityInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return EntityInstance( + self._version, + payload, + service_sididentity=self._solution['service_sid''identity'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class EntityInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, identity: str): + super(EntityInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'identity' = payload.get('identity'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'identity': identity or self._properties['identity'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = EntityContext( + self._version, + service_sid=self._solution['service_sid'],identity=self._solution['identity'], + ) + return self._context + + @property + def challenges(self): + return self._proxy.challenges + @property + def factors(self): + return self._proxy.factors + @property + def new_factors(self): + return self._proxy.new_factors + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class EntityListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(EntityListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Entities' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EntityInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EntityPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/verify/v2/service/entity/challenge.py b/twilio/rest/verify/v2/service/entity/challenge.py new file mode 100644 index 0000000000..df208ee550 --- /dev/null +++ b/twilio/rest/verify/v2/service/entity/challenge.py @@ -0,0 +1,170 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.challenge.notification import NotificationListInstance + + +class ChallengeContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, identity: str, sid: str): + # TODO: needs autogenerated docs + super(ChallengeContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, identity, sid, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Challenges/${sid}' + + self._notifications = None + + def fetch(self): + + """ + Fetch the ChallengeInstance + + :returns: The fetched ChallengeInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ChallengeInstance( + self._version, + payload, + service_sididentitysid=self._solution['service_sid''identity''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ChallengeInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, identity: str, sid: str): + super(ChallengeInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'entity_sid' = payload.get('entity_sid'), + 'identity' = payload.get('identity'), + 'factor_sid' = payload.get('factor_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'date_responded' = payload.get('date_responded'), + 'expiration_date' = payload.get('expiration_date'), + 'status' = payload.get('status'), + 'responded_reason' = payload.get('responded_reason'), + 'details' = payload.get('details'), + 'hidden_details' = payload.get('hidden_details'), + 'metadata' = payload.get('metadata'), + 'factor_type' = payload.get('factor_type'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'identity': identity or self._properties['identity']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ChallengeContext( + self._version, + service_sid=self._solution['service_sid'],identity=self._solution['identity'],sid=self._solution['sid'], + ) + return self._context + + @property + def notifications(self): + return self._proxy.notifications + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ChallengeListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, identity: str): + # TODO: needs autogenerated docs + super(ChallengeListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, identity, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Challenges' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid']identity=self._solution['identity']) + + + def page(self, factor_sid, status, order, page_size): + + data = values.of({ + 'factor_sid': factor_sid,'status': status,'order': order,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ChallengePage(self._version, payload, service_sid=self._solution['service_sid']identity=self._solution['identity']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/verify/v2/service/entity/challenge/notification.py b/twilio/rest/verify/v2/service/entity/challenge/notification.py index 14adf0521c..d33ccdf4c9 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/notification.py +++ b/twilio/rest/verify/v2/service/entity/challenge/notification.py @@ -1,221 +1,97 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class NotificationList(ListResource): - def __init__(self, version, service_sid, identity, challenge_sid): - """ - Initialize the NotificationList - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - :param challenge_sid: Challenge Sid. - :returns: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationList - :rtype: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationList - """ - super(NotificationList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, 'challenge_sid': challenge_sid, } - self._uri = '/Services/{service_sid}/Entities/{identity}/Challenges/{challenge_sid}/Notifications'.format(**self._solution) - - def create(self, ttl=values.unset): - """ - Create the NotificationInstance - :param unicode ttl: How long, in seconds, the notification is valid. +class NotificationInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, identity: str, challenge_sid: str): + super(NotificationInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'entity_sid' = payload.get('entity_sid'), + 'identity' = payload.get('identity'), + 'challenge_sid' = payload.get('challenge_sid'), + 'priority' = payload.get('priority'), + 'ttl' = payload.get('ttl'), + 'date_created' = payload.get('date_created'), + } - :returns: The created NotificationInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationInstance - """ - data = values.of({'Ttl': ttl, }) + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'identity': identity or self._properties['identity']'challenge_sid': challenge_sid or self._properties['challenge_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = NotificationContext( + self._version, + service_sid=self._solution['service_sid'],identity=self._solution['identity'],challenge_sid=self._solution['challenge_sid'], + ) + return self._context - return NotificationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - challenge_sid=self._solution['challenge_sid'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class NotificationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the NotificationPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - :param challenge_sid: Challenge Sid. - - :returns: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationPage - :rtype: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationPage - """ - super(NotificationPage, self).__init__(version, response) +class NotificationListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, identity: str, challenge_sid: str): + # TODO: needs autogenerated docs + super(NotificationListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { service_sid, identity, challenge_sid, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Challenges/${challenge_sid}/Notifications' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def get_instance(self, payload): - """ - Build an instance of NotificationInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationInstance - """ - return NotificationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - challenge_sid=self._solution['challenge_sid'], - ) + return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid']identity=self._solution['identity']challenge_sid=self._solution['challenge_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class NotificationInstance(InstanceResource): - - def __init__(self, version, payload, service_sid, identity, challenge_sid): - """ - Initialize the NotificationInstance - - :returns: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationInstance - """ - super(NotificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'entity_sid': payload.get('entity_sid'), - 'identity': payload.get('identity'), - 'challenge_sid': payload.get('challenge_sid'), - 'priority': payload.get('priority'), - 'ttl': deserialize.integer(payload.get('ttl')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'identity': identity, 'challenge_sid': challenge_sid, } - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Notification. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] + return '' - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def entity_sid(self): - """ - :returns: Entity Sid. - :rtype: unicode - """ - return self._properties['entity_sid'] - - @property - def identity(self): - """ - :returns: Unique external identifier of the Entity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def challenge_sid(self): - """ - :returns: Challenge Sid. - :rtype: unicode - """ - return self._properties['challenge_sid'] - - @property - def priority(self): - """ - :returns: The priority of the notification. - :rtype: unicode - """ - return self._properties['priority'] - - @property - def ttl(self): - """ - :returns: How long, in seconds, the notification is valid. - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def date_created(self): - """ - :returns: The date this Notification was created - :rtype: datetime - """ - return self._properties['date_created'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/verify/v2/service/entity/factor.py b/twilio/rest/verify/v2/service/entity/factor.py index 552fc577d8..174f6c56d7 100644 --- a/twilio/rest/verify/v2/service/entity/factor.py +++ b/twilio/rest/verify/v2/service/entity/factor.py @@ -1,535 +1,162 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FactorList(ListResource): - - def __init__(self, version, service_sid, identity): - """ - Initialize the FactorList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorList - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorList - """ - super(FactorList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Entities/{identity}/Factors'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FactorInstance 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 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.verify.v2.service.entity.factor.FactorInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FactorInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.verify.v2.service.entity.factor.FactorInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FactorInstance records from the API. - Request is executed immediately - - :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 FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FactorPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FactorInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FactorPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FactorContext - - :param sid: A string that uniquely identifies this Factor. - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorContext - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorContext - """ - return FactorContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FactorContext - - :param sid: A string that uniquely identifies this Factor. - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorContext - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorContext - """ - return FactorContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FactorPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the FactorPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorPage - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorPage - """ - super(FactorPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FactorInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.verify.v2.service.entity.factor.FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorInstance - """ - return FactorInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class FactorContext(InstanceContext): - - def __init__(self, version, service_sid, identity, sid): - """ - Initialize the FactorContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - :param sid: A string that uniquely identifies this Factor. - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorContext - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorContext - """ - super(FactorContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, identity: str, sid: str): + # TODO: needs autogenerated docs + super(FactorContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, 'sid': sid, } - self._uri = '/Services/{service_sid}/Entities/{identity}/Factors/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the FactorInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the FactorInstance - - :returns: The fetched FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FactorInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], - ) - - def update(self, auth_payload=values.unset, friendly_name=values.unset, - config_notification_token=values.unset, - config_sdk_version=values.unset, config_time_step=values.unset, - config_skew=values.unset, config_code_length=values.unset, - config_alg=values.unset, config_notification_platform=values.unset): - """ - Update the FactorInstance - - :param unicode auth_payload: Optional payload to verify the Factor for the first time - :param unicode friendly_name: The friendly name of this Factor - :param unicode config_notification_token: For APN, the device token. For FCM, the registration token - :param unicode config_sdk_version: The Verify Push SDK version used to configure the factor - :param unicode config_time_step: How often, in seconds, are TOTP codes generated - :param unicode config_skew: The number of past and future time-steps valid at a given time - :param unicode config_code_length: Number of digits for generated TOTP codes - :param FactorInstance.TotpAlgorithms config_alg: The algorithm used to derive the TOTP codes - :param unicode config_notification_platform: The transport technology used to generate the Notification Token - - :returns: The updated FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorInstance - """ - data = values.of({ - 'AuthPayload': auth_payload, - 'FriendlyName': friendly_name, - 'Config.NotificationToken': config_notification_token, - 'Config.SdkVersion': config_sdk_version, - 'Config.TimeStep': config_time_step, - 'Config.Skew': config_skew, - 'Config.CodeLength': config_code_length, - 'Config.Alg': config_alg, - 'Config.NotificationPlatform': config_notification_platform, - }) + self._solution = { service_sid, identity, sid, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Factors/${sid}' + + + def delete(self): + + + """ + Deletes the FactorInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the FactorInstance + + :returns: The fetched FactorInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return FactorInstance( + self._version, + payload, + service_sididentitysid=self._solution['service_sid''identity''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return FactorInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], - ) + return FactorInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FactorInstance(InstanceResource): - - class FactorStatuses(object): - UNVERIFIED = "unverified" - VERIFIED = "verified" - - class FactorTypes(object): - PUSH = "push" - TOTP = "totp" - class NotificationPlatforms(object): - APN = "apn" - FCM = "fcm" - NONE = "none" - - class TotpAlgorithms(object): - SHA1 = "sha1" - SHA256 = "sha256" - SHA512 = "sha512" - - def __init__(self, version, payload, service_sid, identity, sid=None): - """ - Initialize the FactorInstance - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorInstance - """ +class FactorInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, identity: str, sid: str): super(FactorInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'entity_sid': payload.get('entity_sid'), - 'identity': payload.get('identity'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'factor_type': payload.get('factor_type'), - 'config': payload.get('config'), - 'metadata': payload.get('metadata'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'entity_sid' = payload.get('entity_sid'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'factor_type' = payload.get('factor_type'), + 'config' = payload.get('config'), + 'metadata' = payload.get('metadata'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'identity': identity, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'identity': identity or self._properties['identity']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FactorContext for this FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorContext - """ if self._context is None: self._context = FactorContext( self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],identity=self._solution['identity'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Factor. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def entity_sid(self): - """ - :returns: Entity Sid. - :rtype: unicode - """ - return self._properties['entity_sid'] - - @property - def identity(self): - """ - :returns: Unique external identifier of the Entity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The date this Factor was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Factor was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The Status of this Factor - :rtype: FactorInstance.FactorStatuses - """ - return self._properties['status'] - - @property - def factor_type(self): - """ - :returns: The Type of this Factor - :rtype: FactorInstance.FactorTypes - """ - return self._properties['factor_type'] - - @property - def config(self): - """ - :returns: Configurations for a `factor_type`. - :rtype: dict - """ - return self._properties['config'] - - @property - def metadata(self): - """ - :returns: Metadata of the factor. - :rtype: dict - """ - return self._properties['metadata'] + - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the FactorInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the FactorInstance - :returns: The fetched FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorInstance - """ - return self._proxy.fetch() +class FactorListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, identity: str): + # TODO: needs autogenerated docs + super(FactorListInstanceList, self).__init__(version) - def update(self, auth_payload=values.unset, friendly_name=values.unset, - config_notification_token=values.unset, - config_sdk_version=values.unset, config_time_step=values.unset, - config_skew=values.unset, config_code_length=values.unset, - config_alg=values.unset, config_notification_platform=values.unset): - """ - Update the FactorInstance + # Path Solution + self._solution = { service_sid, identity, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Factors' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param unicode auth_payload: Optional payload to verify the Factor for the first time - :param unicode friendly_name: The friendly name of this Factor - :param unicode config_notification_token: For APN, the device token. For FCM, the registration token - :param unicode config_sdk_version: The Verify Push SDK version used to configure the factor - :param unicode config_time_step: How often, in seconds, are TOTP codes generated - :param unicode config_skew: The number of past and future time-steps valid at a given time - :param unicode config_code_length: Number of digits for generated TOTP codes - :param FactorInstance.TotpAlgorithms config_alg: The algorithm used to derive the TOTP codes - :param unicode config_notification_platform: The transport technology used to generate the Notification Token + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated FactorInstance - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorInstance - """ - return self._proxy.update( - auth_payload=auth_payload, - friendly_name=friendly_name, - config_notification_token=config_notification_token, - config_sdk_version=config_sdk_version, - config_time_step=config_time_step, - config_skew=config_skew, - config_code_length=config_code_length, - config_alg=config_alg, - config_notification_platform=config_notification_platform, - ) + return FactorPage(self._version, payload, service_sid=self._solution['service_sid']identity=self._solution['identity']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/entity/new_factor.py b/twilio/rest/verify/v2/service/entity/new_factor.py index fee3f7cd6e..401b0d4457 100644 --- a/twilio/rest/verify/v2/service/entity/new_factor.py +++ b/twilio/rest/verify/v2/service/entity/new_factor.py @@ -1,316 +1,102 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NewFactorList(ListResource): - - def __init__(self, version, service_sid, identity): - """ - Initialize the NewFactorList - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList - :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList - """ - super(NewFactorList, self).__init__(version) - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Entities/{identity}/Factors'.format(**self._solution) - def create(self, friendly_name, factor_type, binding_alg=values.unset, - binding_public_key=values.unset, config_app_id=values.unset, - config_notification_platform=values.unset, - config_notification_token=values.unset, - config_sdk_version=values.unset, binding_secret=values.unset, - config_time_step=values.unset, config_skew=values.unset, - config_code_length=values.unset, config_alg=values.unset, - metadata=values.unset): - """ - Create the NewFactorInstance - :param unicode friendly_name: The friendly name of this Factor - :param NewFactorInstance.FactorTypes factor_type: The Type of this Factor - :param unicode binding_alg: The algorithm used when `factor_type` is `push` - :param unicode binding_public_key: The public key encoded in Base64 - :param unicode config_app_id: The ID that uniquely identifies your app in the Google or Apple store - :param NewFactorInstance.NotificationPlatforms config_notification_platform: The transport technology used to generate the Notification Token - :param unicode config_notification_token: For APN, the device token. For FCM, the registration token - :param unicode config_sdk_version: The Verify Push SDK version used to configure the factor - :param unicode binding_secret: The shared secret in Base32 - :param unicode config_time_step: How often, in seconds, are TOTP codes generated - :param unicode config_skew: The number of past and future time-steps valid at a given time - :param unicode config_code_length: Number of digits for generated TOTP codes - :param NewFactorInstance.TotpAlgorithms config_alg: The algorithm used to derive the TOTP codes - :param dict metadata: Metadata of the factor. +class NewFactorInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, identity: str): + super(NewFactorInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'entity_sid' = payload.get('entity_sid'), + 'identity' = payload.get('identity'), + 'binding' = payload.get('binding'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'friendly_name' = payload.get('friendly_name'), + 'status' = payload.get('status'), + 'factor_type' = payload.get('factor_type'), + 'config' = payload.get('config'), + 'metadata' = payload.get('metadata'), + 'url' = payload.get('url'), + } - :returns: The created NewFactorInstance - :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'FactorType': factor_type, - 'Binding.Alg': binding_alg, - 'Binding.PublicKey': binding_public_key, - 'Config.AppId': config_app_id, - 'Config.NotificationPlatform': config_notification_platform, - 'Config.NotificationToken': config_notification_token, - 'Config.SdkVersion': config_sdk_version, - 'Binding.Secret': binding_secret, - 'Config.TimeStep': config_time_step, - 'Config.Skew': config_skew, - 'Config.CodeLength': config_code_length, - 'Config.Alg': config_alg, - 'Metadata': serialize.object(metadata), - }) + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'identity': identity or self._properties['identity'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = NewFactorContext( + self._version, + service_sid=self._solution['service_sid'],identity=self._solution['identity'], + ) + return self._context - return NewFactorInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class NewFactorPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the NewFactorPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - - :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorPage - :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorPage - """ - super(NewFactorPage, self).__init__(version, response) +class NewFactorListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, identity: str): + # TODO: needs autogenerated docs + super(NewFactorListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NewFactorInstance + self._solution = { service_sid, identity, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Factors' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance - :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance - """ - return NewFactorInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) + return NewFactorInstance(self._version, payload, service_sid=self._solution['service_sid']identity=self._solution['identity']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class NewFactorInstance(InstanceResource): - - class FactorStatuses(object): - UNVERIFIED = "unverified" - VERIFIED = "verified" - - class FactorTypes(object): - PUSH = "push" - TOTP = "totp" - - class NotificationPlatforms(object): - APN = "apn" - FCM = "fcm" - NONE = "none" - - class TotpAlgorithms(object): - SHA1 = "sha1" - SHA256 = "sha256" - SHA512 = "sha512" - - def __init__(self, version, payload, service_sid, identity): - """ - Initialize the NewFactorInstance - - :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance - :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance - """ - super(NewFactorInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'entity_sid': payload.get('entity_sid'), - 'identity': payload.get('identity'), - 'binding': payload.get('binding'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'factor_type': payload.get('factor_type'), - 'config': payload.get('config'), - 'metadata': payload.get('metadata'), - 'url': payload.get('url'), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, 'identity': identity, } - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Factor. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def entity_sid(self): - """ - :returns: Entity Sid. - :rtype: unicode - """ - return self._properties['entity_sid'] - - @property - def identity(self): - """ - :returns: Unique external identifier of the Entity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def binding(self): - """ - :returns: Binding of the factor - :rtype: dict - """ - return self._properties['binding'] + return '' - @property - def date_created(self): - """ - :returns: The date this Factor was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Factor was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The Status of this Factor - :rtype: NewFactorInstance.FactorStatuses - """ - return self._properties['status'] - - @property - def factor_type(self): - """ - :returns: The Type of this Factor - :rtype: NewFactorInstance.FactorTypes - """ - return self._properties['factor_type'] - - @property - def config(self): - """ - :returns: Configurations for a `factor_type`. - :rtype: dict - """ - return self._properties['config'] - - @property - def metadata(self): - """ - :returns: Metadata of the factor. - :rtype: dict - """ - return self._properties['metadata'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/verify/v2/service/messaging_configuration.py b/twilio/rest/verify/v2/service/messaging_configuration.py index 83a699d780..14c4bbbb23 100644 --- a/twilio/rest/verify/v2/service/messaging_configuration.py +++ b/twilio/rest/verify/v2/service/messaging_configuration.py @@ -1,426 +1,166 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MessagingConfigurationList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the MessagingConfigurationList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationList - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationList - """ - super(MessagingConfigurationList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/MessagingConfigurations'.format(**self._solution) - - def create(self, country, messaging_service_sid): - """ - Create the MessagingConfigurationInstance - - :param unicode country: The ISO-3166-1 country code of the country or `all`. - :param unicode messaging_service_sid: The SID of the Messaging Service used for this configuration. - - :returns: The created MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - """ - data = values.of({'Country': country, 'MessagingServiceSid': messaging_service_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return MessagingConfigurationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams MessagingConfigurationInstance 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 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.verify.v2.service.messaging_configuration.MessagingConfigurationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists MessagingConfigurationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.verify.v2.service.messaging_configuration.MessagingConfigurationInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MessagingConfigurationInstance records from the API. - Request is executed immediately - - :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 MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MessagingConfigurationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessagingConfigurationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - :returns: Page of MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagingConfigurationPage(self._version, response, self._solution) - - def get(self, country): - """ - Constructs a MessagingConfigurationContext - - :param country: The ISO-3166-1 country code of the country or `all`. - - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationContext - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationContext - """ - return MessagingConfigurationContext( - self._version, - service_sid=self._solution['service_sid'], - country=country, - ) - - def __call__(self, country): - """ - Constructs a MessagingConfigurationContext - - :param country: The ISO-3166-1 country code of the country or `all`. - - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationContext - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationContext - """ - return MessagingConfigurationContext( - self._version, - service_sid=self._solution['service_sid'], - country=country, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MessagingConfigurationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MessagingConfigurationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationPage - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationPage - """ - super(MessagingConfigurationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessagingConfigurationInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - """ - return MessagingConfigurationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class MessagingConfigurationContext(InstanceContext): - - def __init__(self, version, service_sid, country): - """ - Initialize the MessagingConfigurationContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param country: The ISO-3166-1 country code of the country or `all`. - - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationContext - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationContext - """ - super(MessagingConfigurationContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, country: str): + # TODO: needs autogenerated docs + super(MessagingConfigurationContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'country': country, } - self._uri = '/Services/{service_sid}/MessagingConfigurations/{country}'.format(**self._solution) - - def update(self, messaging_service_sid): - """ - Update the MessagingConfigurationInstance - - :param unicode messaging_service_sid: The SID of the Messaging Service used for this configuration. - - :returns: The updated MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - """ - data = values.of({'MessagingServiceSid': messaging_service_sid, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return MessagingConfigurationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - country=self._solution['country'], - ) - - def fetch(self): - """ - Fetch the MessagingConfigurationInstance - - :returns: The fetched MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MessagingConfigurationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - country=self._solution['country'], - ) + self._solution = { service_sid, country, } + self._uri = '/Services/${service_sid}/MessagingConfigurations/${country}' + + + def delete(self): + + + """ + Deletes the MessagingConfigurationInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the MessagingConfigurationInstance + + :returns: The fetched MessagingConfigurationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return MessagingConfigurationInstance( + self._version, + payload, + service_sidcountry=self._solution['service_sid''country'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the MessagingConfigurationInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return MessagingConfigurationInstance(self._version, payload, service_sid=self._solution['service_sid'], country=self._solution['country'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class MessagingConfigurationInstance(InstanceResource): - - def __init__(self, version, payload, service_sid, country=None): - """ - Initialize the MessagingConfigurationInstance - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - """ +class MessagingConfigurationInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, country: str): super(MessagingConfigurationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'country': payload.get('country'), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'country' = payload.get('country'), + 'messaging_service_sid' = payload.get('messaging_service_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'country': country or self._properties['country'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'country': country or self._properties['country'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessagingConfigurationContext for this MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationContext - """ if self._context is None: self._context = MessagingConfigurationContext( self._version, - service_sid=self._solution['service_sid'], - country=self._solution['country'], + service_sid=self._solution['service_sid'],country=self._solution['country'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def country(self): - """ - :returns: The ISO-3166-1 country code of the country or `all`. - :rtype: unicode - """ - return self._properties['country'] - - @property - def messaging_service_sid(self): - """ - :returns: The SID of the Messaging Service used for this configuration. - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def update(self, messaging_service_sid): + def __repr__(self): """ - Update the MessagingConfigurationInstance - - :param unicode messaging_service_sid: The SID of the Messaging Service used for this configuration. - - :returns: The updated MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(messaging_service_sid, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the MessagingConfigurationInstance - :returns: The fetched MessagingConfigurationInstance - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the MessagingConfigurationInstance +class MessagingConfigurationListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(MessagingConfigurationListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/MessagingConfigurations' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return MessagingConfigurationInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return MessagingConfigurationPage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/rate_limit.py b/twilio/rest/verify/v2/service/rate_limit.py new file mode 100644 index 0000000000..37aad8d039 --- /dev/null +++ b/twilio/rest/verify/v2/service/rate_limit.py @@ -0,0 +1,172 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.rate_limit.bucket import BucketListInstance + + +class RateLimitContext(InstanceContext): + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RateLimitContextList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/RateLimits/${sid}' + + self._buckets = None + + def delete(self): + + + """ + Deletes the RateLimitInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RateLimitInstance + + :returns: The fetched RateLimitInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RateLimitInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RateLimitInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super(RateLimitInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'unique_name' = payload.get('unique_name'), + 'description' = payload.get('description'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RateLimitContext( + self._version, + service_sid=self._solution['service_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def buckets(self): + return self._proxy.buckets + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RateLimitListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(RateLimitListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/RateLimits' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RateLimitPage(self._version, payload, service_sid=self._solution['service_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/verify/v2/service/rate_limit/bucket.py b/twilio/rest/verify/v2/service/rate_limit/bucket.py index 5ec82abc04..c3db9989e1 100644 --- a/twilio/rest/verify/v2/service/rate_limit/bucket.py +++ b/twilio/rest/verify/v2/service/rate_limit/bucket.py @@ -1,460 +1,168 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BucketList(ListResource): - - def __init__(self, version, service_sid, rate_limit_sid): - """ - Initialize the BucketList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param rate_limit_sid: Rate Limit Sid. - - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketList - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketList - """ - super(BucketList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'rate_limit_sid': rate_limit_sid, } - self._uri = '/Services/{service_sid}/RateLimits/{rate_limit_sid}/Buckets'.format(**self._solution) - - def create(self, max, interval): - """ - Create the BucketInstance - - :param unicode max: Max number of requests. - :param unicode interval: Number of seconds that the rate limit will be enforced over. - - :returns: The created BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - """ - data = values.of({'Max': max, 'Interval': interval, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return BucketInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['rate_limit_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams BucketInstance 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 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.verify.v2.service.rate_limit.bucket.BucketInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists BucketInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.verify.v2.service.rate_limit.bucket.BucketInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BucketInstance records from the API. - Request is executed immediately - - :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 BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BucketPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BucketInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return BucketPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BucketContext - - :param sid: A string that uniquely identifies this Bucket. - - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketContext - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketContext - """ - return BucketContext( - self._version, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['rate_limit_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a BucketContext - - :param sid: A string that uniquely identifies this Bucket. - - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketContext - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketContext - """ - return BucketContext( - self._version, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['rate_limit_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BucketPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the BucketPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :param rate_limit_sid: Rate Limit Sid. - - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketPage - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketPage - """ - super(BucketPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BucketInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - """ - return BucketInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['rate_limit_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class BucketContext(InstanceContext): - - def __init__(self, version, service_sid, rate_limit_sid, sid): - """ - Initialize the BucketContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param rate_limit_sid: Rate Limit Sid. - :param sid: A string that uniquely identifies this Bucket. - - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketContext - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketContext - """ - super(BucketContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, rate_limit_sid: str, sid: str): + # TODO: needs autogenerated docs + super(BucketContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'rate_limit_sid': rate_limit_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/RateLimits/{rate_limit_sid}/Buckets/{sid}'.format(**self._solution) - - def update(self, max=values.unset, interval=values.unset): - """ - Update the BucketInstance - - :param unicode max: Max number of requests. - :param unicode interval: Number of seconds that the rate limit will be enforced over. - - :returns: The updated BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - """ - data = values.of({'Max': max, 'Interval': interval, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return BucketInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['rate_limit_sid'], - sid=self._solution['sid'], - ) - - def fetch(self): - """ - Fetch the BucketInstance - - :returns: The fetched BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BucketInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['rate_limit_sid'], - sid=self._solution['sid'], - ) + self._solution = { service_sid, rate_limit_sid, sid, } + self._uri = '/Services/${service_sid}/RateLimits/${rate_limit_sid}/Buckets/${sid}' + + + def delete(self): + + + """ + Deletes the BucketInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the BucketInstance + + :returns: The fetched BucketInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return BucketInstance( + self._version, + payload, + service_sidrate_limit_sidsid=self._solution['service_sid''rate_limit_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the BucketInstance + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return BucketInstance(self._version, payload, service_sid=self._solution['service_sid'], rate_limit_sid=self._solution['rate_limit_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class BucketInstance(InstanceResource): - def __init__(self, version, payload, service_sid, rate_limit_sid, sid=None): - """ - Initialize the BucketInstance - - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - """ +class BucketInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, rate_limit_sid: str, sid: str): super(BucketInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'rate_limit_sid': payload.get('rate_limit_sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'max': deserialize.integer(payload.get('max')), - 'interval': deserialize.integer(payload.get('interval')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'rate_limit_sid' = payload.get('rate_limit_sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'max' = payload.get('max'), + 'interval' = payload.get('interval'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'rate_limit_sid': rate_limit_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid']'rate_limit_sid': rate_limit_sid or self._properties['rate_limit_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BucketContext for this BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketContext - """ if self._context is None: self._context = BucketContext( self._version, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['rate_limit_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],rate_limit_sid=self._solution['rate_limit_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Bucket. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def rate_limit_sid(self): - """ - :returns: Rate Limit Sid. - :rtype: unicode - """ - return self._properties['rate_limit_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def max(self): - """ - :returns: Max number of requests. - :rtype: unicode - """ - return self._properties['max'] - - @property - def interval(self): - """ - :returns: Number of seconds that the rate limit will be enforced over. - :rtype: unicode - """ - return self._properties['interval'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] + - def update(self, max=values.unset, interval=values.unset): + def __repr__(self): """ - Update the BucketInstance - - :param unicode max: Max number of requests. - :param unicode interval: Number of seconds that the rate limit will be enforced over. - - :returns: The updated BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(max=max, interval=interval, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the BucketInstance - :returns: The fetched BucketInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the BucketInstance +class BucketListInstance(ListResource): + def __init__(self, version: V2, service_sid: str, rate_limit_sid: str): + # TODO: needs autogenerated docs + super(BucketListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { service_sid, rate_limit_sid, } + self._uri = '/Services/${service_sid}/RateLimits/${rate_limit_sid}/Buckets' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return BucketInstance(self._version, payload, service_sid=self._solution['service_sid']rate_limit_sid=self._solution['rate_limit_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return BucketPage(self._version, payload, service_sid=self._solution['service_sid']rate_limit_sid=self._solution['rate_limit_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index 15fa617fbb..38871176c4 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,421 +19,133 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VerificationList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the VerificationList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.verify.v2.service.verification.VerificationList - :rtype: twilio.rest.verify.v2.service.verification.VerificationList - """ - super(VerificationList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Verifications'.format(**self._solution) - - def create(self, to, channel, custom_friendly_name=values.unset, - custom_message=values.unset, send_digits=values.unset, - locale=values.unset, custom_code=values.unset, amount=values.unset, - payee=values.unset, rate_limits=values.unset, - channel_configuration=values.unset, app_hash=values.unset, - template_sid=values.unset, - template_custom_substitutions=values.unset): - """ - Create the VerificationInstance - - :param unicode to: The phone number or email to verify - :param unicode channel: The verification method to use - :param unicode custom_friendly_name: A custom user defined friendly name - :param unicode custom_message: The text of a custom message to use for the verification - :param unicode send_digits: The digits to send after a phone call is answered - :param unicode locale: The override locale to use for the verification SMS, WhatsApp or call - :param unicode custom_code: A pre-generated code - :param unicode amount: The amount of the associated PSD2 compliant transaction. - :param unicode payee: The payee of the associated PSD2 compliant transaction - :param dict rate_limits: The custom key-value pairs of Programmable Rate Limits. - :param dict channel_configuration: Channel specific configuration in json format. - :param unicode app_hash: Your App Hash to be appended at the end of an SMS. - :param unicode template_sid: The verification template SMS or Voice message. - :param unicode template_custom_substitutions: The values of the special variables declared on the message template. - - :returns: The created VerificationInstance - :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance - """ - data = values.of({ - 'To': to, - 'Channel': channel, - 'CustomFriendlyName': custom_friendly_name, - 'CustomMessage': custom_message, - 'SendDigits': send_digits, - 'Locale': locale, - 'CustomCode': custom_code, - 'Amount': amount, - 'Payee': payee, - 'RateLimits': serialize.object(rate_limits), - 'ChannelConfiguration': serialize.object(channel_configuration), - 'AppHash': app_hash, - 'TemplateSid': template_sid, - 'TemplateCustomSubstitutions': template_custom_substitutions, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return VerificationInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - 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, ) - - def __call__(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, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' -class VerificationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the VerificationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.verify.v2.service.verification.VerificationPage - :rtype: twilio.rest.verify.v2.service.verification.VerificationPage - """ - super(VerificationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - 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'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class VerificationContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the VerificationContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the verification Service to fetch the resource from - :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 - """ - super(VerificationContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(VerificationContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Verifications/{sid}'.format(**self._solution) - - def update(self, status): - """ - Update the VerificationInstance - - :param VerificationInstance.Status status: The new status of the resource - - :returns: The updated VerificationInstance - :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return VerificationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def fetch(self): - """ - Fetch the VerificationInstance + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Verifications/${sid}' + + + def fetch(self): + + """ + Fetch the VerificationInstance + + :returns: The fetched VerificationInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return VerificationInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched VerificationInstance - :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return VerificationInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return VerificationInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class VerificationInstance(InstanceResource): - - class Channel(object): - SMS = "sms" - CALL = "call" - EMAIL = "email" - WHATSAPP = "whatsapp" - SNA = "sna" - class Status(object): - CANCELED = "canceled" - APPROVED = "approved" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the VerificationInstance - - :returns: twilio.rest.verify.v2.service.verification.VerificationInstance - :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance - """ +class VerificationInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(VerificationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'to': payload.get('to'), - 'channel': payload.get('channel'), - 'status': payload.get('status'), - 'valid': payload.get('valid'), - 'lookup': payload.get('lookup'), - 'amount': payload.get('amount'), - 'payee': payload.get('payee'), - 'send_code_attempts': payload.get('send_code_attempts'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'sna': payload.get('sna'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'to' = payload.get('to'), + 'channel' = payload.get('channel'), + 'status' = payload.get('status'), + 'valid' = payload.get('valid'), + 'lookup' = payload.get('lookup'), + 'amount' = payload.get('amount'), + 'payee' = payload.get('payee'), + 'send_code_attempts' = payload.get('send_code_attempts'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'sna' = payload.get('sna'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: VerificationContext for this VerificationInstance - :rtype: twilio.rest.verify.v2.service.verification.VerificationContext - """ if self._context is None: self._context = VerificationContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def to(self): - """ - :returns: The phone number or email being verified - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel(self): - """ - :returns: The verification method used. - :rtype: VerificationInstance.Channel - """ - return self._properties['channel'] - - @property - def status(self): - """ - :returns: The status of the verification resource - :rtype: unicode - """ - return self._properties['status'] - - @property - def valid(self): - """ - :returns: Whether the verification was successful - :rtype: bool - """ - return self._properties['valid'] - - @property - def lookup(self): - """ - :returns: Information about the phone number being verified - :rtype: dict - """ - return self._properties['lookup'] - - @property - def amount(self): - """ - :returns: The amount of the associated PSD2 compliant transaction. - :rtype: unicode - """ - return self._properties['amount'] - - @property - def payee(self): - """ - :returns: The payee of the associated PSD2 compliant transaction - :rtype: unicode - """ - return self._properties['payee'] - - @property - def send_code_attempts(self): - """ - :returns: An array of verification attempt objects. - :rtype: list[dict] - """ - return self._properties['send_code_attempts'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sna(self): + def __repr__(self): """ - :returns: The set of fields used for a silent network auth (`sna`) verification - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['sna'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Verification resource - :rtype: unicode - """ - return self._properties['url'] - def update(self, status): - """ - Update the VerificationInstance - :param VerificationInstance.Status status: The new status of the resource +class VerificationListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(VerificationListInstanceList, self).__init__(version) - :returns: The updated VerificationInstance - :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance - """ - return self._proxy.update(status, ) + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Verifications' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def fetch(self): - """ - Fetch the VerificationInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The fetched VerificationInstance - :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance - """ - return self._proxy.fetch() + return VerificationInstance(self._version, payload, service_sid=self._solution['service_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/verification_check.py b/twilio/rest/verify/v2/service/verification_check.py index 2cfce2f07d..7280d8136a 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -1,251 +1,100 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VerificationCheckList(ListResource): - def __init__(self, version, service_sid): - """ - Initialize the VerificationCheckList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :returns: twilio.rest.verify.v2.service.verification_check.VerificationCheckList - :rtype: twilio.rest.verify.v2.service.verification_check.VerificationCheckList - """ - super(VerificationCheckList, self).__init__(version) - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/VerificationCheck'.format(**self._solution) - def create(self, code=values.unset, to=values.unset, - verification_sid=values.unset, amount=values.unset, - payee=values.unset): - """ - Create the VerificationCheckInstance - :param unicode code: The verification string - :param unicode to: The phone number or email to verify - :param unicode verification_sid: A SID that uniquely identifies the Verification Check - :param unicode amount: The amount of the associated PSD2 compliant transaction. - :param unicode payee: The payee of the associated PSD2 compliant transaction +class VerificationCheckInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str): + super(VerificationCheckInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'to' = payload.get('to'), + 'channel' = payload.get('channel'), + 'status' = payload.get('status'), + 'valid' = payload.get('valid'), + 'amount' = payload.get('amount'), + 'payee' = payload.get('payee'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'sna_attempts_error_codes' = payload.get('sna_attempts_error_codes'), + } - :returns: The created VerificationCheckInstance - :rtype: twilio.rest.verify.v2.service.verification_check.VerificationCheckInstance - """ - data = values.of({ - 'Code': code, - 'To': to, - 'VerificationSid': verification_sid, - 'Amount': amount, - 'Payee': payee, - }) + self._context = None + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'] + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = VerificationCheckContext( + self._version, + service_sid=self._solution['service_sid'], + ) + return self._context - return VerificationCheckInstance(self._version, payload, service_sid=self._solution['service_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class VerificationCheckPage(Page): + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def __init__(self, version, response, solution): - """ - Initialize the VerificationCheckPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - :returns: twilio.rest.verify.v2.service.verification_check.VerificationCheckPage - :rtype: twilio.rest.verify.v2.service.verification_check.VerificationCheckPage - """ - super(VerificationCheckPage, self).__init__(version, response) +class VerificationCheckListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(VerificationCheckListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VerificationCheckInstance + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/VerificationCheck' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.verify.v2.service.verification_check.VerificationCheckInstance - :rtype: twilio.rest.verify.v2.service.verification_check.VerificationCheckInstance - """ - return VerificationCheckInstance(self._version, payload, service_sid=self._solution['service_sid'], ) + return VerificationCheckInstance(self._version, payload, service_sid=self._solution['service_sid']) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class VerificationCheckInstance(InstanceResource): - - class Channel(object): - SMS = "sms" - CALL = "call" - EMAIL = "email" - WHATSAPP = "whatsapp" - SNA = "sna" - - def __init__(self, version, payload, service_sid): - """ - Initialize the VerificationCheckInstance - - :returns: twilio.rest.verify.v2.service.verification_check.VerificationCheckInstance - :rtype: twilio.rest.verify.v2.service.verification_check.VerificationCheckInstance - """ - super(VerificationCheckInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'to': payload.get('to'), - 'channel': payload.get('channel'), - 'status': payload.get('status'), - 'valid': payload.get('valid'), - 'amount': payload.get('amount'), - 'payee': payload.get('payee'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'sna_attempts_error_codes': payload.get('sna_attempts_error_codes'), - } - - # Context - self._context = None - self._solution = {'service_sid': service_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] + return '' - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def to(self): - """ - :returns: The phone number or email being verified - :rtype: unicode - """ - return self._properties['to'] - - @property - def channel(self): - """ - :returns: The verification method to use - :rtype: VerificationCheckInstance.Channel - """ - return self._properties['channel'] - - @property - def status(self): - """ - :returns: The status of the verification resource - :rtype: unicode - """ - return self._properties['status'] - - @property - def valid(self): - """ - :returns: Whether the verification was successful - :rtype: bool - """ - return self._properties['valid'] - - @property - def amount(self): - """ - :returns: The amount of the associated PSD2 compliant transaction. - :rtype: unicode - """ - return self._properties['amount'] - - @property - def payee(self): - """ - :returns: The payee of the associated PSD2 compliant transaction - :rtype: unicode - """ - return self._properties['payee'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Verification Check resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Verification Check resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sna_attempts_error_codes(self): - """ - :returns: List of error codes as a result of attempting a verification using the `sna` channel. - :rtype: list[dict] - """ - return self._properties['sna_attempts_error_codes'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/verify/v2/service/webhook.py b/twilio/rest/verify/v2/service/webhook.py index b5cb36a7b3..aeae00c4d6 100644 --- a/twilio/rest/verify/v2/service/webhook.py +++ b/twilio/rest/verify/v2/service/webhook.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,489 +19,153 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class WebhookList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the WebhookList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.verify.v2.service.webhook.WebhookList - :rtype: twilio.rest.verify.v2.service.webhook.WebhookList - """ - super(WebhookList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Webhooks'.format(**self._solution) - - def create(self, friendly_name, event_types, webhook_url, status=values.unset, - version=values.unset): - """ - Create the WebhookInstance - - :param unicode friendly_name: The string that you assigned to describe the webhook - :param list[unicode] event_types: The array of events that this Webhook is subscribed to. - :param unicode webhook_url: The URL associated with this Webhook. - :param WebhookInstance.Status status: The webhook status - :param WebhookInstance.Version version: The webhook version - - :returns: The created WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'EventTypes': serialize.map(event_types, lambda e: e), - 'WebhookUrl': webhook_url, - 'Status': status, - 'Version': version, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams WebhookInstance 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 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.verify.v2.service.webhook.WebhookInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists WebhookInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.verify.v2.service.webhook.WebhookInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WebhookInstance records from the API. - Request is executed immediately - - :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 WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WebhookPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WebhookInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WebhookPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a WebhookContext - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.verify.v2.service.webhook.WebhookContext - :rtype: twilio.rest.verify.v2.service.webhook.WebhookContext - """ - return WebhookContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WebhookContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.verify.v2.service.webhook.WebhookContext - :rtype: twilio.rest.verify.v2.service.webhook.WebhookContext - """ - return WebhookContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WebhookPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WebhookPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.verify.v2.service.webhook.WebhookPage - :rtype: twilio.rest.verify.v2.service.webhook.WebhookPage - """ - super(WebhookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of WebhookInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.webhook.WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance - """ - return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class WebhookContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the WebhookContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.verify.v2.service.webhook.WebhookContext - :rtype: twilio.rest.verify.v2.service.webhook.WebhookContext - """ - super(WebhookContext, self).__init__(version) + def __init__(self, version: V2, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super(WebhookContextList, self).__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Webhooks/{sid}'.format(**self._solution) - - def update(self, friendly_name=values.unset, event_types=values.unset, - webhook_url=values.unset, status=values.unset, version=values.unset): - """ - Update the WebhookInstance - - :param unicode friendly_name: The string that you assigned to describe the webhook - :param list[unicode] event_types: The array of events that this Webhook is subscribed to. - :param unicode webhook_url: The URL associated with this Webhook. - :param WebhookInstance.Status status: The webhook status - :param WebhookInstance.Version version: The webhook version - - :returns: The updated WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'EventTypes': serialize.map(event_types, lambda e: e), - 'WebhookUrl': webhook_url, - 'Status': status, - 'Version': version, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WebhookInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WebhookInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the WebhookInstance + self._solution = { service_sid, sid, } + self._uri = '/Services/${service_sid}/Webhooks/${sid}' + + + def delete(self): + + + """ + Deletes the WebhookInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the WebhookInstance + + :returns: The fetched WebhookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return WebhookInstance( + self._version, + payload, + service_sidsid=self._solution['service_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return WebhookInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class WebhookInstance(InstanceResource): - - class Status(object): - ENABLED = "enabled" - DISABLED = "disabled" + return '' - class Version(object): - V1 = "v1" - V2 = "v2" - class Methods(object): - GET = "GET" - POST = "POST" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the WebhookInstance - - :returns: twilio.rest.verify.v2.service.webhook.WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance - """ +class WebhookInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): super(WebhookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'event_types': payload.get('event_types'), - 'status': payload.get('status'), - 'version': payload.get('version'), - 'webhook_url': payload.get('webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'service_sid' = payload.get('service_sid'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'event_types' = payload.get('event_types'), + 'status' = payload.get('status'), + 'version' = payload.get('version'), + 'webhook_url' = payload.get('webhook_url'), + 'webhook_method' = payload.get('webhook_method'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid']'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WebhookContext for this WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookContext - """ if self._context is None: self._context = WebhookContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the webhook - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def event_types(self): - """ - :returns: The array of events that this Webhook is subscribed to. - :rtype: list[unicode] - """ - return self._properties['event_types'] - - @property - def status(self): - """ - :returns: The webhook status - :rtype: WebhookInstance.Status - """ - return self._properties['status'] - - @property - def version(self): - """ - :returns: The webhook version - :rtype: WebhookInstance.Version - """ - return self._properties['version'] - - @property - def webhook_url(self): - """ - :returns: The URL associated with this Webhook. - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The method used when calling the webhook's URL. - :rtype: WebhookInstance.Methods - """ - return self._properties['webhook_method'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Webhook resource - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def update(self, friendly_name=values.unset, event_types=values.unset, - webhook_url=values.unset, status=values.unset, version=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the WebhookInstance - - :param unicode friendly_name: The string that you assigned to describe the webhook - :param list[unicode] event_types: The array of events that this Webhook is subscribed to. - :param unicode webhook_url: The URL associated with this Webhook. - :param WebhookInstance.Status status: The webhook status - :param WebhookInstance.Version version: The webhook version + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The updated WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - event_types=event_types, - webhook_url=webhook_url, - status=status, - version=version, - ) - - def delete(self): - """ - Deletes the WebhookInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the WebhookInstance +class WebhookListInstance(ListResource): + def __init__(self, version: V2, service_sid: str): + # TODO: needs autogenerated docs + super(WebhookListInstanceList, self).__init__(version) - :returns: The fetched WebhookInstance - :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { service_sid, } + self._uri = '/Services/${service_sid}/Webhooks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WebhookInstance(self._version, payload, service_sid=self._solution['service_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WebhookPage(self._version, payload, service_sid=self._solution['service_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/template.py b/twilio/rest/verify/v2/template.py index d445ade3b9..a8e2fbb4e6 100644 --- a/twilio/rest/verify/v2/template.py +++ b/twilio/rest/verify/v2/template.py @@ -1,236 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TemplateList(ListResource): - - def __init__(self, version): - """ - Initialize the TemplateList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.verify.v2.template.TemplateList - :rtype: twilio.rest.verify.v2.template.TemplateList - """ - super(TemplateList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Templates'.format(**self._solution) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams TemplateInstance 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 friendly_name: Filter templates using friendly name - :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.verify.v2.template.TemplateInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists TemplateInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: Filter templates using friendly name - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.verify.v2.template.TemplateInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TemplateInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: Filter templates using friendly name - :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 + Twilio - Verify + This is the public Twilio REST API. - :returns: Page of TemplateInstance - :rtype: twilio.rest.verify.v2.template.TemplatePage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TemplatePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TemplateInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - :returns: Page of TemplateInstance - :rtype: twilio.rest.verify.v2.template.TemplatePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return TemplatePage(self._version, response, self._solution) +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class TemplatePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the TemplatePage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.verify.v2.template.TemplatePage - :rtype: twilio.rest.verify.v2.template.TemplatePage - """ - super(TemplatePage, self).__init__(version, response) +class TemplateListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(TemplateListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { } + self._uri = '/Templates' + + + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of TemplateInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.template.TemplateInstance - :rtype: twilio.rest.verify.v2.template.TemplateInstance - """ - return TemplateInstance(self._version, payload, ) + return TemplatePage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class TemplateInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the TemplateInstance - - :returns: twilio.rest.verify.v2.template.TemplateInstance - :rtype: twilio.rest.verify.v2.template.TemplateInstance - """ - super(TemplateInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'channels': payload.get('channels'), - 'translations': payload.get('translations'), - } - - # Context - self._context = None - self._solution = {} - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Template - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A string to describe the verification template - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def channels(self): - """ - :returns: A list of channels that support the Template - :rtype: list[unicode] - """ - return self._properties['channels'] - - @property - def translations(self): - """ - :returns: Object with the template translations. - :rtype: dict - """ - return self._properties['translations'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/verify/v2/verification_attempt.py b/twilio/rest/verify/v2/verification_attempt.py index c1eca860a6..898ed6bf9e 100644 --- a/twilio/rest/verify/v2/verification_attempt.py +++ b/twilio/rest/verify/v2/verification_attempt.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,468 +19,120 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VerificationAttemptList(ListResource): - - def __init__(self, version): - """ - Initialize the VerificationAttemptList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.verify.v2.verification_attempt.VerificationAttemptList - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptList - """ - super(VerificationAttemptList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Attempts'.format(**self._solution) - - def stream(self, date_created_after=values.unset, - date_created_before=values.unset, channel_data_to=values.unset, - country=values.unset, channel=values.unset, - verify_service_sid=values.unset, verification_sid=values.unset, - status=values.unset, limit=None, page_size=None): - """ - Streams VerificationAttemptInstance 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 datetime date_created_after: Filter verification attempts after this date. - :param datetime date_created_before: Filter verification attempts before this date. - :param unicode channel_data_to: Filters by destination of the verification attempt. - :param unicode country: Filter verification attempts by destination country. - :param VerificationAttemptInstance.Channels channel: Filter verification attempts by communication channel. - :param unicode verify_service_sid: Filter verification attempts by verify service. - :param unicode verification_sid: Filter attempts by verification. - :param VerificationAttemptInstance.ConversionStatus status: Filter verification attempts by conversion status. - :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.verify.v2.verification_attempt.VerificationAttemptInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_after=date_created_after, - date_created_before=date_created_before, - channel_data_to=channel_data_to, - country=country, - channel=channel, - verify_service_sid=verify_service_sid, - verification_sid=verification_sid, - status=status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_after=values.unset, - date_created_before=values.unset, channel_data_to=values.unset, - country=values.unset, channel=values.unset, - verify_service_sid=values.unset, verification_sid=values.unset, - status=values.unset, limit=None, page_size=None): - """ - Lists VerificationAttemptInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_after: Filter verification attempts after this date. - :param datetime date_created_before: Filter verification attempts before this date. - :param unicode channel_data_to: Filters by destination of the verification attempt. - :param unicode country: Filter verification attempts by destination country. - :param VerificationAttemptInstance.Channels channel: Filter verification attempts by communication channel. - :param unicode verify_service_sid: Filter verification attempts by verify service. - :param unicode verification_sid: Filter attempts by verification. - :param VerificationAttemptInstance.ConversionStatus status: Filter verification attempts by conversion status. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.verify.v2.verification_attempt.VerificationAttemptInstance] - """ - return list(self.stream( - date_created_after=date_created_after, - date_created_before=date_created_before, - channel_data_to=channel_data_to, - country=country, - channel=channel, - verify_service_sid=verify_service_sid, - verification_sid=verification_sid, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_after=values.unset, - date_created_before=values.unset, channel_data_to=values.unset, - country=values.unset, channel=values.unset, - verify_service_sid=values.unset, verification_sid=values.unset, - status=values.unset, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of VerificationAttemptInstance records from the API. - Request is executed immediately - - :param datetime date_created_after: Filter verification attempts after this date. - :param datetime date_created_before: Filter verification attempts before this date. - :param unicode channel_data_to: Filters by destination of the verification attempt. - :param unicode country: Filter verification attempts by destination country. - :param VerificationAttemptInstance.Channels channel: Filter verification attempts by communication channel. - :param unicode verify_service_sid: Filter verification attempts by verify service. - :param unicode verification_sid: Filter attempts by verification. - :param VerificationAttemptInstance.ConversionStatus status: Filter verification attempts by conversion status. - :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 VerificationAttemptInstance - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptPage - """ - data = values.of({ - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'ChannelData.To': channel_data_to, - 'Country': country, - 'Channel': channel, - 'VerifyServiceSid': verify_service_sid, - 'VerificationSid': verification_sid, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return VerificationAttemptPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of VerificationAttemptInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of VerificationAttemptInstance - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return VerificationAttemptPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a VerificationAttemptContext - - :param sid: Verification Attempt Sid. - - :returns: twilio.rest.verify.v2.verification_attempt.VerificationAttemptContext - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptContext - """ - return VerificationAttemptContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a VerificationAttemptContext - - :param sid: Verification Attempt Sid. - - :returns: twilio.rest.verify.v2.verification_attempt.VerificationAttemptContext - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptContext - """ - return VerificationAttemptContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class VerificationAttemptPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the VerificationAttemptPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.verify.v2.verification_attempt.VerificationAttemptPage - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptPage - """ - super(VerificationAttemptPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VerificationAttemptInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.verify.v2.verification_attempt.VerificationAttemptInstance - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptInstance - """ - return VerificationAttemptInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class VerificationAttemptContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the VerificationAttemptContext - - :param Version version: Version that contains the resource - :param sid: Verification Attempt Sid. - - :returns: twilio.rest.verify.v2.verification_attempt.VerificationAttemptContext - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptContext - """ - super(VerificationAttemptContext, self).__init__(version) + def __init__(self, version: V2, sid: str): + # TODO: needs autogenerated docs + super(VerificationAttemptContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Attempts/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the VerificationAttemptInstance - - :returns: The fetched VerificationAttemptInstance - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return VerificationAttemptInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/Attempts/${sid}' + + + def fetch(self): + + """ + Fetch the VerificationAttemptInstance + + :returns: The fetched VerificationAttemptInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return VerificationAttemptInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class VerificationAttemptInstance(InstanceResource): - - class Channels(object): - SMS = "sms" - CALL = "call" - EMAIL = "email" - WHATSAPP = "whatsapp" - - class CallStatus(object): - QUEUED = "queued" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - BUSY = "busy" - FAILED = "failed" - NO_ANSWER = "no-answer" - RINGING = "ringing" - CANCELED = "canceled" - - class MessageStatus(object): - QUEUED = "queued" - SENDING = "sending" - SENT = "sent" - FAILED = "failed" - DELIVERED = "delivered" - UNDELIVERED = "undelivered" - RECEIVING = "receiving" - RECEIVED = "received" - ACCEPTED = "accepted" - SCHEDULED = "scheduled" - READ = "read" - PARTIALLY_DELIVERED = "partially_delivered" - CANCELED = "canceled" + return '' - class ConversionStatus(object): - CONVERTED = "converted" - UNCONVERTED = "unconverted" - class AttemptStatus(object): - CONFIRMED = "confirmed" - UNCONFIRMED = "unconfirmed" - EXPIRED = "expired" - def __init__(self, version, payload, sid=None): - """ - Initialize the VerificationAttemptInstance - - :returns: twilio.rest.verify.v2.verification_attempt.VerificationAttemptInstance - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptInstance - """ +class VerificationAttemptInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(VerificationAttemptInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'verification_sid': payload.get('verification_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'conversion_status': payload.get('conversion_status'), - 'channel': payload.get('channel'), - 'price': payload.get('price'), - 'channel_data': payload.get('channel_data'), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'service_sid' = payload.get('service_sid'), + 'verification_sid' = payload.get('verification_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'conversion_status' = payload.get('conversion_status'), + 'channel' = payload.get('channel'), + 'price' = payload.get('price'), + 'channel_data' = payload.get('channel_data'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: VerificationAttemptContext for this VerificationAttemptInstance - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptContext - """ if self._context is None: - self._context = VerificationAttemptContext(self._version, sid=self._solution['sid'], ) + self._context = VerificationAttemptContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The SID that uniquely identifies the verification attempt. - :rtype: unicode - """ - return self._properties['sid'] + - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the verification. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the verify service that generated this attempt. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def verification_sid(self): + def __repr__(self): """ - :returns: The SID of the verification that generated this attempt. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['verification_sid'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_created(self): - """ - :returns: The date this Attempt was created - :rtype: datetime - """ - return self._properties['date_created'] - @property - def date_updated(self): - """ - :returns: The date this Attempt was updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def conversion_status(self): - """ - :returns: Status of the conversion for the verification. - :rtype: VerificationAttemptInstance.ConversionStatus - """ - return self._properties['conversion_status'] +class VerificationAttemptListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(VerificationAttemptListInstanceList, self).__init__(version) - @property - def channel(self): - """ - :returns: Communication channel used for the attempt. - :rtype: VerificationAttemptInstance.Channels - """ - return self._properties['channel'] - - @property - def price(self): - """ - :returns: An object containing the charge for this verification attempt. - :rtype: dict - """ - return self._properties['price'] - - @property - def channel_data(self): - """ - :returns: An object containing the channel specific information for an attempt. - :rtype: dict - """ - return self._properties['channel_data'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] + # Path Solution + self._solution = { } + self._uri = '/Attempts' + + + def page(self, date_created_after, date_created_before, channel_data_to, country, channel, verify_service_sid, verification_sid, status, page_size): + + data = values.of({ + 'date_created_after': date_created_after,'date_created_before': date_created_before,'channel_data_to': channel_data_to,'country': country,'channel': channel,'verify_service_sid': verify_service_sid,'verification_sid': verification_sid,'status': status,'page_size': page_size, + }) - def fetch(self): - """ - Fetch the VerificationAttemptInstance + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The fetched VerificationAttemptInstance - :rtype: twilio.rest.verify.v2.verification_attempt.VerificationAttemptInstance - """ - return self._proxy.fetch() + return VerificationAttemptPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/verification_attempts_summary.py b/twilio/rest/verify/v2/verification_attempts_summary.py index 26c3ecc679..cf95e4f798 100644 --- a/twilio/rest/verify/v2/verification_attempts_summary.py +++ b/twilio/rest/verify/v2/verification_attempts_summary.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,264 +19,102 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VerificationAttemptsSummaryList(ListResource): - - def __init__(self, version): - """ - Initialize the VerificationAttemptsSummaryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryList - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryList - """ - super(VerificationAttemptsSummaryList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a VerificationAttemptsSummaryContext - - :returns: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryContext - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryContext - """ - return VerificationAttemptsSummaryContext(self._version, ) - - def __call__(self): - """ - Constructs a VerificationAttemptsSummaryContext - - :returns: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryContext - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryContext - """ - return VerificationAttemptsSummaryContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class VerificationAttemptsSummaryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the VerificationAttemptsSummaryPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryPage - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryPage - """ - super(VerificationAttemptsSummaryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VerificationAttemptsSummaryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryInstance - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryInstance - """ - return VerificationAttemptsSummaryInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class VerificationAttemptsSummaryContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the VerificationAttemptsSummaryContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryContext - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryContext - """ - super(VerificationAttemptsSummaryContext, self).__init__(version) + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(VerificationAttemptsSummaryContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/Attempts/Summary'.format(**self._solution) - - def fetch(self, verify_service_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - country=values.unset, channel=values.unset, - destination_prefix=values.unset): - """ - Fetch the VerificationAttemptsSummaryInstance - - :param unicode verify_service_sid: Filter the verification attempts considered on the summary by verify service. - :param datetime date_created_after: Consider verification attempts create after this date on the summary. - :param datetime date_created_before: Consider verification attempts created before this date on the summary. - :param unicode country: Filter verification attempts considered on the summary by destination country. - :param VerificationAttemptsSummaryInstance.Channels channel: Filter verification attempts considered on the summary by communication channel. - :param unicode destination_prefix: Filters the attempts considered on the summary by destination prefix. - - :returns: The fetched VerificationAttemptsSummaryInstance - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryInstance - """ - data = values.of({ - 'VerifyServiceSid': verify_service_sid, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'Country': country, - 'Channel': channel, - 'DestinationPrefix': destination_prefix, - }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return VerificationAttemptsSummaryInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Attempts/Summary' + + + def fetch(self, verify_service_sid, date_created_after, date_created_before, country, channel, destination_prefix): + + """ + Fetch the VerificationAttemptsSummaryInstance + + :returns: The fetched VerificationAttemptsSummaryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return VerificationAttemptsSummaryInstance( + self._version, + payload, + =self._solution[], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class VerificationAttemptsSummaryInstance(InstanceResource): - - class Channels(object): - SMS = "sms" - CALL = "call" - EMAIL = "email" - WHATSAPP = "whatsapp" +class VerificationAttemptsSummaryInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the VerificationAttemptsSummaryInstance - - :returns: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryInstance - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryInstance - """ super(VerificationAttemptsSummaryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'total_attempts': deserialize.integer(payload.get('total_attempts')), - 'total_converted': deserialize.integer(payload.get('total_converted')), - 'total_unconverted': deserialize.integer(payload.get('total_unconverted')), - 'conversion_rate_percentage': deserialize.decimal(payload.get('conversion_rate_percentage')), - 'url': payload.get('url'), + self._properties = { + 'total_attempts' = payload.get('total_attempts'), + 'total_converted' = payload.get('total_converted'), + 'total_unconverted' = payload.get('total_unconverted'), + 'conversion_rate_percentage' = payload.get('conversion_rate_percentage'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: VerificationAttemptsSummaryContext for this VerificationAttemptsSummaryInstance - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryContext - """ if self._context is None: - self._context = VerificationAttemptsSummaryContext(self._version, ) + self._context = VerificationAttemptsSummaryContext( + self._version, + + ) return self._context - @property - def total_attempts(self): - """ - :returns: Total of attempts made. - :rtype: unicode - """ - return self._properties['total_attempts'] - - @property - def total_converted(self): - """ - :returns: Total of attempts confirmed by the end user. - :rtype: unicode - """ - return self._properties['total_converted'] + - @property - def total_unconverted(self): - """ - :returns: Total of attempts made that were not confirmed by the end user. - :rtype: unicode - """ - return self._properties['total_unconverted'] - - @property - def conversion_rate_percentage(self): + def __repr__(self): """ - :returns: Percentage of the confirmed messages over the total. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['conversion_rate_percentage'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - def fetch(self, verify_service_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - country=values.unset, channel=values.unset, - destination_prefix=values.unset): - """ - Fetch the VerificationAttemptsSummaryInstance - :param unicode verify_service_sid: Filter the verification attempts considered on the summary by verify service. - :param datetime date_created_after: Consider verification attempts create after this date on the summary. - :param datetime date_created_before: Consider verification attempts created before this date on the summary. - :param unicode country: Filter verification attempts considered on the summary by destination country. - :param VerificationAttemptsSummaryInstance.Channels channel: Filter verification attempts considered on the summary by communication channel. - :param unicode destination_prefix: Filters the attempts considered on the summary by destination prefix. +class VerificationAttemptsSummaryListInstance(ListResource): + def __init__(self, version: V2): + # TODO: needs autogenerated docs + super(VerificationAttemptsSummaryListInstanceList, self).__init__(version) - :returns: The fetched VerificationAttemptsSummaryInstance - :rtype: twilio.rest.verify.v2.verification_attempts_summary.VerificationAttemptsSummaryInstance - """ - return self._proxy.fetch( - verify_service_sid=verify_service_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - country=country, - channel=channel, - destination_prefix=destination_prefix, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/video/__init__.py b/twilio/rest/video/__init__.py index f9f1c1bde5..5a14b9ccaf 100644 --- a/twilio/rest/video/__init__.py +++ b/twilio/rest/video/__init__.py @@ -1,87 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.video.v1 import V1 + Twilio - Video + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Video(Domain): +from twilio.base.domain import Domain +from twilio.rest.Video.v1 import V1 +class Video(Domain): def __init__(self, twilio): """ Initialize the Video Domain :returns: Domain for Video - :rtype: twilio.rest.video.Video + :rtype: twilio.rest.v1.Video """ super(Video, self).__init__(twilio) - - self.base_url = 'https://video.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Video.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of video - :rtype: twilio.rest.video.v1.V1 + :returns: Versions v1 of Video + :rtype: twilio.rest.Video.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def compositions(self): """ - :rtype: twilio.rest.video.v1.composition.CompositionList + :rtype: twilio.rest.v1.compositions """ return self.v1.compositions + @property def composition_hooks(self): """ - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookList + :rtype: twilio.rest.v1.composition_hooks """ return self.v1.composition_hooks + @property def composition_settings(self): """ - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsList + :rtype: twilio.rest.v1.composition_settings """ return self.v1.composition_settings + @property def recordings(self): """ - :rtype: twilio.rest.video.v1.recording.RecordingList + :rtype: twilio.rest.v1.recordings """ return self.v1.recordings + @property def recording_settings(self): """ - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsList + :rtype: twilio.rest.v1.recording_settings """ return self.v1.recording_settings + @property def rooms(self): """ - :rtype: twilio.rest.video.v1.room.RoomList + :rtype: twilio.rest.v1.rooms """ return self.v1.rooms + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/video/v1/.openapi-generator-ignore b/twilio/rest/video/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/video/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/video/v1/.openapi-generator/FILES b/twilio/rest/video/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..c7fc26631e --- /dev/null +++ b/twilio/rest/video/v1/.openapi-generator/FILES @@ -0,0 +1,27 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +composition.py +composition_hook.py +composition_settings.py +recording.py +recording_settings.py +room.py +room/participant.py +room/participant/anonymize.py +room/participant/published_track.py +room/participant/subscribe_rules.py +room/participant/subscribed_track.py +room/recording_rules.py +room/room_recording.py diff --git a/twilio/rest/video/v1/.openapi-generator/VERSION b/twilio/rest/video/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/video/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py new file mode 100644 index 0000000000..a80cb11584 --- /dev/null +++ b/twilio/rest/video/v1/composition.py @@ -0,0 +1,169 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class CompositionContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CompositionContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Compositions/${sid}' + + + def delete(self): + + + """ + Deletes the CompositionInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CompositionInstance + + :returns: The fetched CompositionInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CompositionInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CompositionInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(CompositionInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'status' = payload.get('status'), + 'date_created' = payload.get('date_created'), + 'date_completed' = payload.get('date_completed'), + 'date_deleted' = payload.get('date_deleted'), + 'sid' = payload.get('sid'), + 'room_sid' = payload.get('room_sid'), + 'audio_sources' = payload.get('audio_sources'), + 'audio_sources_excluded' = payload.get('audio_sources_excluded'), + 'video_layout' = payload.get('video_layout'), + 'resolution' = payload.get('resolution'), + 'trim' = payload.get('trim'), + 'format' = payload.get('format'), + 'bitrate' = payload.get('bitrate'), + 'size' = payload.get('size'), + 'duration' = payload.get('duration'), + 'media_external_location' = payload.get('media_external_location'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CompositionContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CompositionListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CompositionListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Compositions' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CompositionInstance(self._version, payload, ) + + + def page(self, status, date_created_after, date_created_before, room_sid, page_size): + + data = values.of({ + 'status': status,'date_created_after': date_created_after,'date_created_before': date_created_before,'room_sid': room_sid,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CompositionPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/composition_hook.py b/twilio/rest/video/v1/composition_hook.py index 214693d065..c1db51ffaf 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,567 +19,156 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CompositionHookList(ListResource): - - def __init__(self, version): - """ - Initialize the CompositionHookList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.composition_hook.CompositionHookList - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookList - """ - super(CompositionHookList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/CompositionHooks'.format(**self._solution) - - def stream(self, enabled=values.unset, date_created_after=values.unset, - date_created_before=values.unset, friendly_name=values.unset, - limit=None, page_size=None): - """ - Streams CompositionHookInstance 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 enabled: Read only CompositionHook resources with an enabled value that matches this parameter - :param datetime date_created_after: Read only CompositionHook resources created on or after this ISO 8601 datetime with time zone - :param datetime date_created_before: Read only CompositionHook resources created before this ISO 8601 datetime with time zone - :param unicode friendly_name: Read only CompositionHook resources with friendly names that match this string - :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.video.v1.composition_hook.CompositionHookInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - enabled=enabled, - date_created_after=date_created_after, - date_created_before=date_created_before, - friendly_name=friendly_name, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, enabled=values.unset, date_created_after=values.unset, - date_created_before=values.unset, friendly_name=values.unset, - limit=None, page_size=None): - """ - Lists CompositionHookInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool enabled: Read only CompositionHook resources with an enabled value that matches this parameter - :param datetime date_created_after: Read only CompositionHook resources created on or after this ISO 8601 datetime with time zone - :param datetime date_created_before: Read only CompositionHook resources created before this ISO 8601 datetime with time zone - :param unicode friendly_name: Read only CompositionHook resources with friendly names that match this string - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.video.v1.composition_hook.CompositionHookInstance] - """ - return list(self.stream( - enabled=enabled, - date_created_after=date_created_after, - date_created_before=date_created_before, - friendly_name=friendly_name, - limit=limit, - page_size=page_size, - )) - - def page(self, enabled=values.unset, date_created_after=values.unset, - date_created_before=values.unset, friendly_name=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CompositionHookInstance records from the API. - Request is executed immediately - - :param bool enabled: Read only CompositionHook resources with an enabled value that matches this parameter - :param datetime date_created_after: Read only CompositionHook resources created on or after this ISO 8601 datetime with time zone - :param datetime date_created_before: Read only CompositionHook resources created before this ISO 8601 datetime with time zone - :param unicode friendly_name: Read only CompositionHook resources with friendly names that match this string - :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 CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookPage - """ - data = values.of({ - 'Enabled': enabled, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CompositionHookPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CompositionHookInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CompositionHookPage(self._version, response, self._solution) - - def create(self, friendly_name, enabled=values.unset, video_layout=values.unset, - audio_sources=values.unset, audio_sources_excluded=values.unset, - resolution=values.unset, format=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - trim=values.unset): - """ - Create the CompositionHookInstance - - :param unicode friendly_name: A unique string to describe the resource - :param bool enabled: Whether the composition hook is active - :param dict video_layout: An object that describes the video layout of the composition hook - :param list[unicode] audio_sources: An array of track names from the same group room to merge - :param list[unicode] audio_sources_excluded: An array of track names to exclude - :param unicode resolution: A string that describes the rows (width) and columns (height) of the generated composed video in pixels - :param CompositionHookInstance.Format format: The container format of the media files used by the compositions created by the composition hook - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param bool trim: Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook - - :returns: The created CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Enabled': enabled, - 'VideoLayout': serialize.object(video_layout), - 'AudioSources': serialize.map(audio_sources, lambda e: e), - 'AudioSourcesExcluded': serialize.map(audio_sources_excluded, lambda e: e), - 'Resolution': resolution, - 'Format': format, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'Trim': trim, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CompositionHookInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CompositionHookContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.composition_hook.CompositionHookContext - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookContext - """ - return CompositionHookContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CompositionHookContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.composition_hook.CompositionHookContext - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookContext - """ - return CompositionHookContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CompositionHookPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CompositionHookPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.composition_hook.CompositionHookPage - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookPage - """ - super(CompositionHookPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CompositionHookInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - :returns: twilio.rest.video.v1.composition_hook.CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance - """ - return CompositionHookInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class CompositionHookContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CompositionHookContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.composition_hook.CompositionHookContext - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookContext - """ - super(CompositionHookContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CompositionHookContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/CompositionHooks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CompositionHookInstance - - :returns: The fetched CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CompositionHookInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CompositionHookInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name, enabled=values.unset, video_layout=values.unset, - audio_sources=values.unset, audio_sources_excluded=values.unset, - trim=values.unset, format=values.unset, resolution=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Update the CompositionHookInstance - - :param unicode friendly_name: A unique string to describe the resource - :param bool enabled: Whether the composition hook is active - :param dict video_layout: A JSON object that describes the video layout of the composition hook - :param list[unicode] audio_sources: An array of track names from the same group room to merge - :param list[unicode] audio_sources_excluded: An array of track names to exclude - :param bool trim: Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook - :param CompositionHookInstance.Format format: The container format of the media files used by the compositions created by the composition hook - :param unicode resolution: A string that describes the columns (width) and rows (height) of the generated composed video in pixels - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - - :returns: The updated 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), - 'Trim': trim, - 'Format': format, - 'Resolution': resolution, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return CompositionHookInstance(self._version, payload, sid=self._solution['sid'], ) + self._solution = { sid, } + self._uri = '/CompositionHooks/${sid}' + + + def delete(self): + + + """ + Deletes the CompositionHookInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CompositionHookInstance + + :returns: The fetched CompositionHookInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CompositionHookInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return CompositionHookInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CompositionHookInstance(InstanceResource): - - class Format(object): - MP4 = "mp4" - WEBM = "webm" - def __init__(self, version, payload, sid=None): - """ - Initialize the CompositionHookInstance - - :returns: twilio.rest.video.v1.composition_hook.CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance - """ +class CompositionHookInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(CompositionHookInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'enabled': payload.get('enabled'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'sid': payload.get('sid'), - 'audio_sources': payload.get('audio_sources'), - 'audio_sources_excluded': payload.get('audio_sources_excluded'), - 'video_layout': payload.get('video_layout'), - 'resolution': payload.get('resolution'), - 'trim': payload.get('trim'), - 'format': payload.get('format'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'enabled' = payload.get('enabled'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'sid' = payload.get('sid'), + 'audio_sources' = payload.get('audio_sources'), + 'audio_sources_excluded' = payload.get('audio_sources_excluded'), + 'video_layout' = payload.get('video_layout'), + 'resolution' = payload.get('resolution'), + 'trim' = payload.get('trim'), + 'format' = payload.get('format'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CompositionHookContext for this CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookContext - """ if self._context is None: - self._context = CompositionHookContext(self._version, sid=self._solution['sid'], ) + self._context = CompositionHookContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def enabled(self): - """ - :returns: Whether the CompositionHook is active - :rtype: bool - """ - return self._properties['enabled'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def audio_sources(self): - """ - :returns: The array of track names to include in the compositions created by the composition hook - :rtype: list[unicode] - """ - return self._properties['audio_sources'] - - @property - def audio_sources_excluded(self): - """ - :returns: The array of track names to exclude from the compositions created by the composition hook - :rtype: list[unicode] - """ - return self._properties['audio_sources_excluded'] - - @property - def video_layout(self): - """ - :returns: A JSON object that describes the video layout of the Composition - :rtype: dict - """ - return self._properties['video_layout'] - - @property - def resolution(self): - """ - :returns: The dimensions of the video image in pixels expressed as columns (width) and rows (height) - :rtype: unicode - """ - return self._properties['resolution'] - - @property - def trim(self): - """ - :returns: Whether intervals with no media are clipped - :rtype: bool - """ - return self._properties['trim'] - - @property - def format(self): - """ - :returns: The container format of the media files used by the compositions created by the composition hook - :rtype: CompositionHookInstance.Format - """ - return self._properties['format'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] + - @property - def status_callback_method(self): - """ - :returns: The HTTP method we should use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the CompositionHookInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the CompositionHookInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() +class CompositionHookListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CompositionHookListInstanceList, self).__init__(version) - def update(self, friendly_name, enabled=values.unset, video_layout=values.unset, - audio_sources=values.unset, audio_sources_excluded=values.unset, - trim=values.unset, format=values.unset, resolution=values.unset, - status_callback=values.unset, status_callback_method=values.unset): - """ - Update the CompositionHookInstance - - :param unicode friendly_name: A unique string to describe the resource - :param bool enabled: Whether the composition hook is active - :param dict video_layout: A JSON object that describes the video layout of the composition hook - :param list[unicode] audio_sources: An array of track names from the same group room to merge - :param list[unicode] audio_sources_excluded: An array of track names to exclude - :param bool trim: Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook - :param CompositionHookInstance.Format format: The container format of the media files used by the compositions created by the composition hook - :param unicode resolution: A string that describes the columns (width) and rows (height) of the generated composed video in pixels - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - - :returns: The updated CompositionHookInstance - :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance - """ - return self._proxy.update( - friendly_name, - enabled=enabled, - video_layout=video_layout, - audio_sources=audio_sources, - audio_sources_excluded=audio_sources_excluded, - trim=trim, - format=format, - resolution=resolution, - status_callback=status_callback, - status_callback_method=status_callback_method, - ) + # Path Solution + self._solution = { } + self._uri = '/CompositionHooks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CompositionHookInstance(self._version, payload, ) + + + def page(self, enabled, date_created_after, date_created_before, friendly_name, page_size): + + data = values.of({ + 'enabled': enabled,'date_created_after': date_created_after,'date_created_before': date_created_before,'friendly_name': friendly_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CompositionHookPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/video/v1/composition_settings.py b/twilio/rest/video/v1/composition_settings.py index 98fb805c8f..b51c40f313 100644 --- a/twilio/rest/video/v1/composition_settings.py +++ b/twilio/rest/video/v1/composition_settings.py @@ -1,312 +1,128 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CompositionSettingsList(ListResource): - - def __init__(self, version): - """ - Initialize the CompositionSettingsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.composition_settings.CompositionSettingsList - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsList - """ - super(CompositionSettingsList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a CompositionSettingsContext - - :returns: twilio.rest.video.v1.composition_settings.CompositionSettingsContext - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsContext - """ - return CompositionSettingsContext(self._version, ) - - def __call__(self): - """ - Constructs a CompositionSettingsContext - - :returns: twilio.rest.video.v1.composition_settings.CompositionSettingsContext - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsContext - """ - return CompositionSettingsContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - -class CompositionSettingsPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the CompositionSettingsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.composition_settings.CompositionSettingsPage - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsPage - """ - super(CompositionSettingsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CompositionSettingsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - """ - return CompositionSettingsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class CompositionSettingsContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the CompositionSettingsContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.composition_settings.CompositionSettingsContext - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsContext - """ - super(CompositionSettingsContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CompositionSettingsContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/CompositionSettings/Default'.format(**self._solution) - - def fetch(self): - """ - Fetch the CompositionSettingsInstance - - :returns: The fetched CompositionSettingsInstance - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CompositionSettingsInstance(self._version, payload, ) - - def create(self, friendly_name, aws_credentials_sid=values.unset, - encryption_key_sid=values.unset, aws_s3_url=values.unset, - aws_storage_enabled=values.unset, encryption_enabled=values.unset): - """ - Create the CompositionSettingsInstance - - :param unicode friendly_name: A descriptive string that you create to describe the resource - :param unicode aws_credentials_sid: The SID of the stored Credential resource - :param unicode encryption_key_sid: The SID of the Public Key resource to use for encryption - :param unicode aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored - :param bool aws_storage_enabled: Whether all compositions should be written to the aws_s3_url - :param bool encryption_enabled: Whether all compositions should be stored in an encrypted form - - :returns: The created CompositionSettingsInstance - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'AwsCredentialsSid': aws_credentials_sid, - 'EncryptionKeySid': encryption_key_sid, - 'AwsS3Url': aws_s3_url, - 'AwsStorageEnabled': aws_storage_enabled, - 'EncryptionEnabled': encryption_enabled, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CompositionSettingsInstance(self._version, payload, ) + self._solution = { } + self._uri = '/CompositionSettings/Default' + + + def create(self, body): + + + + + def fetch(self): + + """ + Fetch the CompositionSettingsInstance + + :returns: The fetched CompositionSettingsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CompositionSettingsInstance( + self._version, + payload, + =self._solution[], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CompositionSettingsInstance(InstanceResource): +class CompositionSettingsInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the CompositionSettingsInstance - - :returns: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - """ super(CompositionSettingsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'aws_credentials_sid': payload.get('aws_credentials_sid'), - 'aws_s3_url': payload.get('aws_s3_url'), - 'aws_storage_enabled': payload.get('aws_storage_enabled'), - 'encryption_key_sid': payload.get('encryption_key_sid'), - 'encryption_enabled': payload.get('encryption_enabled'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'aws_credentials_sid' = payload.get('aws_credentials_sid'), + 'aws_s3_url' = payload.get('aws_s3_url'), + 'aws_storage_enabled' = payload.get('aws_storage_enabled'), + 'encryption_key_sid' = payload.get('encryption_key_sid'), + 'encryption_enabled' = payload.get('encryption_enabled'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CompositionSettingsContext for this CompositionSettingsInstance - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsContext - """ if self._context is None: - self._context = CompositionSettingsContext(self._version, ) + self._context = CompositionSettingsContext( + self._version, + + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def aws_credentials_sid(self): - """ - :returns: The SID of the stored Credential resource - :rtype: unicode - """ - return self._properties['aws_credentials_sid'] - - @property - def aws_s3_url(self): - """ - :returns: The URL of the AWS S3 bucket where the compositions are stored - :rtype: unicode - """ - return self._properties['aws_s3_url'] - - @property - def aws_storage_enabled(self): - """ - :returns: Whether all compositions are written to the aws_s3_url - :rtype: bool - """ - return self._properties['aws_storage_enabled'] - - @property - def encryption_key_sid(self): - """ - :returns: The SID of the Public Key resource used for encryption - :rtype: unicode - """ - return self._properties['encryption_key_sid'] - - @property - def encryption_enabled(self): - """ - :returns: Whether all compositions are stored in an encrypted form - :rtype: bool - """ - return self._properties['encryption_enabled'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the CompositionSettingsInstance - :returns: The fetched CompositionSettingsInstance - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - """ - return self._proxy.fetch() - def create(self, friendly_name, aws_credentials_sid=values.unset, - encryption_key_sid=values.unset, aws_s3_url=values.unset, - aws_storage_enabled=values.unset, encryption_enabled=values.unset): - """ - Create the CompositionSettingsInstance - - :param unicode friendly_name: A descriptive string that you create to describe the resource - :param unicode aws_credentials_sid: The SID of the stored Credential resource - :param unicode encryption_key_sid: The SID of the Public Key resource to use for encryption - :param unicode aws_s3_url: The URL of the AWS S3 bucket where the compositions should be stored - :param bool aws_storage_enabled: Whether all compositions should be written to the aws_s3_url - :param bool encryption_enabled: Whether all compositions should be stored in an encrypted form +class CompositionSettingsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CompositionSettingsListInstanceList, self).__init__(version) - :returns: The created CompositionSettingsInstance - :rtype: twilio.rest.video.v1.composition_settings.CompositionSettingsInstance - """ - return self._proxy.create( - friendly_name, - aws_credentials_sid=aws_credentials_sid, - encryption_key_sid=encryption_key_sid, - aws_s3_url=aws_s3_url, - aws_storage_enabled=aws_storage_enabled, - encryption_enabled=encryption_enabled, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/video/v1/recording.py b/twilio/rest/video/v1/recording.py new file mode 100644 index 0000000000..c3b5f73f7e --- /dev/null +++ b/twilio/rest/video/v1/recording.py @@ -0,0 +1,156 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class RecordingContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(RecordingContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Recordings/${sid}' + + + def delete(self): + + + """ + Deletes the RecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RecordingInstance + + :returns: The fetched RecordingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RecordingInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RecordingInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(RecordingInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'status' = payload.get('status'), + 'date_created' = payload.get('date_created'), + 'sid' = payload.get('sid'), + 'source_sid' = payload.get('source_sid'), + 'size' = payload.get('size'), + 'url' = payload.get('url'), + 'type' = payload.get('type'), + 'duration' = payload.get('duration'), + 'container_format' = payload.get('container_format'), + 'codec' = payload.get('codec'), + 'grouping_sids' = payload.get('grouping_sids'), + 'track_name' = payload.get('track_name'), + 'offset' = payload.get('offset'), + 'media_external_location' = payload.get('media_external_location'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RecordingContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RecordingListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RecordingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Recordings' + + + def page(self, status, source_sid, grouping_sid, date_created_after, date_created_before, media_type, page_size): + + data = values.of({ + 'status': status,'source_sid': source_sid,'grouping_sid': grouping_sid,'date_created_after': date_created_after,'date_created_before': date_created_before,'media_type': media_type,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RecordingPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/recording_settings.py b/twilio/rest/video/v1/recording_settings.py index 98e1e94be1..eaeafaddc9 100644 --- a/twilio/rest/video/v1/recording_settings.py +++ b/twilio/rest/video/v1/recording_settings.py @@ -1,312 +1,128 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RecordingSettingsList(ListResource): - - def __init__(self, version): - """ - Initialize the RecordingSettingsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.recording_settings.RecordingSettingsList - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsList - """ - super(RecordingSettingsList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a RecordingSettingsContext - - :returns: twilio.rest.video.v1.recording_settings.RecordingSettingsContext - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsContext - """ - return RecordingSettingsContext(self._version, ) - - def __call__(self): - """ - Constructs a RecordingSettingsContext - - :returns: twilio.rest.video.v1.recording_settings.RecordingSettingsContext - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsContext - """ - return RecordingSettingsContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - -class RecordingSettingsPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the RecordingSettingsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.recording_settings.RecordingSettingsPage - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsPage - """ - super(RecordingSettingsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingSettingsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - """ - return RecordingSettingsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class RecordingSettingsContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the RecordingSettingsContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.recording_settings.RecordingSettingsContext - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsContext - """ - super(RecordingSettingsContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RecordingSettingsContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/RecordingSettings/Default'.format(**self._solution) - - def fetch(self): - """ - Fetch the RecordingSettingsInstance - - :returns: The fetched RecordingSettingsInstance - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RecordingSettingsInstance(self._version, payload, ) - - def create(self, friendly_name, aws_credentials_sid=values.unset, - encryption_key_sid=values.unset, aws_s3_url=values.unset, - aws_storage_enabled=values.unset, encryption_enabled=values.unset): - """ - Create the RecordingSettingsInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode aws_credentials_sid: The SID of the stored Credential resource - :param unicode encryption_key_sid: The SID of the Public Key resource to use for encryption - :param unicode aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored - :param bool aws_storage_enabled: Whether all recordings should be written to the aws_s3_url - :param bool encryption_enabled: Whether all recordings should be stored in an encrypted form - - :returns: The created RecordingSettingsInstance - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'AwsCredentialsSid': aws_credentials_sid, - 'EncryptionKeySid': encryption_key_sid, - 'AwsS3Url': aws_s3_url, - 'AwsStorageEnabled': aws_storage_enabled, - 'EncryptionEnabled': encryption_enabled, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RecordingSettingsInstance(self._version, payload, ) + self._solution = { } + self._uri = '/RecordingSettings/Default' + + + def create(self, body): + + + + + def fetch(self): + + """ + Fetch the RecordingSettingsInstance + + :returns: The fetched RecordingSettingsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RecordingSettingsInstance( + self._version, + payload, + =self._solution[], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RecordingSettingsInstance(InstanceResource): +class RecordingSettingsInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the RecordingSettingsInstance - - :returns: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - """ super(RecordingSettingsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'aws_credentials_sid': payload.get('aws_credentials_sid'), - 'aws_s3_url': payload.get('aws_s3_url'), - 'aws_storage_enabled': payload.get('aws_storage_enabled'), - 'encryption_key_sid': payload.get('encryption_key_sid'), - 'encryption_enabled': payload.get('encryption_enabled'), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'aws_credentials_sid' = payload.get('aws_credentials_sid'), + 'aws_s3_url' = payload.get('aws_s3_url'), + 'aws_storage_enabled' = payload.get('aws_storage_enabled'), + 'encryption_key_sid' = payload.get('encryption_key_sid'), + 'encryption_enabled' = payload.get('encryption_enabled'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingSettingsContext for this RecordingSettingsInstance - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsContext - """ if self._context is None: - self._context = RecordingSettingsContext(self._version, ) + self._context = RecordingSettingsContext( + self._version, + + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def aws_credentials_sid(self): - """ - :returns: The SID of the stored Credential resource - :rtype: unicode - """ - return self._properties['aws_credentials_sid'] - - @property - def aws_s3_url(self): - """ - :returns: The URL of the AWS S3 bucket where the recordings are stored - :rtype: unicode - """ - return self._properties['aws_s3_url'] - - @property - def aws_storage_enabled(self): - """ - :returns: Whether all recordings are written to the aws_s3_url - :rtype: bool - """ - return self._properties['aws_storage_enabled'] - - @property - def encryption_key_sid(self): - """ - :returns: The SID of the Public Key resource used for encryption - :rtype: unicode - """ - return self._properties['encryption_key_sid'] - - @property - def encryption_enabled(self): - """ - :returns: Whether all recordings are stored in an encrypted form - :rtype: bool - """ - return self._properties['encryption_enabled'] + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the RecordingSettingsInstance - :returns: The fetched RecordingSettingsInstance - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - """ - return self._proxy.fetch() - def create(self, friendly_name, aws_credentials_sid=values.unset, - encryption_key_sid=values.unset, aws_s3_url=values.unset, - aws_storage_enabled=values.unset, encryption_enabled=values.unset): - """ - Create the RecordingSettingsInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode aws_credentials_sid: The SID of the stored Credential resource - :param unicode encryption_key_sid: The SID of the Public Key resource to use for encryption - :param unicode aws_s3_url: The URL of the AWS S3 bucket where the recordings should be stored - :param bool aws_storage_enabled: Whether all recordings should be written to the aws_s3_url - :param bool encryption_enabled: Whether all recordings should be stored in an encrypted form +class RecordingSettingsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RecordingSettingsListInstanceList, self).__init__(version) - :returns: The created RecordingSettingsInstance - :rtype: twilio.rest.video.v1.recording_settings.RecordingSettingsInstance - """ - return self._proxy.create( - friendly_name, - aws_credentials_sid=aws_credentials_sid, - encryption_key_sid=encryption_key_sid, - aws_s3_url=aws_s3_url, - aws_storage_enabled=aws_storage_enabled, - encryption_enabled=encryption_enabled, - ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/video/v1/room.py b/twilio/rest/video/v1/room.py new file mode 100644 index 0000000000..25520a0c0b --- /dev/null +++ b/twilio/rest/video/v1/room.py @@ -0,0 +1,184 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.room.participant import ParticipantListInstancefrom twilio.rest.room.recording_rules import RecordingRulesListInstancefrom twilio.rest.room.room_recording import RoomRecordingListInstance + + +class RoomContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(RoomContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Rooms/${sid}' + + self._participants = None + self._recording_rules = None + self._recordings = None + + def fetch(self): + + """ + Fetch the RoomInstance + + :returns: The fetched RoomInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoomInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RoomInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RoomInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(RoomInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'status' = payload.get('status'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'account_sid' = payload.get('account_sid'), + 'enable_turn' = payload.get('enable_turn'), + 'unique_name' = payload.get('unique_name'), + 'status_callback' = payload.get('status_callback'), + 'status_callback_method' = payload.get('status_callback_method'), + 'end_time' = payload.get('end_time'), + 'duration' = payload.get('duration'), + 'type' = payload.get('type'), + 'max_participants' = payload.get('max_participants'), + 'max_participant_duration' = payload.get('max_participant_duration'), + 'max_concurrent_published_tracks' = payload.get('max_concurrent_published_tracks'), + 'record_participants_on_connect' = payload.get('record_participants_on_connect'), + 'video_codecs' = payload.get('video_codecs'), + 'media_region' = payload.get('media_region'), + 'audio_only' = payload.get('audio_only'), + 'empty_room_timeout' = payload.get('empty_room_timeout'), + 'unused_room_timeout' = payload.get('unused_room_timeout'), + 'large_room' = payload.get('large_room'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RoomContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def participants(self): + return self._proxy.participants + @property + def recording_rules(self): + return self._proxy.recording_rules + @property + def recordings(self): + return self._proxy.recordings + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RoomListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RoomListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Rooms' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RoomInstance(self._version, payload, ) + + + def page(self, status, unique_name, date_created_after, date_created_before, page_size): + + data = values.of({ + 'status': status,'unique_name': unique_name,'date_created_after': date_created_after,'date_created_before': date_created_before,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RoomPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/room/participant.py b/twilio/rest/video/v1/room/participant.py new file mode 100644 index 0000000000..3d26370cff --- /dev/null +++ b/twilio/rest/video/v1/room/participant.py @@ -0,0 +1,166 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.participant.anonymize import AnonymizeListInstancefrom twilio.rest.participant.published_track import PublishedTrackListInstancefrom twilio.rest.participant.subscribe_rules import SubscribeRulesListInstancefrom twilio.rest.participant.subscribed_track import SubscribedTrackListInstance + + +class ParticipantContext(InstanceContext): + def __init__(self, version: V1, room_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ParticipantContextList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, sid, } + self._uri = '/Rooms/${room_sid}/Participants/${sid}' + + self._anonymize = None + self._published_tracks = None + self._subscribe_rules = None + self._subscribed_tracks = None + + def fetch(self): + + """ + Fetch the ParticipantInstance + + :returns: The fetched ParticipantInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ParticipantInstance( + self._version, + payload, + room_sidsid=self._solution['room_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ParticipantInstance(self._version, payload, room_sid=self._solution['room_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ParticipantInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str, sid: str): + super(ParticipantInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'room_sid' = payload.get('room_sid'), + 'account_sid' = payload.get('account_sid'), + 'status' = payload.get('status'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'duration' = payload.get('duration'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ParticipantContext( + self._version, + room_sid=self._solution['room_sid'],sid=self._solution['sid'], + ) + return self._context + + @property + def anonymize(self): + return self._proxy.anonymize + @property + def published_tracks(self): + return self._proxy.published_tracks + @property + def subscribe_rules(self): + return self._proxy.subscribe_rules + @property + def subscribed_tracks(self): + return self._proxy.subscribed_tracks + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ParticipantListInstance(ListResource): + def __init__(self, version: V1, room_sid: str): + # TODO: needs autogenerated docs + super(ParticipantListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, } + self._uri = '/Rooms/${room_sid}/Participants' + + + def page(self, status, identity, date_created_after, date_created_before, page_size): + + data = values.of({ + 'status': status,'identity': identity,'date_created_after': date_created_after,'date_created_before': date_created_before,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ParticipantPage(self._version, payload, room_sid=self._solution['room_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/room/participant/anonymize.py b/twilio/rest/video/v1/room/participant/anonymize.py new file mode 100644 index 0000000000..49a7230728 --- /dev/null +++ b/twilio/rest/video/v1/room/participant/anonymize.py @@ -0,0 +1,120 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + +class AnonymizeContext(InstanceContext): + def __init__(self, version: V1, room_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AnonymizeContextList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, sid, } + self._uri = '/Rooms/${room_sid}/Participants/${sid}/Anonymize' + + + def update(self): + data = values.of({ + + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return AnonymizeInstance(self._version, payload, room_sid=self._solution['room_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class AnonymizeInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str, sid: str): + super(AnonymizeInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'room_sid' = payload.get('room_sid'), + 'account_sid' = payload.get('account_sid'), + 'status' = payload.get('status'), + 'identity' = payload.get('identity'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'start_time' = payload.get('start_time'), + 'end_time' = payload.get('end_time'), + 'duration' = payload.get('duration'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = AnonymizeContext( + self._version, + room_sid=self._solution['room_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class AnonymizeListInstance(ListResource): + def __init__(self, version: V1, room_sid: str, sid: str): + # TODO: needs autogenerated docs + super(AnonymizeListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, sid, } + self._uri = '' + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/room/participant/published_track.py b/twilio/rest/video/v1/room/participant/published_track.py new file mode 100644 index 0000000000..b0a346896e --- /dev/null +++ b/twilio/rest/video/v1/room/participant/published_track.py @@ -0,0 +1,136 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class PublishedTrackContext(InstanceContext): + def __init__(self, version: V1, room_sid: str, participant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(PublishedTrackContextList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, participant_sid, sid, } + self._uri = '/Rooms/${room_sid}/Participants/${participant_sid}/PublishedTracks/${sid}' + + + def fetch(self): + + """ + Fetch the PublishedTrackInstance + + :returns: The fetched PublishedTrackInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return PublishedTrackInstance( + self._version, + payload, + room_sidparticipant_sidsid=self._solution['room_sid''participant_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class PublishedTrackInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str, participant_sid: str, sid: str): + super(PublishedTrackInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'participant_sid' = payload.get('participant_sid'), + 'room_sid' = payload.get('room_sid'), + 'name' = payload.get('name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'enabled' = payload.get('enabled'), + 'kind' = payload.get('kind'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid']'participant_sid': participant_sid or self._properties['participant_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = PublishedTrackContext( + self._version, + room_sid=self._solution['room_sid'],participant_sid=self._solution['participant_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class PublishedTrackListInstance(ListResource): + def __init__(self, version: V1, room_sid: str, participant_sid: str): + # TODO: needs autogenerated docs + super(PublishedTrackListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, participant_sid, } + self._uri = '/Rooms/${room_sid}/Participants/${participant_sid}/PublishedTracks' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return PublishedTrackPage(self._version, payload, room_sid=self._solution['room_sid']participant_sid=self._solution['participant_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py new file mode 100644 index 0000000000..2a02a7a401 --- /dev/null +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -0,0 +1,91 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + + +class SubscribeRulesInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str, participant_sid: str): + super(SubscribeRulesInstance, self).__init__(version) + self._properties = { + 'participant_sid' = payload.get('participant_sid'), + 'room_sid' = payload.get('room_sid'), + 'rules' = payload.get('rules'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid']'participant_sid': participant_sid or self._properties['participant_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SubscribeRulesContext( + self._version, + room_sid=self._solution['room_sid'],participant_sid=self._solution['participant_sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SubscribeRulesListInstance(ListResource): + def __init__(self, version: V1, room_sid: str, participant_sid: str): + # TODO: needs autogenerated docs + super(SubscribeRulesListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, participant_sid, } + self._uri = '/Rooms/${room_sid}/Participants/${participant_sid}/SubscribeRules' + + + def fetch(self): + + + + def update(self, body): + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/room/participant/subscribed_track.py b/twilio/rest/video/v1/room/participant/subscribed_track.py new file mode 100644 index 0000000000..72192b9dea --- /dev/null +++ b/twilio/rest/video/v1/room/participant/subscribed_track.py @@ -0,0 +1,137 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class SubscribedTrackContext(InstanceContext): + def __init__(self, version: V1, room_sid: str, participant_sid: str, sid: str): + # TODO: needs autogenerated docs + super(SubscribedTrackContextList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, participant_sid, sid, } + self._uri = '/Rooms/${room_sid}/Participants/${participant_sid}/SubscribedTracks/${sid}' + + + def fetch(self): + + """ + Fetch the SubscribedTrackInstance + + :returns: The fetched SubscribedTrackInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SubscribedTrackInstance( + self._version, + payload, + room_sidparticipant_sidsid=self._solution['room_sid''participant_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SubscribedTrackInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str, participant_sid: str, sid: str): + super(SubscribedTrackInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'participant_sid' = payload.get('participant_sid'), + 'publisher_sid' = payload.get('publisher_sid'), + 'room_sid' = payload.get('room_sid'), + 'name' = payload.get('name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'enabled' = payload.get('enabled'), + 'kind' = payload.get('kind'), + 'url' = payload.get('url'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid']'participant_sid': participant_sid or self._properties['participant_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SubscribedTrackContext( + self._version, + room_sid=self._solution['room_sid'],participant_sid=self._solution['participant_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SubscribedTrackListInstance(ListResource): + def __init__(self, version: V1, room_sid: str, participant_sid: str): + # TODO: needs autogenerated docs + super(SubscribedTrackListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, participant_sid, } + self._uri = '/Rooms/${room_sid}/Participants/${participant_sid}/SubscribedTracks' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SubscribedTrackPage(self._version, payload, room_sid=self._solution['room_sid']participant_sid=self._solution['participant_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py new file mode 100644 index 0000000000..b88051e2e2 --- /dev/null +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -0,0 +1,90 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + + + + + +class RecordingRulesInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str): + super(RecordingRulesInstance, self).__init__(version) + self._properties = { + 'room_sid' = payload.get('room_sid'), + 'rules' = payload.get('rules'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RecordingRulesContext( + self._version, + room_sid=self._solution['room_sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RecordingRulesListInstance(ListResource): + def __init__(self, version: V1, room_sid: str): + # TODO: needs autogenerated docs + super(RecordingRulesListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, } + self._uri = '/Rooms/${room_sid}/RecordingRules' + + + def fetch(self): + + + + def update(self, body): + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/video/v1/room/room_recording.py b/twilio/rest/video/v1/room/room_recording.py new file mode 100644 index 0000000000..ab4c2b1182 --- /dev/null +++ b/twilio/rest/video/v1/room/room_recording.py @@ -0,0 +1,155 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + + + + +class RoomRecordingContext(InstanceContext): + def __init__(self, version: V1, room_sid: str, sid: str): + # TODO: needs autogenerated docs + super(RoomRecordingContextList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, sid, } + self._uri = '/Rooms/${room_sid}/Recordings/${sid}' + + + def delete(self): + + + """ + Deletes the RoomRecordingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RoomRecordingInstance + + :returns: The fetched RoomRecordingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RoomRecordingInstance( + self._version, + payload, + room_sidsid=self._solution['room_sid''sid'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class RoomRecordingInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str, sid: str): + super(RoomRecordingInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'status' = payload.get('status'), + 'date_created' = payload.get('date_created'), + 'sid' = payload.get('sid'), + 'source_sid' = payload.get('source_sid'), + 'size' = payload.get('size'), + 'url' = payload.get('url'), + 'type' = payload.get('type'), + 'duration' = payload.get('duration'), + 'container_format' = payload.get('container_format'), + 'codec' = payload.get('codec'), + 'grouping_sids' = payload.get('grouping_sids'), + 'track_name' = payload.get('track_name'), + 'offset' = payload.get('offset'), + 'media_external_location' = payload.get('media_external_location'), + 'room_sid' = payload.get('room_sid'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'room_sid': room_sid or self._properties['room_sid']'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = RoomRecordingContext( + self._version, + room_sid=self._solution['room_sid'],sid=self._solution['sid'], + ) + return self._context + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class RoomRecordingListInstance(ListResource): + def __init__(self, version: V1, room_sid: str): + # TODO: needs autogenerated docs + super(RoomRecordingListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { room_sid, } + self._uri = '/Rooms/${room_sid}/Recordings' + + + def page(self, status, source_sid, date_created_after, date_created_before, page_size): + + data = values.of({ + 'status': status,'source_sid': source_sid,'date_created_after': date_created_after,'date_created_before': date_created_before,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RoomRecordingPage(self._version, payload, room_sid=self._solution['room_sid']) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/voice/__init__.py b/twilio/rest/voice/__init__.py index 192ed8be8f..be8d319a08 100644 --- a/twilio/rest/voice/__init__.py +++ b/twilio/rest/voice/__init__.py @@ -1,87 +1,94 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.voice.v1 import V1 + Twilio - Voice + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Voice(Domain): +from twilio.base.domain import Domain +from twilio.rest.Voice.v1 import V1 +class Voice(Domain): def __init__(self, twilio): """ Initialize the Voice Domain :returns: Domain for Voice - :rtype: twilio.rest.voice.Voice + :rtype: twilio.rest.v1.Voice """ super(Voice, self).__init__(twilio) - - self.base_url = 'https://voice.twilio.com' - - # Versions - self._v1 = None + self.base_url = 'https://Voice.twilio.com' + self._V1 = None @property - def v1(self): + def V1(self): """ - :returns: Version v1 of voice - :rtype: twilio.rest.voice.v1.V1 + :returns: Versions v1 of Voice + :rtype: twilio.rest.Voice.v1 """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def archived_calls(self): """ - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallList + :rtype: twilio.rest.v1.archived_calls """ return self.v1.archived_calls + @property def byoc_trunks(self): """ - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkList + :rtype: twilio.rest.v1.byoc_trunks """ return self.v1.byoc_trunks + @property def connection_policies(self): """ - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyList + :rtype: twilio.rest.v1.connection_policies """ return self.v1.connection_policies + @property def dialing_permissions(self): """ - :rtype: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsList + :rtype: twilio.rest.v1.dialing_permissions """ return self.v1.dialing_permissions + @property def ip_records(self): """ - :rtype: twilio.rest.voice.v1.ip_record.IpRecordList + :rtype: twilio.rest.v1.ip_records """ return self.v1.ip_records + @property def source_ip_mappings(self): """ - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingList + :rtype: twilio.rest.v1.source_ip_mappings """ return self.v1.source_ip_mappings + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/voice/v1/.openapi-generator-ignore b/twilio/rest/voice/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/voice/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/voice/v1/.openapi-generator/FILES b/twilio/rest/voice/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..1a4a0093c7 --- /dev/null +++ b/twilio/rest/voice/v1/.openapi-generator/FILES @@ -0,0 +1,23 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +archived_call.py +byoc_trunk.py +connection_policy.py +connection_policy/connection_policy_target.py +dialing_permissions.py +dialing_permissions/bulk_country_update.py +dialing_permissions/country.py +dialing_permissions/country/highrisk_special_prefix.py +dialing_permissions/settings.py +ip_record.py +source_ip_mapping.py diff --git a/twilio/rest/voice/v1/.openapi-generator/VERSION b/twilio/rest/voice/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/voice/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/voice/v1/archived_call.py b/twilio/rest/voice/v1/archived_call.py index d64b3b097b..120d65782f 100644 --- a/twilio/rest/voice/v1/archived_call.py +++ b/twilio/rest/voice/v1/archived_call.py @@ -1,231 +1,77 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - -class ArchivedCallList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version): - """ - Initialize the ArchivedCallList - :param Version version: Version that contains the resource - :returns: twilio.rest.voice.v1.archived_call.ArchivedCallList - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallList - """ - super(ArchivedCallList, self).__init__(version) +class ArchivedCallContext(InstanceContext): + def __init__(self, version: V1, date: date, sid: str): + # TODO: needs autogenerated docs + super(ArchivedCallContextList, self).__init__(version) # Path Solution - self._solution = {} - - def get(self, date, sid): - """ - Constructs a ArchivedCallContext - - :param date: The date of the Call in UTC. - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.voice.v1.archived_call.ArchivedCallContext - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext - """ - return ArchivedCallContext(self._version, date=date, sid=sid, ) - - def __call__(self, date, sid): - """ - Constructs a ArchivedCallContext - - :param date: The date of the Call in UTC. - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.voice.v1.archived_call.ArchivedCallContext - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext - """ - return ArchivedCallContext(self._version, date=date, sid=sid, ) + self._solution = { date, sid, } + self._uri = '/Archives/${date}/Calls/${sid}' + + + def delete(self): + + + """ + Deletes the ArchivedCallInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' -class ArchivedCallPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, response, solution): - """ - Initialize the ArchivedCallPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.voice.v1.archived_call.ArchivedCallPage - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallPage - """ - super(ArchivedCallPage, self).__init__(version, response) +class ArchivedCallListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ArchivedCallListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ArchivedCallInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.archived_call.ArchivedCallInstance - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallInstance - """ - return ArchivedCallInstance(self._version, payload, ) + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class ArchivedCallContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, date, sid): - """ - Initialize the ArchivedCallContext - - :param Version version: Version that contains the resource - :param date: The date of the Call in UTC. - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.voice.v1.archived_call.ArchivedCallContext - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext - """ - super(ArchivedCallContext, self).__init__(version) + return '' - # Path Solution - self._solution = {'date': date, 'sid': sid, } - self._uri = '/Archives/{date}/Calls/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the ArchivedCallInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ArchivedCallInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, date=None, sid=None): - """ - Initialize the ArchivedCallInstance - - :returns: twilio.rest.voice.v1.archived_call.ArchivedCallInstance - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallInstance - """ - super(ArchivedCallInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'date': deserialize.iso8601_date(payload.get('date')), - 'sid': payload.get('sid'), - 'url': payload.get('url'), - } - - # Context - self._context = None - self._solution = {'date': date or self._properties['date'], 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ArchivedCallContext for this ArchivedCallInstance - :rtype: twilio.rest.voice.v1.archived_call.ArchivedCallContext - """ - if self._context is None: - self._context = ArchivedCallContext( - self._version, - date=self._solution['date'], - sid=self._solution['sid'], - ) - return self._context - - @property - def date(self): - """ - :returns: date - :rtype: date - """ - return self._properties['date'] - - @property - def sid(self): - """ - :returns: sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the ArchivedCallInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index e1a25bf9ab..52ee889fab 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -1,539 +1,174 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ByocTrunkList(ListResource): - - def __init__(self, version): - """ - Initialize the ByocTrunkList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.voice.v1.byoc_trunk.ByocTrunkList - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkList - """ - super(ByocTrunkList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/ByocTrunks'.format(**self._solution) - - def create(self, friendly_name=values.unset, voice_url=values.unset, - voice_method=values.unset, voice_fallback_url=values.unset, - voice_fallback_method=values.unset, status_callback_url=values.unset, - status_callback_method=values.unset, - cnam_lookup_enabled=values.unset, connection_policy_sid=values.unset, - from_domain_sid=values.unset): - """ - Create the ByocTrunkInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode voice_url: The URL we should call when receiving a call - :param unicode voice_method: The HTTP method to use with voice_url - :param unicode voice_fallback_url: The URL we should call when an error occurs in executing TwiML - :param unicode voice_fallback_method: The HTTP method to use with voice_fallback_url - :param unicode status_callback_url: The URL that we should call to pass status updates - :param unicode status_callback_method: The HTTP method we should use to call `status_callback_url` - :param bool cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk - :param unicode connection_policy_sid: Origination Connection Policy (to your Carrier) - :param unicode from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls - - :returns: The created ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'VoiceUrl': voice_url, - 'VoiceMethod': voice_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'StatusCallbackUrl': status_callback_url, - 'StatusCallbackMethod': status_callback_method, - 'CnamLookupEnabled': cnam_lookup_enabled, - 'ConnectionPolicySid': connection_policy_sid, - 'FromDomainSid': from_domain_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ByocTrunkInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ByocTrunkInstance 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 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.voice.v1.byoc_trunk.ByocTrunkInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ByocTrunkInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.voice.v1.byoc_trunk.ByocTrunkInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ByocTrunkInstance records from the API. - Request is executed immediately - - :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 ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ByocTrunkPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ByocTrunkInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ByocTrunkPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ByocTrunkContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.byoc_trunk.ByocTrunkContext - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkContext - """ - return ByocTrunkContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ByocTrunkContext - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.byoc_trunk.ByocTrunkContext - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkContext - """ - return ByocTrunkContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ByocTrunkPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ByocTrunkPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.voice.v1.byoc_trunk.ByocTrunkPage - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkPage - """ - super(ByocTrunkPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ByocTrunkInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - """ - return ByocTrunkInstance(self._version, payload, ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class ByocTrunkContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ByocTrunkContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.byoc_trunk.ByocTrunkContext - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkContext - """ - super(ByocTrunkContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ByocTrunkContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/ByocTrunks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ByocTrunkInstance - - :returns: The fetched ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ByocTrunkInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset, voice_url=values.unset, - voice_method=values.unset, voice_fallback_url=values.unset, - voice_fallback_method=values.unset, status_callback_url=values.unset, - status_callback_method=values.unset, - cnam_lookup_enabled=values.unset, connection_policy_sid=values.unset, - from_domain_sid=values.unset): - """ - Update the ByocTrunkInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode voice_url: The URL we should call when receiving a call - :param unicode voice_method: The HTTP method we should use with voice_url - :param unicode voice_fallback_url: The URL we should call when an error occurs in executing TwiML - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode status_callback_url: The URL that we should call to pass status updates - :param unicode status_callback_method: The HTTP method we should use to call status_callback_url - :param bool cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk - :param unicode connection_policy_sid: Origination Connection Policy (to your Carrier) - :param unicode from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls - - :returns: The updated ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'VoiceUrl': voice_url, - 'VoiceMethod': voice_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'StatusCallbackUrl': status_callback_url, - 'StatusCallbackMethod': status_callback_method, - 'CnamLookupEnabled': cnam_lookup_enabled, - 'ConnectionPolicySid': connection_policy_sid, - 'FromDomainSid': from_domain_sid, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ByocTrunkInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the ByocTrunkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/ByocTrunks/${sid}' + + + def delete(self): + + + """ + Deletes the ByocTrunkInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ByocTrunkInstance + + :returns: The fetched ByocTrunkInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ByocTrunkInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ByocTrunkInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ByocTrunkInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the ByocTrunkInstance - :returns: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - """ +class ByocTrunkInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(ByocTrunkInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'voice_url': payload.get('voice_url'), - 'voice_method': payload.get('voice_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'status_callback_url': payload.get('status_callback_url'), - 'status_callback_method': payload.get('status_callback_method'), - 'cnam_lookup_enabled': payload.get('cnam_lookup_enabled'), - 'connection_policy_sid': payload.get('connection_policy_sid'), - 'from_domain_sid': payload.get('from_domain_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'voice_url' = payload.get('voice_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'status_callback_url' = payload.get('status_callback_url'), + 'status_callback_method' = payload.get('status_callback_method'), + 'cnam_lookup_enabled' = payload.get('cnam_lookup_enabled'), + 'connection_policy_sid' = payload.get('connection_policy_sid'), + 'from_domain_sid' = payload.get('from_domain_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ByocTrunkContext for this ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkContext - """ if self._context is None: - self._context = ByocTrunkContext(self._version, sid=self._solution['sid'], ) + self._context = ByocTrunkContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def voice_url(self): - """ - :returns: The URL we call when receiving a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method to use with voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs while executing TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def status_callback_url(self): - """ - :returns: The URL that we call with status updates - :rtype: unicode - """ - return self._properties['status_callback_url'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback_url - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def cnam_lookup_enabled(self): - """ - :returns: Whether Caller ID Name (CNAM) lookup is enabled for the trunk - :rtype: bool - """ - return self._properties['cnam_lookup_enabled'] - - @property - def connection_policy_sid(self): - """ - :returns: Origination Connection Policy (to your Carrier) - :rtype: unicode - """ - return self._properties['connection_policy_sid'] + - @property - def from_domain_sid(self): - """ - :returns: The SID of the SIP Domain that should be used in the `From` header of originating calls - :rtype: unicode - """ - return self._properties['from_domain_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): + def __repr__(self): """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_updated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - def fetch(self): - """ - Fetch the ByocTrunkInstance - :returns: The fetched ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, voice_url=values.unset, - voice_method=values.unset, voice_fallback_url=values.unset, - voice_fallback_method=values.unset, status_callback_url=values.unset, - status_callback_method=values.unset, - cnam_lookup_enabled=values.unset, connection_policy_sid=values.unset, - from_domain_sid=values.unset): - """ - Update the ByocTrunkInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode voice_url: The URL we should call when receiving a call - :param unicode voice_method: The HTTP method we should use with voice_url - :param unicode voice_fallback_url: The URL we should call when an error occurs in executing TwiML - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode status_callback_url: The URL that we should call to pass status updates - :param unicode status_callback_method: The HTTP method we should use to call status_callback_url - :param bool cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk - :param unicode connection_policy_sid: Origination Connection Policy (to your Carrier) - :param unicode from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls - - :returns: The updated ByocTrunkInstance - :rtype: twilio.rest.voice.v1.byoc_trunk.ByocTrunkInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - voice_url=voice_url, - voice_method=voice_method, - voice_fallback_url=voice_fallback_url, - voice_fallback_method=voice_fallback_method, - status_callback_url=status_callback_url, - status_callback_method=status_callback_method, - cnam_lookup_enabled=cnam_lookup_enabled, - connection_policy_sid=connection_policy_sid, - from_domain_sid=from_domain_sid, - ) - - def delete(self): - """ - Deletes the ByocTrunkInstance +class ByocTrunkListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ByocTrunkListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/ByocTrunks' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ByocTrunkInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ByocTrunkPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/voice/v1/connection_policy.py b/twilio/rest/voice/v1/connection_policy.py new file mode 100644 index 0000000000..345da73e43 --- /dev/null +++ b/twilio/rest/voice/v1/connection_policy.py @@ -0,0 +1,170 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.connection_policy.connection_policy_target import ConnectionPolicyTargetListInstance + + +class ConnectionPolicyContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(ConnectionPolicyContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/ConnectionPolicies/${sid}' + + self._targets = None + + def delete(self): + + + """ + Deletes the ConnectionPolicyInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ConnectionPolicyInstance + + :returns: The fetched ConnectionPolicyInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConnectionPolicyInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ConnectionPolicyInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class ConnectionPolicyInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(ConnectionPolicyInstance, self).__init__(version) + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = ConnectionPolicyContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def targets(self): + return self._proxy.targets + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class ConnectionPolicyListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(ConnectionPolicyListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/ConnectionPolicies' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ConnectionPolicyInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ConnectionPolicyPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py index c0477e110f..1f4c9a07f1 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -1,497 +1,170 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class ConnectionPolicyTargetList(ListResource): - - def __init__(self, version, connection_policy_sid): - """ - Initialize the ConnectionPolicyTargetList - - :param Version version: Version that contains the resource - :param connection_policy_sid: The SID of the Connection Policy that owns the Target - - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetList - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetList - """ - super(ConnectionPolicyTargetList, self).__init__(version) - - # Path Solution - self._solution = {'connection_policy_sid': connection_policy_sid, } - self._uri = '/ConnectionPolicies/{connection_policy_sid}/Targets'.format(**self._solution) - - def create(self, target, friendly_name=values.unset, priority=values.unset, - weight=values.unset, enabled=values.unset): - """ - Create the ConnectionPolicyTargetInstance - - :param unicode target: The SIP address you want Twilio to route your calls to - :param unicode friendly_name: A string to describe the resource - :param unicode priority: The relative importance of the target - :param unicode weight: The value that determines the relative load the Target should receive compared to others with the same priority - :param bool enabled: Whether the Target is enabled - - :returns: The created ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - """ - data = values.of({ - 'Target': target, - 'FriendlyName': friendly_name, - 'Priority': priority, - 'Weight': weight, - 'Enabled': enabled, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ConnectionPolicyTargetInstance( - self._version, - payload, - connection_policy_sid=self._solution['connection_policy_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams ConnectionPolicyTargetInstance 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 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.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ConnectionPolicyTargetInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConnectionPolicyTargetInstance records from the API. - Request is executed immediately - - :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 ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConnectionPolicyTargetPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConnectionPolicyTargetInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConnectionPolicyTargetPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConnectionPolicyTargetContext - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetContext - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetContext - """ - return ConnectionPolicyTargetContext( - self._version, - connection_policy_sid=self._solution['connection_policy_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ConnectionPolicyTargetContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetContext - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetContext - """ - return ConnectionPolicyTargetContext( - self._version, - connection_policy_sid=self._solution['connection_policy_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConnectionPolicyTargetPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConnectionPolicyTargetPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param connection_policy_sid: The SID of the Connection Policy that owns the Target - - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetPage - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetPage - """ - super(ConnectionPolicyTargetPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConnectionPolicyTargetInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - """ - return ConnectionPolicyTargetInstance( - self._version, - payload, - connection_policy_sid=self._solution['connection_policy_sid'], - ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class ConnectionPolicyTargetContext(InstanceContext): - - def __init__(self, version, connection_policy_sid, sid): - """ - Initialize the ConnectionPolicyTargetContext - - :param Version version: Version that contains the resource - :param connection_policy_sid: The SID of the Connection Policy that owns the Target - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetContext - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetContext - """ - super(ConnectionPolicyTargetContext, self).__init__(version) + def __init__(self, version: V1, connection_policy_sid: str, sid: str): + # TODO: needs autogenerated docs + super(ConnectionPolicyTargetContextList, self).__init__(version) # Path Solution - self._solution = {'connection_policy_sid': connection_policy_sid, 'sid': sid, } - self._uri = '/ConnectionPolicies/{connection_policy_sid}/Targets/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the ConnectionPolicyTargetInstance - - :returns: The fetched ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConnectionPolicyTargetInstance( - self._version, - payload, - connection_policy_sid=self._solution['connection_policy_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, target=values.unset, - priority=values.unset, weight=values.unset, enabled=values.unset): - """ - Update the ConnectionPolicyTargetInstance + self._solution = { connection_policy_sid, sid, } + self._uri = '/ConnectionPolicies/${connection_policy_sid}/Targets/${sid}' + + + def delete(self): + + + """ + Deletes the ConnectionPolicyTargetInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ConnectionPolicyTargetInstance + + :returns: The fetched ConnectionPolicyTargetInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return ConnectionPolicyTargetInstance( + self._version, + payload, + connection_policy_sidsid=self._solution['connection_policy_sid''sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :param unicode friendly_name: A string to describe the resource - :param unicode target: The SIP address you want Twilio to route your calls to - :param unicode priority: The relative importance of the target - :param unicode weight: The value that determines the relative load the Target should receive compared to others with the same priority - :param bool enabled: Whether the Target is enabled + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The updated ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Target': target, - 'Priority': priority, - 'Weight': weight, - 'Enabled': enabled, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ConnectionPolicyTargetInstance( - self._version, - payload, - connection_policy_sid=self._solution['connection_policy_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the ConnectionPolicyTargetInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + return ConnectionPolicyTargetInstance(self._version, payload, connection_policy_sid=self._solution['connection_policy_sid'], sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ConnectionPolicyTargetInstance(InstanceResource): - def __init__(self, version, payload, connection_policy_sid, sid=None): - """ - Initialize the ConnectionPolicyTargetInstance - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - """ +class ConnectionPolicyTargetInstance(InstanceResource): + def __init__(self, version, payload, connection_policy_sid: str, sid: str): super(ConnectionPolicyTargetInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'connection_policy_sid': payload.get('connection_policy_sid'), - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'target': payload.get('target'), - 'priority': deserialize.integer(payload.get('priority')), - 'weight': deserialize.integer(payload.get('weight')), - 'enabled': payload.get('enabled'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'connection_policy_sid' = payload.get('connection_policy_sid'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'target' = payload.get('target'), + 'priority' = payload.get('priority'), + 'weight' = payload.get('weight'), + 'enabled' = payload.get('enabled'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None self._solution = { - 'connection_policy_sid': connection_policy_sid, - 'sid': sid or self._properties['sid'], + 'connection_policy_sid': connection_policy_sid or self._properties['connection_policy_sid']'sid': sid or self._properties['sid'] } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConnectionPolicyTargetContext for this ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetContext - """ if self._context is None: self._context = ConnectionPolicyTargetContext( self._version, - connection_policy_sid=self._solution['connection_policy_sid'], - sid=self._solution['sid'], + connection_policy_sid=self._solution['connection_policy_sid'],sid=self._solution['sid'], ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def connection_policy_sid(self): - """ - :returns: The SID of the Connection Policy that owns the Target - :rtype: unicode - """ - return self._properties['connection_policy_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] + - @property - def target(self): - """ - :returns: The SIP address you want Twilio to route your calls to - :rtype: unicode - """ - return self._properties['target'] - - @property - def priority(self): - """ - :returns: The relative importance of the target - :rtype: unicode - """ - return self._properties['priority'] - - @property - def weight(self): - """ - :returns: The value that determines the relative load the Target should receive compared to others with the same priority - :rtype: unicode - """ - return self._properties['weight'] - - @property - def enabled(self): - """ - :returns: Whether the target is enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): + def __repr__(self): """ - Fetch the ConnectionPolicyTargetInstance - - :returns: The fetched ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, friendly_name=values.unset, target=values.unset, - priority=values.unset, weight=values.unset, enabled=values.unset): - """ - Update the ConnectionPolicyTargetInstance - :param unicode friendly_name: A string to describe the resource - :param unicode target: The SIP address you want Twilio to route your calls to - :param unicode priority: The relative importance of the target - :param unicode weight: The value that determines the relative load the Target should receive compared to others with the same priority - :param bool enabled: Whether the Target is enabled - :returns: The updated ConnectionPolicyTargetInstance - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - target=target, - priority=priority, - weight=weight, - enabled=enabled, - ) - - def delete(self): - """ - Deletes the ConnectionPolicyTargetInstance +class ConnectionPolicyTargetListInstance(ListResource): + def __init__(self, version: V1, connection_policy_sid: str): + # TODO: needs autogenerated docs + super(ConnectionPolicyTargetListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { connection_policy_sid, } + self._uri = '/ConnectionPolicies/${connection_policy_sid}/Targets' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ConnectionPolicyTargetInstance(self._version, payload, connection_policy_sid=self._solution['connection_policy_sid']) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ConnectionPolicyTargetPage(self._version, payload, connection_policy_sid=self._solution['connection_policy_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/voice/v1/dialing_permissions.py b/twilio/rest/voice/v1/dialing_permissions.py new file mode 100644 index 0000000000..af6daf4e8e --- /dev/null +++ b/twilio/rest/voice/v1/dialing_permissions.py @@ -0,0 +1,49 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.rest.dialing_permissions.bulk_country_update import BulkCountryUpdateListInstancefrom twilio.rest.dialing_permissions.country import CountryListInstancefrom twilio.rest.dialing_permissions.settings import SettingsListInstance + + + + +class DialingPermissionsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(DialingPermissionsListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/DialingPermissions' + + self._bulk_country_updates = None + self._countries = None + self._settings = None + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py index bae66f2b98..cfa2c0d23d 100644 --- a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py +++ b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py @@ -1,149 +1,90 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class BulkCountryUpdateList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the BulkCountryUpdateList - :param Version version: Version that contains the resource - :returns: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateList - :rtype: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateList - """ - super(BulkCountryUpdateList, self).__init__(version) - # Path Solution - self._solution = {} - self._uri = '/DialingPermissions/BulkCountryUpdates'.format(**self._solution) - def create(self, update_request): - """ - Create the BulkCountryUpdateInstance - :param unicode update_request: URL encoded JSON array of update objects +class BulkCountryUpdateInstance(InstanceResource): + def __init__(self, version, payload): + super(BulkCountryUpdateInstance, self).__init__(version) + self._properties = { + 'update_count' = payload.get('update_count'), + 'update_request' = payload.get('update_request'), + } - :returns: The created BulkCountryUpdateInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateInstance - """ - data = values.of({'UpdateRequest': update_request, }) + self._context = None + self._solution = { + + } - payload = self._version.create(method='POST', uri=self._uri, data=data, ) + @property + def _proxy(self): + if self._context is None: + self._context = BulkCountryUpdateContext( + self._version, + + ) + return self._context - return BulkCountryUpdateInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) -class BulkCountryUpdatePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, response, solution): - """ - Initialize the BulkCountryUpdatePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdatePage - :rtype: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdatePage - """ - super(BulkCountryUpdatePage, self).__init__(version, response) +class BulkCountryUpdateListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(BulkCountryUpdateListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { } + self._uri = '/DialingPermissions/BulkCountryUpdates' + + + def create(self, body): + data = values.of({ + 'body': body, + }) - def get_instance(self, payload): - """ - Build an instance of BulkCountryUpdateInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateInstance - """ - return BulkCountryUpdateInstance(self._version, payload, ) + return BulkCountryUpdateInstance(self._version, payload, ) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class BulkCountryUpdateInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload): - """ - Initialize the BulkCountryUpdateInstance - - :returns: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateInstance - """ - super(BulkCountryUpdateInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'update_count': deserialize.integer(payload.get('update_count')), - 'update_request': payload.get('update_request'), - } - - # Context - self._context = None - self._solution = {} - - @property - def update_count(self): - """ - :returns: The number of countries updated - :rtype: unicode - """ - return self._properties['update_count'] - - @property - def update_request(self): - """ - :returns: A URL encoded JSON array of update objects - :rtype: unicode - """ - return self._properties['update_request'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/voice/v1/dialing_permissions/country.py b/twilio/rest/voice/v1/dialing_permissions/country.py new file mode 100644 index 0000000000..430e284f4f --- /dev/null +++ b/twilio/rest/voice/v1/dialing_permissions/country.py @@ -0,0 +1,140 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.country.highrisk_special_prefix import HighriskSpecialPrefixListInstance + + +class CountryContext(InstanceContext): + def __init__(self, version: V1, iso_code: str): + # TODO: needs autogenerated docs + super(CountryContextList, self).__init__(version) + + # Path Solution + self._solution = { iso_code, } + self._uri = '/DialingPermissions/Countries/${iso_code}' + + self._highrisk_special_prefixes = None + + def fetch(self): + + """ + Fetch the CountryInstance + + :returns: The fetched CountryInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CountryInstance( + self._version, + payload, + iso_code=self._solution['iso_code'], + ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class CountryInstance(InstanceResource): + def __init__(self, version, payload, iso_code: str): + super(CountryInstance, self).__init__(version) + self._properties = { + 'iso_code' = payload.get('iso_code'), + 'name' = payload.get('name'), + 'continent' = payload.get('continent'), + 'country_codes' = payload.get('country_codes'), + 'low_risk_numbers_enabled' = payload.get('low_risk_numbers_enabled'), + 'high_risk_special_numbers_enabled' = payload.get('high_risk_special_numbers_enabled'), + 'high_risk_tollfraud_numbers_enabled' = payload.get('high_risk_tollfraud_numbers_enabled'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + } + + self._context = None + self._solution = { + 'iso_code': iso_code or self._properties['iso_code'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = CountryContext( + self._version, + iso_code=self._solution['iso_code'], + ) + return self._context + + @property + def highrisk_special_prefixes(self): + return self._proxy.highrisk_special_prefixes + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class CountryListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CountryListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/DialingPermissions/Countries' + + + def page(self, iso_code, continent, country_code, low_risk_numbers_enabled, high_risk_special_numbers_enabled, high_risk_tollfraud_numbers_enabled, page_size): + + data = values.of({ + 'iso_code': iso_code,'continent': continent,'country_code': country_code,'low_risk_numbers_enabled': low_risk_numbers_enabled,'high_risk_special_numbers_enabled': high_risk_special_numbers_enabled,'high_risk_tollfraud_numbers_enabled': high_risk_tollfraud_numbers_enabled,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CountryPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py index 87df51a272..e11f4ac270 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py @@ -1,201 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class HighriskSpecialPrefixList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, iso_code): - """ - Initialize the HighriskSpecialPrefixList - - :param Version version: Version that contains the resource - :param iso_code: The ISO country code - - :returns: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixList - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixList - """ - super(HighriskSpecialPrefixList, self).__init__(version) - - # Path Solution - self._solution = {'iso_code': iso_code, } - self._uri = '/DialingPermissions/Countries/{iso_code}/HighRiskSpecialPrefixes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams HighriskSpecialPrefixInstance 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 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.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) + Twilio - Voice + This is the public Twilio REST API. - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists HighriskSpecialPrefixInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of HighriskSpecialPrefixInstance records from the API. - Request is executed immediately - - :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 HighriskSpecialPrefixInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return HighriskSpecialPrefixPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of HighriskSpecialPrefixInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - :returns: Page of HighriskSpecialPrefixInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return HighriskSpecialPrefixPage(self._version, response, self._solution) +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class HighriskSpecialPrefixPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, response, solution): - """ - Initialize the HighriskSpecialPrefixPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param iso_code: The ISO country code - :returns: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixPage - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixPage - """ - super(HighriskSpecialPrefixPage, self).__init__(version, response) +class HighriskSpecialPrefixListInstance(ListResource): + def __init__(self, version: V1, iso_code: str): + # TODO: needs autogenerated docs + super(HighriskSpecialPrefixListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of HighriskSpecialPrefixInstance + self._solution = { iso_code, } + self._uri = '/DialingPermissions/Countries/${iso_code}/HighRiskSpecialPrefixes' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixInstance - """ - return HighriskSpecialPrefixInstance(self._version, payload, iso_code=self._solution['iso_code'], ) + return HighriskSpecialPrefixPage(self._version, payload, iso_code=self._solution['iso_code']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class HighriskSpecialPrefixInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ + return '' - def __init__(self, version, payload, iso_code): - """ - Initialize the HighriskSpecialPrefixInstance - - :returns: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixInstance - """ - super(HighriskSpecialPrefixInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'prefix': payload.get('prefix'), } - - # Context - self._context = None - self._solution = {'iso_code': iso_code, } - - @property - def prefix(self): - """ - :returns: A prefix that includes the E.164 assigned country code - :rtype: unicode - """ - return self._properties['prefix'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/voice/v1/dialing_permissions/settings.py b/twilio/rest/voice/v1/dialing_permissions/settings.py index 8451ea258e..9afb9ccba3 100644 --- a/twilio/rest/voice/v1/dialing_permissions/settings.py +++ b/twilio/rest/voice/v1/dialing_permissions/settings.py @@ -1,242 +1,128 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SettingsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the SettingsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsList - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsList - """ - super(SettingsList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a SettingsContext - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsContext - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsContext - """ - return SettingsContext(self._version, ) - - def __call__(self): - """ - Constructs a SettingsContext - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsContext - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsContext - """ - return SettingsContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SettingsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SettingsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsPage - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsPage - """ - super(SettingsPage, self).__init__(version, response) - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SettingsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - """ - return SettingsInstance(self._version, payload, ) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SettingsContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the SettingsContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsContext - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsContext - """ - super(SettingsContext, self).__init__(version) + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SettingsContextList, self).__init__(version) # Path Solution - self._solution = {} - self._uri = '/Settings'.format(**self._solution) - - def fetch(self): - """ - Fetch the SettingsInstance - - :returns: The fetched SettingsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SettingsInstance(self._version, payload, ) - - def update(self, dialing_permissions_inheritance=values.unset): - """ - Update the SettingsInstance - - :param bool dialing_permissions_inheritance: `true` for the sub-account to inherit voice dialing permissions from the Master Project; otherwise `false` - - :returns: The updated SettingsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - """ - data = values.of({'DialingPermissionsInheritance': dialing_permissions_inheritance, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SettingsInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Settings' + + + def fetch(self): + + """ + Fetch the SettingsInstance + + :returns: The fetched SettingsInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SettingsInstance( + self._version, + payload, + =self._solution[], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SettingsInstance(self._version, payload, ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SettingsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ +class SettingsInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the SettingsInstance - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - """ super(SettingsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'dialing_permissions_inheritance': payload.get('dialing_permissions_inheritance'), - 'url': payload.get('url'), + self._properties = { + 'dialing_permissions_inheritance' = payload.get('dialing_permissions_inheritance'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SettingsContext for this SettingsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsContext - """ if self._context is None: - self._context = SettingsContext(self._version, ) + self._context = SettingsContext( + self._version, + + ) return self._context - @property - def dialing_permissions_inheritance(self): - """ - :returns: `true` if the sub-account will inherit voice dialing permissions from the Master Project; otherwise `false` - :rtype: bool - """ - return self._properties['dialing_permissions_inheritance'] + - @property - def url(self): - """ - :returns: The absolute URL of this resource - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the SettingsInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched SettingsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - """ - return self._proxy.fetch() - def update(self, dialing_permissions_inheritance=values.unset): - """ - Update the SettingsInstance - :param bool dialing_permissions_inheritance: `true` for the sub-account to inherit voice dialing permissions from the Master Project; otherwise `false` +class SettingsListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SettingsListInstanceList, self).__init__(version) - :returns: The updated SettingsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsInstance - """ - return self._proxy.update(dialing_permissions_inheritance=dialing_permissions_inheritance, ) + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/voice/v1/ip_record.py b/twilio/rest/voice/v1/ip_record.py index a005b67543..f0b754d6f3 100644 --- a/twilio/rest/voice/v1/ip_record.py +++ b/twilio/rest/voice/v1/ip_record.py @@ -1,408 +1,167 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class IpRecordList(ListResource): - - def __init__(self, version): - """ - Initialize the IpRecordList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.voice.v1.ip_record.IpRecordList - :rtype: twilio.rest.voice.v1.ip_record.IpRecordList - """ - super(IpRecordList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/IpRecords'.format(**self._solution) - - def create(self, ip_address, friendly_name=values.unset, - cidr_prefix_length=values.unset): - """ - Create the IpRecordInstance - - :param unicode ip_address: An IP address in dotted decimal notation, IPv4 only. - :param unicode friendly_name: A string to describe the resource - :param unicode cidr_prefix_length: An integer representing the length of the `CIDR `_ prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. - - :returns: The created IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordInstance - """ - data = values.of({ - 'IpAddress': ip_address, - 'FriendlyName': friendly_name, - 'CidrPrefixLength': cidr_prefix_length, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return IpRecordInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams IpRecordInstance 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 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.voice.v1.ip_record.IpRecordInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpRecordInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.voice.v1.ip_record.IpRecordInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpRecordInstance records from the API. - Request is executed immediately - - :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 IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return IpRecordPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpRecordInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpRecordPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a IpRecordContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.ip_record.IpRecordContext - :rtype: twilio.rest.voice.v1.ip_record.IpRecordContext - """ - return IpRecordContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IpRecordContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.ip_record.IpRecordContext - :rtype: twilio.rest.voice.v1.ip_record.IpRecordContext - """ - return IpRecordContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.page import Page -class IpRecordPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the IpRecordPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.voice.v1.ip_record.IpRecordPage - :rtype: twilio.rest.voice.v1.ip_record.IpRecordPage - """ - super(IpRecordPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpRecordInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.ip_record.IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordInstance - """ - return IpRecordInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class IpRecordContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the IpRecordContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.ip_record.IpRecordContext - :rtype: twilio.rest.voice.v1.ip_record.IpRecordContext - """ - super(IpRecordContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(IpRecordContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/IpRecords/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the IpRecordInstance - - :returns: The fetched IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return IpRecordInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, friendly_name=values.unset): - """ - Update the IpRecordInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The updated IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return IpRecordInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the IpRecordInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/IpRecords/${sid}' + + + def delete(self): + + + """ + Deletes the IpRecordInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the IpRecordInstance + + :returns: The fetched IpRecordInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return IpRecordInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return IpRecordInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class IpRecordInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the IpRecordInstance - :returns: twilio.rest.voice.v1.ip_record.IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordInstance - """ +class IpRecordInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(IpRecordInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'ip_address': payload.get('ip_address'), - 'cidr_prefix_length': deserialize.integer(payload.get('cidr_prefix_length')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'account_sid' = payload.get('account_sid'), + 'sid' = payload.get('sid'), + 'friendly_name' = payload.get('friendly_name'), + 'ip_address' = payload.get('ip_address'), + 'cidr_prefix_length' = payload.get('cidr_prefix_length'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpRecordContext for this IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordContext - """ if self._context is None: - self._context = IpRecordContext(self._version, sid=self._solution['sid'], ) + self._context = IpRecordContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] + - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def ip_address(self): - """ - :returns: An IP address in dotted decimal notation, IPv4 only. - :rtype: unicode - """ - return self._properties['ip_address'] - - @property - def cidr_prefix_length(self): - """ - :returns: An integer representing the length of the `CIDR `_ prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. - :rtype: unicode - """ - return self._properties['cidr_prefix_length'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the IpRecordInstance - - :returns: The fetched IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the IpRecordInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the resource - :returns: The updated IpRecordInstance - :rtype: twilio.rest.voice.v1.ip_record.IpRecordInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - def delete(self): - """ - Deletes the IpRecordInstance +class IpRecordListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(IpRecordListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/IpRecords' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IpRecordInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IpRecordPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/voice/v1/source_ip_mapping.py b/twilio/rest/voice/v1/source_ip_mapping.py index 1564c4de36..b5b2c04ec2 100644 --- a/twilio/rest/voice/v1/source_ip_mapping.py +++ b/twilio/rest/voice/v1/source_ip_mapping.py @@ -1,384 +1,165 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SourceIpMappingList(ListResource): - - def __init__(self, version): - """ - Initialize the SourceIpMappingList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingList - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingList - """ - super(SourceIpMappingList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/SourceIpMappings'.format(**self._solution) - - def create(self, ip_record_sid, sip_domain_sid): - """ - Create the SourceIpMappingInstance - - :param unicode ip_record_sid: The unique string that identifies an IP Record - :param unicode sip_domain_sid: The unique string that identifies a SIP Domain - - :returns: The created SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - """ - data = values.of({'IpRecordSid': ip_record_sid, 'SipDomainSid': sip_domain_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SourceIpMappingInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams SourceIpMappingInstance 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 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.voice.v1.source_ip_mapping.SourceIpMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SourceIpMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.voice.v1.source_ip_mapping.SourceIpMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SourceIpMappingInstance records from the API. - Request is executed immediately - - :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 SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SourceIpMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SourceIpMappingInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SourceIpMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SourceIpMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingContext - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingContext - """ - return SourceIpMappingContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SourceIpMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingContext - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingContext - """ - return SourceIpMappingContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SourceIpMappingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SourceIpMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingPage - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingPage - """ - super(SourceIpMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.page import Page - def get_instance(self, payload): - """ - Build an instance of SourceIpMappingInstance - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - """ - return SourceIpMappingInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' class SourceIpMappingContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the SourceIpMappingContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingContext - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingContext - """ - super(SourceIpMappingContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SourceIpMappingContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/SourceIpMappings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SourceIpMappingInstance - - :returns: The fetched SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SourceIpMappingInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, sip_domain_sid): - """ - Update the SourceIpMappingInstance - - :param unicode sip_domain_sid: The unique string that identifies a SIP Domain - - :returns: The updated SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - """ - data = values.of({'SipDomainSid': sip_domain_sid, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SourceIpMappingInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the SourceIpMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/SourceIpMappings/${sid}' + + + def delete(self): + + + """ + Deletes the SourceIpMappingInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SourceIpMappingInstance + + :returns: The fetched SourceIpMappingInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SourceIpMappingInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SourceIpMappingInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SourceIpMappingInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the SourceIpMappingInstance - - :returns: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - """ +class SourceIpMappingInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(SourceIpMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'ip_record_sid': payload.get('ip_record_sid'), - 'sip_domain_sid': payload.get('sip_domain_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'ip_record_sid' = payload.get('ip_record_sid'), + 'sip_domain_sid' = payload.get('sip_domain_sid'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SourceIpMappingContext for this SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingContext - """ if self._context is None: - self._context = SourceIpMappingContext(self._version, sid=self._solution['sid'], ) + self._context = SourceIpMappingContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def ip_record_sid(self): - """ - :returns: The unique string that identifies an IP Record - :rtype: unicode - """ - return self._properties['ip_record_sid'] - - @property - def sip_domain_sid(self): - """ - :returns: The unique string that identifies a SIP Domain - :rtype: unicode - """ - return self._properties['sip_domain_sid'] + - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the SourceIpMappingInstance - - :returns: The fetched SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, sip_domain_sid): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the SourceIpMappingInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode sip_domain_sid: The unique string that identifies a SIP Domain - :returns: The updated SourceIpMappingInstance - :rtype: twilio.rest.voice.v1.source_ip_mapping.SourceIpMappingInstance - """ - return self._proxy.update(sip_domain_sid, ) - def delete(self): - """ - Deletes the SourceIpMappingInstance +class SourceIpMappingListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SourceIpMappingListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/SourceIpMappings' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SourceIpMappingInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SourceIpMappingPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/wireless/__init__.py b/twilio/rest/wireless/__init__.py index df3e45da84..8effc6d5f1 100644 --- a/twilio/rest/wireless/__init__.py +++ b/twilio/rest/wireless/__init__.py @@ -1,73 +1,78 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.domain import Domain -from twilio.rest.wireless.v1 import V1 + Twilio - Wireless + This is the public Twilio REST API. + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" -class Wireless(Domain): +from twilio.base.domain import Domain +from twilio.rest.Wireless.v1 import V1 +class Wireless(Domain): def __init__(self, twilio): """ Initialize the Wireless Domain :returns: Domain for Wireless - :rtype: twilio.rest.wireless.Wireless + :rtype: twilio.rest.v1.Wireless """ super(Wireless, self).__init__(twilio) - - self.base_url = 'https://wireless.twilio.com' - - # Versions - self._v1 = None - - @property - def v1(self): - """ - :returns: Version v1 of wireless - :rtype: twilio.rest.wireless.v1.V1 - """ - if self._v1 is None: - self._v1 = V1(self) - return self._v1 + self.base_url = 'https://Wireless.twilio.com' + self._V1 = None @property - def usage_records(self): + def V1(self): """ - :rtype: twilio.rest.wireless.v1.usage_record.UsageRecordList + :returns: Versions v1 of Wireless + :rtype: twilio.rest.Wireless.v1 """ - return self.v1.usage_records + if self._V1 is None: + self._V1 = V1(self) + return self._V1 + @property def commands(self): """ - :rtype: twilio.rest.wireless.v1.command.CommandList + :rtype: twilio.rest.v1.commands """ return self.v1.commands + @property def rate_plans(self): """ - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanList + :rtype: twilio.rest.v1.rate_plans """ return self.v1.rate_plans + @property def sims(self): """ - :rtype: twilio.rest.wireless.v1.sim.SimList + :rtype: twilio.rest.v1.sims """ return self.v1.sims + + + @property + def usage_records(self): + """ + :rtype: twilio.rest.v1.usage_records + """ + return self.v1.usage_records + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/wireless/v1/.openapi-generator-ignore b/twilio/rest/wireless/v1/.openapi-generator-ignore new file mode 100644 index 0000000000..7484ee590a --- /dev/null +++ b/twilio/rest/wireless/v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/twilio/rest/wireless/v1/.openapi-generator/FILES b/twilio/rest/wireless/v1/.openapi-generator/FILES new file mode 100644 index 0000000000..add8b8f056 --- /dev/null +++ b/twilio/rest/wireless/v1/.openapi-generator/FILES @@ -0,0 +1,13 @@ +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +../__init__.py +.openapi-generator-ignore +command.py +rate_plan.py +sim.py +sim/data_session.py +sim/usage_record.py +usage_record.py diff --git a/twilio/rest/wireless/v1/.openapi-generator/VERSION b/twilio/rest/wireless/v1/.openapi-generator/VERSION new file mode 100644 index 0000000000..0df17dd0f6 --- /dev/null +++ b/twilio/rest/wireless/v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.2.1 \ No newline at end of file diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index 225fb84da5..8106640fa8 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -1,482 +1,160 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Wireless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CommandList(ListResource): - - def __init__(self, version): - """ - Initialize the CommandList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.wireless.v1.command.CommandList - :rtype: twilio.rest.wireless.v1.command.CommandList - """ - super(CommandList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Commands'.format(**self._solution) - - def stream(self, sim=values.unset, status=values.unset, direction=values.unset, - transport=values.unset, limit=None, page_size=None): - """ - Streams CommandInstance 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 sim: The sid or unique_name of the Sim resources to read - :param CommandInstance.Status status: The status of the resources to read - :param CommandInstance.Direction direction: Only return Commands with this direction value - :param CommandInstance.Transport transport: Only return Commands with this transport value - :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.wireless.v1.command.CommandInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - sim=sim, - status=status, - direction=direction, - transport=transport, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, sim=values.unset, status=values.unset, direction=values.unset, - transport=values.unset, limit=None, page_size=None): - """ - Lists CommandInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode sim: The sid or unique_name of the Sim resources to read - :param CommandInstance.Status status: The status of the resources to read - :param CommandInstance.Direction direction: Only return Commands with this direction value - :param CommandInstance.Transport transport: Only return Commands with this transport value - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.wireless.v1.command.CommandInstance] - """ - return list(self.stream( - sim=sim, - status=status, - direction=direction, - transport=transport, - limit=limit, - page_size=page_size, - )) - - def page(self, sim=values.unset, status=values.unset, direction=values.unset, - transport=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CommandInstance records from the API. - Request is executed immediately - - :param unicode sim: The sid or unique_name of the Sim resources to read - :param CommandInstance.Status status: The status of the resources to read - :param CommandInstance.Direction direction: Only return Commands with this direction value - :param CommandInstance.Transport transport: Only return Commands with this transport value - :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 CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandPage - """ - data = values.of({ - 'Sim': sim, - 'Status': status, - 'Direction': direction, - 'Transport': transport, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CommandPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CommandInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CommandPage(self._version, response, self._solution) - - def create(self, command, sim=values.unset, callback_method=values.unset, - callback_url=values.unset, command_mode=values.unset, - include_sid=values.unset, delivery_receipt_requested=values.unset): - """ - Create the CommandInstance - - :param unicode command: The message body of the Command or a Base64 encoded byte string in binary mode - :param unicode sim: The sid or unique_name of the SIM to send the Command to - :param unicode callback_method: The HTTP method we use to call callback_url - :param unicode callback_url: he URL we call when the Command has finished sending - :param CommandInstance.CommandMode command_mode: The mode to use when sending the SMS message - :param unicode include_sid: Whether to include the SID of the command in the message body - :param bool delivery_receipt_requested: Whether to request delivery receipt from the recipient - - :returns: The created CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - data = values.of({ - 'Command': command, - 'Sim': sim, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'CommandMode': command_mode, - 'IncludeSid': include_sid, - 'DeliveryReceiptRequested': delivery_receipt_requested, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CommandInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CommandContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.wireless.v1.command.CommandContext - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CommandContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.wireless.v1.command.CommandContext - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ - return CommandContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - -class CommandPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CommandPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.wireless.v1.command.CommandPage - :rtype: twilio.rest.wireless.v1.command.CommandPage - """ - super(CommandPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CommandInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.command.CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - return CommandInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class CommandContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CommandContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.wireless.v1.command.CommandContext - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ - super(CommandContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(CommandContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Commands/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CommandInstance - - :returns: The fetched CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CommandInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CommandInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/Commands/${sid}' + + + def delete(self): + + + """ + Deletes the CommandInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the CommandInstance + + :returns: The fetched CommandInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return CommandInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CommandInstance(InstanceResource): + return '' - class Direction(object): - FROM_SIM = "from_sim" - TO_SIM = "to_sim" - class Status(object): - QUEUED = "queued" - SENT = "sent" - DELIVERED = "delivered" - RECEIVED = "received" - FAILED = "failed" - class CommandMode(object): - TEXT = "text" - BINARY = "binary" - - class Transport(object): - SMS = "sms" - IP = "ip" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CommandInstance - - :returns: twilio.rest.wireless.v1.command.CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ +class CommandInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(CommandInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'sim_sid': payload.get('sim_sid'), - 'command': payload.get('command'), - 'command_mode': payload.get('command_mode'), - 'transport': payload.get('transport'), - 'delivery_receipt_requested': payload.get('delivery_receipt_requested'), - 'status': payload.get('status'), - 'direction': payload.get('direction'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'account_sid' = payload.get('account_sid'), + 'sim_sid' = payload.get('sim_sid'), + 'command' = payload.get('command'), + 'command_mode' = payload.get('command_mode'), + 'transport' = payload.get('transport'), + 'delivery_receipt_requested' = payload.get('delivery_receipt_requested'), + 'status' = payload.get('status'), + 'direction' = payload.get('direction'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CommandContext for this CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandContext - """ if self._context is None: - self._context = CommandContext(self._version, sid=self._solution['sid'], ) + self._context = CommandContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sim_sid(self): - """ - :returns: The SID of the Sim resource that the Command was sent to or from - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def command(self): - """ - :returns: The message being sent to or from the SIM - :rtype: unicode - """ - return self._properties['command'] + - @property - def command_mode(self): - """ - :returns: The mode used to send the SMS message - :rtype: CommandInstance.CommandMode - """ - return self._properties['command_mode'] - - @property - def transport(self): - """ - :returns: The type of transport used - :rtype: CommandInstance.Transport - """ - return self._properties['transport'] - - @property - def delivery_receipt_requested(self): - """ - :returns: Whether to request a delivery receipt - :rtype: bool - """ - return self._properties['delivery_receipt_requested'] - - @property - def status(self): - """ - :returns: The status of the Command - :rtype: CommandInstance.Status - """ - return self._properties['status'] - - @property - def direction(self): - """ - :returns: The direction of the Command - :rtype: CommandInstance.Direction - """ - return self._properties['direction'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated format - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the CommandInstance - :returns: The fetched CommandInstance - :rtype: twilio.rest.wireless.v1.command.CommandInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the CommandInstance +class CommandListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(CommandListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/Commands' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CommandInstance(self._version, payload, ) + + + def page(self, sim, status, direction, transport, page_size): + + data = values.of({ + 'sim': sim,'status': status,'direction': direction,'transport': transport,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CommandPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index 67291f7164..5df0d4d9ab 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Wireless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize from twilio.base import serialize @@ -12,497 +19,157 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RatePlanList(ListResource): - - def __init__(self, version): - """ - Initialize the RatePlanList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanList - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanList - """ - super(RatePlanList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RatePlans'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams RatePlanInstance 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 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.wireless.v1.rate_plan.RatePlanInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RatePlanInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.wireless.v1.rate_plan.RatePlanInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RatePlanInstance records from the API. - Request is executed immediately - :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 RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RatePlanPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RatePlanInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RatePlanPage(self._version, response, self._solution) - - def create(self, unique_name=values.unset, friendly_name=values.unset, - data_enabled=values.unset, data_limit=values.unset, - data_metering=values.unset, messaging_enabled=values.unset, - voice_enabled=values.unset, national_roaming_enabled=values.unset, - international_roaming=values.unset, - national_roaming_data_limit=values.unset, - international_roaming_data_limit=values.unset): - """ - Create the RatePlanInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode friendly_name: A string to describe the resource - :param bool data_enabled: Whether SIMs can use GPRS/3G/4G/LTE data connectivity - :param unicode data_limit: The total data usage in Megabytes that the Network allows during one month on the home network - :param unicode data_metering: The model used to meter data usage - :param bool messaging_enabled: Whether SIMs can make, send, and receive SMS using Commands - :param bool voice_enabled: Deprecated - :param bool national_roaming_enabled: Whether SIMs can roam on networks other than the home network in the United States - :param list[unicode] international_roaming: The services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States - :param unicode national_roaming_data_limit: The total data usage in Megabytes that the Network allows during one month on non-home networks in the United States - :param unicode international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States - - :returns: The created RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'DataEnabled': data_enabled, - 'DataLimit': data_limit, - 'DataMetering': data_metering, - 'MessagingEnabled': messaging_enabled, - 'VoiceEnabled': voice_enabled, - 'NationalRoamingEnabled': national_roaming_enabled, - 'InternationalRoaming': serialize.map(international_roaming, lambda e: e), - 'NationalRoamingDataLimit': national_roaming_data_limit, - 'InternationalRoamingDataLimit': international_roaming_data_limit, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RatePlanInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanContext - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RatePlanContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanContext - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ - return RatePlanContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RatePlanPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RatePlanPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanPage - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanPage - """ - super(RatePlanPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RatePlanInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - return RatePlanInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' class RatePlanContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the RatePlanContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanContext - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ - super(RatePlanContext, self).__init__(version) + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(RatePlanContextList, self).__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RatePlans/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the RatePlanInstance - - :returns: The fetched RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, unique_name=values.unset, friendly_name=values.unset): - """ - Update the RatePlanInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode friendly_name: A string to describe the resource - - :returns: The updated RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the RatePlanInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + self._solution = { sid, } + self._uri = '/RatePlans/${sid}' + + + def delete(self): + + + """ + Deletes the RatePlanInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the RatePlanInstance + + :returns: The fetched RatePlanInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return RatePlanInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return RatePlanInstance(self._version, payload, sid=self._solution['sid'], ) + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RatePlanInstance(InstanceResource): + return '' - class DataLimitStrategy(object): - BLOCK = "block" - THROTTLE = "throttle" - def __init__(self, version, payload, sid=None): - """ - Initialize the RatePlanInstance - :returns: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ +class RatePlanInstance(InstanceResource): + def __init__(self, version, payload, sid: str): super(RatePlanInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'data_enabled': payload.get('data_enabled'), - 'data_metering': payload.get('data_metering'), - 'data_limit': deserialize.integer(payload.get('data_limit')), - 'messaging_enabled': payload.get('messaging_enabled'), - 'voice_enabled': payload.get('voice_enabled'), - 'national_roaming_enabled': payload.get('national_roaming_enabled'), - 'national_roaming_data_limit': deserialize.integer(payload.get('national_roaming_data_limit')), - 'international_roaming': payload.get('international_roaming'), - 'international_roaming_data_limit': deserialize.integer(payload.get('international_roaming_data_limit')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'data_enabled' = payload.get('data_enabled'), + 'data_metering' = payload.get('data_metering'), + 'data_limit' = payload.get('data_limit'), + 'messaging_enabled' = payload.get('messaging_enabled'), + 'voice_enabled' = payload.get('voice_enabled'), + 'national_roaming_enabled' = payload.get('national_roaming_enabled'), + 'national_roaming_data_limit' = payload.get('national_roaming_data_limit'), + 'international_roaming' = payload.get('international_roaming'), + 'international_roaming_data_limit' = payload.get('international_roaming_data_limit'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'] + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RatePlanContext for this RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanContext - """ if self._context is None: - self._context = RatePlanContext(self._version, sid=self._solution['sid'], ) + self._context = RatePlanContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def data_enabled(self): - """ - :returns: Whether SIMs can use GPRS/3G/4G/LTE data connectivity - :rtype: bool - """ - return self._properties['data_enabled'] - - @property - def data_metering(self): - """ - :returns: The model used to meter data usage - :rtype: unicode - """ - return self._properties['data_metering'] - - @property - def data_limit(self): - """ - :returns: The total data usage in Megabytes that the Network allows during one month on the home network - :rtype: unicode - """ - return self._properties['data_limit'] - - @property - def messaging_enabled(self): - """ - :returns: Whether SIMs can make, send, and receive SMS using Commands - :rtype: bool - """ - return self._properties['messaging_enabled'] - - @property - def voice_enabled(self): - """ - :returns: Deprecated. Whether SIMs can make and receive voice calls - :rtype: bool - """ - return self._properties['voice_enabled'] - - @property - def national_roaming_enabled(self): - """ - :returns: Whether SIMs can roam on networks other than the home network in the United States - :rtype: bool - """ - return self._properties['national_roaming_enabled'] - - @property - def national_roaming_data_limit(self): - """ - :returns: The total data usage in Megabytes that the Network allows during one month on non-home networks in the United States - :rtype: unicode - """ - return self._properties['national_roaming_data_limit'] - - @property - def international_roaming(self): - """ - :returns: The services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States - :rtype: list[unicode] - """ - return self._properties['international_roaming'] - - @property - def international_roaming_data_limit(self): - """ - :returns: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States - :rtype: unicode - """ - return self._properties['international_roaming_data_limit'] - - @property - def date_created(self): - """ - :returns: The date when the resource was created, given as GMT in ISO 8601 format - :rtype: datetime - """ - return self._properties['date_created'] + - @property - def date_updated(self): - """ - :returns: The date when the resource was last updated, given as GMT in ISO 8601 format - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the RatePlanInstance - - :returns: The fetched RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset, friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the RatePlanInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode friendly_name: A string to describe the resource - :returns: The updated RatePlanInstance - :rtype: twilio.rest.wireless.v1.rate_plan.RatePlanInstance - """ - return self._proxy.update(unique_name=unique_name, friendly_name=friendly_name, ) - def delete(self): - """ - Deletes the RatePlanInstance +class RatePlanListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(RatePlanListInstanceList, self).__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + # Path Solution + self._solution = { } + self._uri = '/RatePlans' + + + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RatePlanInstance(self._version, payload, ) + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RatePlanPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/wireless/v1/sim.py b/twilio/rest/wireless/v1/sim.py new file mode 100644 index 0000000000..ff7bac2a7f --- /dev/null +++ b/twilio/rest/wireless/v1/sim.py @@ -0,0 +1,181 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Wireless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource + +from twilio.base.page import Page + +from twilio.rest.sim.data_session import DataSessionListInstancefrom twilio.rest.sim.usage_record import UsageRecordListInstance + + +class SimContext(InstanceContext): + def __init__(self, version: V1, sid: str): + # TODO: needs autogenerated docs + super(SimContextList, self).__init__(version) + + # Path Solution + self._solution = { sid, } + self._uri = '/Sims/${sid}' + + self._data_sessions = None + self._usage_records = None + + def delete(self): + + + """ + Deletes the SimInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SimInstance + + :returns: The fetched SimInstance + #TODO: add rtype docs + """ + payload = self._version.fetch(method='GET', uri=self._uri, ) + return SimInstance( + self._version, + payload, + sid=self._solution['sid'], + ) + + + + def update(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return SimInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + + + +class SimInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super(SimInstance, self).__init__(version) + self._properties = { + 'sid' = payload.get('sid'), + 'unique_name' = payload.get('unique_name'), + 'account_sid' = payload.get('account_sid'), + 'rate_plan_sid' = payload.get('rate_plan_sid'), + 'friendly_name' = payload.get('friendly_name'), + 'iccid' = payload.get('iccid'), + 'e_id' = payload.get('e_id'), + 'status' = payload.get('status'), + 'reset_status' = payload.get('reset_status'), + 'commands_callback_url' = payload.get('commands_callback_url'), + 'commands_callback_method' = payload.get('commands_callback_method'), + 'sms_fallback_method' = payload.get('sms_fallback_method'), + 'sms_fallback_url' = payload.get('sms_fallback_url'), + 'sms_method' = payload.get('sms_method'), + 'sms_url' = payload.get('sms_url'), + 'voice_fallback_method' = payload.get('voice_fallback_method'), + 'voice_fallback_url' = payload.get('voice_fallback_url'), + 'voice_method' = payload.get('voice_method'), + 'voice_url' = payload.get('voice_url'), + 'date_created' = payload.get('date_created'), + 'date_updated' = payload.get('date_updated'), + 'url' = payload.get('url'), + 'links' = payload.get('links'), + 'ip_address' = payload.get('ip_address'), + } + + self._context = None + self._solution = { + 'sid': sid or self._properties['sid'] + } + + @property + def _proxy(self): + if self._context is None: + self._context = SimContext( + self._version, + sid=self._solution['sid'], + ) + return self._context + + @property + def data_sessions(self): + return self._proxy.data_sessions + @property + def usage_records(self): + return self._proxy.usage_records + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class SimListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(SimListInstanceList, self).__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Sims' + + + def page(self, status, iccid, rate_plan, eid, sim_registration_code, page_size): + + data = values.of({ + 'status': status,'iccid': iccid,'rate_plan': rate_plan,'eid': eid,'sim_registration_code': sim_registration_code,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SimPage(self._version, payload, ) + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/wireless/v1/sim/data_session.py b/twilio/rest/wireless/v1/sim/data_session.py index af1862f9d6..42045b0d6f 100644 --- a/twilio/rest/wireless/v1/sim/data_session.py +++ b/twilio/rest/wireless/v1/sim/data_session.py @@ -1,330 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Wireless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + from twilio.base import deserialize +from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DataSessionList(ListResource): - - def __init__(self, version, sim_sid): - """ - Initialize the DataSessionList - - :param Version version: Version that contains the resource - :param sim_sid: The SID of the Sim resource that the Data Session is for - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList - """ - super(DataSessionList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/DataSessions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DataSessionInstance 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 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.wireless.v1.sim.data_session.DataSessionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DataSessionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.wireless.v1.sim.data_session.DataSessionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DataSessionInstance records from the API. - Request is executed immediately - - :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 DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) +from twilio.base.page import Page - return DataSessionPage(self._version, response, self._solution) - def get_page(self, target_url): - """ - Retrieve a specific page of DataSessionInstance records from the API. - Request is executed immediately - :param str target_url: API-generated URL for the requested results page - :returns: Page of DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - return DataSessionPage(self._version, response, self._solution) - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DataSessionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DataSessionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The SID of the Sim resource that the Data Session is for - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionPage - """ - super(DataSessionPage, self).__init__(version, response) +class DataSessionListInstance(ListResource): + def __init__(self, version: V1, sim_sid: str): + # TODO: needs autogenerated docs + super(DataSessionListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { sim_sid, } + self._uri = '/Sims/${sim_sid}/DataSessions' + + + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of DataSessionInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - """ - return DataSessionInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) + return DataSessionPage(self._version, payload, sim_sid=self._solution['sim_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class DataSessionInstance(InstanceResource): - - def __init__(self, version, payload, sim_sid): - """ - Initialize the DataSessionInstance - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionInstance - """ - super(DataSessionInstance, self).__init__(version) + return '' - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'sim_sid': payload.get('sim_sid'), - 'account_sid': payload.get('account_sid'), - 'radio_link': payload.get('radio_link'), - 'operator_mcc': payload.get('operator_mcc'), - 'operator_mnc': payload.get('operator_mnc'), - 'operator_country': payload.get('operator_country'), - 'operator_name': payload.get('operator_name'), - 'cell_id': payload.get('cell_id'), - 'cell_location_estimate': payload.get('cell_location_estimate'), - 'packets_uploaded': deserialize.integer(payload.get('packets_uploaded')), - 'packets_downloaded': deserialize.integer(payload.get('packets_downloaded')), - 'last_updated': deserialize.iso8601_datetime(payload.get('last_updated')), - 'start': deserialize.iso8601_datetime(payload.get('start')), - 'end': deserialize.iso8601_datetime(payload.get('end')), - 'imei': payload.get('imei'), - } - - # Context - self._context = None - self._solution = {'sim_sid': sim_sid, } - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sim_sid(self): - """ - :returns: The SID of the Sim resource that the Data Session is for - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def radio_link(self): - """ - :returns: The generation of wireless technology that the device was using - :rtype: unicode - """ - return self._properties['radio_link'] - - @property - def operator_mcc(self): - """ - :returns: The 'mobile country code' is the unique ID of the home country where the Data Session took place - :rtype: unicode - """ - return self._properties['operator_mcc'] - - @property - def operator_mnc(self): - """ - :returns: The 'mobile network code' is the unique ID specific to the mobile operator network where the Data Session took place - :rtype: unicode - """ - return self._properties['operator_mnc'] - - @property - def operator_country(self): - """ - :returns: The three letter country code representing where the device's Data Session took place - :rtype: unicode - """ - return self._properties['operator_country'] - - @property - def operator_name(self): - """ - :returns: The friendly name of the mobile operator network that the SIM-connected device is attached to - :rtype: unicode - """ - return self._properties['operator_name'] - - @property - def cell_id(self): - """ - :returns: The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated - :rtype: unicode - """ - return self._properties['cell_id'] - - @property - def cell_location_estimate(self): - """ - :returns: An object with the estimated location where the device's Data Session took place - :rtype: dict - """ - return self._properties['cell_location_estimate'] - - @property - def packets_uploaded(self): - """ - :returns: The number of packets uploaded by the device between the start time and when the Data Session was last updated - :rtype: unicode - """ - return self._properties['packets_uploaded'] - - @property - def packets_downloaded(self): - """ - :returns: The number of packets downloaded by the device between the start time and when the Data Session was last updated - :rtype: unicode - """ - return self._properties['packets_downloaded'] - - @property - def last_updated(self): - """ - :returns: The date that the resource was last updated, given as GMT in ISO 8601 format - :rtype: datetime - """ - return self._properties['last_updated'] - - @property - def start(self): - """ - :returns: The date that the Data Session started, given as GMT in ISO 8601 format - :rtype: datetime - """ - return self._properties['start'] - - @property - def end(self): - """ - :returns: The date that the record ended, given as GMT in ISO 8601 format - :rtype: datetime - """ - return self._properties['end'] - - @property - def imei(self): - """ - :returns: The unique ID of the device using the SIM to connect - :rtype: unicode - """ - return self._properties['imei'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/wireless/v1/sim/usage_record.py b/twilio/rest/wireless/v1/sim/usage_record.py index 5e09266c2a..cc3b86a293 100644 --- a/twilio/rest/wireless/v1/sim/usage_record.py +++ b/twilio/rest/wireless/v1/sim/usage_record.py @@ -1,261 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Wireless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UsageRecordList(ListResource): - - def __init__(self, version, sim_sid): - """ - Initialize the UsageRecordList - - :param Version version: Version that contains the resource - :param sim_sid: The SID of the Sim resource that this Usage Record is for - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - """ - super(UsageRecordList, self).__init__(version) - - # Path Solution - self._solution = {'sim_sid': sim_sid, } - self._uri = '/Sims/{sim_sid}/UsageRecords'.format(**self._solution) - - def stream(self, end=values.unset, start=values.unset, granularity=values.unset, - limit=None, page_size=None): - """ - Streams UsageRecordInstance 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 datetime end: Only include usage that occurred on or before this date - :param datetime start: Only include usage that has occurred on or after this date - :param UsageRecordInstance.Granularity granularity: The time-based grouping that results are aggregated by - :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.wireless.v1.sim.usage_record.UsageRecordInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(end=end, start=start, granularity=granularity, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - def list(self, end=values.unset, start=values.unset, granularity=values.unset, - limit=None, page_size=None): - """ - Lists UsageRecordInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end: Only include usage that occurred on or before this date - :param datetime start: Only include usage that has occurred on or after this date - :param UsageRecordInstance.Granularity granularity: The time-based grouping that results are aggregated by - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.wireless.v1.sim.usage_record.UsageRecordInstance] - """ - return list(self.stream( - end=end, - start=start, - granularity=granularity, - limit=limit, - page_size=page_size, - )) - - def page(self, end=values.unset, start=values.unset, granularity=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UsageRecordInstance records from the API. - Request is executed immediately - - :param datetime end: Only include usage that occurred on or before this date - :param datetime start: Only include usage that has occurred on or after this date - :param UsageRecordInstance.Granularity granularity: The time-based grouping that results are aggregated by - :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 UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - """ - data = values.of({ - 'End': serialize.iso8601_datetime(end), - 'Start': serialize.iso8601_datetime(start), - 'Granularity': granularity, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UsageRecordPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UsageRecordInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UsageRecordPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class UsageRecordPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the UsageRecordPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sim_sid: The SID of the Sim resource that this Usage Record is for - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordPage - """ - super(UsageRecordPage, self).__init__(version, response) +class UsageRecordListInstance(ListResource): + def __init__(self, version: V1, sim_sid: str): + # TODO: needs autogenerated docs + super(UsageRecordListInstanceList, self).__init__(version) # Path Solution - self._solution = solution + self._solution = { sim_sid, } + self._uri = '/Sims/${sim_sid}/UsageRecords' + + + def page(self, end, start, granularity, page_size): + + data = values.of({ + 'end': end,'start': start,'granularity': granularity,'page_size': page_size, + }) - def get_instance(self, payload): - """ - Build an instance of UsageRecordInstance - - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - """ - return UsageRecordInstance(self._version, payload, sim_sid=self._solution['sim_sid'], ) + return UsageRecordPage(self._version, payload, sim_sid=self._solution['sim_sid']) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + return '' -class UsageRecordInstance(InstanceResource): - - class Granularity(object): - HOURLY = "hourly" - DAILY = "daily" - ALL = "all" - - def __init__(self, version, payload, sim_sid): - """ - Initialize the UsageRecordInstance - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordInstance - """ - super(UsageRecordInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sim_sid': payload.get('sim_sid'), - 'account_sid': payload.get('account_sid'), - 'period': payload.get('period'), - 'commands': payload.get('commands'), - 'data': payload.get('data'), - } - - # Context - self._context = None - self._solution = {'sim_sid': sim_sid, } - - @property - def sim_sid(self): - """ - :returns: The SID of the Sim resource that this Usage Record is for - :rtype: unicode - """ - return self._properties['sim_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def period(self): - """ - :returns: The time period for which the usage is reported - :rtype: dict - """ - return self._properties['period'] - - @property - def commands(self): - """ - :returns: An object that describes the SIM's usage of Commands during the specified period - :rtype: dict - """ - return self._properties['commands'] - - @property - def data(self): - """ - :returns: An object that describes the SIM's data usage during the specified period - :rtype: dict - """ - return self._properties['data'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/wireless/v1/usage_record.py b/twilio/rest/wireless/v1/usage_record.py index 422eccbfeb..2a35bb1abd 100644 --- a/twilio/rest/wireless/v1/usage_record.py +++ b/twilio/rest/wireless/v1/usage_record.py @@ -1,250 +1,58 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Wireless + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + + +from twilio.base import deserialize from twilio.base import serialize from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class UsageRecordList(ListResource): - - def __init__(self, version): - """ - Initialize the UsageRecordList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.wireless.v1.usage_record.UsageRecordList - :rtype: twilio.rest.wireless.v1.usage_record.UsageRecordList - """ - super(UsageRecordList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/UsageRecords'.format(**self._solution) - - def stream(self, end=values.unset, start=values.unset, granularity=values.unset, - limit=None, page_size=None): - """ - Streams UsageRecordInstance 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 datetime end: Only include usage that has occurred on or before this date - :param datetime start: Only include usage that has occurred on or after this date - :param UsageRecordInstance.Granularity granularity: The time-based grouping that results are aggregated by - :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.wireless.v1.usage_record.UsageRecordInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(end=end, start=start, granularity=granularity, page_size=limits['page_size'], ) - return self._version.stream(page, limits['limit']) - - def list(self, end=values.unset, start=values.unset, granularity=values.unset, - limit=None, page_size=None): - """ - Lists UsageRecordInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime end: Only include usage that has occurred on or before this date - :param datetime start: Only include usage that has occurred on or after this date - :param UsageRecordInstance.Granularity granularity: The time-based grouping that results are aggregated by - :param int limit: Upper limit for the number of records to return. list() guarantees - never to 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, list() 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.wireless.v1.usage_record.UsageRecordInstance] - """ - return list(self.stream( - end=end, - start=start, - granularity=granularity, - limit=limit, - page_size=page_size, - )) - - def page(self, end=values.unset, start=values.unset, granularity=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UsageRecordInstance records from the API. - Request is executed immediately - - :param datetime end: Only include usage that has occurred on or before this date - :param datetime start: Only include usage that has occurred on or after this date - :param UsageRecordInstance.Granularity granularity: The time-based grouping that results are aggregated by - :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 UsageRecordInstance - :rtype: twilio.rest.wireless.v1.usage_record.UsageRecordPage - """ - data = values.of({ - 'End': serialize.iso8601_datetime(end), - 'Start': serialize.iso8601_datetime(start), - 'Granularity': granularity, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UsageRecordPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UsageRecordInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UsageRecordInstance - :rtype: twilio.rest.wireless.v1.usage_record.UsageRecordPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UsageRecordPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' -class UsageRecordPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the UsageRecordPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.wireless.v1.usage_record.UsageRecordPage - :rtype: twilio.rest.wireless.v1.usage_record.UsageRecordPage - """ - super(UsageRecordPage, self).__init__(version, response) +class UsageRecordListInstance(ListResource): + def __init__(self, version: V1): + # TODO: needs autogenerated docs + super(UsageRecordListInstanceList, self).__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsageRecordInstance + self._solution = { } + self._uri = '/UsageRecords' + + + def page(self, end, start, granularity, page_size): + + data = values.of({ + 'end': end,'start': start,'granularity': granularity,'page_size': page_size, + }) - :param dict payload: Payload response from the API + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.wireless.v1.usage_record.UsageRecordInstance - :rtype: twilio.rest.wireless.v1.usage_record.UsageRecordInstance - """ - return UsageRecordInstance(self._version, payload, ) + return UsageRecordPage(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class UsageRecordInstance(InstanceResource): + return '' - class Granularity(object): - HOURLY = "hourly" - DAILY = "daily" - ALL = "all" - - def __init__(self, version, payload): - """ - Initialize the UsageRecordInstance - - :returns: twilio.rest.wireless.v1.usage_record.UsageRecordInstance - :rtype: twilio.rest.wireless.v1.usage_record.UsageRecordInstance - """ - super(UsageRecordInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'period': payload.get('period'), - 'commands': payload.get('commands'), - 'data': payload.get('data'), - } - - # Context - self._context = None - self._solution = {} - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def period(self): - """ - :returns: The time period for which usage is reported - :rtype: dict - """ - return self._properties['period'] - - @property - def commands(self): - """ - :returns: An object that describes the aggregated Commands usage for all SIMs during the specified period - :rtype: dict - """ - return self._properties['commands'] - - @property - def data(self): - """ - :returns: An object that describes the aggregated Data usage for all SIMs over the period - :rtype: dict - """ - return self._properties['data'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' From 1ff479ebb0ec8ccee6c4d1fde9e472771a056f3d Mon Sep 17 00:00:00 2001 From: Matt Cole Date: Wed, 11 Jan 2023 10:55:18 -0500 Subject: [PATCH 2/3] Ignore unwanted files --- .gitignore | 3 + .vscode/configurationCache.log | 1 + .vscode/settings.json | 3 + .vscode/targets.log | 356 ++++++++++++++++++ .../accounts/v1/.openapi-generator-ignore | 23 -- .../rest/accounts/v1/.openapi-generator/FILES | 11 - .../accounts/v1/.openapi-generator/VERSION | 1 - .../rest/api/v2010/.openapi-generator-ignore | 23 -- .../rest/api/v2010/.openapi-generator/FILES | 159 -------- .../rest/api/v2010/.openapi-generator/VERSION | 1 - .../autopilot/v1/.openapi-generator-ignore | 23 -- .../autopilot/v1/.openapi-generator/FILES | 31 -- .../autopilot/v1/.openapi-generator/VERSION | 1 - .../bulkexports/v1/.openapi-generator-ignore | 23 -- .../bulkexports/v1/.openapi-generator/FILES | 11 - .../bulkexports/v1/.openapi-generator/VERSION | 1 - twilio/rest/chat/v1/.openapi-generator-ignore | 23 -- twilio/rest/chat/v1/.openapi-generator/FILES | 19 - .../rest/chat/v1/.openapi-generator/VERSION | 1 - twilio/rest/chat/v2/.openapi-generator-ignore | 23 -- twilio/rest/chat/v2/.openapi-generator/FILES | 25 -- .../rest/chat/v2/.openapi-generator/VERSION | 1 - twilio/rest/chat/v3/.openapi-generator-ignore | 23 -- twilio/rest/chat/v3/.openapi-generator/FILES | 3 - .../rest/chat/v3/.openapi-generator/VERSION | 1 - .../rest/content/v1/.openapi-generator-ignore | 23 -- .../rest/content/v1/.openapi-generator/FILES | 5 - .../content/v1/.openapi-generator/VERSION | 1 - .../v1/.openapi-generator-ignore | 23 -- .../conversations/v1/.openapi-generator/FILES | 55 --- .../v1/.openapi-generator/VERSION | 1 - .../rest/events/v1/.openapi-generator-ignore | 23 -- .../rest/events/v1/.openapi-generator/FILES | 17 - .../rest/events/v1/.openapi-generator/VERSION | 1 - .../rest/flexApi/v1/.openapi-generator-ignore | 23 -- .../rest/flexApi/v1/.openapi-generator/FILES | 23 -- .../flexApi/v1/.openapi-generator/VERSION | 1 - .../rest/flexApi/v2/.openapi-generator-ignore | 23 -- .../rest/flexApi/v2/.openapi-generator/FILES | 3 - .../flexApi/v2/.openapi-generator/VERSION | 1 - .../frontlineApi/v1/.openapi-generator-ignore | 23 -- .../frontlineApi/v1/.openapi-generator/FILES | 3 - .../v1/.openapi-generator/VERSION | 1 - .../insights/v1/.openapi-generator-ignore | 23 -- .../rest/insights/v1/.openapi-generator/FILES | 23 -- .../insights/v1/.openapi-generator/VERSION | 1 - .../ipMessaging/v1/.openapi-generator-ignore | 23 -- .../ipMessaging/v1/.openapi-generator/FILES | 19 - .../ipMessaging/v1/.openapi-generator/VERSION | 1 - .../ipMessaging/v2/.openapi-generator-ignore | 23 -- .../ipMessaging/v2/.openapi-generator/FILES | 25 -- .../ipMessaging/v2/.openapi-generator/VERSION | 1 - .../rest/lookups/v1/.openapi-generator-ignore | 23 -- .../rest/lookups/v1/.openapi-generator/FILES | 3 - .../lookups/v1/.openapi-generator/VERSION | 1 - .../rest/lookups/v2/.openapi-generator-ignore | 23 -- .../rest/lookups/v2/.openapi-generator/FILES | 3 - .../lookups/v2/.openapi-generator/VERSION | 1 - .../rest/media/v1/.openapi-generator-ignore | 23 -- twilio/rest/media/v1/.openapi-generator/FILES | 9 - .../rest/media/v1/.openapi-generator/VERSION | 1 - .../messaging/v1/.openapi-generator-ignore | 23 -- .../messaging/v1/.openapi-generator/FILES | 29 -- .../messaging/v1/.openapi-generator/VERSION | 1 - .../microvisor/v1/.openapi-generator-ignore | 23 -- .../microvisor/v1/.openapi-generator/FILES | 5 - .../microvisor/v1/.openapi-generator/VERSION | 1 - .../rest/monitor/v1/.openapi-generator-ignore | 23 -- .../rest/monitor/v1/.openapi-generator/FILES | 5 - .../monitor/v1/.openapi-generator/VERSION | 1 - .../rest/notify/v1/.openapi-generator-ignore | 23 -- .../rest/notify/v1/.openapi-generator/FILES | 9 - .../rest/notify/v1/.openapi-generator/VERSION | 1 - .../rest/numbers/v2/.openapi-generator-ignore | 23 -- .../rest/numbers/v2/.openapi-generator/FILES | 23 -- .../numbers/v2/.openapi-generator/VERSION | 1 - .../rest/oauth/v1/.openapi-generator-ignore | 23 -- twilio/rest/oauth/v1/.openapi-generator/FILES | 11 - .../rest/oauth/v1/.openapi-generator/VERSION | 1 - twilio/rest/preview/.openapi-generator-ignore | 23 -- twilio/rest/preview/.openapi-generator/FILES | 79 ---- .../rest/preview/.openapi-generator/VERSION | 1 - .../rest/pricing/v1/.openapi-generator-ignore | 23 -- .../rest/pricing/v1/.openapi-generator/FILES | 15 - .../pricing/v1/.openapi-generator/VERSION | 1 - .../rest/pricing/v2/.openapi-generator-ignore | 23 -- .../rest/pricing/v2/.openapi-generator/FILES | 11 - .../pricing/v2/.openapi-generator/VERSION | 1 - .../rest/proxy/v1/.openapi-generator-ignore | 23 -- twilio/rest/proxy/v1/.openapi-generator/FILES | 15 - .../rest/proxy/v1/.openapi-generator/VERSION | 1 - .../rest/routes/v2/.openapi-generator-ignore | 23 -- .../rest/routes/v2/.openapi-generator/FILES | 7 - .../rest/routes/v2/.openapi-generator/VERSION | 1 - .../serverless/v1/.openapi-generator-ignore | 23 -- .../serverless/v1/.openapi-generator/FILES | 25 -- .../serverless/v1/.openapi-generator/VERSION | 1 - .../rest/studio/v1/.openapi-generator-ignore | 23 -- .../rest/studio/v1/.openapi-generator/FILES | 19 - .../rest/studio/v1/.openapi-generator/VERSION | 1 - .../rest/studio/v2/.openapi-generator-ignore | 23 -- .../rest/studio/v2/.openapi-generator/FILES | 17 - .../rest/studio/v2/.openapi-generator/VERSION | 1 - .../supersim/v1/.openapi-generator-ignore | 23 -- .../rest/supersim/v1/.openapi-generator/FILES | 25 -- .../supersim/v1/.openapi-generator/VERSION | 1 - twilio/rest/sync/v1/.openapi-generator-ignore | 23 -- twilio/rest/sync/v1/.openapi-generator/FILES | 23 -- .../rest/sync/v1/.openapi-generator/VERSION | 1 - .../taskrouter/v1/.openapi-generator-ignore | 23 -- .../taskrouter/v1/.openapi-generator/FILES | 51 --- .../taskrouter/v1/.openapi-generator/VERSION | 1 - .../trunking/v1/.openapi-generator-ignore | 23 -- .../rest/trunking/v1/.openapi-generator/FILES | 13 - .../trunking/v1/.openapi-generator/VERSION | 1 - .../trusthub/v1/.openapi-generator-ignore | 23 -- .../rest/trusthub/v1/.openapi-generator/FILES | 27 -- .../trusthub/v1/.openapi-generator/VERSION | 1 - .../rest/verify/v2/.openapi-generator-ignore | 23 -- .../rest/verify/v2/.openapi-generator/FILES | 37 -- .../rest/verify/v2/.openapi-generator/VERSION | 1 - .../rest/video/v1/.openapi-generator-ignore | 23 -- twilio/rest/video/v1/.openapi-generator/FILES | 27 -- .../rest/video/v1/.openapi-generator/VERSION | 1 - .../rest/voice/v1/.openapi-generator-ignore | 23 -- twilio/rest/voice/v1/.openapi-generator/FILES | 23 -- .../rest/voice/v1/.openapi-generator/VERSION | 1 - .../wireless/v1/.openapi-generator-ignore | 23 -- .../rest/wireless/v1/.openapi-generator/FILES | 13 - .../wireless/v1/.openapi-generator/VERSION | 1 - 130 files changed, 363 insertions(+), 1964 deletions(-) create mode 100644 .vscode/configurationCache.log create mode 100644 .vscode/settings.json create mode 100644 .vscode/targets.log delete mode 100644 twilio/rest/accounts/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/accounts/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/accounts/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/api/v2010/.openapi-generator-ignore delete mode 100644 twilio/rest/api/v2010/.openapi-generator/FILES delete mode 100644 twilio/rest/api/v2010/.openapi-generator/VERSION delete mode 100644 twilio/rest/autopilot/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/autopilot/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/autopilot/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/bulkexports/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/bulkexports/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/bulkexports/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/chat/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/chat/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/chat/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/chat/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/chat/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/chat/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/chat/v3/.openapi-generator-ignore delete mode 100644 twilio/rest/chat/v3/.openapi-generator/FILES delete mode 100644 twilio/rest/chat/v3/.openapi-generator/VERSION delete mode 100644 twilio/rest/content/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/content/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/content/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/conversations/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/conversations/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/conversations/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/events/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/events/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/events/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/flexApi/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/flexApi/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/flexApi/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/flexApi/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/flexApi/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/flexApi/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/frontlineApi/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/frontlineApi/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/frontlineApi/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/insights/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/insights/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/insights/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/ipMessaging/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/ipMessaging/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/ipMessaging/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/ipMessaging/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/ipMessaging/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/ipMessaging/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/lookups/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/lookups/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/lookups/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/lookups/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/lookups/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/lookups/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/media/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/media/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/media/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/messaging/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/messaging/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/messaging/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/microvisor/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/microvisor/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/microvisor/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/monitor/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/monitor/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/monitor/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/notify/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/notify/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/notify/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/numbers/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/numbers/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/numbers/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/oauth/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/oauth/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/oauth/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/preview/.openapi-generator-ignore delete mode 100644 twilio/rest/preview/.openapi-generator/FILES delete mode 100644 twilio/rest/preview/.openapi-generator/VERSION delete mode 100644 twilio/rest/pricing/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/pricing/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/pricing/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/pricing/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/pricing/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/pricing/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/proxy/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/proxy/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/proxy/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/routes/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/routes/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/routes/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/serverless/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/serverless/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/serverless/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/studio/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/studio/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/studio/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/studio/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/studio/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/studio/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/supersim/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/supersim/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/supersim/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/sync/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/sync/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/sync/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/taskrouter/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/taskrouter/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/taskrouter/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/trunking/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/trunking/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/trunking/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/trusthub/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/trusthub/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/trusthub/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/verify/v2/.openapi-generator-ignore delete mode 100644 twilio/rest/verify/v2/.openapi-generator/FILES delete mode 100644 twilio/rest/verify/v2/.openapi-generator/VERSION delete mode 100644 twilio/rest/video/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/video/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/video/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/voice/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/voice/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/voice/v1/.openapi-generator/VERSION delete mode 100644 twilio/rest/wireless/v1/.openapi-generator-ignore delete mode 100644 twilio/rest/wireless/v1/.openapi-generator/FILES delete mode 100644 twilio/rest/wireless/v1/.openapi-generator/VERSION diff --git a/.gitignore b/.gitignore index 5244650abc..fdcd464eb5 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ docs/source/_rst .python-version README.md.bak + +**/.openapi-generator* + diff --git a/.vscode/configurationCache.log b/.vscode/configurationCache.log new file mode 100644 index 0000000000..f1ffa6fa0e --- /dev/null +++ b/.vscode/configurationCache.log @@ -0,0 +1 @@ +{"buildTargets":[".PHONY","analysis","build","clean","develop","docker-build","docker-push","docs","docs-install","install","make","nopyc","release","test","test-install","test-with-coverage","venv"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..65e1ec0785 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "makefile.extensionOutputFolder": "./.vscode" +} \ No newline at end of file diff --git a/.vscode/targets.log b/.vscode/targets.log new file mode 100644 index 0000000000..60693623f9 --- /dev/null +++ b/.vscode/targets.log @@ -0,0 +1,356 @@ +# GNU Make 3.81 +# Copyright (C) 2006 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. +# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# This program built for i386-apple-darwin11.3.0 + +# Make data base, printed on Tue Aug 9 15:34:30 2022 + +# Variables + +# automatic +/dev/null || echo /Developer)/Makefiles +# environment +VSCODE_CODE_CACHE_PATH = /Users/mcole/Library/Application Support/Code/CachedData/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 +# environment +LOGNAME = mcole +# environment +APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1 +# environment +VSCODE_HANDLES_UNCAUGHT_ERRORS = true +# automatic +^D = $(patsubst %/,%,$(dir $^)) +# environment +XPC_FLAGS = 0x0 +# default +MAKE = $(MAKE_COMMAND) +# default +MAKECMDGOALS := all +# environment +SHLVL = 1 +# default +MAKE_VERSION := 3.81 +# environment +USER = mcole +# makefile +.DEFAULT_GOAL := venv +# automatic +%D = $(patsubst %/,%,$(dir $%)) +# default +MAKE_COMMAND := /Library/Developer/CommandLineTools/usr/bin/make +# default +.VARIABLES := +# environment +TMPDIR = /var/folders/c2/df88nx7j2pg3rv6h25kk6wnh0000gn/T/ +# automatic +*F = $(notdir $*) +# environment +VSCODE_IPC_HOOK = /Users/mcole/Library/Application Support/Code/1.67.2-main.sock +# makefile +MAKEFLAGS = Rrqp +# environment +MFLAGS = -Rrqp +# automatic +*D = $(patsubst %/,%,$(dir $*)) +# environment +XPC_SERVICE_NAME = application.com.microsoft.VSCode.2608531.2608537 +# automatic ++D = $(patsubst %/,%,$(dir $+)) +# automatic ++F = $(notdir $+) +# environment +__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0 +# environment +COMMAND_MODE = unix2003 +# default +MAKEFILES := +# automatic + Date: Wed, 11 Jan 2023 10:58:37 -0500 Subject: [PATCH 3/3] chore: remove unwanted vscode files --- .gitignore | 1 - .vscode/configurationCache.log | 1 - .vscode/settings.json | 3 - .vscode/targets.log | 356 --------------------------------- 4 files changed, 361 deletions(-) delete mode 100644 .vscode/configurationCache.log delete mode 100644 .vscode/settings.json delete mode 100644 .vscode/targets.log diff --git a/.gitignore b/.gitignore index fdcd464eb5..87b3317bf6 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,3 @@ docs/source/_rst README.md.bak **/.openapi-generator* - diff --git a/.vscode/configurationCache.log b/.vscode/configurationCache.log deleted file mode 100644 index f1ffa6fa0e..0000000000 --- a/.vscode/configurationCache.log +++ /dev/null @@ -1 +0,0 @@ -{"buildTargets":[".PHONY","analysis","build","clean","develop","docker-build","docker-push","docs","docs-install","install","make","nopyc","release","test","test-install","test-with-coverage","venv"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 65e1ec0785..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "makefile.extensionOutputFolder": "./.vscode" -} \ No newline at end of file diff --git a/.vscode/targets.log b/.vscode/targets.log deleted file mode 100644 index 60693623f9..0000000000 --- a/.vscode/targets.log +++ /dev/null @@ -1,356 +0,0 @@ -# GNU Make 3.81 -# Copyright (C) 2006 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. -# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# This program built for i386-apple-darwin11.3.0 - -# Make data base, printed on Tue Aug 9 15:34:30 2022 - -# Variables - -# automatic -/dev/null || echo /Developer)/Makefiles -# environment -VSCODE_CODE_CACHE_PATH = /Users/mcole/Library/Application Support/Code/CachedData/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 -# environment -LOGNAME = mcole -# environment -APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1 -# environment -VSCODE_HANDLES_UNCAUGHT_ERRORS = true -# automatic -^D = $(patsubst %/,%,$(dir $^)) -# environment -XPC_FLAGS = 0x0 -# default -MAKE = $(MAKE_COMMAND) -# default -MAKECMDGOALS := all -# environment -SHLVL = 1 -# default -MAKE_VERSION := 3.81 -# environment -USER = mcole -# makefile -.DEFAULT_GOAL := venv -# automatic -%D = $(patsubst %/,%,$(dir $%)) -# default -MAKE_COMMAND := /Library/Developer/CommandLineTools/usr/bin/make -# default -.VARIABLES := -# environment -TMPDIR = /var/folders/c2/df88nx7j2pg3rv6h25kk6wnh0000gn/T/ -# automatic -*F = $(notdir $*) -# environment -VSCODE_IPC_HOOK = /Users/mcole/Library/Application Support/Code/1.67.2-main.sock -# makefile -MAKEFLAGS = Rrqp -# environment -MFLAGS = -Rrqp -# automatic -*D = $(patsubst %/,%,$(dir $*)) -# environment -XPC_SERVICE_NAME = application.com.microsoft.VSCode.2608531.2608537 -# automatic -+D = $(patsubst %/,%,$(dir $+)) -# automatic -+F = $(notdir $+) -# environment -__CF_USER_TEXT_ENCODING = 0x1F5:0x0:0x0 -# environment -COMMAND_MODE = unix2003 -# default -MAKEFILES := -# automatic -