diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83d63e88..c7bf1134 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,9 +14,6 @@ stages: - pip install -r test-requirements.txt - pytest --cov=bandwidth -pytest-3.8: - extends: .pytest - image: python:3.8-alpine pytest-3.9: extends: .pytest image: python:3.9-alpine @@ -29,3 +26,6 @@ pytest-3.11: pytest-3.12: extends: .pytest image: python:3.12-alpine +pytest-3.13: + extends: .pytest + image: python:3.13-alpine diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3a07d2c4..ed969ed2 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -23,6 +23,7 @@ bandwidth/models/account_statistics.py bandwidth/models/additional_denial_reason.py bandwidth/models/address.py bandwidth/models/answer_callback.py +bandwidth/models/async_lookup_request.py bandwidth/models/blocked_webhook.py bandwidth/models/bridge_complete_callback.py bandwidth/models/bridge_target_complete_callback.py @@ -41,6 +42,7 @@ bandwidth/models/callback.py bandwidth/models/callback_method_enum.py bandwidth/models/card_width_enum.py bandwidth/models/code_request.py +bandwidth/models/completed_lookup_status_enum.py bandwidth/models/conference.py bandwidth/models/conference_completed_callback.py bandwidth/models/conference_created_callback.py @@ -52,11 +54,15 @@ bandwidth/models/conference_recording_metadata.py bandwidth/models/conference_redirect_callback.py bandwidth/models/conference_state_enum.py bandwidth/models/contact.py +bandwidth/models/create_async_bulk_lookup_response.py +bandwidth/models/create_async_bulk_lookup_response_data.py bandwidth/models/create_call.py bandwidth/models/create_call_response.py -bandwidth/models/create_lookup_response.py bandwidth/models/create_message_request_error.py bandwidth/models/create_multi_channel_message_response.py +bandwidth/models/create_sync_lookup_response.py +bandwidth/models/create_sync_lookup_response_data.py +bandwidth/models/deactivation_event_enum.py bandwidth/models/disconnect_callback.py bandwidth/models/diversion.py bandwidth/models/dtmf_callback.py @@ -67,18 +73,24 @@ bandwidth/models/failure_webhook.py bandwidth/models/field_error.py bandwidth/models/file_format_enum.py bandwidth/models/gather_callback.py +bandwidth/models/get_async_bulk_lookup_response.py +bandwidth/models/get_async_bulk_lookup_response_data.py +bandwidth/models/in_progress_lookup_status_enum.py bandwidth/models/inbound_callback.py bandwidth/models/inbound_callback_message.py bandwidth/models/inbound_callback_type_enum.py bandwidth/models/initiate_callback.py +bandwidth/models/latest_message_delivery_status_enum.py +bandwidth/models/line_type_enum.py bandwidth/models/link.py +bandwidth/models/link_schema.py bandwidth/models/links_object.py bandwidth/models/list_message_direction_enum.py bandwidth/models/list_message_item.py -bandwidth/models/lookup_request.py +bandwidth/models/lookup_error_response.py +bandwidth/models/lookup_error_schema.py +bandwidth/models/lookup_error_schema_meta.py bandwidth/models/lookup_result.py -bandwidth/models/lookup_status.py -bandwidth/models/lookup_status_enum.py bandwidth/models/machine_detection_complete_callback.py bandwidth/models/machine_detection_configuration.py bandwidth/models/machine_detection_mode_enum.py @@ -140,6 +152,7 @@ bandwidth/models/status_callback.py bandwidth/models/status_callback_message.py bandwidth/models/status_callback_type_enum.py bandwidth/models/stir_shaken.py +bandwidth/models/sync_lookup_request.py bandwidth/models/telephone_number.py bandwidth/models/tfv_basic_authentication.py bandwidth/models/tfv_callback_status_enum.py @@ -149,7 +162,6 @@ bandwidth/models/tfv_status_enum.py bandwidth/models/tfv_submission_info.py bandwidth/models/tfv_submission_wrapper.py bandwidth/models/thumbnail_alignment_enum.py -bandwidth/models/tn_lookup_request_error.py bandwidth/models/transcribe_recording.py bandwidth/models/transcription.py bandwidth/models/transcription_available_callback.py @@ -179,6 +191,7 @@ docs/AccountStatistics.md docs/AdditionalDenialReason.md docs/Address.md docs/AnswerCallback.md +docs/AsyncLookupRequest.md docs/BlockedWebhook.md docs/BridgeCompleteCallback.md docs/BridgeTargetCompleteCallback.md @@ -198,6 +211,7 @@ docs/CallbackMethodEnum.md docs/CallsApi.md docs/CardWidthEnum.md docs/CodeRequest.md +docs/CompletedLookupStatusEnum.md docs/Conference.md docs/ConferenceCompletedCallback.md docs/ConferenceCreatedCallback.md @@ -210,11 +224,15 @@ docs/ConferenceRedirectCallback.md docs/ConferenceStateEnum.md docs/ConferencesApi.md docs/Contact.md +docs/CreateAsyncBulkLookupResponse.md +docs/CreateAsyncBulkLookupResponseData.md docs/CreateCall.md docs/CreateCallResponse.md -docs/CreateLookupResponse.md docs/CreateMessageRequestError.md docs/CreateMultiChannelMessageResponse.md +docs/CreateSyncLookupResponse.md +docs/CreateSyncLookupResponseData.md +docs/DeactivationEventEnum.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md @@ -225,18 +243,24 @@ docs/FailureWebhook.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md +docs/GetAsyncBulkLookupResponse.md +docs/GetAsyncBulkLookupResponseData.md +docs/InProgressLookupStatusEnum.md docs/InboundCallback.md docs/InboundCallbackMessage.md docs/InboundCallbackTypeEnum.md docs/InitiateCallback.md +docs/LatestMessageDeliveryStatusEnum.md +docs/LineTypeEnum.md docs/Link.md +docs/LinkSchema.md docs/LinksObject.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md -docs/LookupRequest.md +docs/LookupErrorResponse.md +docs/LookupErrorSchema.md +docs/LookupErrorSchemaMeta.md docs/LookupResult.md -docs/LookupStatus.md -docs/LookupStatusEnum.md docs/MFAApi.md docs/MachineDetectionCompleteCallback.md docs/MachineDetectionConfiguration.md @@ -305,6 +329,7 @@ docs/StatusCallback.md docs/StatusCallbackMessage.md docs/StatusCallbackTypeEnum.md docs/StirShaken.md +docs/SyncLookupRequest.md docs/TelephoneNumber.md docs/TfvBasicAuthentication.md docs/TfvCallbackStatusEnum.md @@ -314,7 +339,6 @@ docs/TfvStatusEnum.md docs/TfvSubmissionInfo.md docs/TfvSubmissionWrapper.md docs/ThumbnailAlignmentEnum.md -docs/TnLookupRequestError.md docs/TollFreeVerificationApi.md docs/TranscribeRecording.md docs/Transcription.md diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index b23eb275..6328c542 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.11.0 +7.17.0 diff --git a/.travis.yml b/.travis.yml index 5eb462cc..5f7621b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ # ref: https://docs.travis-ci.com/user/languages/python language: python python: - - "3.8" - "3.9" - "3.10" - "3.11" - "3.12" + - "3.13" # uncomment the following if needed - #- "3.12-dev" # 3.12 development branch + #- "3.13-dev" # 3.13 development branch #- "nightly" # nightly build # command to install dependencies install: diff --git a/README.md b/README.md index ff6453f4..e83698f9 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 1.0.0 - Package version: 1.0.0 -- Generator version: 7.11.0 +- Generator version: 7.17.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://dev.bandwidth.com](https://dev.bandwidth.com) ## Requirements. -Python 3.8+ +Python 3.9+ ## Installation & Usage ### pip install @@ -19,9 +19,9 @@ Python 3.8+ If the python package is hosted on a repository, you can install directly using: ```sh -pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +pip install git+https://github.com/bandwidth/python-sdk.git ``` -(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/bandwidth/python-sdk.git`) Then import the package: ```python @@ -121,8 +121,9 @@ Class | Method | HTTP request | Description *MessagesApi* | [**create_message**](docs/MessagesApi.md#create_message) | **POST** /users/{accountId}/messages | Create Message *MessagesApi* | [**list_messages**](docs/MessagesApi.md#list_messages) | **GET** /users/{accountId}/messages | List Messages *MultiChannelApi* | [**create_multi_channel_message**](docs/MultiChannelApi.md#create_multi_channel_message) | **POST** /users/{accountId}/messages/multiChannel | Create Multi-Channel Message -*PhoneNumberLookupApi* | [**create_lookup**](docs/PhoneNumberLookupApi.md#create_lookup) | **POST** /accounts/{accountId}/tnlookup | Create Lookup -*PhoneNumberLookupApi* | [**get_lookup_status**](docs/PhoneNumberLookupApi.md#get_lookup_status) | **GET** /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status +*PhoneNumberLookupApi* | [**create_async_bulk_lookup**](docs/PhoneNumberLookupApi.md#create_async_bulk_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup +*PhoneNumberLookupApi* | [**create_sync_lookup**](docs/PhoneNumberLookupApi.md#create_sync_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup +*PhoneNumberLookupApi* | [**get_async_bulk_lookup**](docs/PhoneNumberLookupApi.md#get_async_bulk_lookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup *RecordingsApi* | [**delete_recording**](docs/RecordingsApi.md#delete_recording) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording *RecordingsApi* | [**delete_recording_media**](docs/RecordingsApi.md#delete_recording_media) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media *RecordingsApi* | [**delete_recording_transcription**](docs/RecordingsApi.md#delete_recording_transcription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription @@ -154,6 +155,7 @@ Class | Method | HTTP request | Description - [AdditionalDenialReason](docs/AdditionalDenialReason.md) - [Address](docs/Address.md) - [AnswerCallback](docs/AnswerCallback.md) + - [AsyncLookupRequest](docs/AsyncLookupRequest.md) - [BlockedWebhook](docs/BlockedWebhook.md) - [BridgeCompleteCallback](docs/BridgeCompleteCallback.md) - [BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md) @@ -172,6 +174,7 @@ Class | Method | HTTP request | Description - [CallbackMethodEnum](docs/CallbackMethodEnum.md) - [CardWidthEnum](docs/CardWidthEnum.md) - [CodeRequest](docs/CodeRequest.md) + - [CompletedLookupStatusEnum](docs/CompletedLookupStatusEnum.md) - [Conference](docs/Conference.md) - [ConferenceCompletedCallback](docs/ConferenceCompletedCallback.md) - [ConferenceCreatedCallback](docs/ConferenceCreatedCallback.md) @@ -183,11 +186,15 @@ Class | Method | HTTP request | Description - [ConferenceRedirectCallback](docs/ConferenceRedirectCallback.md) - [ConferenceStateEnum](docs/ConferenceStateEnum.md) - [Contact](docs/Contact.md) + - [CreateAsyncBulkLookupResponse](docs/CreateAsyncBulkLookupResponse.md) + - [CreateAsyncBulkLookupResponseData](docs/CreateAsyncBulkLookupResponseData.md) - [CreateCall](docs/CreateCall.md) - [CreateCallResponse](docs/CreateCallResponse.md) - - [CreateLookupResponse](docs/CreateLookupResponse.md) - [CreateMessageRequestError](docs/CreateMessageRequestError.md) - [CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) + - [CreateSyncLookupResponse](docs/CreateSyncLookupResponse.md) + - [CreateSyncLookupResponseData](docs/CreateSyncLookupResponseData.md) + - [DeactivationEventEnum](docs/DeactivationEventEnum.md) - [DisconnectCallback](docs/DisconnectCallback.md) - [Diversion](docs/Diversion.md) - [DtmfCallback](docs/DtmfCallback.md) @@ -198,18 +205,24 @@ Class | Method | HTTP request | Description - [FieldError](docs/FieldError.md) - [FileFormatEnum](docs/FileFormatEnum.md) - [GatherCallback](docs/GatherCallback.md) + - [GetAsyncBulkLookupResponse](docs/GetAsyncBulkLookupResponse.md) + - [GetAsyncBulkLookupResponseData](docs/GetAsyncBulkLookupResponseData.md) + - [InProgressLookupStatusEnum](docs/InProgressLookupStatusEnum.md) - [InboundCallback](docs/InboundCallback.md) - [InboundCallbackMessage](docs/InboundCallbackMessage.md) - [InboundCallbackTypeEnum](docs/InboundCallbackTypeEnum.md) - [InitiateCallback](docs/InitiateCallback.md) + - [LatestMessageDeliveryStatusEnum](docs/LatestMessageDeliveryStatusEnum.md) + - [LineTypeEnum](docs/LineTypeEnum.md) - [Link](docs/Link.md) + - [LinkSchema](docs/LinkSchema.md) - [LinksObject](docs/LinksObject.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [ListMessageItem](docs/ListMessageItem.md) - - [LookupRequest](docs/LookupRequest.md) + - [LookupErrorResponse](docs/LookupErrorResponse.md) + - [LookupErrorSchema](docs/LookupErrorSchema.md) + - [LookupErrorSchemaMeta](docs/LookupErrorSchemaMeta.md) - [LookupResult](docs/LookupResult.md) - - [LookupStatus](docs/LookupStatus.md) - - [LookupStatusEnum](docs/LookupStatusEnum.md) - [MachineDetectionCompleteCallback](docs/MachineDetectionCompleteCallback.md) - [MachineDetectionConfiguration](docs/MachineDetectionConfiguration.md) - [MachineDetectionModeEnum](docs/MachineDetectionModeEnum.md) @@ -271,6 +284,7 @@ Class | Method | HTTP request | Description - [StatusCallbackMessage](docs/StatusCallbackMessage.md) - [StatusCallbackTypeEnum](docs/StatusCallbackTypeEnum.md) - [StirShaken](docs/StirShaken.md) + - [SyncLookupRequest](docs/SyncLookupRequest.md) - [TelephoneNumber](docs/TelephoneNumber.md) - [TfvBasicAuthentication](docs/TfvBasicAuthentication.md) - [TfvCallbackStatusEnum](docs/TfvCallbackStatusEnum.md) @@ -280,7 +294,6 @@ Class | Method | HTTP request | Description - [TfvSubmissionInfo](docs/TfvSubmissionInfo.md) - [TfvSubmissionWrapper](docs/TfvSubmissionWrapper.md) - [ThumbnailAlignmentEnum](docs/ThumbnailAlignmentEnum.md) - - [TnLookupRequestError](docs/TnLookupRequestError.md) - [TranscribeRecording](docs/TranscribeRecording.md) - [Transcription](docs/Transcription.md) - [TranscriptionAvailableCallback](docs/TranscriptionAvailableCallback.md) diff --git a/bandwidth.yml b/bandwidth.yml index bf2c9ab0..0c613484 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -1328,62 +1328,66 @@ paths: '500': $ref: '#/components/responses/mfaInternalServerError' servers: *ref_2 - /accounts/{accountId}/tnlookup: + /accounts/{accountId}/phoneNumberLookup: post: - deprecated: true - summary: Create Lookup - description: Create a Phone Number Lookup Request. - operationId: createLookup + summary: Create Synchronous Number Lookup + description: >- + Creates a synchronous phone number lookup request. Maximum of 100 + telephone numbers per request. + operationId: createSyncLookup tags: - Phone Number Lookup parameters: - - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/accountId1' requestBody: - $ref: '#/components/requestBodies/createLookupRequest' + $ref: '#/components/requestBodies/createSyncLookupRequest' responses: - '202': - $ref: '#/components/responses/createLookupResponse' - '400': - $ref: '#/components/responses/tnLookupBadRequestError' - '401': - $ref: '#/components/responses/tnLookupUnauthorizedError' - '403': - $ref: '#/components/responses/tnLookupForbiddenError' - '415': - $ref: '#/components/responses/tnLookupMediaTypeError' - '429': - $ref: '#/components/responses/tnLookupTooManyRequestsError' - '500': - $ref: '#/components/responses/tnLookupInternalServerError' + '200': + $ref: '#/components/responses/createSyncLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' servers: &ref_3 - - url: https://numbers.bandwidth.com/api/v1 + - url: https://api.bandwidth.com/v2 description: Production - /accounts/{accountId}/tnlookup/{requestId}: + /accounts/{accountId}/phoneNumberLookup/bulk: + post: + summary: Create Asynchronous Bulk Number Lookup + description: >- + Creates an asynchronous bulk phone number lookup request. Maximum of + 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk + Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) + endpoint to check the status of the request and view the results. + operationId: createAsyncBulkLookup + tags: + - Phone Number Lookup + parameters: + - $ref: '#/components/parameters/accountId1' + requestBody: + $ref: '#/components/requestBodies/createAsyncBulkLookupRequest' + responses: + '202': + $ref: '#/components/responses/createAsyncBulkLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' + servers: *ref_3 + /accounts/{accountId}/phoneNumberLookup/bulk/{requestId}: get: - deprecated: true - summary: Get Lookup Request Status - description: Get an existing Phone Number Lookup Request. - operationId: getLookupStatus + summary: Get Asynchronous Bulk Number Lookup + description: >- + Get an existing [Asynchronous Bulk Number + Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use + this endpoint to check the status of the request and view the results. + operationId: getAsyncBulkLookup tags: - Phone Number Lookup parameters: - - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/accountId1' - $ref: '#/components/parameters/requestId' responses: '200': - $ref: '#/components/responses/getLookupResponse' - '400': - $ref: '#/components/responses/tnLookupBadRequestError' - '401': - $ref: '#/components/responses/tnLookupUnauthorizedError' - '403': - $ref: '#/components/responses/tnLookupForbiddenError' - '404': - $ref: '#/components/responses/tnLookupNotFoundError' - '429': - $ref: '#/components/responses/tnLookupTooManyRequestsError' - '500': - $ref: '#/components/responses/tnLookupInternalServerError' + $ref: '#/components/responses/getAsyncBulkLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' servers: *ref_3 /accounts/{accountId}/tollFreeVerification: post: @@ -5368,112 +5372,291 @@ components: The message containing the reason behind the request being forbidden. example: Missing Authentication Token - lookupStatusEnum: + completedLookupStatusEnum: + type: string + enum: + - COMPLETE + - PARTIAL_COMPLETE + - FAILED + example: COMPLETE + inProgressLookupStatusEnum: type: string - description: >- - The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or - FAILED). enum: - IN_PROGRESS - COMPLETE - PARTIAL_COMPLETE - FAILED example: COMPLETE - lookupRequest: + deactivationEventEnum: + type: string + description: > + [DNI-Only](#section/DNI-Only). + + `DEACTIVATED` if the carrier reported a deactivation event for this + phone number. + enum: + - DEACTIVATED + latestMessageDeliveryStatusEnum: + type: string + description: >- + [DNI-Only](#section/DNI-Only). The current delivery status of the phone + number. + + - ACTIVE: A message was successfully sent to the number (delivery code + 0). + + - DEACTIVATED: A message was not delivered to a number (delivery code + 720) + + - UNKNOWN: Bandwidth cannot find an delivery status entry for the + number. + enum: + - ACTIVE + - DEACTIVATED + - UNKNOWN + lineTypeEnum: + type: string + enum: + - FIXED + - VOIP-FIXED + - MOBILE + - VOIP + example: MOBILE + requestId: + type: string + format: uuid + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + linkSchema: + title: Link type: object - description: Create phone number lookup request. properties: - tns: + href: + type: string + description: URI of the link. + example: /relative/uri + rel: + type: string + description: Specifies the relationship between this link and the resource. + example: aRelatedResource + method: + type: string + description: HTTP method to be used. + example: GET + lookupErrorSchema: + type: object + properties: + code: + type: string + description: Validation error code + example: NO-MATCH + description: + type: string + description: Description of validation error + example: Example error description + type: + type: string + description: Type of validation error + example: NumberInventory + meta: + type: object + properties: + phoneNumbers: + type: array + items: + type: string + description: Phone number experiencing the error. + example: + - '+13992077164' + - '+19196104424' + message: + type: string + description: Message describing the error + example: Invalid TNs + code: + type: integer + description: Error code associated with the message + example: 1001 + syncLookupRequest: + type: object + properties: + phoneNumbers: + description: Telephone numbers in E.164 format. type: array + minimum: 1 + maximum: 100 items: type: string + pattern: ^\+[1-9]\d{1,14}$ required: - - tns - createLookupResponse: + - phoneNumbers + asyncLookupRequest: type: object - description: >- - The request has been accepted for processing but not yet finished and in - a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). properties: - requestId: - type: string - description: The phone number lookup request ID from Bandwidth. - status: - $ref: '#/components/schemas/lookupStatusEnum' - lookupStatus: + phoneNumbers: + description: Telephone numbers in E.164 format. + type: array + minimum: 1 + maximum: 15000 + items: + type: string + pattern: ^\+[1-9]\d{1,14}$ + required: + - phoneNumbers + createSyncLookupResponse: type: object - description: >- - If requestId exists, the result for that request is returned. See the - Examples for details on the various responses that you can receive. - Generally, if you see a Response Code of 0 in a result for a TN, - information will be available for it. Any other Response Code will - indicate no information was available for the TN. properties: - requestId: - type: string - description: The requestId. - example: 004223a0-8b17-41b1-bf81-20732adf5590 - status: - $ref: '#/components/schemas/lookupStatusEnum' - result: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/completedLookupStatusEnum' + results: + type: array + description: >- + The carrier information results for the specified telephone + numbers. + items: + $ref: '#/components/schemas/lookupResult' + errors: type: array - description: The carrier information results for the specified telephone number. items: - $ref: '#/components/schemas/lookupResult' - failedTelephoneNumbers: + $ref: '#/components/schemas/lookupErrorSchema' + createAsyncBulkLookupResponse: + type: object + properties: + links: type: array - description: The telephone numbers whose lookup failed. + description: Links for pagination (if applicable) items: - type: string - example: - - '+191955512345' + $ref: '#/components/schemas/linkSchema' + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/inProgressLookupStatusEnum' + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + getAsyncBulkLookupResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/inProgressLookupStatusEnum' + results: + type: array + description: >- + The carrier information results for the specified telephone + number. + items: + $ref: '#/components/schemas/lookupResult' + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + lookupErrorResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' lookupResult: type: object description: Carrier information results for the specified telephone number. properties: - Response Code: - type: integer - description: Our vendor's response code. - example: 0 - Message: - type: string - description: Message associated with the response code. - example: NOERROR - E.164 Format: + phoneNumber: type: string description: The telephone number in E.164 format. - example: '+19195551234' - Formatted: - type: string - description: The formatted version of the telephone number. - example: (919) 555-1234 - Country: - type: string - description: The country of the telephone number. - example: US - Line Type: - type: string - description: The line type of the telephone number. - example: Mobile - Line Provider: + example: '+10072904498' + lineType: + $ref: '#/components/schemas/lineTypeEnum' + messagingProvider: type: string description: The messaging service provider of the telephone number. example: Verizon Wireless - Mobile Country Code: + voiceProvider: type: string - description: The first half of the Home Network Identity (HNI). - example: '310' - Mobile Network Code: + description: The voice service provider of the telephone number. + example: Verizon Wireless + countryCodeA3: type: string - description: The second half of the HNI. - example: '010' - tnLookupRequestError: - type: object - properties: - message: + description: >- + The country code of the telephone number in ISO 3166-1 alpha-3 + format. + example: USA + deactivationReporter: + type: string + description: > + [DNI-Only](#section/DNI-Only). + + The carrier that reported a deactivation event for this phone + number. + deactivationDate: + type: string + format: date-time-local + description: >- + [DNI-Only](#section/DNI-Only). The datetime the carrier reported a + deactivation event. + example: 2025-06-20 18:35 + deactivationEvent: + $ref: '#/components/schemas/deactivationEventEnum' + latestMessageDeliveryStatus: + $ref: '#/components/schemas/latestMessageDeliveryStatusEnum' + initialMessageDeliveryStatusDate: + type: string + format: date + description: >- + [DNI-Only](#section/DNI-Only). The date the phone number entered the + status described in `latestMessageDeliveryStatus`. + + Think of this as the "start time" for that status. + + Value resets every time the `latestMessageDeliveryStatus` changes. + example: '2025-06-20' + latestMessageDeliveryStatusDate: type: string - description: A description of what validation error occurred. - example: example error message + format: date + description: >- + [DNI-Only](#section/DNI-Only). The date bandwidth last received + delivery status information for this phone number. + + Use this field to understand how up-to-date the + `latestMessageDeliveryStatus` is. + + Value resets every time the `latestMessageDeliveryStatus` changes. + example: '2025-06-21' accountId1: type: string description: User's account ID. @@ -6720,109 +6903,68 @@ components: application/json: schema: $ref: '#/components/schemas/mfaRequestError' - createLookupResponse: + createSyncLookupResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/createSyncLookupResponse' + examples: + lookupCompleteWithDniExample: + $ref: '#/components/examples/lookupCompleteWithDniExample' + lookupCompleteExample: + $ref: '#/components/examples/lookupCompleteExample' + lookupPartialExample: + $ref: '#/components/examples/lookupPartialExample' + lookupFailedExample: + $ref: '#/components/examples/lookupFailedExample' + createAsyncBulkLookupResponse: description: Accepted content: application/json: schema: - $ref: '#/components/schemas/createLookupResponse' + $ref: '#/components/schemas/createAsyncBulkLookupResponse' examples: - lookupResponseExample: + lookupInProgressExample: $ref: '#/components/examples/lookupInProgressExample' - getLookupResponse: + getAsyncBulkLookupResponse: description: OK content: application/json: schema: - $ref: '#/components/schemas/lookupStatus' + $ref: '#/components/schemas/getAsyncBulkLookupResponse' examples: + lookupCompleteWithDniExample: + $ref: '#/components/examples/lookupCompleteWithDniExample' + lookupCompleteExample: + $ref: '#/components/examples/lookupCompleteExample' lookupInProgressExample: $ref: '#/components/examples/lookupInProgressExample' + lookupPartialExample: + $ref: '#/components/examples/lookupPartialExample' lookupFailedExample: $ref: '#/components/examples/lookupFailedExample' - lookupSingleNumberCompleteExample: - $ref: '#/components/examples/lookupSingleNumberCompleteExample' - lookupMultipleNumbersCompleteExample: - $ref: '#/components/examples/lookupMultipleNumbersCompleteExample' - lookupMultipleNumbersPartialCompleteExample: - $ref: >- - #/components/examples/lookupMultipleNumbersPartialCompleteExample - lookupSingleNumberCompleteNoInfoExample: - $ref: '#/components/examples/lookupSingleNumberCompleteNoInfoExample' - tnLookupBadRequestError: + tnLookupDefaultResponse: description: Bad Request content: application/json: schema: - $ref: '#/components/schemas/tnLookupRequestError' + $ref: '#/components/schemas/lookupErrorResponse' examples: badRequest: - summary: Example Bad Request Error - value: - message: 'Some tns do not match e164 format: 1234' - tnLookupUnauthorizedError: - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: + $ref: '#/components/examples/badRequestExample' unauthorized: - summary: Example Unauthorized Error - value: - message: Unauthorized - tnLookupForbiddenError: - description: Forbidden - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: + $ref: '#/components/examples/unauthorizedExample' forbidden: - summary: Example Forbidden Error - value: - message: >- - Authorization header requires 'Credential' parameter. - Authorization header requires 'Signature' parameter. - Authorization header requires 'SignedHeaders' parameter. - Authorization header requires existence of either a - 'X-Amz-Date' or a 'Date' header. Authorization=Basic - Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' - tnLookupMediaTypeError: - description: Unsupported Media Type - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: - mediaType: - summary: Example Unsupported Media Type Error - value: - message: Content-Type must be application/json. - tnLookupNotFoundError: - description: Not Found - tnLookupTooManyRequestsError: - description: Too Many Requests - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: + $ref: '#/components/examples/forbiddenExample' mediaType: - summary: Example Too Many Requests Error - value: - message: Too many requests. - tnLookupInternalServerError: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: - mediaType: - summary: Example Internal Server Error Error - value: - message: Request has not been passed further. + $ref: '#/components/examples/unsupportedMediaTypeExample' + notFound: + $ref: '#/components/examples/notFoundExample' + tooManyRequests: + $ref: '#/components/examples/tooManyRequestsExample' + internalServer: + $ref: '#/components/examples/internalServerErrorExample' getTollFreeVerificationStatusResponse: description: OK content: @@ -7405,14 +7547,23 @@ components: type: string description: Filter results to calls with specified call Disconnect Cause. example: hangup + accountId1: + in: path + name: accountId + required: true + schema: + type: string + description: Your Bandwidth Account ID. + example: '9900000' requestId: - name: requestId in: path + name: requestId required: true schema: type: string - description: The phone number lookup request ID from Bandwidth. - example: 004223a0-8b17-41b1-bf81-20732adf5590 + format: uuid + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 tfPhoneNumberPathParam: in: path name: phoneNumber @@ -7651,95 +7802,208 @@ components: type: validation description: 'Invalid answerUrl: only http and https are allowed.' singleNumberRequestExample: - summary: Example Number Lookup Request for One Number + summary: Number Lookup Request value: - tns: - - '+19195551234' + phoneNumbers: + - '+19196104423' multipleNumberRequestExample: - summary: Example Number Lookup Request for Multiple Numbers + summary: Number Lookup Request for Multiple Numbers value: - tns: - - '+19195551234' - - '+19195554321' + phoneNumbers: + - '+19196104423' + - '+19196104424' lookupInProgressExample: - summary: Example Lookup In Progress Response + summary: Numbers Lookup In Progress value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: IN_PROGRESS + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + results: [] + errors: [] lookupFailedExample: - summary: Example Lookup Failed Response + summary: Numbers Lookup Failed + value: + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: FAILED + results: [] + errors: + - code: NO-MATCH + description: The following TNs could not be found in the Number Industry data + meta: + phoneNumbers: + - '+13992077164' + message: Invalid TNs + code: 1001 + type: NumberInventory + lookupPartialExample: + summary: Numbers Lookup Partial Complete + value: + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: PARTIAL_COMPLETE + results: + - phoneNumber: '+19196104423' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + - phoneNumber: '+19196104424' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + errors: + - code: NO-MATCH + description: The following TNs could not be found in the Number Industry data + meta: + phoneNumbers: + - '+13992077164' + message: Invalid TNs + code: 1001 + type: NumberInventory + lookupCompleteExample: + summary: Numbers Lookup Complete (without DNI) + value: + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + - phoneNumber: '+10072904498' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + errors: [] + lookupCompleteWithDniExample: + summary: Numbers Lookup Complete (with DNI) value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: FAILED - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteExample: - summary: Example Single Number Lookup Complete Response + links: + - href: href + rel: rel + method: GET + data: + requestId: 20732adf-bf81-8b17-41b1-004223a05590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + countryCodeA3: USA + lineType: MOBILE + messagingProvider: T-MOBILE USA INC + voiceProvider: T-MOBILE USA INC + latestMessageDeliveryStatus: ACTIVE + initialMessageDeliveryStatusDate: '2025-05-14' + latestMessageDeliveryStatusDate: '2025-05-18' + - phoneNumber: '+10072904498' + countryCodeA3: USA + lineType: FIXED + voiceProvider: VERIZON + latestMessageDeliveryStatus: DEACTIVATED + initialMessageDeliveryStatusDate: '2025-09-05' + latestMessageDeliveryStatusDate: '2025-09-05' + - phoneNumber: '+10072904499' + lineType: MOBILE + countryCodeA3: USA + messagingProvider: VERIZON + voiceProvider: VERIZON + deactivationReporter: Verizon Wireless + deactivationDate: '2025-09-29 01:23:00' + deactivationEvent: DEACTIVATED + latestMessageDeliveryStatus: UNKNOWN + errors: [] + badRequestExample: + summary: Example Bad Request Error + value: + links: [] + data: {} + errors: + - type: bad-request + description: >- + Bad Request. Ensure that you have set the requestId as a URL path + parameter. + unauthorizedExample: + summary: Unauthorized Error + value: + links: [] + data: {} + errors: + - type: Unauthorized + description: You are not authorized to access this resource. + code: '1' + page: null + forbiddenExample: + summary: Forbidden Error + value: + links: [] + data: {} + errors: + - type: Forbidden + description: You do not have permission to access this resource. + code: '2' + page: null + unsupportedMediaTypeExample: + summary: Unsupported Media Type Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - lookupMultipleNumbersCompleteExample: - summary: Example Multiple Numbers Lookup Complete Response + links: [] + data: {} + errors: + - type: invalid-content-type + description: >- + Invalid content-type. Ensure that your content-type header is set + to application/json. + notFoundExample: + summary: Not Found Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195554321' - Formatted: (919) 555-4321 - Country: US - Line Type: Mobile - Line Provider: T-Mobile USA - Mobile Country Code: '310' - Mobile Network Code: '160' - lookupMultipleNumbersPartialCompleteExample: - summary: Example Multiple Numbers Lookup Partial Complete Response + links: [] + data: {} + errors: + - type: not-found + description: >- + RequestId not found. Ensure that the requestId used in the URL + path is valid and maps to a previous request that was submitted. + tooManyRequestsExample: + summary: Too Many Requests Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: PARTIAL_COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteNoInfoExample: - summary: Example Single Number Lookup Complete with No Information Response + links: [] + data: {} + errors: + - type: rate-limiting + description: >- + Rate limit exceeded. Wait for the time specified in the + Retry-After header before sending another request. + internalServerErrorExample: + summary: Internal Server Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 3 - Message: NXDOMAIN - E.164 Format: '+19195550000' - Formatted: (919) 555-0000 - Country: US + links: [] + data: {} + errors: + - code: '500' + type: unexpected-error + description: >- + Unexpected error. Please contact Bandwidth Support if your + requests are receiving this status code for an extended period of + time. requestBodies: createMessageRequest: content: @@ -8039,18 +8303,28 @@ components: application/json: schema: $ref: '#/components/schemas/verifyCodeRequest' - createLookupRequest: - description: Phone number lookup request. + createSyncLookupRequest: + description: Synchronous phone number lookup request. required: true content: application/json: schema: - $ref: '#/components/schemas/lookupRequest' + $ref: '#/components/schemas/syncLookupRequest' examples: singleNumberRequestExample: $ref: '#/components/examples/singleNumberRequestExample' multipleNumberRequestExample: $ref: '#/components/examples/multipleNumberRequestExample' + createAsyncBulkLookupRequest: + description: Asynchronous bulk phone number lookup request. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/asyncLookupRequest' + examples: + multipleNumberRequestExample: + $ref: '#/components/examples/multipleNumberRequestExample' requestTollFreeVerificationRequest: description: Request for verification of a toll-free phone number. required: true diff --git a/bandwidth/__init__.py b/bandwidth/__init__.py index ea2c741e..f626b252 100644 --- a/bandwidth/__init__.py +++ b/bandwidth/__init__.py @@ -17,182 +17,385 @@ __version__ = "1.0.0" +# Define package exports +__all__ = [ + "CallsApi", + "ConferencesApi", + "MFAApi", + "MediaApi", + "MessagesApi", + "MultiChannelApi", + "PhoneNumberLookupApi", + "RecordingsApi", + "StatisticsApi", + "TollFreeVerificationApi", + "TranscriptionsApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "AccountStatistics", + "AdditionalDenialReason", + "Address", + "AnswerCallback", + "AsyncLookupRequest", + "BlockedWebhook", + "BridgeCompleteCallback", + "BridgeTargetCompleteCallback", + "BusinessEntityTypeEnum", + "BusinessRegistrationTypeEnum", + "CallDirectionEnum", + "CallRecordingMetadata", + "CallState", + "CallStateEnum", + "CallTranscription", + "CallTranscriptionDetectedLanguageEnum", + "CallTranscriptionMetadata", + "CallTranscriptionResponse", + "CallTranscriptionTrackEnum", + "Callback", + "CallbackMethodEnum", + "CardWidthEnum", + "CodeRequest", + "CompletedLookupStatusEnum", + "Conference", + "ConferenceCompletedCallback", + "ConferenceCreatedCallback", + "ConferenceMember", + "ConferenceMemberExitCallback", + "ConferenceMemberJoinCallback", + "ConferenceRecordingAvailableCallback", + "ConferenceRecordingMetadata", + "ConferenceRedirectCallback", + "ConferenceStateEnum", + "Contact", + "CreateAsyncBulkLookupResponse", + "CreateAsyncBulkLookupResponseData", + "CreateCall", + "CreateCallResponse", + "CreateMessageRequestError", + "CreateMultiChannelMessageResponse", + "CreateSyncLookupResponse", + "CreateSyncLookupResponseData", + "DeactivationEventEnum", + "DisconnectCallback", + "Diversion", + "DtmfCallback", + "Error", + "ErrorObject", + "ErrorSource", + "FailureWebhook", + "FieldError", + "FileFormatEnum", + "GatherCallback", + "GetAsyncBulkLookupResponse", + "GetAsyncBulkLookupResponseData", + "InProgressLookupStatusEnum", + "InboundCallback", + "InboundCallbackMessage", + "InboundCallbackTypeEnum", + "InitiateCallback", + "LatestMessageDeliveryStatusEnum", + "LineTypeEnum", + "Link", + "LinkSchema", + "LinksObject", + "ListMessageDirectionEnum", + "ListMessageItem", + "LookupErrorResponse", + "LookupErrorSchema", + "LookupErrorSchemaMeta", + "LookupResult", + "MachineDetectionCompleteCallback", + "MachineDetectionConfiguration", + "MachineDetectionModeEnum", + "MachineDetectionResult", + "Media", + "Message", + "MessageDirectionEnum", + "MessageRequest", + "MessageStatusEnum", + "MessageTypeEnum", + "MessagesList", + "MessagingCodeResponse", + "MessagingRequestError", + "MfaForbiddenRequestError", + "MfaRequestError", + "MfaUnauthorizedRequestError", + "MmsMessageContent", + "MmsMessageContentFile", + "MultiChannelAction", + "MultiChannelActionCalendarEvent", + "MultiChannelChannelListObject", + "MultiChannelChannelListObjectContent", + "MultiChannelError", + "MultiChannelMessageChannelEnum", + "MultiChannelMessageContent", + "MultiChannelMessageRequest", + "MultiChannelMessageResponseData", + "MultiChannelMessageResponseDataChannelListInner", + "OptInWorkflow", + "PageInfo", + "PriorityEnum", + "ProductTypeEnum", + "RbmActionBase", + "RbmActionDial", + "RbmActionOpenUrl", + "RbmActionTypeEnum", + "RbmActionViewLocation", + "RbmCardContent", + "RbmCardContentMedia", + "RbmLocationResponse", + "RbmMediaHeightEnum", + "RbmMessageCarouselCard", + "RbmMessageContentFile", + "RbmMessageContentRichCard", + "RbmMessageContentText", + "RbmMessageMedia", + "RbmStandaloneCard", + "RbmSuggestionResponse", + "RecordingAvailableCallback", + "RecordingCompleteCallback", + "RecordingStateEnum", + "RecordingTranscriptionMetadata", + "RecordingTranscriptions", + "RedirectCallback", + "RedirectMethodEnum", + "SmsMessageContent", + "StandaloneCardOrientationEnum", + "StatusCallback", + "StatusCallbackMessage", + "StatusCallbackTypeEnum", + "StirShaken", + "SyncLookupRequest", + "TelephoneNumber", + "TfvBasicAuthentication", + "TfvCallbackStatusEnum", + "TfvError", + "TfvStatus", + "TfvStatusEnum", + "TfvSubmissionInfo", + "TfvSubmissionWrapper", + "ThumbnailAlignmentEnum", + "TranscribeRecording", + "Transcription", + "TranscriptionAvailableCallback", + "TransferAnswerCallback", + "TransferCompleteCallback", + "TransferDisconnectCallback", + "UpdateCall", + "UpdateCallRecording", + "UpdateConference", + "UpdateConferenceMember", + "VerificationDenialWebhook", + "VerificationRequest", + "VerificationUpdateRequest", + "VerificationWebhook", + "VerifyCodeRequest", + "VerifyCodeResponse", + "VoiceApiError", + "VoiceCodeResponse", + "WebhookSubscription", + "WebhookSubscriptionBasicAuthentication", + "WebhookSubscriptionRequestSchema", + "WebhookSubscriptionTypeEnum", + "WebhookSubscriptionsListBody", +] + # import apis into sdk package -from bandwidth.api.calls_api import CallsApi -from bandwidth.api.conferences_api import ConferencesApi -from bandwidth.api.mfa_api import MFAApi -from bandwidth.api.media_api import MediaApi -from bandwidth.api.messages_api import MessagesApi -from bandwidth.api.multi_channel_api import MultiChannelApi -from bandwidth.api.phone_number_lookup_api import PhoneNumberLookupApi -from bandwidth.api.recordings_api import RecordingsApi -from bandwidth.api.statistics_api import StatisticsApi -from bandwidth.api.toll_free_verification_api import TollFreeVerificationApi -from bandwidth.api.transcriptions_api import TranscriptionsApi +from bandwidth.api.calls_api import CallsApi as CallsApi +from bandwidth.api.conferences_api import ConferencesApi as ConferencesApi +from bandwidth.api.mfa_api import MFAApi as MFAApi +from bandwidth.api.media_api import MediaApi as MediaApi +from bandwidth.api.messages_api import MessagesApi as MessagesApi +from bandwidth.api.multi_channel_api import MultiChannelApi as MultiChannelApi +from bandwidth.api.phone_number_lookup_api import PhoneNumberLookupApi as PhoneNumberLookupApi +from bandwidth.api.recordings_api import RecordingsApi as RecordingsApi +from bandwidth.api.statistics_api import StatisticsApi as StatisticsApi +from bandwidth.api.toll_free_verification_api import TollFreeVerificationApi as TollFreeVerificationApi +from bandwidth.api.transcriptions_api import TranscriptionsApi as TranscriptionsApi # import ApiClient -from bandwidth.api_response import ApiResponse -from bandwidth.api_client import ApiClient -from bandwidth.configuration import Configuration -from bandwidth.exceptions import OpenApiException -from bandwidth.exceptions import ApiTypeError -from bandwidth.exceptions import ApiValueError -from bandwidth.exceptions import ApiKeyError -from bandwidth.exceptions import ApiAttributeError -from bandwidth.exceptions import ApiException +from bandwidth.api_response import ApiResponse as ApiResponse +from bandwidth.api_client import ApiClient as ApiClient +from bandwidth.configuration import Configuration as Configuration +from bandwidth.exceptions import OpenApiException as OpenApiException +from bandwidth.exceptions import ApiTypeError as ApiTypeError +from bandwidth.exceptions import ApiValueError as ApiValueError +from bandwidth.exceptions import ApiKeyError as ApiKeyError +from bandwidth.exceptions import ApiAttributeError as ApiAttributeError +from bandwidth.exceptions import ApiException as ApiException # import models into sdk package -from bandwidth.models.account_statistics import AccountStatistics -from bandwidth.models.additional_denial_reason import AdditionalDenialReason -from bandwidth.models.address import Address -from bandwidth.models.answer_callback import AnswerCallback -from bandwidth.models.blocked_webhook import BlockedWebhook -from bandwidth.models.bridge_complete_callback import BridgeCompleteCallback -from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback -from bandwidth.models.business_entity_type_enum import BusinessEntityTypeEnum -from bandwidth.models.business_registration_type_enum import BusinessRegistrationTypeEnum -from bandwidth.models.call_direction_enum import CallDirectionEnum -from bandwidth.models.call_recording_metadata import CallRecordingMetadata -from bandwidth.models.call_state import CallState -from bandwidth.models.call_state_enum import CallStateEnum -from bandwidth.models.call_transcription import CallTranscription -from bandwidth.models.call_transcription_detected_language_enum import CallTranscriptionDetectedLanguageEnum -from bandwidth.models.call_transcription_metadata import CallTranscriptionMetadata -from bandwidth.models.call_transcription_response import CallTranscriptionResponse -from bandwidth.models.call_transcription_track_enum import CallTranscriptionTrackEnum -from bandwidth.models.callback import Callback -from bandwidth.models.callback_method_enum import CallbackMethodEnum -from bandwidth.models.card_width_enum import CardWidthEnum -from bandwidth.models.code_request import CodeRequest -from bandwidth.models.conference import Conference -from bandwidth.models.conference_completed_callback import ConferenceCompletedCallback -from bandwidth.models.conference_created_callback import ConferenceCreatedCallback -from bandwidth.models.conference_member import ConferenceMember -from bandwidth.models.conference_member_exit_callback import ConferenceMemberExitCallback -from bandwidth.models.conference_member_join_callback import ConferenceMemberJoinCallback -from bandwidth.models.conference_recording_available_callback import ConferenceRecordingAvailableCallback -from bandwidth.models.conference_recording_metadata import ConferenceRecordingMetadata -from bandwidth.models.conference_redirect_callback import ConferenceRedirectCallback -from bandwidth.models.conference_state_enum import ConferenceStateEnum -from bandwidth.models.contact import Contact -from bandwidth.models.create_call import CreateCall -from bandwidth.models.create_call_response import CreateCallResponse -from bandwidth.models.create_lookup_response import CreateLookupResponse -from bandwidth.models.create_message_request_error import CreateMessageRequestError -from bandwidth.models.create_multi_channel_message_response import CreateMultiChannelMessageResponse -from bandwidth.models.disconnect_callback import DisconnectCallback -from bandwidth.models.diversion import Diversion -from bandwidth.models.dtmf_callback import DtmfCallback -from bandwidth.models.error import Error -from bandwidth.models.error_object import ErrorObject -from bandwidth.models.error_source import ErrorSource -from bandwidth.models.failure_webhook import FailureWebhook -from bandwidth.models.field_error import FieldError -from bandwidth.models.file_format_enum import FileFormatEnum -from bandwidth.models.gather_callback import GatherCallback -from bandwidth.models.inbound_callback import InboundCallback -from bandwidth.models.inbound_callback_message import InboundCallbackMessage -from bandwidth.models.inbound_callback_type_enum import InboundCallbackTypeEnum -from bandwidth.models.initiate_callback import InitiateCallback -from bandwidth.models.link import Link -from bandwidth.models.links_object import LinksObject -from bandwidth.models.list_message_direction_enum import ListMessageDirectionEnum -from bandwidth.models.list_message_item import ListMessageItem -from bandwidth.models.lookup_request import LookupRequest -from bandwidth.models.lookup_result import LookupResult -from bandwidth.models.lookup_status import LookupStatus -from bandwidth.models.lookup_status_enum import LookupStatusEnum -from bandwidth.models.machine_detection_complete_callback import MachineDetectionCompleteCallback -from bandwidth.models.machine_detection_configuration import MachineDetectionConfiguration -from bandwidth.models.machine_detection_mode_enum import MachineDetectionModeEnum -from bandwidth.models.machine_detection_result import MachineDetectionResult -from bandwidth.models.media import Media -from bandwidth.models.message import Message -from bandwidth.models.message_direction_enum import MessageDirectionEnum -from bandwidth.models.message_request import MessageRequest -from bandwidth.models.message_status_enum import MessageStatusEnum -from bandwidth.models.message_type_enum import MessageTypeEnum -from bandwidth.models.messages_list import MessagesList -from bandwidth.models.messaging_code_response import MessagingCodeResponse -from bandwidth.models.messaging_request_error import MessagingRequestError -from bandwidth.models.mfa_forbidden_request_error import MfaForbiddenRequestError -from bandwidth.models.mfa_request_error import MfaRequestError -from bandwidth.models.mfa_unauthorized_request_error import MfaUnauthorizedRequestError -from bandwidth.models.mms_message_content import MmsMessageContent -from bandwidth.models.mms_message_content_file import MmsMessageContentFile -from bandwidth.models.multi_channel_action import MultiChannelAction -from bandwidth.models.multi_channel_action_calendar_event import MultiChannelActionCalendarEvent -from bandwidth.models.multi_channel_channel_list_object import MultiChannelChannelListObject -from bandwidth.models.multi_channel_channel_list_object_content import MultiChannelChannelListObjectContent -from bandwidth.models.multi_channel_error import MultiChannelError -from bandwidth.models.multi_channel_message_channel_enum import MultiChannelMessageChannelEnum -from bandwidth.models.multi_channel_message_content import MultiChannelMessageContent -from bandwidth.models.multi_channel_message_request import MultiChannelMessageRequest -from bandwidth.models.multi_channel_message_response_data import MultiChannelMessageResponseData -from bandwidth.models.multi_channel_message_response_data_channel_list_inner import MultiChannelMessageResponseDataChannelListInner -from bandwidth.models.opt_in_workflow import OptInWorkflow -from bandwidth.models.page_info import PageInfo -from bandwidth.models.priority_enum import PriorityEnum -from bandwidth.models.product_type_enum import ProductTypeEnum -from bandwidth.models.rbm_action_base import RbmActionBase -from bandwidth.models.rbm_action_dial import RbmActionDial -from bandwidth.models.rbm_action_open_url import RbmActionOpenUrl -from bandwidth.models.rbm_action_type_enum import RbmActionTypeEnum -from bandwidth.models.rbm_action_view_location import RbmActionViewLocation -from bandwidth.models.rbm_card_content import RbmCardContent -from bandwidth.models.rbm_card_content_media import RbmCardContentMedia -from bandwidth.models.rbm_location_response import RbmLocationResponse -from bandwidth.models.rbm_media_height_enum import RbmMediaHeightEnum -from bandwidth.models.rbm_message_carousel_card import RbmMessageCarouselCard -from bandwidth.models.rbm_message_content_file import RbmMessageContentFile -from bandwidth.models.rbm_message_content_rich_card import RbmMessageContentRichCard -from bandwidth.models.rbm_message_content_text import RbmMessageContentText -from bandwidth.models.rbm_message_media import RbmMessageMedia -from bandwidth.models.rbm_standalone_card import RbmStandaloneCard -from bandwidth.models.rbm_suggestion_response import RbmSuggestionResponse -from bandwidth.models.recording_available_callback import RecordingAvailableCallback -from bandwidth.models.recording_complete_callback import RecordingCompleteCallback -from bandwidth.models.recording_state_enum import RecordingStateEnum -from bandwidth.models.recording_transcription_metadata import RecordingTranscriptionMetadata -from bandwidth.models.recording_transcriptions import RecordingTranscriptions -from bandwidth.models.redirect_callback import RedirectCallback -from bandwidth.models.redirect_method_enum import RedirectMethodEnum -from bandwidth.models.sms_message_content import SmsMessageContent -from bandwidth.models.standalone_card_orientation_enum import StandaloneCardOrientationEnum -from bandwidth.models.status_callback import StatusCallback -from bandwidth.models.status_callback_message import StatusCallbackMessage -from bandwidth.models.status_callback_type_enum import StatusCallbackTypeEnum -from bandwidth.models.stir_shaken import StirShaken -from bandwidth.models.telephone_number import TelephoneNumber -from bandwidth.models.tfv_basic_authentication import TfvBasicAuthentication -from bandwidth.models.tfv_callback_status_enum import TfvCallbackStatusEnum -from bandwidth.models.tfv_error import TfvError -from bandwidth.models.tfv_status import TfvStatus -from bandwidth.models.tfv_status_enum import TfvStatusEnum -from bandwidth.models.tfv_submission_info import TfvSubmissionInfo -from bandwidth.models.tfv_submission_wrapper import TfvSubmissionWrapper -from bandwidth.models.thumbnail_alignment_enum import ThumbnailAlignmentEnum -from bandwidth.models.tn_lookup_request_error import TnLookupRequestError -from bandwidth.models.transcribe_recording import TranscribeRecording -from bandwidth.models.transcription import Transcription -from bandwidth.models.transcription_available_callback import TranscriptionAvailableCallback -from bandwidth.models.transfer_answer_callback import TransferAnswerCallback -from bandwidth.models.transfer_complete_callback import TransferCompleteCallback -from bandwidth.models.transfer_disconnect_callback import TransferDisconnectCallback -from bandwidth.models.update_call import UpdateCall -from bandwidth.models.update_call_recording import UpdateCallRecording -from bandwidth.models.update_conference import UpdateConference -from bandwidth.models.update_conference_member import UpdateConferenceMember -from bandwidth.models.verification_denial_webhook import VerificationDenialWebhook -from bandwidth.models.verification_request import VerificationRequest -from bandwidth.models.verification_update_request import VerificationUpdateRequest -from bandwidth.models.verification_webhook import VerificationWebhook -from bandwidth.models.verify_code_request import VerifyCodeRequest -from bandwidth.models.verify_code_response import VerifyCodeResponse -from bandwidth.models.voice_api_error import VoiceApiError -from bandwidth.models.voice_code_response import VoiceCodeResponse -from bandwidth.models.webhook_subscription import WebhookSubscription -from bandwidth.models.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication -from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema -from bandwidth.models.webhook_subscription_type_enum import WebhookSubscriptionTypeEnum -from bandwidth.models.webhook_subscriptions_list_body import WebhookSubscriptionsListBody +from bandwidth.models.account_statistics import AccountStatistics as AccountStatistics +from bandwidth.models.additional_denial_reason import AdditionalDenialReason as AdditionalDenialReason +from bandwidth.models.address import Address as Address +from bandwidth.models.answer_callback import AnswerCallback as AnswerCallback +from bandwidth.models.async_lookup_request import AsyncLookupRequest as AsyncLookupRequest +from bandwidth.models.blocked_webhook import BlockedWebhook as BlockedWebhook +from bandwidth.models.bridge_complete_callback import BridgeCompleteCallback as BridgeCompleteCallback +from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback as BridgeTargetCompleteCallback +from bandwidth.models.business_entity_type_enum import BusinessEntityTypeEnum as BusinessEntityTypeEnum +from bandwidth.models.business_registration_type_enum import BusinessRegistrationTypeEnum as BusinessRegistrationTypeEnum +from bandwidth.models.call_direction_enum import CallDirectionEnum as CallDirectionEnum +from bandwidth.models.call_recording_metadata import CallRecordingMetadata as CallRecordingMetadata +from bandwidth.models.call_state import CallState as CallState +from bandwidth.models.call_state_enum import CallStateEnum as CallStateEnum +from bandwidth.models.call_transcription import CallTranscription as CallTranscription +from bandwidth.models.call_transcription_detected_language_enum import CallTranscriptionDetectedLanguageEnum as CallTranscriptionDetectedLanguageEnum +from bandwidth.models.call_transcription_metadata import CallTranscriptionMetadata as CallTranscriptionMetadata +from bandwidth.models.call_transcription_response import CallTranscriptionResponse as CallTranscriptionResponse +from bandwidth.models.call_transcription_track_enum import CallTranscriptionTrackEnum as CallTranscriptionTrackEnum +from bandwidth.models.callback import Callback as Callback +from bandwidth.models.callback_method_enum import CallbackMethodEnum as CallbackMethodEnum +from bandwidth.models.card_width_enum import CardWidthEnum as CardWidthEnum +from bandwidth.models.code_request import CodeRequest as CodeRequest +from bandwidth.models.completed_lookup_status_enum import CompletedLookupStatusEnum as CompletedLookupStatusEnum +from bandwidth.models.conference import Conference as Conference +from bandwidth.models.conference_completed_callback import ConferenceCompletedCallback as ConferenceCompletedCallback +from bandwidth.models.conference_created_callback import ConferenceCreatedCallback as ConferenceCreatedCallback +from bandwidth.models.conference_member import ConferenceMember as ConferenceMember +from bandwidth.models.conference_member_exit_callback import ConferenceMemberExitCallback as ConferenceMemberExitCallback +from bandwidth.models.conference_member_join_callback import ConferenceMemberJoinCallback as ConferenceMemberJoinCallback +from bandwidth.models.conference_recording_available_callback import ConferenceRecordingAvailableCallback as ConferenceRecordingAvailableCallback +from bandwidth.models.conference_recording_metadata import ConferenceRecordingMetadata as ConferenceRecordingMetadata +from bandwidth.models.conference_redirect_callback import ConferenceRedirectCallback as ConferenceRedirectCallback +from bandwidth.models.conference_state_enum import ConferenceStateEnum as ConferenceStateEnum +from bandwidth.models.contact import Contact as Contact +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse as CreateAsyncBulkLookupResponse +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData as CreateAsyncBulkLookupResponseData +from bandwidth.models.create_call import CreateCall as CreateCall +from bandwidth.models.create_call_response import CreateCallResponse as CreateCallResponse +from bandwidth.models.create_message_request_error import CreateMessageRequestError as CreateMessageRequestError +from bandwidth.models.create_multi_channel_message_response import CreateMultiChannelMessageResponse as CreateMultiChannelMessageResponse +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse as CreateSyncLookupResponse +from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData as CreateSyncLookupResponseData +from bandwidth.models.deactivation_event_enum import DeactivationEventEnum as DeactivationEventEnum +from bandwidth.models.disconnect_callback import DisconnectCallback as DisconnectCallback +from bandwidth.models.diversion import Diversion as Diversion +from bandwidth.models.dtmf_callback import DtmfCallback as DtmfCallback +from bandwidth.models.error import Error as Error +from bandwidth.models.error_object import ErrorObject as ErrorObject +from bandwidth.models.error_source import ErrorSource as ErrorSource +from bandwidth.models.failure_webhook import FailureWebhook as FailureWebhook +from bandwidth.models.field_error import FieldError as FieldError +from bandwidth.models.file_format_enum import FileFormatEnum as FileFormatEnum +from bandwidth.models.gather_callback import GatherCallback as GatherCallback +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse as GetAsyncBulkLookupResponse +from bandwidth.models.get_async_bulk_lookup_response_data import GetAsyncBulkLookupResponseData as GetAsyncBulkLookupResponseData +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum as InProgressLookupStatusEnum +from bandwidth.models.inbound_callback import InboundCallback as InboundCallback +from bandwidth.models.inbound_callback_message import InboundCallbackMessage as InboundCallbackMessage +from bandwidth.models.inbound_callback_type_enum import InboundCallbackTypeEnum as InboundCallbackTypeEnum +from bandwidth.models.initiate_callback import InitiateCallback as InitiateCallback +from bandwidth.models.latest_message_delivery_status_enum import LatestMessageDeliveryStatusEnum as LatestMessageDeliveryStatusEnum +from bandwidth.models.line_type_enum import LineTypeEnum as LineTypeEnum +from bandwidth.models.link import Link as Link +from bandwidth.models.link_schema import LinkSchema as LinkSchema +from bandwidth.models.links_object import LinksObject as LinksObject +from bandwidth.models.list_message_direction_enum import ListMessageDirectionEnum as ListMessageDirectionEnum +from bandwidth.models.list_message_item import ListMessageItem as ListMessageItem +from bandwidth.models.lookup_error_response import LookupErrorResponse as LookupErrorResponse +from bandwidth.models.lookup_error_schema import LookupErrorSchema as LookupErrorSchema +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta as LookupErrorSchemaMeta +from bandwidth.models.lookup_result import LookupResult as LookupResult +from bandwidth.models.machine_detection_complete_callback import MachineDetectionCompleteCallback as MachineDetectionCompleteCallback +from bandwidth.models.machine_detection_configuration import MachineDetectionConfiguration as MachineDetectionConfiguration +from bandwidth.models.machine_detection_mode_enum import MachineDetectionModeEnum as MachineDetectionModeEnum +from bandwidth.models.machine_detection_result import MachineDetectionResult as MachineDetectionResult +from bandwidth.models.media import Media as Media +from bandwidth.models.message import Message as Message +from bandwidth.models.message_direction_enum import MessageDirectionEnum as MessageDirectionEnum +from bandwidth.models.message_request import MessageRequest as MessageRequest +from bandwidth.models.message_status_enum import MessageStatusEnum as MessageStatusEnum +from bandwidth.models.message_type_enum import MessageTypeEnum as MessageTypeEnum +from bandwidth.models.messages_list import MessagesList as MessagesList +from bandwidth.models.messaging_code_response import MessagingCodeResponse as MessagingCodeResponse +from bandwidth.models.messaging_request_error import MessagingRequestError as MessagingRequestError +from bandwidth.models.mfa_forbidden_request_error import MfaForbiddenRequestError as MfaForbiddenRequestError +from bandwidth.models.mfa_request_error import MfaRequestError as MfaRequestError +from bandwidth.models.mfa_unauthorized_request_error import MfaUnauthorizedRequestError as MfaUnauthorizedRequestError +from bandwidth.models.mms_message_content import MmsMessageContent as MmsMessageContent +from bandwidth.models.mms_message_content_file import MmsMessageContentFile as MmsMessageContentFile +from bandwidth.models.multi_channel_action import MultiChannelAction as MultiChannelAction +from bandwidth.models.multi_channel_action_calendar_event import MultiChannelActionCalendarEvent as MultiChannelActionCalendarEvent +from bandwidth.models.multi_channel_channel_list_object import MultiChannelChannelListObject as MultiChannelChannelListObject +from bandwidth.models.multi_channel_channel_list_object_content import MultiChannelChannelListObjectContent as MultiChannelChannelListObjectContent +from bandwidth.models.multi_channel_error import MultiChannelError as MultiChannelError +from bandwidth.models.multi_channel_message_channel_enum import MultiChannelMessageChannelEnum as MultiChannelMessageChannelEnum +from bandwidth.models.multi_channel_message_content import MultiChannelMessageContent as MultiChannelMessageContent +from bandwidth.models.multi_channel_message_request import MultiChannelMessageRequest as MultiChannelMessageRequest +from bandwidth.models.multi_channel_message_response_data import MultiChannelMessageResponseData as MultiChannelMessageResponseData +from bandwidth.models.multi_channel_message_response_data_channel_list_inner import MultiChannelMessageResponseDataChannelListInner as MultiChannelMessageResponseDataChannelListInner +from bandwidth.models.opt_in_workflow import OptInWorkflow as OptInWorkflow +from bandwidth.models.page_info import PageInfo as PageInfo +from bandwidth.models.priority_enum import PriorityEnum as PriorityEnum +from bandwidth.models.product_type_enum import ProductTypeEnum as ProductTypeEnum +from bandwidth.models.rbm_action_base import RbmActionBase as RbmActionBase +from bandwidth.models.rbm_action_dial import RbmActionDial as RbmActionDial +from bandwidth.models.rbm_action_open_url import RbmActionOpenUrl as RbmActionOpenUrl +from bandwidth.models.rbm_action_type_enum import RbmActionTypeEnum as RbmActionTypeEnum +from bandwidth.models.rbm_action_view_location import RbmActionViewLocation as RbmActionViewLocation +from bandwidth.models.rbm_card_content import RbmCardContent as RbmCardContent +from bandwidth.models.rbm_card_content_media import RbmCardContentMedia as RbmCardContentMedia +from bandwidth.models.rbm_location_response import RbmLocationResponse as RbmLocationResponse +from bandwidth.models.rbm_media_height_enum import RbmMediaHeightEnum as RbmMediaHeightEnum +from bandwidth.models.rbm_message_carousel_card import RbmMessageCarouselCard as RbmMessageCarouselCard +from bandwidth.models.rbm_message_content_file import RbmMessageContentFile as RbmMessageContentFile +from bandwidth.models.rbm_message_content_rich_card import RbmMessageContentRichCard as RbmMessageContentRichCard +from bandwidth.models.rbm_message_content_text import RbmMessageContentText as RbmMessageContentText +from bandwidth.models.rbm_message_media import RbmMessageMedia as RbmMessageMedia +from bandwidth.models.rbm_standalone_card import RbmStandaloneCard as RbmStandaloneCard +from bandwidth.models.rbm_suggestion_response import RbmSuggestionResponse as RbmSuggestionResponse +from bandwidth.models.recording_available_callback import RecordingAvailableCallback as RecordingAvailableCallback +from bandwidth.models.recording_complete_callback import RecordingCompleteCallback as RecordingCompleteCallback +from bandwidth.models.recording_state_enum import RecordingStateEnum as RecordingStateEnum +from bandwidth.models.recording_transcription_metadata import RecordingTranscriptionMetadata as RecordingTranscriptionMetadata +from bandwidth.models.recording_transcriptions import RecordingTranscriptions as RecordingTranscriptions +from bandwidth.models.redirect_callback import RedirectCallback as RedirectCallback +from bandwidth.models.redirect_method_enum import RedirectMethodEnum as RedirectMethodEnum +from bandwidth.models.sms_message_content import SmsMessageContent as SmsMessageContent +from bandwidth.models.standalone_card_orientation_enum import StandaloneCardOrientationEnum as StandaloneCardOrientationEnum +from bandwidth.models.status_callback import StatusCallback as StatusCallback +from bandwidth.models.status_callback_message import StatusCallbackMessage as StatusCallbackMessage +from bandwidth.models.status_callback_type_enum import StatusCallbackTypeEnum as StatusCallbackTypeEnum +from bandwidth.models.stir_shaken import StirShaken as StirShaken +from bandwidth.models.sync_lookup_request import SyncLookupRequest as SyncLookupRequest +from bandwidth.models.telephone_number import TelephoneNumber as TelephoneNumber +from bandwidth.models.tfv_basic_authentication import TfvBasicAuthentication as TfvBasicAuthentication +from bandwidth.models.tfv_callback_status_enum import TfvCallbackStatusEnum as TfvCallbackStatusEnum +from bandwidth.models.tfv_error import TfvError as TfvError +from bandwidth.models.tfv_status import TfvStatus as TfvStatus +from bandwidth.models.tfv_status_enum import TfvStatusEnum as TfvStatusEnum +from bandwidth.models.tfv_submission_info import TfvSubmissionInfo as TfvSubmissionInfo +from bandwidth.models.tfv_submission_wrapper import TfvSubmissionWrapper as TfvSubmissionWrapper +from bandwidth.models.thumbnail_alignment_enum import ThumbnailAlignmentEnum as ThumbnailAlignmentEnum +from bandwidth.models.transcribe_recording import TranscribeRecording as TranscribeRecording +from bandwidth.models.transcription import Transcription as Transcription +from bandwidth.models.transcription_available_callback import TranscriptionAvailableCallback as TranscriptionAvailableCallback +from bandwidth.models.transfer_answer_callback import TransferAnswerCallback as TransferAnswerCallback +from bandwidth.models.transfer_complete_callback import TransferCompleteCallback as TransferCompleteCallback +from bandwidth.models.transfer_disconnect_callback import TransferDisconnectCallback as TransferDisconnectCallback +from bandwidth.models.update_call import UpdateCall as UpdateCall +from bandwidth.models.update_call_recording import UpdateCallRecording as UpdateCallRecording +from bandwidth.models.update_conference import UpdateConference as UpdateConference +from bandwidth.models.update_conference_member import UpdateConferenceMember as UpdateConferenceMember +from bandwidth.models.verification_denial_webhook import VerificationDenialWebhook as VerificationDenialWebhook +from bandwidth.models.verification_request import VerificationRequest as VerificationRequest +from bandwidth.models.verification_update_request import VerificationUpdateRequest as VerificationUpdateRequest +from bandwidth.models.verification_webhook import VerificationWebhook as VerificationWebhook +from bandwidth.models.verify_code_request import VerifyCodeRequest as VerifyCodeRequest +from bandwidth.models.verify_code_response import VerifyCodeResponse as VerifyCodeResponse +from bandwidth.models.voice_api_error import VoiceApiError as VoiceApiError +from bandwidth.models.voice_code_response import VoiceCodeResponse as VoiceCodeResponse +from bandwidth.models.webhook_subscription import WebhookSubscription as WebhookSubscription +from bandwidth.models.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication as WebhookSubscriptionBasicAuthentication +from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema as WebhookSubscriptionRequestSchema +from bandwidth.models.webhook_subscription_type_enum import WebhookSubscriptionTypeEnum as WebhookSubscriptionTypeEnum +from bandwidth.models.webhook_subscriptions_list_body import WebhookSubscriptionsListBody as WebhookSubscriptionsListBody + diff --git a/bandwidth/api/phone_number_lookup_api.py b/bandwidth/api/phone_number_lookup_api.py index 6c5dc0a1..7a18ca86 100644 --- a/bandwidth/api/phone_number_lookup_api.py +++ b/bandwidth/api/phone_number_lookup_api.py @@ -19,9 +19,12 @@ from pydantic import Field, StrictStr from typing_extensions import Annotated -from bandwidth.models.create_lookup_response import CreateLookupResponse -from bandwidth.models.lookup_request import LookupRequest -from bandwidth.models.lookup_status import LookupStatus +from uuid import UUID +from bandwidth.models.async_lookup_request import AsyncLookupRequest +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse +from bandwidth.models.sync_lookup_request import SyncLookupRequest from bandwidth.api_client import ApiClient, RequestSerialized from bandwidth.api_response import ApiResponse @@ -42,10 +45,10 @@ def __init__(self, api_client=None) -> None: @validate_call - def create_lookup( + def create_async_bulk_lookup( self, - account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], - lookup_request: Annotated[LookupRequest, Field(description="Phone number lookup request.")], + account_id: StrictStr, + async_lookup_request: Annotated[AsyncLookupRequest, Field(description="Asynchronous bulk phone number lookup request.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -58,15 +61,15 @@ def create_lookup( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, - ) -> CreateLookupResponse: - """(Deprecated) Create Lookup + ) -> CreateAsyncBulkLookupResponse: + """Create Asynchronous Bulk Number Lookup - Create a Phone Number Lookup Request. + Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. - :param account_id: Your Bandwidth Account ID. (required) + :param account_id: (required) :type account_id: str - :param lookup_request: Phone number lookup request. (required) - :type lookup_request: LookupRequest + :param async_lookup_request: Asynchronous bulk phone number lookup request. (required) + :type async_lookup_request: AsyncLookupRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -88,11 +91,10 @@ def create_lookup( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("POST /accounts/{accountId}/tnlookup is deprecated.", DeprecationWarning) - _param = self._create_lookup_serialize( + _param = self._create_async_bulk_lookup_serialize( account_id=account_id, - lookup_request=lookup_request, + async_lookup_request=async_lookup_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -100,13 +102,7 @@ def create_lookup( ) _response_types_map: Dict[str, Optional[str]] = { - '202': "CreateLookupResponse", - '400': "TnLookupRequestError", - '401': "TnLookupRequestError", - '403': "TnLookupRequestError", - '415': "TnLookupRequestError", - '429': "TnLookupRequestError", - '500': "TnLookupRequestError", + '202': "CreateAsyncBulkLookupResponse", } response_data = self.api_client.call_api( *_param, @@ -120,10 +116,10 @@ def create_lookup( @validate_call - def create_lookup_with_http_info( + def create_async_bulk_lookup_with_http_info( self, - account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], - lookup_request: Annotated[LookupRequest, Field(description="Phone number lookup request.")], + account_id: StrictStr, + async_lookup_request: Annotated[AsyncLookupRequest, Field(description="Asynchronous bulk phone number lookup request.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -136,15 +132,15 @@ def create_lookup_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, - ) -> ApiResponse[CreateLookupResponse]: - """(Deprecated) Create Lookup + ) -> ApiResponse[CreateAsyncBulkLookupResponse]: + """Create Asynchronous Bulk Number Lookup - Create a Phone Number Lookup Request. + Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. - :param account_id: Your Bandwidth Account ID. (required) + :param account_id: (required) :type account_id: str - :param lookup_request: Phone number lookup request. (required) - :type lookup_request: LookupRequest + :param async_lookup_request: Asynchronous bulk phone number lookup request. (required) + :type async_lookup_request: AsyncLookupRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -166,11 +162,10 @@ def create_lookup_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("POST /accounts/{accountId}/tnlookup is deprecated.", DeprecationWarning) - _param = self._create_lookup_serialize( + _param = self._create_async_bulk_lookup_serialize( account_id=account_id, - lookup_request=lookup_request, + async_lookup_request=async_lookup_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -178,13 +173,7 @@ def create_lookup_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '202': "CreateLookupResponse", - '400': "TnLookupRequestError", - '401': "TnLookupRequestError", - '403': "TnLookupRequestError", - '415': "TnLookupRequestError", - '429': "TnLookupRequestError", - '500': "TnLookupRequestError", + '202': "CreateAsyncBulkLookupResponse", } response_data = self.api_client.call_api( *_param, @@ -198,10 +187,10 @@ def create_lookup_with_http_info( @validate_call - def create_lookup_without_preload_content( + def create_async_bulk_lookup_without_preload_content( self, - account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], - lookup_request: Annotated[LookupRequest, Field(description="Phone number lookup request.")], + account_id: StrictStr, + async_lookup_request: Annotated[AsyncLookupRequest, Field(description="Asynchronous bulk phone number lookup request.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -215,14 +204,14 @@ def create_lookup_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, ) -> RESTResponseType: - """(Deprecated) Create Lookup + """Create Asynchronous Bulk Number Lookup - Create a Phone Number Lookup Request. + Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. - :param account_id: Your Bandwidth Account ID. (required) + :param account_id: (required) :type account_id: str - :param lookup_request: Phone number lookup request. (required) - :type lookup_request: LookupRequest + :param async_lookup_request: Asynchronous bulk phone number lookup request. (required) + :type async_lookup_request: AsyncLookupRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -244,11 +233,10 @@ def create_lookup_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("POST /accounts/{accountId}/tnlookup is deprecated.", DeprecationWarning) - _param = self._create_lookup_serialize( + _param = self._create_async_bulk_lookup_serialize( account_id=account_id, - lookup_request=lookup_request, + async_lookup_request=async_lookup_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -256,13 +244,7 @@ def create_lookup_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '202': "CreateLookupResponse", - '400': "TnLookupRequestError", - '401': "TnLookupRequestError", - '403': "TnLookupRequestError", - '415': "TnLookupRequestError", - '429': "TnLookupRequestError", - '500': "TnLookupRequestError", + '202': "CreateAsyncBulkLookupResponse", } response_data = self.api_client.call_api( *_param, @@ -271,10 +253,10 @@ def create_lookup_without_preload_content( return response_data.response - def _create_lookup_serialize( + def _create_async_bulk_lookup_serialize( self, account_id, - lookup_request, + async_lookup_request, _request_auth, _content_type, _headers, @@ -282,7 +264,7 @@ def _create_lookup_serialize( ) -> RequestSerialized: _hosts = [ - 'https://numbers.bandwidth.com/api/v1' + 'https://api.bandwidth.com/v2' ] _host = _hosts[_host_index] @@ -305,8 +287,8 @@ def _create_lookup_serialize( # process the header parameters # process the form parameters # process the body parameter - if lookup_request is not None: - _body_params = lookup_request + if async_lookup_request is not None: + _body_params = async_lookup_request # set the HTTP header `Accept` @@ -338,7 +320,7 @@ def _create_lookup_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/accounts/{accountId}/tnlookup', + resource_path='/accounts/{accountId}/phoneNumberLookup/bulk', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -355,10 +337,10 @@ def _create_lookup_serialize( @validate_call - def get_lookup_status( + def create_sync_lookup( self, - account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], - request_id: Annotated[StrictStr, Field(description="The phone number lookup request ID from Bandwidth.")], + account_id: StrictStr, + sync_lookup_request: Annotated[SyncLookupRequest, Field(description="Synchronous phone number lookup request.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -371,14 +353,306 @@ def get_lookup_status( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, - ) -> LookupStatus: - """(Deprecated) Get Lookup Request Status + ) -> CreateSyncLookupResponse: + """Create Synchronous Number Lookup - Get an existing Phone Number Lookup Request. + Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. - :param account_id: Your Bandwidth Account ID. (required) + :param account_id: (required) :type account_id: str - :param request_id: The phone number lookup request ID from Bandwidth. (required) + :param sync_lookup_request: Synchronous phone number lookup request. (required) + :type sync_lookup_request: SyncLookupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_sync_lookup_serialize( + account_id=account_id, + sync_lookup_request=sync_lookup_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateSyncLookupResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_sync_lookup_with_http_info( + self, + account_id: StrictStr, + sync_lookup_request: Annotated[SyncLookupRequest, Field(description="Synchronous phone number lookup request.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> ApiResponse[CreateSyncLookupResponse]: + """Create Synchronous Number Lookup + + Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. + + :param account_id: (required) + :type account_id: str + :param sync_lookup_request: Synchronous phone number lookup request. (required) + :type sync_lookup_request: SyncLookupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_sync_lookup_serialize( + account_id=account_id, + sync_lookup_request=sync_lookup_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateSyncLookupResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_sync_lookup_without_preload_content( + self, + account_id: StrictStr, + sync_lookup_request: Annotated[SyncLookupRequest, Field(description="Synchronous phone number lookup request.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> RESTResponseType: + """Create Synchronous Number Lookup + + Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. + + :param account_id: (required) + :type account_id: str + :param sync_lookup_request: Synchronous phone number lookup request. (required) + :type sync_lookup_request: SyncLookupRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_sync_lookup_serialize( + account_id=account_id, + sync_lookup_request=sync_lookup_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateSyncLookupResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_sync_lookup_serialize( + self, + account_id, + sync_lookup_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/v2' + ] + _host = _hosts[_host_index] + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if sync_lookup_request is not None: + _body_params = sync_lookup_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'Basic' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/accounts/{accountId}/phoneNumberLookup', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_async_bulk_lookup( + self, + account_id: StrictStr, + request_id: UUID, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, + ) -> GetAsyncBulkLookupResponse: + """Get Asynchronous Bulk Number Lookup + + Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. + + :param account_id: (required) + :type account_id: str + :param request_id: (required) :type request_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -401,9 +675,8 @@ def get_lookup_status( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /accounts/{accountId}/tnlookup/{requestId} is deprecated.", DeprecationWarning) - _param = self._get_lookup_status_serialize( + _param = self._get_async_bulk_lookup_serialize( account_id=account_id, request_id=request_id, _request_auth=_request_auth, @@ -413,13 +686,7 @@ def get_lookup_status( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LookupStatus", - '400': "TnLookupRequestError", - '401': "TnLookupRequestError", - '403': "TnLookupRequestError", - '404': None, - '429': "TnLookupRequestError", - '500': "TnLookupRequestError", + '200': "GetAsyncBulkLookupResponse", } response_data = self.api_client.call_api( *_param, @@ -433,10 +700,10 @@ def get_lookup_status( @validate_call - def get_lookup_status_with_http_info( + def get_async_bulk_lookup_with_http_info( self, - account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], - request_id: Annotated[StrictStr, Field(description="The phone number lookup request ID from Bandwidth.")], + account_id: StrictStr, + request_id: UUID, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -449,14 +716,14 @@ def get_lookup_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, - ) -> ApiResponse[LookupStatus]: - """(Deprecated) Get Lookup Request Status + ) -> ApiResponse[GetAsyncBulkLookupResponse]: + """Get Asynchronous Bulk Number Lookup - Get an existing Phone Number Lookup Request. + Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. - :param account_id: Your Bandwidth Account ID. (required) + :param account_id: (required) :type account_id: str - :param request_id: The phone number lookup request ID from Bandwidth. (required) + :param request_id: (required) :type request_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -479,9 +746,8 @@ def get_lookup_status_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /accounts/{accountId}/tnlookup/{requestId} is deprecated.", DeprecationWarning) - _param = self._get_lookup_status_serialize( + _param = self._get_async_bulk_lookup_serialize( account_id=account_id, request_id=request_id, _request_auth=_request_auth, @@ -491,13 +757,7 @@ def get_lookup_status_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LookupStatus", - '400': "TnLookupRequestError", - '401': "TnLookupRequestError", - '403': "TnLookupRequestError", - '404': None, - '429': "TnLookupRequestError", - '500': "TnLookupRequestError", + '200': "GetAsyncBulkLookupResponse", } response_data = self.api_client.call_api( *_param, @@ -511,10 +771,10 @@ def get_lookup_status_with_http_info( @validate_call - def get_lookup_status_without_preload_content( + def get_async_bulk_lookup_without_preload_content( self, - account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], - request_id: Annotated[StrictStr, Field(description="The phone number lookup request ID from Bandwidth.")], + account_id: StrictStr, + request_id: UUID, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -528,13 +788,13 @@ def get_lookup_status_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=1)] = 0, ) -> RESTResponseType: - """(Deprecated) Get Lookup Request Status + """Get Asynchronous Bulk Number Lookup - Get an existing Phone Number Lookup Request. + Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. - :param account_id: Your Bandwidth Account ID. (required) + :param account_id: (required) :type account_id: str - :param request_id: The phone number lookup request ID from Bandwidth. (required) + :param request_id: (required) :type request_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -557,9 +817,8 @@ def get_lookup_status_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 - warnings.warn("GET /accounts/{accountId}/tnlookup/{requestId} is deprecated.", DeprecationWarning) - _param = self._get_lookup_status_serialize( + _param = self._get_async_bulk_lookup_serialize( account_id=account_id, request_id=request_id, _request_auth=_request_auth, @@ -569,13 +828,7 @@ def get_lookup_status_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LookupStatus", - '400': "TnLookupRequestError", - '401': "TnLookupRequestError", - '403': "TnLookupRequestError", - '404': None, - '429': "TnLookupRequestError", - '500': "TnLookupRequestError", + '200': "GetAsyncBulkLookupResponse", } response_data = self.api_client.call_api( *_param, @@ -584,7 +837,7 @@ def get_lookup_status_without_preload_content( return response_data.response - def _get_lookup_status_serialize( + def _get_async_bulk_lookup_serialize( self, account_id, request_id, @@ -595,7 +848,7 @@ def _get_lookup_status_serialize( ) -> RequestSerialized: _hosts = [ - 'https://numbers.bandwidth.com/api/v1' + 'https://api.bandwidth.com/v2' ] _host = _hosts[_host_index] @@ -638,7 +891,7 @@ def _get_lookup_status_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/accounts/{accountId}/tnlookup/{requestId}', + resource_path='/accounts/{accountId}/phoneNumberLookup/bulk/{requestId}', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/bandwidth/api_client.py b/bandwidth/api_client.py index b361b95a..d0429aa9 100644 --- a/bandwidth/api_client.py +++ b/bandwidth/api_client.py @@ -22,6 +22,7 @@ import os import re import tempfile +import uuid from urllib.parse import quote from typing import Tuple, Optional, List, Dict, Union @@ -357,6 +358,8 @@ def sanitize_for_serialization(self, obj): return obj.get_secret_value() elif isinstance(obj, self.PRIMITIVE_TYPES): return obj + elif isinstance(obj, uuid.UUID): + return str(obj) elif isinstance(obj, list): return [ self.sanitize_for_serialization(sub_obj) for sub_obj in obj @@ -383,6 +386,10 @@ def sanitize_for_serialization(self, obj): else: obj_dict = obj.__dict__ + if isinstance(obj_dict, list): + # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() + return self.sanitize_for_serialization(obj_dict) + return { key: self.sanitize_for_serialization(val) for key, val in obj_dict.items() @@ -405,7 +412,7 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): if response_text == "": data = "" else: @@ -454,13 +461,13 @@ def __deserialize(self, data, klass): if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) - elif klass == object: + elif klass is object: return self.__deserialize_object(data) - elif klass == datetime.date: + elif klass is datetime.date: return self.__deserialize_date(data) - elif klass == datetime.datetime: + elif klass is datetime.datetime: return self.__deserialize_datetime(data) - elif klass == decimal.Decimal: + elif klass is decimal.Decimal: return decimal.Decimal(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) diff --git a/bandwidth/configuration.py b/bandwidth/configuration.py index f5c38e1c..a7fd607d 100644 --- a/bandwidth/configuration.py +++ b/bandwidth/configuration.py @@ -19,7 +19,7 @@ from logging import FileHandler import multiprocessing import sys -from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union from typing_extensions import NotRequired, Self import urllib3 @@ -162,6 +162,10 @@ class Configuration: :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format. :param retries: Number of retries for API requests. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. :Example: @@ -192,13 +196,16 @@ def __init__( username: Optional[str]=None, password: Optional[str]=None, access_token: Optional[str]=None, - server_index: Optional[int]=None, + server_index: Optional[int]=None, server_variables: Optional[ServerVariablesT]=None, server_operation_index: Optional[Dict[int, int]]=None, server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, ignore_operation_servers: bool=False, ssl_ca_cert: Optional[str]=None, retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, *, debug: Optional[bool] = None, ) -> None: @@ -276,10 +283,14 @@ def __init__( self.ssl_ca_cert = ssl_ca_cert """Set this to customize the certificate file to verify the peer. """ - self.cert_file = None + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file """client certificate file """ - self.key_file = None + self.key_file = key_file """client key file """ self.assert_hostname = None diff --git a/bandwidth/models/__init__.py b/bandwidth/models/__init__.py index 056461f2..ba4198f4 100644 --- a/bandwidth/models/__init__.py +++ b/bandwidth/models/__init__.py @@ -13,12 +13,12 @@ Do not edit the class manually. """ # noqa: E501 - # import models into model package from bandwidth.models.account_statistics import AccountStatistics from bandwidth.models.additional_denial_reason import AdditionalDenialReason from bandwidth.models.address import Address from bandwidth.models.answer_callback import AnswerCallback +from bandwidth.models.async_lookup_request import AsyncLookupRequest from bandwidth.models.blocked_webhook import BlockedWebhook from bandwidth.models.bridge_complete_callback import BridgeCompleteCallback from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback @@ -37,6 +37,7 @@ from bandwidth.models.callback_method_enum import CallbackMethodEnum from bandwidth.models.card_width_enum import CardWidthEnum from bandwidth.models.code_request import CodeRequest +from bandwidth.models.completed_lookup_status_enum import CompletedLookupStatusEnum from bandwidth.models.conference import Conference from bandwidth.models.conference_completed_callback import ConferenceCompletedCallback from bandwidth.models.conference_created_callback import ConferenceCreatedCallback @@ -48,11 +49,15 @@ from bandwidth.models.conference_redirect_callback import ConferenceRedirectCallback from bandwidth.models.conference_state_enum import ConferenceStateEnum from bandwidth.models.contact import Contact +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData from bandwidth.models.create_call import CreateCall from bandwidth.models.create_call_response import CreateCallResponse -from bandwidth.models.create_lookup_response import CreateLookupResponse from bandwidth.models.create_message_request_error import CreateMessageRequestError from bandwidth.models.create_multi_channel_message_response import CreateMultiChannelMessageResponse +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse +from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData +from bandwidth.models.deactivation_event_enum import DeactivationEventEnum from bandwidth.models.disconnect_callback import DisconnectCallback from bandwidth.models.diversion import Diversion from bandwidth.models.dtmf_callback import DtmfCallback @@ -63,18 +68,24 @@ from bandwidth.models.field_error import FieldError from bandwidth.models.file_format_enum import FileFormatEnum from bandwidth.models.gather_callback import GatherCallback +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse +from bandwidth.models.get_async_bulk_lookup_response_data import GetAsyncBulkLookupResponseData +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum from bandwidth.models.inbound_callback import InboundCallback from bandwidth.models.inbound_callback_message import InboundCallbackMessage from bandwidth.models.inbound_callback_type_enum import InboundCallbackTypeEnum from bandwidth.models.initiate_callback import InitiateCallback +from bandwidth.models.latest_message_delivery_status_enum import LatestMessageDeliveryStatusEnum +from bandwidth.models.line_type_enum import LineTypeEnum from bandwidth.models.link import Link +from bandwidth.models.link_schema import LinkSchema from bandwidth.models.links_object import LinksObject from bandwidth.models.list_message_direction_enum import ListMessageDirectionEnum from bandwidth.models.list_message_item import ListMessageItem -from bandwidth.models.lookup_request import LookupRequest +from bandwidth.models.lookup_error_response import LookupErrorResponse +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta from bandwidth.models.lookup_result import LookupResult -from bandwidth.models.lookup_status import LookupStatus -from bandwidth.models.lookup_status_enum import LookupStatusEnum from bandwidth.models.machine_detection_complete_callback import MachineDetectionCompleteCallback from bandwidth.models.machine_detection_configuration import MachineDetectionConfiguration from bandwidth.models.machine_detection_mode_enum import MachineDetectionModeEnum @@ -136,6 +147,7 @@ from bandwidth.models.status_callback_message import StatusCallbackMessage from bandwidth.models.status_callback_type_enum import StatusCallbackTypeEnum from bandwidth.models.stir_shaken import StirShaken +from bandwidth.models.sync_lookup_request import SyncLookupRequest from bandwidth.models.telephone_number import TelephoneNumber from bandwidth.models.tfv_basic_authentication import TfvBasicAuthentication from bandwidth.models.tfv_callback_status_enum import TfvCallbackStatusEnum @@ -145,7 +157,6 @@ from bandwidth.models.tfv_submission_info import TfvSubmissionInfo from bandwidth.models.tfv_submission_wrapper import TfvSubmissionWrapper from bandwidth.models.thumbnail_alignment_enum import ThumbnailAlignmentEnum -from bandwidth.models.tn_lookup_request_error import TnLookupRequestError from bandwidth.models.transcribe_recording import TranscribeRecording from bandwidth.models.transcription import Transcription from bandwidth.models.transcription_available_callback import TranscriptionAvailableCallback @@ -169,3 +180,4 @@ from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema from bandwidth.models.webhook_subscription_type_enum import WebhookSubscriptionTypeEnum from bandwidth.models.webhook_subscriptions_list_body import WebhookSubscriptionsListBody + diff --git a/bandwidth/models/tn_lookup_request_error.py b/bandwidth/models/async_lookup_request.py similarity index 81% rename from bandwidth/models/tn_lookup_request_error.py rename to bandwidth/models/async_lookup_request.py index d8760fae..ce388bcf 100644 --- a/bandwidth/models/tn_lookup_request_error.py +++ b/bandwidth/models/async_lookup_request.py @@ -18,18 +18,19 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, field_validator +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self -class TnLookupRequestError(BaseModel): +class AsyncLookupRequest(BaseModel): """ - TnLookupRequestError + AsyncLookupRequest """ # noqa: E501 - message: Optional[StrictStr] = Field(default=None, description="A description of what validation error occurred.") + phone_numbers: List[Annotated[str, Field(strict=True)]] = Field(description="Telephone numbers in E.164 format.", alias="phoneNumbers") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["message"] + __properties: ClassVar[List[str]] = ["phoneNumbers"] model_config = ConfigDict( populate_by_name=True, @@ -49,7 +50,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of TnLookupRequestError from a JSON string""" + """Create an instance of AsyncLookupRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -81,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of TnLookupRequestError from a dict""" + """Create an instance of AsyncLookupRequest from a dict""" if obj is None: return None @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "message": obj.get("message") + "phoneNumbers": obj.get("phoneNumbers") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/bandwidth/models/blocked_webhook.py b/bandwidth/models/blocked_webhook.py index 22eff561..f1f534f0 100644 --- a/bandwidth/models/blocked_webhook.py +++ b/bandwidth/models/blocked_webhook.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from uuid import UUID from bandwidth.models.tfv_callback_status_enum import TfvCallbackStatusEnum from typing import Optional, Set from typing_extensions import Self @@ -32,7 +33,7 @@ class BlockedWebhook(BaseModel): account_id: Optional[StrictStr] = Field(default=None, description="User's account ID.", alias="accountId") phone_number: Optional[Annotated[str, Field(min_length=12, strict=True, max_length=12)]] = Field(default=None, description="Toll-free telephone number in E.164 format.", alias="phoneNumber") status: Optional[TfvCallbackStatusEnum] = None - internal_ticket_number: Optional[StrictStr] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") + internal_ticket_number: Optional[UUID] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") blocked: Optional[StrictBool] = Field(default=None, description="Whether a Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.") blocked_reason: Optional[StrictStr] = Field(default=None, description="The reason why the Toll-Free Verification is blocked. This attribute will only be defined when the number is blocked.", alias="blockedReason") additional_properties: Dict[str, Any] = {} diff --git a/bandwidth/models/completed_lookup_status_enum.py b/bandwidth/models/completed_lookup_status_enum.py new file mode 100644 index 00000000..d99859b5 --- /dev/null +++ b/bandwidth/models/completed_lookup_status_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class CompletedLookupStatusEnum(str, Enum): + """ + CompletedLookupStatusEnum + """ + + """ + allowed enum values + """ + COMPLETE = 'COMPLETE' + PARTIAL_COMPLETE = 'PARTIAL_COMPLETE' + FAILED = 'FAILED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CompletedLookupStatusEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/create_async_bulk_lookup_response.py b/bandwidth/models/create_async_bulk_lookup_response.py new file mode 100644 index 00000000..924a02d1 --- /dev/null +++ b/bandwidth/models/create_async_bulk_lookup_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData +from bandwidth.models.link_schema import LinkSchema +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from typing import Optional, Set +from typing_extensions import Self + +class CreateAsyncBulkLookupResponse(BaseModel): + """ + CreateAsyncBulkLookupResponse + """ # noqa: E501 + links: Optional[List[LinkSchema]] = Field(default=None, description="Links for pagination (if applicable)") + data: Optional[CreateAsyncBulkLookupResponseData] = None + errors: Optional[List[LookupErrorSchema]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateAsyncBulkLookupResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateAsyncBulkLookupResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": [LinkSchema.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "data": CreateAsyncBulkLookupResponseData.from_dict(obj["data"]) if obj.get("data") is not None else None, + "errors": [LookupErrorSchema.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/create_lookup_response.py b/bandwidth/models/create_async_bulk_lookup_response_data.py similarity index 81% rename from bandwidth/models/create_lookup_response.py rename to bandwidth/models/create_async_bulk_lookup_response_data.py index de58a193..30b84a19 100644 --- a/bandwidth/models/create_lookup_response.py +++ b/bandwidth/models/create_async_bulk_lookup_response_data.py @@ -18,18 +18,19 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional -from bandwidth.models.lookup_status_enum import LookupStatusEnum +from uuid import UUID +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum from typing import Optional, Set from typing_extensions import Self -class CreateLookupResponse(BaseModel): +class CreateAsyncBulkLookupResponseData(BaseModel): """ - The request has been accepted for processing but not yet finished and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). + The phone number lookup response data """ # noqa: E501 - request_id: Optional[StrictStr] = Field(default=None, description="The phone number lookup request ID from Bandwidth.", alias="requestId") - status: Optional[LookupStatusEnum] = None + request_id: Optional[UUID] = Field(default=None, description="The phone number lookup request ID from Bandwidth.", alias="requestId") + status: Optional[InProgressLookupStatusEnum] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["requestId", "status"] @@ -51,7 +52,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CreateLookupResponse from a JSON string""" + """Create an instance of CreateAsyncBulkLookupResponseData from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CreateLookupResponse from a dict""" + """Create an instance of CreateAsyncBulkLookupResponseData from a dict""" if obj is None: return None diff --git a/bandwidth/models/create_sync_lookup_response.py b/bandwidth/models/create_sync_lookup_response.py new file mode 100644 index 00000000..04a9e077 --- /dev/null +++ b/bandwidth/models/create_sync_lookup_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData +from bandwidth.models.link_schema import LinkSchema +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from typing import Optional, Set +from typing_extensions import Self + +class CreateSyncLookupResponse(BaseModel): + """ + CreateSyncLookupResponse + """ # noqa: E501 + links: Optional[List[LinkSchema]] = None + data: Optional[CreateSyncLookupResponseData] = None + errors: Optional[List[LookupErrorSchema]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateSyncLookupResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateSyncLookupResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": [LinkSchema.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "data": CreateSyncLookupResponseData.from_dict(obj["data"]) if obj.get("data") is not None else None, + "errors": [LookupErrorSchema.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/lookup_status.py b/bandwidth/models/create_sync_lookup_response_data.py similarity index 65% rename from bandwidth/models/lookup_status.py rename to bandwidth/models/create_sync_lookup_response_data.py index 85d29de9..fddf986d 100644 --- a/bandwidth/models/lookup_status.py +++ b/bandwidth/models/create_sync_lookup_response_data.py @@ -18,23 +18,23 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from bandwidth.models.completed_lookup_status_enum import CompletedLookupStatusEnum from bandwidth.models.lookup_result import LookupResult -from bandwidth.models.lookup_status_enum import LookupStatusEnum from typing import Optional, Set from typing_extensions import Self -class LookupStatus(BaseModel): +class CreateSyncLookupResponseData(BaseModel): """ - If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no information was available for the TN. + The phone number lookup response data """ # noqa: E501 - request_id: Optional[StrictStr] = Field(default=None, description="The requestId.", alias="requestId") - status: Optional[LookupStatusEnum] = None - result: Optional[List[LookupResult]] = Field(default=None, description="The carrier information results for the specified telephone number.") - failed_telephone_numbers: Optional[List[StrictStr]] = Field(default=None, description="The telephone numbers whose lookup failed.", alias="failedTelephoneNumbers") + request_id: Optional[UUID] = Field(default=None, description="The phone number lookup request ID from Bandwidth.", alias="requestId") + status: Optional[CompletedLookupStatusEnum] = None + results: Optional[List[LookupResult]] = Field(default=None, description="The carrier information results for the specified telephone numbers.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["requestId", "status", "result", "failedTelephoneNumbers"] + __properties: ClassVar[List[str]] = ["requestId", "status", "results"] model_config = ConfigDict( populate_by_name=True, @@ -54,7 +54,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of LookupStatus from a JSON string""" + """Create an instance of CreateSyncLookupResponseData from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -77,13 +77,13 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in result (list) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) _items = [] - if self.result: - for _item_result in self.result: - if _item_result: - _items.append(_item_result.to_dict()) - _dict['result'] = _items + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -93,7 +93,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of LookupStatus from a dict""" + """Create an instance of CreateSyncLookupResponseData from a dict""" if obj is None: return None @@ -103,8 +103,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "requestId": obj.get("requestId"), "status": obj.get("status"), - "result": [LookupResult.from_dict(_item) for _item in obj["result"]] if obj.get("result") is not None else None, - "failedTelephoneNumbers": obj.get("failedTelephoneNumbers") + "results": [LookupResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/bandwidth/models/deactivation_event_enum.py b/bandwidth/models/deactivation_event_enum.py new file mode 100644 index 00000000..39f89852 --- /dev/null +++ b/bandwidth/models/deactivation_event_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class DeactivationEventEnum(str, Enum): + """ + [DNI-Only](#section/DNI-Only). `DEACTIVATED` if the carrier reported a deactivation event for this phone number. + """ + + """ + allowed enum values + """ + DEACTIVATED = 'DEACTIVATED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DeactivationEventEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/failure_webhook.py b/bandwidth/models/failure_webhook.py index 5c502946..c06e21d4 100644 --- a/bandwidth/models/failure_webhook.py +++ b/bandwidth/models/failure_webhook.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from uuid import UUID from typing import Optional, Set from typing_extensions import Self @@ -33,7 +34,7 @@ class FailureWebhook(BaseModel): error_code: Optional[StrictStr] = Field(default=None, description="An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered.", alias="errorCode") error_message: Optional[StrictStr] = Field(default=None, description="A description of the error that was encountered.", alias="errorMessage") errors: Optional[List[StrictStr]] = Field(default=None, description="Details of the errors that were encountered when processing the request.") - internal_ticket_number: Optional[StrictStr] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") + internal_ticket_number: Optional[UUID] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["accountId", "phoneNumber", "errorCode", "errorMessage", "errors", "internalTicketNumber"] diff --git a/bandwidth/models/get_async_bulk_lookup_response.py b/bandwidth/models/get_async_bulk_lookup_response.py new file mode 100644 index 00000000..75ec2d4a --- /dev/null +++ b/bandwidth/models/get_async_bulk_lookup_response.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.get_async_bulk_lookup_response_data import GetAsyncBulkLookupResponseData +from bandwidth.models.link_schema import LinkSchema +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from typing import Optional, Set +from typing_extensions import Self + +class GetAsyncBulkLookupResponse(BaseModel): + """ + GetAsyncBulkLookupResponse + """ # noqa: E501 + links: Optional[List[LinkSchema]] = None + data: Optional[GetAsyncBulkLookupResponseData] = None + errors: Optional[List[LookupErrorSchema]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetAsyncBulkLookupResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetAsyncBulkLookupResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": [LinkSchema.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "data": GetAsyncBulkLookupResponseData.from_dict(obj["data"]) if obj.get("data") is not None else None, + "errors": [LookupErrorSchema.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/get_async_bulk_lookup_response_data.py b/bandwidth/models/get_async_bulk_lookup_response_data.py new file mode 100644 index 00000000..5b05d93d --- /dev/null +++ b/bandwidth/models/get_async_bulk_lookup_response_data.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum +from bandwidth.models.lookup_result import LookupResult +from typing import Optional, Set +from typing_extensions import Self + +class GetAsyncBulkLookupResponseData(BaseModel): + """ + The phone number lookup response data + """ # noqa: E501 + request_id: Optional[UUID] = Field(default=None, description="The phone number lookup request ID from Bandwidth.", alias="requestId") + status: Optional[InProgressLookupStatusEnum] = None + results: Optional[List[LookupResult]] = Field(default=None, description="The carrier information results for the specified telephone number.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["requestId", "status", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetAsyncBulkLookupResponseData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetAsyncBulkLookupResponseData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "requestId": obj.get("requestId"), + "status": obj.get("status"), + "results": [LookupResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/lookup_status_enum.py b/bandwidth/models/in_progress_lookup_status_enum.py similarity index 77% rename from bandwidth/models/lookup_status_enum.py rename to bandwidth/models/in_progress_lookup_status_enum.py index 768f9085..06d5d0c2 100644 --- a/bandwidth/models/lookup_status_enum.py +++ b/bandwidth/models/in_progress_lookup_status_enum.py @@ -19,9 +19,9 @@ from typing_extensions import Self -class LookupStatusEnum(str, Enum): +class InProgressLookupStatusEnum(str, Enum): """ - The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or FAILED). + InProgressLookupStatusEnum """ """ @@ -34,7 +34,7 @@ class LookupStatusEnum(str, Enum): @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of LookupStatusEnum from a JSON string""" + """Create an instance of InProgressLookupStatusEnum from a JSON string""" return cls(json.loads(json_str)) diff --git a/bandwidth/models/latest_message_delivery_status_enum.py b/bandwidth/models/latest_message_delivery_status_enum.py new file mode 100644 index 00000000..a4eb61ec --- /dev/null +++ b/bandwidth/models/latest_message_delivery_status_enum.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class LatestMessageDeliveryStatusEnum(str, Enum): + """ + [DNI-Only](#section/DNI-Only). The current delivery status of the phone number. - ACTIVE: A message was successfully sent to the number (delivery code 0). - DEACTIVATED: A message was not delivered to a number (delivery code 720) - UNKNOWN: Bandwidth cannot find an delivery status entry for the number. + """ + + """ + allowed enum values + """ + ACTIVE = 'ACTIVE' + DEACTIVATED = 'DEACTIVATED' + UNKNOWN = 'UNKNOWN' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LatestMessageDeliveryStatusEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/line_type_enum.py b/bandwidth/models/line_type_enum.py new file mode 100644 index 00000000..8ae164e1 --- /dev/null +++ b/bandwidth/models/line_type_enum.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class LineTypeEnum(str, Enum): + """ + LineTypeEnum + """ + + """ + allowed enum values + """ + FIXED = 'FIXED' + VOIP_MINUS_FIXED = 'VOIP-FIXED' + MOBILE = 'MOBILE' + VOIP = 'VOIP' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LineTypeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/link_schema.py b/bandwidth/models/link_schema.py new file mode 100644 index 00000000..02ad1328 --- /dev/null +++ b/bandwidth/models/link_schema.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LinkSchema(BaseModel): + """ + LinkSchema + """ # noqa: E501 + href: Optional[StrictStr] = Field(default=None, description="URI of the link.") + rel: Optional[StrictStr] = Field(default=None, description="Specifies the relationship between this link and the resource.") + method: Optional[StrictStr] = Field(default=None, description="HTTP method to be used.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["href", "rel", "method"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LinkSchema from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LinkSchema from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "href": obj.get("href"), + "rel": obj.get("rel"), + "method": obj.get("method") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/lookup_error_response.py b/bandwidth/models/lookup_error_response.py new file mode 100644 index 00000000..72103d7c --- /dev/null +++ b/bandwidth/models/lookup_error_response.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.link_schema import LinkSchema +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from typing import Optional, Set +from typing_extensions import Self + +class LookupErrorResponse(BaseModel): + """ + LookupErrorResponse + """ # noqa: E501 + links: Optional[List[LinkSchema]] = None + data: Optional[Dict[str, Any]] = Field(default=None, description="The phone number lookup response data") + errors: Optional[List[LookupErrorSchema]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "data", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LookupErrorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LookupErrorResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": [LinkSchema.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "data": obj.get("data"), + "errors": [LookupErrorSchema.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/lookup_error_schema.py b/bandwidth/models/lookup_error_schema.py new file mode 100644 index 00000000..cb7c1fa5 --- /dev/null +++ b/bandwidth/models/lookup_error_schema.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta +from typing import Optional, Set +from typing_extensions import Self + +class LookupErrorSchema(BaseModel): + """ + LookupErrorSchema + """ # noqa: E501 + code: Optional[StrictStr] = Field(default=None, description="Validation error code") + description: Optional[StrictStr] = Field(default=None, description="Description of validation error") + type: Optional[StrictStr] = Field(default=None, description="Type of validation error") + meta: Optional[LookupErrorSchemaMeta] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "description", "type", "meta"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LookupErrorSchema from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LookupErrorSchema from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "description": obj.get("description"), + "type": obj.get("type"), + "meta": LookupErrorSchemaMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/lookup_error_schema_meta.py b/bandwidth/models/lookup_error_schema_meta.py new file mode 100644 index 00000000..7f7e00ac --- /dev/null +++ b/bandwidth/models/lookup_error_schema_meta.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class LookupErrorSchemaMeta(BaseModel): + """ + LookupErrorSchemaMeta + """ # noqa: E501 + phone_numbers: Optional[List[StrictStr]] = Field(default=None, alias="phoneNumbers") + message: Optional[StrictStr] = Field(default=None, description="Message describing the error") + code: Optional[StrictInt] = Field(default=None, description="Error code associated with the message") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["phoneNumbers", "message", "code"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LookupErrorSchemaMeta from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LookupErrorSchemaMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "phoneNumbers": obj.get("phoneNumbers"), + "message": obj.get("message"), + "code": obj.get("code") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/bandwidth/models/lookup_result.py b/bandwidth/models/lookup_result.py index c514117a..4bd1f0c5 100644 --- a/bandwidth/models/lookup_result.py +++ b/bandwidth/models/lookup_result.py @@ -18,8 +18,12 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from datetime import date +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.deactivation_event_enum import DeactivationEventEnum +from bandwidth.models.latest_message_delivery_status_enum import LatestMessageDeliveryStatusEnum +from bandwidth.models.line_type_enum import LineTypeEnum from typing import Optional, Set from typing_extensions import Self @@ -27,17 +31,19 @@ class LookupResult(BaseModel): """ Carrier information results for the specified telephone number. """ # noqa: E501 - response_code: Optional[StrictInt] = Field(default=None, description="Our vendor's response code.", alias="Response Code") - message: Optional[StrictStr] = Field(default=None, description="Message associated with the response code.", alias="Message") - e_164_format: Optional[StrictStr] = Field(default=None, description="The telephone number in E.164 format.", alias="E.164 Format") - formatted: Optional[StrictStr] = Field(default=None, description="The formatted version of the telephone number.", alias="Formatted") - country: Optional[StrictStr] = Field(default=None, description="The country of the telephone number.", alias="Country") - line_type: Optional[StrictStr] = Field(default=None, description="The line type of the telephone number.", alias="Line Type") - line_provider: Optional[StrictStr] = Field(default=None, description="The messaging service provider of the telephone number.", alias="Line Provider") - mobile_country_code: Optional[StrictStr] = Field(default=None, description="The first half of the Home Network Identity (HNI).", alias="Mobile Country Code") - mobile_network_code: Optional[StrictStr] = Field(default=None, description="The second half of the HNI.", alias="Mobile Network Code") + phone_number: Optional[StrictStr] = Field(default=None, description="The telephone number in E.164 format.", alias="phoneNumber") + line_type: Optional[LineTypeEnum] = Field(default=None, alias="lineType") + messaging_provider: Optional[StrictStr] = Field(default=None, description="The messaging service provider of the telephone number.", alias="messagingProvider") + voice_provider: Optional[StrictStr] = Field(default=None, description="The voice service provider of the telephone number.", alias="voiceProvider") + country_code_a3: Optional[StrictStr] = Field(default=None, description="The country code of the telephone number in ISO 3166-1 alpha-3 format.", alias="countryCodeA3") + deactivation_reporter: Optional[StrictStr] = Field(default=None, description="[DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number. ", alias="deactivationReporter") + deactivation_date: Optional[StrictStr] = Field(default=None, description="[DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event.", alias="deactivationDate") + deactivation_event: Optional[DeactivationEventEnum] = Field(default=None, alias="deactivationEvent") + latest_message_delivery_status: Optional[LatestMessageDeliveryStatusEnum] = Field(default=None, alias="latestMessageDeliveryStatus") + initial_message_delivery_status_date: Optional[date] = Field(default=None, description="[DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes.", alias="initialMessageDeliveryStatusDate") + latest_message_delivery_status_date: Optional[date] = Field(default=None, description="[DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes.", alias="latestMessageDeliveryStatusDate") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["Response Code", "Message", "E.164 Format", "Formatted", "Country", "Line Type", "Line Provider", "Mobile Country Code", "Mobile Network Code"] + __properties: ClassVar[List[str]] = ["phoneNumber", "lineType", "messagingProvider", "voiceProvider", "countryCodeA3", "deactivationReporter", "deactivationDate", "deactivationEvent", "latestMessageDeliveryStatus", "initialMessageDeliveryStatusDate", "latestMessageDeliveryStatusDate"] model_config = ConfigDict( populate_by_name=True, @@ -97,15 +103,17 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "Response Code": obj.get("Response Code"), - "Message": obj.get("Message"), - "E.164 Format": obj.get("E.164 Format"), - "Formatted": obj.get("Formatted"), - "Country": obj.get("Country"), - "Line Type": obj.get("Line Type"), - "Line Provider": obj.get("Line Provider"), - "Mobile Country Code": obj.get("Mobile Country Code"), - "Mobile Network Code": obj.get("Mobile Network Code") + "phoneNumber": obj.get("phoneNumber"), + "lineType": obj.get("lineType"), + "messagingProvider": obj.get("messagingProvider"), + "voiceProvider": obj.get("voiceProvider"), + "countryCodeA3": obj.get("countryCodeA3"), + "deactivationReporter": obj.get("deactivationReporter"), + "deactivationDate": obj.get("deactivationDate"), + "deactivationEvent": obj.get("deactivationEvent"), + "latestMessageDeliveryStatus": obj.get("latestMessageDeliveryStatus"), + "initialMessageDeliveryStatusDate": obj.get("initialMessageDeliveryStatusDate"), + "latestMessageDeliveryStatusDate": obj.get("latestMessageDeliveryStatusDate") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/bandwidth/models/lookup_request.py b/bandwidth/models/sync_lookup_request.py similarity index 82% rename from bandwidth/models/lookup_request.py rename to bandwidth/models/sync_lookup_request.py index 4efdd0a4..1532a912 100644 --- a/bandwidth/models/lookup_request.py +++ b/bandwidth/models/sync_lookup_request.py @@ -18,18 +18,19 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, field_validator from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self -class LookupRequest(BaseModel): +class SyncLookupRequest(BaseModel): """ - Create phone number lookup request. + SyncLookupRequest """ # noqa: E501 - tns: List[StrictStr] + phone_numbers: List[Annotated[str, Field(strict=True)]] = Field(description="Telephone numbers in E.164 format.", alias="phoneNumbers") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["tns"] + __properties: ClassVar[List[str]] = ["phoneNumbers"] model_config = ConfigDict( populate_by_name=True, @@ -49,7 +50,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of LookupRequest from a JSON string""" + """Create an instance of SyncLookupRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -81,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of LookupRequest from a dict""" + """Create an instance of SyncLookupRequest from a dict""" if obj is None: return None @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "tns": obj.get("tns") + "phoneNumbers": obj.get("phoneNumbers") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/bandwidth/models/tfv_status.py b/bandwidth/models/tfv_status.py index a22e6f0b..0bc7737a 100644 --- a/bandwidth/models/tfv_status.py +++ b/bandwidth/models/tfv_status.py @@ -22,6 +22,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from uuid import UUID from bandwidth.models.tfv_status_enum import TfvStatusEnum from bandwidth.models.tfv_submission_info import TfvSubmissionInfo from typing import Optional, Set @@ -33,7 +34,7 @@ class TfvStatus(BaseModel): """ # noqa: E501 phone_number: Optional[Annotated[str, Field(min_length=12, strict=True, max_length=12)]] = Field(default=None, description="Toll-free telephone number in E.164 format.", alias="phoneNumber") status: Optional[TfvStatusEnum] = None - internal_ticket_number: Optional[StrictStr] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads.", alias="internalTicketNumber") + internal_ticket_number: Optional[UUID] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads.", alias="internalTicketNumber") decline_reason_description: Optional[StrictStr] = Field(default=None, description="Explanation for why a verification request was declined.", alias="declineReasonDescription") resubmit_allowed: Optional[StrictBool] = Field(default=None, description="Whether a Toll-Free Verification request qualifies for resubmission via PUT.", alias="resubmitAllowed") created_date_time: Optional[datetime] = Field(default=None, description="Date and time the verification request was created.", alias="createdDateTime") diff --git a/bandwidth/models/verification_denial_webhook.py b/bandwidth/models/verification_denial_webhook.py index 0b690589..75ef42da 100644 --- a/bandwidth/models/verification_denial_webhook.py +++ b/bandwidth/models/verification_denial_webhook.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from uuid import UUID from bandwidth.models.additional_denial_reason import AdditionalDenialReason from typing import Optional, Set from typing_extensions import Self @@ -33,7 +34,7 @@ class VerificationDenialWebhook(BaseModel): additional_denial_reasons: Optional[List[AdditionalDenialReason]] = Field(default=None, description="An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply.", alias="additionalDenialReasons") decline_reason_description: Optional[StrictStr] = Field(default=None, description="Explanation for why a verification request was declined.", alias="declineReasonDescription") denial_status_code: Optional[StrictInt] = Field(default=None, description="Reason code for denial.", alias="denialStatusCode") - internal_ticket_number: Optional[StrictStr] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") + internal_ticket_number: Optional[UUID] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") phone_number: Optional[Annotated[str, Field(min_length=12, strict=True, max_length=12)]] = Field(default=None, description="Toll-free telephone number in E.164 format.", alias="phoneNumber") resubmit_allowed: Optional[StrictBool] = Field(default=None, description="Whether a Toll-Free Verification request qualifies for resubmission via PUT.", alias="resubmitAllowed") status: Optional[StrictStr] = 'UNVERIFIED' diff --git a/bandwidth/models/verification_webhook.py b/bandwidth/models/verification_webhook.py index 458fa3af..762e55c5 100644 --- a/bandwidth/models/verification_webhook.py +++ b/bandwidth/models/verification_webhook.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated +from uuid import UUID from bandwidth.models.tfv_callback_status_enum import TfvCallbackStatusEnum from typing import Optional, Set from typing_extensions import Self @@ -32,7 +33,7 @@ class VerificationWebhook(BaseModel): account_id: Optional[StrictStr] = Field(default=None, description="User's account ID.", alias="accountId") phone_number: Optional[Annotated[str, Field(min_length=12, strict=True, max_length=12)]] = Field(default=None, description="Toll-free telephone number in E.164 format.", alias="phoneNumber") status: Optional[TfvCallbackStatusEnum] = None - internal_ticket_number: Optional[StrictStr] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") + internal_ticket_number: Optional[UUID] = Field(default=None, description="Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number.", alias="internalTicketNumber") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["accountId", "phoneNumber", "status", "internalTicketNumber"] diff --git a/bandwidth/rest.py b/bandwidth/rest.py index 454bb1c3..7980ab76 100644 --- a/bandwidth/rest.py +++ b/bandwidth/rest.py @@ -77,6 +77,7 @@ def __init__(self, configuration) -> None: "ca_certs": configuration.ssl_ca_cert, "cert_file": configuration.cert_file, "key_file": configuration.key_file, + "ca_cert_data": configuration.ca_cert_data, } if configuration.assert_hostname is not None: pool_args['assert_hostname'] = ( diff --git a/docs/AsyncLookupRequest.md b/docs/AsyncLookupRequest.md new file mode 100644 index 00000000..856e1ee9 --- /dev/null +++ b/docs/AsyncLookupRequest.md @@ -0,0 +1,29 @@ +# AsyncLookupRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_numbers** | **List[str]** | Telephone numbers in E.164 format. | + +## Example + +```python +from bandwidth.models.async_lookup_request import AsyncLookupRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of AsyncLookupRequest from a JSON string +async_lookup_request_instance = AsyncLookupRequest.from_json(json) +# print the JSON string representation of the object +print(AsyncLookupRequest.to_json()) + +# convert the object into a dict +async_lookup_request_dict = async_lookup_request_instance.to_dict() +# create an instance of AsyncLookupRequest from a dict +async_lookup_request_from_dict = AsyncLookupRequest.from_dict(async_lookup_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CallsApi.md b/docs/CallsApi.md index 87e55f62..03ab8819 100644 --- a/docs/CallsApi.md +++ b/docs/CallsApi.md @@ -16,7 +16,11 @@ Method | HTTP request | Description Create Call -Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. Please note: Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. +Creates an outbound phone call. + +All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to "fire and forget" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. + +Please note: Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. ### Example @@ -106,7 +110,9 @@ Name | Type | Description | Notes Get Call State Information -Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response. +Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. + +**Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response. ### Example @@ -195,7 +201,10 @@ Name | Type | Description | Notes Get Calls -Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of calls in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of call records. Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response. +Returns a max of 10000 calls, sorted by `createdTime` from oldest to newest. + +**NOTE:** If the number of calls in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel="next"`) will be returned in the response. The url can be used to retrieve the next page of call records. +Also, call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an empty array [] in response. ### Example diff --git a/docs/CompletedLookupStatusEnum.md b/docs/CompletedLookupStatusEnum.md new file mode 100644 index 00000000..3fe5b935 --- /dev/null +++ b/docs/CompletedLookupStatusEnum.md @@ -0,0 +1,14 @@ +# CompletedLookupStatusEnum + + +## Enum + +* `COMPLETE` (value: `'COMPLETE'`) + +* `PARTIAL_COMPLETE` (value: `'PARTIAL_COMPLETE'`) + +* `FAILED` (value: `'FAILED'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ConferencesApi.md b/docs/ConferencesApi.md index 9d965732..2564eedf 100644 --- a/docs/ConferencesApi.md +++ b/docs/ConferencesApi.md @@ -470,7 +470,9 @@ Name | Type | Description | Notes Get Conferences -Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records. +Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. + +**NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel="next"`) will be returned in the response. The url can be used to retrieve the next page of conference records. ### Example diff --git a/docs/CreateAsyncBulkLookupResponse.md b/docs/CreateAsyncBulkLookupResponse.md new file mode 100644 index 00000000..a17c679a --- /dev/null +++ b/docs/CreateAsyncBulkLookupResponse.md @@ -0,0 +1,31 @@ +# CreateAsyncBulkLookupResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**List[LinkSchema]**](LinkSchema.md) | Links for pagination (if applicable) | [optional] +**data** | [**CreateAsyncBulkLookupResponseData**](CreateAsyncBulkLookupResponseData.md) | | [optional] +**errors** | [**List[LookupErrorSchema]**](LookupErrorSchema.md) | | [optional] + +## Example + +```python +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateAsyncBulkLookupResponse from a JSON string +create_async_bulk_lookup_response_instance = CreateAsyncBulkLookupResponse.from_json(json) +# print the JSON string representation of the object +print(CreateAsyncBulkLookupResponse.to_json()) + +# convert the object into a dict +create_async_bulk_lookup_response_dict = create_async_bulk_lookup_response_instance.to_dict() +# create an instance of CreateAsyncBulkLookupResponse from a dict +create_async_bulk_lookup_response_from_dict = CreateAsyncBulkLookupResponse.from_dict(create_async_bulk_lookup_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateAsyncBulkLookupResponseData.md b/docs/CreateAsyncBulkLookupResponseData.md new file mode 100644 index 00000000..20e2ffe3 --- /dev/null +++ b/docs/CreateAsyncBulkLookupResponseData.md @@ -0,0 +1,31 @@ +# CreateAsyncBulkLookupResponseData + +The phone number lookup response data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **str** | The phone number lookup request ID from Bandwidth. | [optional] +**status** | [**InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [optional] + +## Example + +```python +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateAsyncBulkLookupResponseData from a JSON string +create_async_bulk_lookup_response_data_instance = CreateAsyncBulkLookupResponseData.from_json(json) +# print the JSON string representation of the object +print(CreateAsyncBulkLookupResponseData.to_json()) + +# convert the object into a dict +create_async_bulk_lookup_response_data_dict = create_async_bulk_lookup_response_data_instance.to_dict() +# create an instance of CreateAsyncBulkLookupResponseData from a dict +create_async_bulk_lookup_response_data_from_dict = CreateAsyncBulkLookupResponseData.from_dict(create_async_bulk_lookup_response_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateLookupResponse.md b/docs/CreateLookupResponse.md deleted file mode 100644 index 4edb1104..00000000 --- a/docs/CreateLookupResponse.md +++ /dev/null @@ -1,31 +0,0 @@ -# CreateLookupResponse - -The request has been accepted for processing but not yet finished and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**request_id** | **str** | The phone number lookup request ID from Bandwidth. | [optional] -**status** | [**LookupStatusEnum**](LookupStatusEnum.md) | | [optional] - -## Example - -```python -from bandwidth.models.create_lookup_response import CreateLookupResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of CreateLookupResponse from a JSON string -create_lookup_response_instance = CreateLookupResponse.from_json(json) -# print the JSON string representation of the object -print(CreateLookupResponse.to_json()) - -# convert the object into a dict -create_lookup_response_dict = create_lookup_response_instance.to_dict() -# create an instance of CreateLookupResponse from a dict -create_lookup_response_from_dict = CreateLookupResponse.from_dict(create_lookup_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CreateSyncLookupResponse.md b/docs/CreateSyncLookupResponse.md new file mode 100644 index 00000000..60090391 --- /dev/null +++ b/docs/CreateSyncLookupResponse.md @@ -0,0 +1,31 @@ +# CreateSyncLookupResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**List[LinkSchema]**](LinkSchema.md) | | [optional] +**data** | [**CreateSyncLookupResponseData**](CreateSyncLookupResponseData.md) | | [optional] +**errors** | [**List[LookupErrorSchema]**](LookupErrorSchema.md) | | [optional] + +## Example + +```python +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateSyncLookupResponse from a JSON string +create_sync_lookup_response_instance = CreateSyncLookupResponse.from_json(json) +# print the JSON string representation of the object +print(CreateSyncLookupResponse.to_json()) + +# convert the object into a dict +create_sync_lookup_response_dict = create_sync_lookup_response_instance.to_dict() +# create an instance of CreateSyncLookupResponse from a dict +create_sync_lookup_response_from_dict = CreateSyncLookupResponse.from_dict(create_sync_lookup_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CreateSyncLookupResponseData.md b/docs/CreateSyncLookupResponseData.md new file mode 100644 index 00000000..82b53f3d --- /dev/null +++ b/docs/CreateSyncLookupResponseData.md @@ -0,0 +1,32 @@ +# CreateSyncLookupResponseData + +The phone number lookup response data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **str** | The phone number lookup request ID from Bandwidth. | [optional] +**status** | [**CompletedLookupStatusEnum**](CompletedLookupStatusEnum.md) | | [optional] +**results** | [**List[LookupResult]**](LookupResult.md) | The carrier information results for the specified telephone numbers. | [optional] + +## Example + +```python +from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData + +# TODO update the JSON string below +json = "{}" +# create an instance of CreateSyncLookupResponseData from a JSON string +create_sync_lookup_response_data_instance = CreateSyncLookupResponseData.from_json(json) +# print the JSON string representation of the object +print(CreateSyncLookupResponseData.to_json()) + +# convert the object into a dict +create_sync_lookup_response_data_dict = create_sync_lookup_response_data_instance.to_dict() +# create an instance of CreateSyncLookupResponseData from a dict +create_sync_lookup_response_data_from_dict = CreateSyncLookupResponseData.from_dict(create_sync_lookup_response_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DeactivationEventEnum.md b/docs/DeactivationEventEnum.md new file mode 100644 index 00000000..dfe1ee0f --- /dev/null +++ b/docs/DeactivationEventEnum.md @@ -0,0 +1,11 @@ +# DeactivationEventEnum + +[DNI-Only](#section/DNI-Only). `DEACTIVATED` if the carrier reported a deactivation event for this phone number. + +## Enum + +* `DEACTIVATED` (value: `'DEACTIVATED'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetAsyncBulkLookupResponse.md b/docs/GetAsyncBulkLookupResponse.md new file mode 100644 index 00000000..49063a52 --- /dev/null +++ b/docs/GetAsyncBulkLookupResponse.md @@ -0,0 +1,31 @@ +# GetAsyncBulkLookupResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**List[LinkSchema]**](LinkSchema.md) | | [optional] +**data** | [**GetAsyncBulkLookupResponseData**](GetAsyncBulkLookupResponseData.md) | | [optional] +**errors** | [**List[LookupErrorSchema]**](LookupErrorSchema.md) | | [optional] + +## Example + +```python +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetAsyncBulkLookupResponse from a JSON string +get_async_bulk_lookup_response_instance = GetAsyncBulkLookupResponse.from_json(json) +# print the JSON string representation of the object +print(GetAsyncBulkLookupResponse.to_json()) + +# convert the object into a dict +get_async_bulk_lookup_response_dict = get_async_bulk_lookup_response_instance.to_dict() +# create an instance of GetAsyncBulkLookupResponse from a dict +get_async_bulk_lookup_response_from_dict = GetAsyncBulkLookupResponse.from_dict(get_async_bulk_lookup_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/GetAsyncBulkLookupResponseData.md b/docs/GetAsyncBulkLookupResponseData.md new file mode 100644 index 00000000..66af5577 --- /dev/null +++ b/docs/GetAsyncBulkLookupResponseData.md @@ -0,0 +1,32 @@ +# GetAsyncBulkLookupResponseData + +The phone number lookup response data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**request_id** | **str** | The phone number lookup request ID from Bandwidth. | [optional] +**status** | [**InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [optional] +**results** | [**List[LookupResult]**](LookupResult.md) | The carrier information results for the specified telephone number. | [optional] + +## Example + +```python +from bandwidth.models.get_async_bulk_lookup_response_data import GetAsyncBulkLookupResponseData + +# TODO update the JSON string below +json = "{}" +# create an instance of GetAsyncBulkLookupResponseData from a JSON string +get_async_bulk_lookup_response_data_instance = GetAsyncBulkLookupResponseData.from_json(json) +# print the JSON string representation of the object +print(GetAsyncBulkLookupResponseData.to_json()) + +# convert the object into a dict +get_async_bulk_lookup_response_data_dict = get_async_bulk_lookup_response_data_instance.to_dict() +# create an instance of GetAsyncBulkLookupResponseData from a dict +get_async_bulk_lookup_response_data_from_dict = GetAsyncBulkLookupResponseData.from_dict(get_async_bulk_lookup_response_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LookupStatusEnum.md b/docs/InProgressLookupStatusEnum.md similarity index 77% rename from docs/LookupStatusEnum.md rename to docs/InProgressLookupStatusEnum.md index 5269ba85..92d8d99e 100644 --- a/docs/LookupStatusEnum.md +++ b/docs/InProgressLookupStatusEnum.md @@ -1,6 +1,5 @@ -# LookupStatusEnum +# InProgressLookupStatusEnum -The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or FAILED). ## Enum diff --git a/docs/LatestMessageDeliveryStatusEnum.md b/docs/LatestMessageDeliveryStatusEnum.md new file mode 100644 index 00000000..63eebf37 --- /dev/null +++ b/docs/LatestMessageDeliveryStatusEnum.md @@ -0,0 +1,15 @@ +# LatestMessageDeliveryStatusEnum + +[DNI-Only](#section/DNI-Only). The current delivery status of the phone number. - ACTIVE: A message was successfully sent to the number (delivery code 0). - DEACTIVATED: A message was not delivered to a number (delivery code 720) - UNKNOWN: Bandwidth cannot find an delivery status entry for the number. + +## Enum + +* `ACTIVE` (value: `'ACTIVE'`) + +* `DEACTIVATED` (value: `'DEACTIVATED'`) + +* `UNKNOWN` (value: `'UNKNOWN'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LineTypeEnum.md b/docs/LineTypeEnum.md new file mode 100644 index 00000000..72f39795 --- /dev/null +++ b/docs/LineTypeEnum.md @@ -0,0 +1,16 @@ +# LineTypeEnum + + +## Enum + +* `FIXED` (value: `'FIXED'`) + +* `VOIP_MINUS_FIXED` (value: `'VOIP-FIXED'`) + +* `MOBILE` (value: `'MOBILE'`) + +* `VOIP` (value: `'VOIP'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LinkSchema.md b/docs/LinkSchema.md new file mode 100644 index 00000000..b5132c7f --- /dev/null +++ b/docs/LinkSchema.md @@ -0,0 +1,31 @@ +# LinkSchema + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **str** | URI of the link. | [optional] +**rel** | **str** | Specifies the relationship between this link and the resource. | [optional] +**method** | **str** | HTTP method to be used. | [optional] + +## Example + +```python +from bandwidth.models.link_schema import LinkSchema + +# TODO update the JSON string below +json = "{}" +# create an instance of LinkSchema from a JSON string +link_schema_instance = LinkSchema.from_json(json) +# print the JSON string representation of the object +print(LinkSchema.to_json()) + +# convert the object into a dict +link_schema_dict = link_schema_instance.to_dict() +# create an instance of LinkSchema from a dict +link_schema_from_dict = LinkSchema.from_dict(link_schema_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LookupErrorResponse.md b/docs/LookupErrorResponse.md new file mode 100644 index 00000000..9c6f5849 --- /dev/null +++ b/docs/LookupErrorResponse.md @@ -0,0 +1,31 @@ +# LookupErrorResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**List[LinkSchema]**](LinkSchema.md) | | [optional] +**data** | **object** | The phone number lookup response data | [optional] +**errors** | [**List[LookupErrorSchema]**](LookupErrorSchema.md) | | [optional] + +## Example + +```python +from bandwidth.models.lookup_error_response import LookupErrorResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of LookupErrorResponse from a JSON string +lookup_error_response_instance = LookupErrorResponse.from_json(json) +# print the JSON string representation of the object +print(LookupErrorResponse.to_json()) + +# convert the object into a dict +lookup_error_response_dict = lookup_error_response_instance.to_dict() +# create an instance of LookupErrorResponse from a dict +lookup_error_response_from_dict = LookupErrorResponse.from_dict(lookup_error_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LookupErrorSchema.md b/docs/LookupErrorSchema.md new file mode 100644 index 00000000..cb7daf4c --- /dev/null +++ b/docs/LookupErrorSchema.md @@ -0,0 +1,32 @@ +# LookupErrorSchema + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **str** | Validation error code | [optional] +**description** | **str** | Description of validation error | [optional] +**type** | **str** | Type of validation error | [optional] +**meta** | [**LookupErrorSchemaMeta**](LookupErrorSchemaMeta.md) | | [optional] + +## Example + +```python +from bandwidth.models.lookup_error_schema import LookupErrorSchema + +# TODO update the JSON string below +json = "{}" +# create an instance of LookupErrorSchema from a JSON string +lookup_error_schema_instance = LookupErrorSchema.from_json(json) +# print the JSON string representation of the object +print(LookupErrorSchema.to_json()) + +# convert the object into a dict +lookup_error_schema_dict = lookup_error_schema_instance.to_dict() +# create an instance of LookupErrorSchema from a dict +lookup_error_schema_from_dict = LookupErrorSchema.from_dict(lookup_error_schema_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LookupErrorSchemaMeta.md b/docs/LookupErrorSchemaMeta.md new file mode 100644 index 00000000..440615c6 --- /dev/null +++ b/docs/LookupErrorSchemaMeta.md @@ -0,0 +1,31 @@ +# LookupErrorSchemaMeta + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_numbers** | **List[str]** | | [optional] +**message** | **str** | Message describing the error | [optional] +**code** | **int** | Error code associated with the message | [optional] + +## Example + +```python +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta + +# TODO update the JSON string below +json = "{}" +# create an instance of LookupErrorSchemaMeta from a JSON string +lookup_error_schema_meta_instance = LookupErrorSchemaMeta.from_json(json) +# print the JSON string representation of the object +print(LookupErrorSchemaMeta.to_json()) + +# convert the object into a dict +lookup_error_schema_meta_dict = lookup_error_schema_meta_instance.to_dict() +# create an instance of LookupErrorSchemaMeta from a dict +lookup_error_schema_meta_from_dict = LookupErrorSchemaMeta.from_dict(lookup_error_schema_meta_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LookupRequest.md b/docs/LookupRequest.md deleted file mode 100644 index 6ba46798..00000000 --- a/docs/LookupRequest.md +++ /dev/null @@ -1,30 +0,0 @@ -# LookupRequest - -Create phone number lookup request. - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**tns** | **List[str]** | | - -## Example - -```python -from bandwidth.models.lookup_request import LookupRequest - -# TODO update the JSON string below -json = "{}" -# create an instance of LookupRequest from a JSON string -lookup_request_instance = LookupRequest.from_json(json) -# print the JSON string representation of the object -print(LookupRequest.to_json()) - -# convert the object into a dict -lookup_request_dict = lookup_request_instance.to_dict() -# create an instance of LookupRequest from a dict -lookup_request_from_dict = LookupRequest.from_dict(lookup_request_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/LookupResult.md b/docs/LookupResult.md index a2154b50..b7758648 100644 --- a/docs/LookupResult.md +++ b/docs/LookupResult.md @@ -6,15 +6,17 @@ Carrier information results for the specified telephone number. Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**response_code** | **int** | Our vendor's response code. | [optional] -**message** | **str** | Message associated with the response code. | [optional] -**e_164_format** | **str** | The telephone number in E.164 format. | [optional] -**formatted** | **str** | The formatted version of the telephone number. | [optional] -**country** | **str** | The country of the telephone number. | [optional] -**line_type** | **str** | The line type of the telephone number. | [optional] -**line_provider** | **str** | The messaging service provider of the telephone number. | [optional] -**mobile_country_code** | **str** | The first half of the Home Network Identity (HNI). | [optional] -**mobile_network_code** | **str** | The second half of the HNI. | [optional] +**phone_number** | **str** | The telephone number in E.164 format. | [optional] +**line_type** | [**LineTypeEnum**](LineTypeEnum.md) | | [optional] +**messaging_provider** | **str** | The messaging service provider of the telephone number. | [optional] +**voice_provider** | **str** | The voice service provider of the telephone number. | [optional] +**country_code_a3** | **str** | The country code of the telephone number in ISO 3166-1 alpha-3 format. | [optional] +**deactivation_reporter** | **str** | [DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number. | [optional] +**deactivation_date** | **str** | [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. | [optional] +**deactivation_event** | [**DeactivationEventEnum**](DeactivationEventEnum.md) | | [optional] +**latest_message_delivery_status** | [**LatestMessageDeliveryStatusEnum**](LatestMessageDeliveryStatusEnum.md) | | [optional] +**initial_message_delivery_status_date** | **date** | [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] +**latest_message_delivery_status_date** | **date** | [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] ## Example diff --git a/docs/LookupStatus.md b/docs/LookupStatus.md deleted file mode 100644 index 490993e5..00000000 --- a/docs/LookupStatus.md +++ /dev/null @@ -1,33 +0,0 @@ -# LookupStatus - -If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no information was available for the TN. - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**request_id** | **str** | The requestId. | [optional] -**status** | [**LookupStatusEnum**](LookupStatusEnum.md) | | [optional] -**result** | [**List[LookupResult]**](LookupResult.md) | The carrier information results for the specified telephone number. | [optional] -**failed_telephone_numbers** | **List[str]** | The telephone numbers whose lookup failed. | [optional] - -## Example - -```python -from bandwidth.models.lookup_status import LookupStatus - -# TODO update the JSON string below -json = "{}" -# create an instance of LookupStatus from a JSON string -lookup_status_instance = LookupStatus.from_json(json) -# print the JSON string representation of the object -print(LookupStatus.to_json()) - -# convert the object into a dict -lookup_status_dict = lookup_status_instance.to_dict() -# create an instance of LookupStatus from a dict -lookup_status_from_dict = LookupStatus.from_dict(lookup_status_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/MediaApi.md b/docs/MediaApi.md index 6b25b7ab..bd3a8bd6 100644 --- a/docs/MediaApi.md +++ b/docs/MediaApi.md @@ -15,7 +15,11 @@ Method | HTTP request | Description Delete Media -Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name. +Deletes a media file from Bandwidth API server. Make sure you don't have +any application scripts still using the media before you delete. + +If you accidentally delete a media file you can immediately upload a new +file with the same name. ### Example @@ -278,7 +282,11 @@ Name | Type | Description | Notes Upload Media -Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). +Upload a file. You may add headers to the request in order to provide some control to your media file. + +If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. + +A list of supported media types can be found [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). ### Example diff --git a/docs/PhoneNumberLookupApi.md b/docs/PhoneNumberLookupApi.md index dfc02ede..da1fe651 100644 --- a/docs/PhoneNumberLookupApi.md +++ b/docs/PhoneNumberLookupApi.md @@ -4,16 +4,17 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**create_lookup**](PhoneNumberLookupApi.md#create_lookup) | **POST** /accounts/{accountId}/tnlookup | Create Lookup -[**get_lookup_status**](PhoneNumberLookupApi.md#get_lookup_status) | **GET** /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status +[**create_async_bulk_lookup**](PhoneNumberLookupApi.md#create_async_bulk_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup +[**create_sync_lookup**](PhoneNumberLookupApi.md#create_sync_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup +[**get_async_bulk_lookup**](PhoneNumberLookupApi.md#get_async_bulk_lookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup -# **create_lookup** -> CreateLookupResponse create_lookup(account_id, lookup_request) +# **create_async_bulk_lookup** +> CreateAsyncBulkLookupResponse create_async_bulk_lookup(account_id, async_lookup_request) -Create Lookup +Create Asynchronous Bulk Number Lookup -Create a Phone Number Lookup Request. +Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. ### Example @@ -21,8 +22,8 @@ Create a Phone Number Lookup Request. ```python import bandwidth -from bandwidth.models.create_lookup_response import CreateLookupResponse -from bandwidth.models.lookup_request import LookupRequest +from bandwidth.models.async_lookup_request import AsyncLookupRequest +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse from bandwidth.rest import ApiException from pprint import pprint @@ -47,16 +48,16 @@ configuration = bandwidth.Configuration( with bandwidth.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = bandwidth.PhoneNumberLookupApi(api_client) - account_id = '9900000' # str | Your Bandwidth Account ID. - lookup_request = bandwidth.LookupRequest() # LookupRequest | Phone number lookup request. + account_id = '9900000' # str | + async_lookup_request = bandwidth.AsyncLookupRequest() # AsyncLookupRequest | Asynchronous bulk phone number lookup request. try: - # Create Lookup - api_response = api_instance.create_lookup(account_id, lookup_request) - print("The response of PhoneNumberLookupApi->create_lookup:\n") + # Create Asynchronous Bulk Number Lookup + api_response = api_instance.create_async_bulk_lookup(account_id, async_lookup_request) + print("The response of PhoneNumberLookupApi->create_async_bulk_lookup:\n") pprint(api_response) except Exception as e: - print("Exception when calling PhoneNumberLookupApi->create_lookup: %s\n" % e) + print("Exception when calling PhoneNumberLookupApi->create_async_bulk_lookup: %s\n" % e) ``` @@ -66,12 +67,12 @@ with bandwidth.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Your Bandwidth Account ID. | - **lookup_request** | [**LookupRequest**](LookupRequest.md)| Phone number lookup request. | + **account_id** | **str**| | + **async_lookup_request** | [**AsyncLookupRequest**](AsyncLookupRequest.md)| Asynchronous bulk phone number lookup request. | ### Return type -[**CreateLookupResponse**](CreateLookupResponse.md) +[**CreateAsyncBulkLookupResponse**](CreateAsyncBulkLookupResponse.md) ### Authorization @@ -87,21 +88,16 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **202** | Accepted | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**415** | Unsupported Media Type | - | -**429** | Too Many Requests | - | -**500** | Internal Server Error | - | +**0** | Bad Request | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_lookup_status** -> LookupStatus get_lookup_status(account_id, request_id) +# **create_sync_lookup** +> CreateSyncLookupResponse create_sync_lookup(account_id, sync_lookup_request) -Get Lookup Request Status +Create Synchronous Number Lookup -Get an existing Phone Number Lookup Request. +Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. ### Example @@ -109,7 +105,8 @@ Get an existing Phone Number Lookup Request. ```python import bandwidth -from bandwidth.models.lookup_status import LookupStatus +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse +from bandwidth.models.sync_lookup_request import SyncLookupRequest from bandwidth.rest import ApiException from pprint import pprint @@ -134,16 +131,16 @@ configuration = bandwidth.Configuration( with bandwidth.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = bandwidth.PhoneNumberLookupApi(api_client) - account_id = '9900000' # str | Your Bandwidth Account ID. - request_id = '004223a0-8b17-41b1-bf81-20732adf5590' # str | The phone number lookup request ID from Bandwidth. + account_id = '9900000' # str | + sync_lookup_request = bandwidth.SyncLookupRequest() # SyncLookupRequest | Synchronous phone number lookup request. try: - # Get Lookup Request Status - api_response = api_instance.get_lookup_status(account_id, request_id) - print("The response of PhoneNumberLookupApi->get_lookup_status:\n") + # Create Synchronous Number Lookup + api_response = api_instance.create_sync_lookup(account_id, sync_lookup_request) + print("The response of PhoneNumberLookupApi->create_sync_lookup:\n") pprint(api_response) except Exception as e: - print("Exception when calling PhoneNumberLookupApi->get_lookup_status: %s\n" % e) + print("Exception when calling PhoneNumberLookupApi->create_sync_lookup: %s\n" % e) ``` @@ -153,12 +150,94 @@ with bandwidth.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **account_id** | **str**| Your Bandwidth Account ID. | - **request_id** | **str**| The phone number lookup request ID from Bandwidth. | + **account_id** | **str**| | + **sync_lookup_request** | [**SyncLookupRequest**](SyncLookupRequest.md)| Synchronous phone number lookup request. | ### Return type -[**LookupStatus**](LookupStatus.md) +[**CreateSyncLookupResponse**](CreateSyncLookupResponse.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**0** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_async_bulk_lookup** +> GetAsyncBulkLookupResponse get_async_bulk_lookup(account_id, request_id) + +Get Asynchronous Bulk Number Lookup + +Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse +from bandwidth.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost +# See configuration.py for a list of all supported configuration parameters. +configuration = bandwidth.Configuration( + host = "http://localhost" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: Basic +configuration = bandwidth.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with bandwidth.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = bandwidth.PhoneNumberLookupApi(api_client) + account_id = '9900000' # str | + request_id = '004223a0-8b17-41b1-bf81-20732adf5590' # str | + + try: + # Get Asynchronous Bulk Number Lookup + api_response = api_instance.get_async_bulk_lookup(account_id, request_id) + print("The response of PhoneNumberLookupApi->get_async_bulk_lookup:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PhoneNumberLookupApi->get_async_bulk_lookup: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| | + **request_id** | **str**| | + +### Return type + +[**GetAsyncBulkLookupResponse**](GetAsyncBulkLookupResponse.md) ### Authorization @@ -174,12 +253,7 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | OK | - | -**400** | Bad Request | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**429** | Too Many Requests | - | -**500** | Internal Server Error | - | +**0** | Bad Request | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/docs/RecordingsApi.md b/docs/RecordingsApi.md index 6e367123..e461ef87 100644 --- a/docs/RecordingsApi.md +++ b/docs/RecordingsApi.md @@ -21,7 +21,9 @@ Method | HTTP request | Description Delete Recording -Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. +Delete the recording information, media and transcription. + +Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. ### Example @@ -197,7 +199,9 @@ void (empty response body) Delete Transcription -Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. +Deletes the specified recording's transcription. + +Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. ### Example @@ -466,7 +470,10 @@ Name | Type | Description | Notes Get Transcription -Downloads the specified transcription. If the recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. +Downloads the specified transcription. +If the recording was multi-channel, then there will be 2 transcripts. +The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. +During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. ### Example @@ -557,7 +564,10 @@ Name | Type | Description | Notes Get Call Recordings -Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria. +Returns a list of metadata for the recordings associated with the +specified account. The list can be filtered by the optional from, to, minStartTime, +and maxStartTime arguments. The list is capped at 1000 entries and may be +empty if no recordings match the specified criteria. ### Example @@ -652,7 +662,8 @@ Name | Type | Description | Notes List Call Recordings -Returns a (potentially empty) list of metadata for the recordings that took place during the specified call. +Returns a (potentially empty) list of metadata for the recordings +that took place during the specified call. ### Example @@ -741,7 +752,9 @@ Name | Type | Description | Notes Create Transcription Request -Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. +Generate the transcription for a specific recording. Transcription +can succeed only for recordings of length greater than 500 milliseconds and +less than 4 hours. ### Example diff --git a/docs/SyncLookupRequest.md b/docs/SyncLookupRequest.md new file mode 100644 index 00000000..7b753251 --- /dev/null +++ b/docs/SyncLookupRequest.md @@ -0,0 +1,29 @@ +# SyncLookupRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_numbers** | **List[str]** | Telephone numbers in E.164 format. | + +## Example + +```python +from bandwidth.models.sync_lookup_request import SyncLookupRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of SyncLookupRequest from a JSON string +sync_lookup_request_instance = SyncLookupRequest.from_json(json) +# print the JSON string representation of the object +print(SyncLookupRequest.to_json()) + +# convert the object into a dict +sync_lookup_request_dict = sync_lookup_request_instance.to_dict() +# create an instance of SyncLookupRequest from a dict +sync_lookup_request_from_dict = SyncLookupRequest.from_dict(sync_lookup_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TnLookupRequestError.md b/docs/TnLookupRequestError.md deleted file mode 100644 index 24ccaa19..00000000 --- a/docs/TnLookupRequestError.md +++ /dev/null @@ -1,29 +0,0 @@ -# TnLookupRequestError - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**message** | **str** | A description of what validation error occurred. | [optional] - -## Example - -```python -from bandwidth.models.tn_lookup_request_error import TnLookupRequestError - -# TODO update the JSON string below -json = "{}" -# create an instance of TnLookupRequestError from a JSON string -tn_lookup_request_error_instance = TnLookupRequestError.from_json(json) -# print the JSON string representation of the object -print(TnLookupRequestError.to_json()) - -# convert the object into a dict -tn_lookup_request_error_dict = tn_lookup_request_error_instance.to_dict() -# create an instance of TnLookupRequestError from a dict -tn_lookup_request_error_from_dict = TnLookupRequestError.from_dict(tn_lookup_request_error_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/TollFreeVerificationApi.md b/docs/TollFreeVerificationApi.md index 8305498e..d5995ce1 100644 --- a/docs/TollFreeVerificationApi.md +++ b/docs/TollFreeVerificationApi.md @@ -20,7 +20,9 @@ Method | HTTP request | Description Create Webhook Subscription -Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. +Create a new webhook subscription (this webhook will be called for every update on every submission). +In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). +The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. ### Example @@ -282,7 +284,8 @@ void (empty response body) Get Toll-Free Verification Status -Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. +Gets the verification status for a phone number that is provisioned to your account. +Submission information will be appended to the response if it is available. ### Example @@ -453,7 +456,8 @@ This endpoint does not need any parameter. List Webhook Subscriptions -Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). +Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API +If `basicAuthentication` is defined, the `password` property of that object will be null). ### Example @@ -625,7 +629,8 @@ void (empty response body) Update Toll-Free Verification Request -Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). +Updates a toll-free verification request. +Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). ### Example diff --git a/docs/TranscriptionsApi.md b/docs/TranscriptionsApi.md index 889dc92b..2a8b05f2 100644 --- a/docs/TranscriptionsApi.md +++ b/docs/TranscriptionsApi.md @@ -14,7 +14,9 @@ Method | HTTP request | Description Delete Real-time Transcription -Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). Note: After the deletion is requested and a `200` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. +Delete the specified transcription that was created on this call via [startTranscription](/docs/voice/bxml/startTranscription). + +Note: After the deletion is requested and a `200` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. ### Example diff --git a/git_push.sh b/git_push.sh index f53a75d4..192bb8f0 100644 --- a/git_push.sh +++ b/git_push.sh @@ -14,12 +14,12 @@ if [ "$git_host" = "" ]; then fi if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" + git_user_id="bandwidth" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" + git_repo_id="python-sdk" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/openapi-config.yml b/openapi-config.yml index b3ebef05..25193c40 100644 --- a/openapi-config.yml +++ b/openapi-config.yml @@ -1,5 +1,7 @@ projectName: bandwidth_sdk packageName: bandwidth packageUrl: 'https://dev.bandwidth.com/sdks/python' +gitUserId: bandwidth +gitRepoId: python-sdk disallowAdditionalPropertiesIfNotPresent: false templateDir: custom_templates diff --git a/openapitools.json b/openapitools.json index 973a005e..f052220d 100644 --- a/openapitools.json +++ b/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.11.0" + "version": "7.17.0" } } diff --git a/pyproject.toml b/pyproject.toml index bd66fc9c..87ca7131 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,23 +1,28 @@ -[tool.poetry] +[project] name = "bandwidth" version = "1.0.0" description = "Bandwidth" -authors = ["Bandwidth "] -license = "NoLicense" +authors = [ + {name = "Bandwidth",email = "letstalk@bandwidth.com"}, +] readme = "README.md" -repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" keywords = ["OpenAPI", "OpenAPI-Generator", "Bandwidth"] -include = ["bandwidth/py.typed"] +requires-python = ">=3.9" -[tool.poetry.dependencies] -python = "^3.8" +dependencies = [ + "urllib3 (>=2.1.0,<3.0.0)", + "python-dateutil (>=2.8.2)", + "pydantic (>=2)", + "typing-extensions (>=4.7.1)", +] -urllib3 = ">= 1.25.3, < 3.0.0" -python-dateutil = ">= 2.8.2" -pydantic = ">= 2" -typing-extensions = ">= 4.7.1" +[project.urls] +Repository = "https://github.com/bandwidth/python-sdk" + +[tool.poetry] +requires-poetry = ">=2.0" -[tool.poetry.dev-dependencies] +[tool.poetry.group.dev.dependencies] pytest = ">= 7.2.1" pytest-cov = ">= 2.8.1" tox = ">= 3.9.0" diff --git a/setup.py b/setup.py index ed152559..a728fc55 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,6 @@ Do not edit the class manually. """ # noqa: E501 - import os import sys from setuptools import setup, find_packages # noqa: H301 diff --git a/test/smoke/test_phone_number_lookup_api.py b/test/smoke/test_phone_number_lookup_api.py index de13eaf7..4867e943 100644 --- a/test/smoke/test_phone_number_lookup_api.py +++ b/test/smoke/test_phone_number_lookup_api.py @@ -1,245 +1,135 @@ +# coding: utf-8 + """ -Integration test for Bandwidth's Phone Number Lookup API -""" + Bandwidth -import json -import time -import unittest + Bandwidth's Communication APIs -import bandwidth -from bandwidth.api import phone_number_lookup_api -from bandwidth.models.lookup_request import LookupRequest -from bandwidth.models.create_lookup_response import CreateLookupResponse -from bandwidth.models.lookup_status import LookupStatus -from bandwidth.models.lookup_result import LookupResult -from bandwidth.models.lookup_status_enum import LookupStatusEnum -from bandwidth.models.tn_lookup_request_error import TnLookupRequestError -from bandwidth.exceptions import ApiException, UnauthorizedException, ForbiddenException -from test.utils.env_variables import * + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the manually. +""" # noqa: E501 -from hamcrest.core import * -from hamcrest.library import * -from .bwmatchers.one_of_string import is_one_of_string +import unittest +from datetime import date +from uuid import UUID +from time import sleep + +from hamcrest import * +from bandwidth import ApiClient, Configuration +from bandwidth.api.phone_number_lookup_api import PhoneNumberLookupApi +from bandwidth.models.async_lookup_request import AsyncLookupRequest +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse +from bandwidth.models.link_schema import LinkSchema +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum +from bandwidth.models.sync_lookup_request import SyncLookupRequest +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse +from bandwidth.models.completed_lookup_status_enum import CompletedLookupStatusEnum +from bandwidth.models.lookup_result import LookupResult +from bandwidth.models.line_type_enum import LineTypeEnum +from bandwidth.models.latest_message_delivery_status_enum import LatestMessageDeliveryStatusEnum +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse +from test.utils.env_variables import * -class TestPhoneNumberLookupIntegration(unittest.TestCase): - """Phone Number Lookup API integration test - """ +class TestPhoneNumberLookupApi(unittest.TestCase): + """PhoneNumberLookupApi unit test stubs""" def setUp(self) -> None: - configuration = bandwidth.Configuration( + configuration = Configuration( username=BW_USERNAME, password=BW_PASSWORD ) - api_client = bandwidth.ApiClient(configuration) - self.api_instance = phone_number_lookup_api.PhoneNumberLookupApi(api_client) - self.account_id = BW_ACCOUNT_ID + api_client = ApiClient(configuration) + self.api = PhoneNumberLookupApi(api_client) - def validateResult(self, result: LookupResult, e_164_format: str) -> None: - """Verify a successful phone number lookup LookupResult object + self.phone_numbers = [BW_NUMBER, USER_NUMBER] - Args: - result (LookupResult): Result derived from LookupStatus result list - e_164_format (str): Phone number in e164 format ex: +19195551234 - line_provider (str): Line service provider ex: Verizon - """ - - # if result has 1 of these attributes it should have the other - if result.mobile_country_code or result.mobile_network_code: - self.assertIs(type(result.mobile_country_code), str) - self.assertIs(type(result.mobile_network_code), str) - - assert_that(result, has_properties( - 'response_code', 0, - 'e_164_format', e_164_format, - 'country', is_one_of_string(["US", "Canada"]), - 'line_type', is_one_of_string(["Mobile", "Fixed"]) - ) - ) - self.assertIs(type(result.line_provider), str) + def tearDown(self) -> None: + pass - def pollLookupStatus(self, request_id: str) -> LookupStatus: - """Poll LookupRequest for 'COMPLETE' status + def test_create_get_async_bulk_lookup(self) -> None: + """Test case for create_async_bulk_lookup - Args: - request_id (str): LookupResult.request_id value to query - - Raises: - Exception: Tries 5 times and raises a general exception if the query takes more than 5 attempts to minimize run time. - - Returns: - LookupStatus: LookupStatus in 'COMPLETE' state - """ - get_lookup_status_response: LookupStatus = self.api_instance.get_lookup_status( - self.account_id, request_id) - get_lookup_status_response_attempts = 1 - while get_lookup_status_response.status != LookupStatusEnum('COMPLETE'): - # Raise an error if it takes more than 5 requests to get COMPLETE status - if get_lookup_status_response_attempts == 5: - raise Exception( - f'Took too long to get phone number lookup \'COMPLETE\' status. Aborting test after {get_lookup_status_response_attempts} attempts.') - time.sleep(2) - - get_lookup_status_response: LookupStatus = self.api_instance.get_lookup_status( - self.account_id, request_id) - get_lookup_status_response_attempts += 1 - - return get_lookup_status_response - - def assertAuthException(self, context: ApiException, expectedException: ApiException, expected_status_code: int) -> None: - """Validates that an auth exception (401 or 403) is properly formatted - - Args: - context (ApiException): Exception to validate - expectedException (ApiException): Expected exception type - expected_status_code (int): Expected status code + Create Asynchronous Bulk Number Lookup """ - self.assertIs(type(context.exception), expectedException) - self.assertIs(type(context.exception.status), int) - self.assertEqual(context.exception.status, expected_status_code) - self.assertIs(type(context.exception.body), str) - - def testSuccessfulPhoneNumberLookup(self) -> None: - """Test Phone Number Lookup API + request = AsyncLookupRequest(phone_numbers=self.phone_numbers) + + response = self.api.create_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request) + assert_that(response, is_not(none())) + assert_that(response.status_code, equal_to(202)) + assert_that(response.data, is_not(none())) + assert_that(response.data, instance_of(CreateAsyncBulkLookupResponse)) + assert_that(response.data.links, is_not(none())) + assert_that(response.data.links[0], instance_of(LinkSchema)) + assert_that(response.data.links[0].rel, instance_of(str)) + assert_that(response.data.links[0].href, instance_of(str)) + assert_that(response.data.links[0].method, instance_of(str)) + assert_that(response.data.data, is_not(none())) + assert_that(response.data.data, instance_of(CreateAsyncBulkLookupResponseData)) + assert_that(response.data.data.request_id, instance_of(UUID)) + assert_that(response.data.data.status, instance_of(InProgressLookupStatusEnum)) + assert_that(response.data.errors, is_not(none())) + assert_that(response.data.errors, instance_of(list)) + + request_id = response.data.data.request_id + sleep(10) + + response = self.api.get_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request_id) + assert_that(response, is_not(none())) + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, is_not(none())) + assert_that(response.data, instance_of(GetAsyncBulkLookupResponse)) + assert_that(response.data.links, is_not(none())) + assert_that(response.data.links[0], instance_of(LinkSchema)) + assert_that(response.data.links[0].rel, instance_of(str)) + assert_that(response.data.links[0].href, instance_of(str)) + assert_that(response.data.links[0].method, instance_of(str)) + assert_that(response.data.data, is_not(none())) + assert_that(response.data.data.request_id, equal_to(request_id)) + assert_that(response.data.data.status, instance_of(InProgressLookupStatusEnum)) + assert_that(response.data.data.status, equal_to(InProgressLookupStatusEnum('COMPLETE'))) + assert_that(response.data.data.results, instance_of(list)) + assert_that(response.data.data.results[0], instance_of(LookupResult)) + assert_that(response.data.data.results[0].phone_number, instance_of(str)) + assert_that(response.data.data.results[0].line_type, instance_of(LineTypeEnum)) + assert_that(response.data.data.results[0].messaging_provider, instance_of(str)) + assert_that(response.data.data.results[0].voice_provider, instance_of(str)) + assert_that(response.data.data.results[0].country_code_a3, instance_of(str)) + + def test_create_sync_lookup(self) -> None: + """Test case for create_sync_lookup + + Create Synchronous Number Lookup """ - lookup_request = LookupRequest( - tns=[ - BW_NUMBER, - VZW_NUMBER, - ATT_NUMBER, - T_MOBILE_NUMBER, - # BW_INVALID_TN_LOOKUP_NUMBER - ], - ) - - # Create the lookup request and validate the response - create_lookup_response: CreateLookupResponse = self.api_instance.create_lookup( - self.account_id, lookup_request - ) - - self.assertIs(type(create_lookup_response.status), LookupStatusEnum) - self.assertEqual(create_lookup_response.status, LookupStatusEnum("IN_PROGRESS")) - self.assertIs(type(create_lookup_response.request_id), str) - self.assertRegex(create_lookup_response.request_id, - r'^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$') - - # Check the status code for the GET LookupStatus response - get_lookup_status_response: LookupStatus = self.api_instance.get_lookup_status( - self.account_id, - create_lookup_response.request_id - ) - - get_lookup_status_response: LookupStatus = self.pollLookupStatus( - create_lookup_response.request_id) - - self.assertEqual(get_lookup_status_response.request_id, - create_lookup_response.request_id) - self.assertIs(type(get_lookup_status_response), LookupStatus) - - # Assert that each result is of type LookupResult - for i in range(len(get_lookup_status_response.result)): - self.assertIs(type(get_lookup_status_response.result[i]), LookupResult) - - # Check the information for a Bandwidth TN - bw_lookup_result = get_lookup_status_response.result[0] - self.validateResult(bw_lookup_result, BW_NUMBER) - - # Check the information for a Verizon TN - vzw_lookup_result = get_lookup_status_response.result[1] - self.validateResult(vzw_lookup_result, VZW_NUMBER) - - # Check the information for an AT&T TN - att_lookup_result = get_lookup_status_response.result[2] - self.validateResult(att_lookup_result, ATT_NUMBER) - - # Check the information for a T-Mobile TN - t_mobile_lookup_result = get_lookup_status_response.result[3] - self.validateResult(t_mobile_lookup_result, T_MOBILE_NUMBER) - - # The only way to get a failed number is if the api call to the downstream service fails - so there is no way to force this in our testing currently - # check the failed_telephone_number list - # self.assertIs(type(get_lookup_status_response.failed_telephone_numbers), list) - # self.assertIn(BW_INVALID_TN_LOOKUP_NUMBER, get_lookup_status_response.failed_telephone_numbers) - - def testFailedPhoneNumberLookup(self) -> None: - """Test Phone Number Lookup API with bad data to force an error - """ - with self.assertRaises(ApiException) as context: - lookup_request = LookupRequest( - tns=[ - 'not a number', - ], - ) - self.api_instance.create_lookup(self.account_id, lookup_request) - - self.assertIs(type(context.exception.status), int) - self.assertIs(type(context.exception.body), str) - - # initialize TnLookupRequestError model - error = TnLookupRequestError(message=(json.loads(context.exception.body))['message']) - self.assertIs(type(error), TnLookupRequestError) - - def testDuplicatePhoneNumberLookup(self) -> None: - """Test a request with a duplicate number. Should throw a 400 Bad Request error. - """ - with self.assertRaises(ApiException) as context: - lookup_request = LookupRequest( - tns=[ - BW_NUMBER, - BW_NUMBER - ], - ) - self.api_instance.create_lookup(self.account_id, lookup_request) - - self.assertIs(type(context.exception.status), int) - self.assertEqual(context.exception.status, 400) - self.assertIs(type(context.exception.body), str) - - def testUnauthorizedRequest(self) -> None: - """Validate an unauthorized (401) request - """ - configuration = bandwidth.Configuration( - username='bad_username', - password='bad_password' - ) - unauthorized_api_client = bandwidth.ApiClient(configuration) - unauthorized_api_instance = phone_number_lookup_api.PhoneNumberLookupApi( - unauthorized_api_client) - lookup_request = LookupRequest( - tns=[ - BW_NUMBER - ], - ) - - with self.assertRaises(UnauthorizedException) as context: - unauthorized_api_instance.create_lookup(self.account_id, lookup_request) - - self.assertAuthException(context, UnauthorizedException, 401) - - def testForbiddenRequest(self) -> None: - """Validate a forbidden (403) request - """ - configuration = bandwidth.Configuration( - username=FORBIDDEN_USERNAME, - password=FORBIDDEN_PASSWORD - ) - forbidden_api_client = bandwidth.ApiClient(configuration) - forbidden_api_instance = phone_number_lookup_api.PhoneNumberLookupApi(forbidden_api_client) - lookup_request = LookupRequest( - tns=[ - BW_NUMBER - ], - ) - - # This API throws a 401 when a user provides valid credentials with the `TN Lookup` role disabled - # with self.assertRaises(ForbiddenException) as context: - with self.assertRaises(UnauthorizedException) as context: - forbidden_api_instance.create_lookup(self.account_id, lookup_request) - - # self.validateAuthException(context, ForbiddenException, 403) - self.assertAuthException(context, UnauthorizedException, 401) - + request = SyncLookupRequest(phone_numbers=self.phone_numbers) + + response = self.api.create_sync_lookup_with_http_info(BW_ACCOUNT_ID, request) + assert_that(response, is_not(none())) + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, is_not(none())) + assert_that(response.data, instance_of(CreateSyncLookupResponse)) + assert_that(response.data.links, is_not(none())) + assert_that(response.data.links[0], instance_of(LinkSchema)) + assert_that(response.data.links[0].rel, instance_of(str)) + assert_that(response.data.links[0].href, instance_of(str)) + assert_that(response.data.links[0].method, instance_of(str)) + assert_that(response.data.data, is_not(none())) + assert_that(response.data.data.request_id, instance_of(UUID)) + assert_that(response.data.data.status, instance_of(CompletedLookupStatusEnum)) + assert_that(response.data.data.status, equal_to(CompletedLookupStatusEnum('COMPLETE'))) + assert_that(response.data.data.results, instance_of(list)) + assert_that(response.data.data.results[0], instance_of(LookupResult)) + assert_that(response.data.data.results[0].phone_number, instance_of(str)) + assert_that(response.data.data.results[0].line_type, instance_of(LineTypeEnum)) + assert_that(response.data.data.results[0].messaging_provider, instance_of(str)) + assert_that(response.data.data.results[0].voice_provider, instance_of(str)) + assert_that(response.data.data.results[0].country_code_a3, instance_of(str)) + if __name__ == '__main__': unittest.main() diff --git a/test/unit/api/test_phone_number_lookup_api.py b/test/unit/api/test_phone_number_lookup_api.py index ce39af50..a5b8ca68 100644 --- a/test/unit/api/test_phone_number_lookup_api.py +++ b/test/unit/api/test_phone_number_lookup_api.py @@ -9,22 +9,31 @@ Contact: letstalk@bandwidth.com Generated by OpenAPI Generator (https://openapi-generator.tech) - Do not edit the class manually. + Do not edit the manually. """ # noqa: E501 import unittest +from datetime import date +from uuid import UUID from hamcrest import * -from test.utils.env_variables import * from bandwidth import ApiClient, Configuration from bandwidth.api.phone_number_lookup_api import PhoneNumberLookupApi -from bandwidth.models.lookup_request import LookupRequest -from bandwidth.models.create_lookup_response import CreateLookupResponse -from bandwidth.models.lookup_status_enum import LookupStatusEnum -from bandwidth.models.lookup_status import LookupStatus +from bandwidth.models.async_lookup_request import AsyncLookupRequest +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse +from bandwidth.models.link_schema import LinkSchema +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum +from bandwidth.models.sync_lookup_request import SyncLookupRequest +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse +from bandwidth.models.completed_lookup_status_enum import CompletedLookupStatusEnum from bandwidth.models.lookup_result import LookupResult +from bandwidth.models.line_type_enum import LineTypeEnum +from bandwidth.models.latest_message_delivery_status_enum import LatestMessageDeliveryStatusEnum +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse +from test.utils.env_variables import * class TestPhoneNumberLookupApi(unittest.TestCase): """PhoneNumberLookupApi unit test stubs""" @@ -37,51 +46,108 @@ def setUp(self) -> None: ignore_operation_servers=True ) api_client = ApiClient(configuration) - self.phone_number_lookup_api_instance = PhoneNumberLookupApi(api_client) + self.api = PhoneNumberLookupApi(api_client) - def test_create_lookup(self) -> None: - """Test case for create_lookup + def tearDown(self) -> None: + pass - Create Lookup - """ - lookup_request = LookupRequest(tns=[BW_NUMBER]) + def test_create_async_bulk_lookup(self) -> None: + """Test case for create_async_bulk_lookup - response = self.phone_number_lookup_api_instance.create_lookup_with_http_info(BW_ACCOUNT_ID, lookup_request) + Create Asynchronous Bulk Number Lookup + """ + request = AsyncLookupRequest( + phone_numbers = [USER_NUMBER, BW_NUMBER], + ) + response = self.api.create_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request) + assert_that(response, is_not(none())) assert_that(response.status_code, equal_to(202)) - assert_that(response.data, instance_of(CreateLookupResponse)) - assert_that(response.data.request_id, has_length(36)) - assert_that(response.data.status, is_in(LookupStatusEnum)) - - def test_get_lookup_status(self) -> None: - """Test case for get_lookup_status - - Get Lookup Request Status + assert_that(response.data, is_not(none())) + assert_that(response.data, instance_of(CreateAsyncBulkLookupResponse)) + assert_that(response.data.links, is_not(none())) + assert_that(response.data.links[0], instance_of(LinkSchema)) + assert_that(response.data.links[0].rel, instance_of(str)) + assert_that(response.data.links[0].href, instance_of(str)) + assert_that(response.data.links[0].method, instance_of(str)) + assert_that(response.data.data, is_not(none())) + assert_that(response.data.data, instance_of(CreateAsyncBulkLookupResponseData)) + assert_that(response.data.data.request_id, instance_of(UUID)) + assert_that(response.data.data.status, equal_to(InProgressLookupStatusEnum('IN_PROGRESS'))) + assert_that(response.data.errors, is_not(none())) + assert_that(response.data.errors, instance_of(list)) + + def test_create_sync_lookup(self) -> None: + """Test case for create_sync_lookup + + Create Synchronous Number Lookup """ - response = self.phone_number_lookup_api_instance.get_lookup_status_with_http_info( - BW_ACCOUNT_ID, - 'request-id', - _headers={'Prefer': 'example=lookupMultipleNumbersPartialCompleteExample'} + request = SyncLookupRequest( + phone_numbers = [USER_NUMBER, BW_NUMBER], ) + response = self.api.create_sync_lookup_with_http_info(BW_ACCOUNT_ID, request) + assert_that(response, is_not(none())) assert_that(response.status_code, equal_to(200)) - assert_that(response.data, instance_of(LookupStatus)) - assert_that(response.data.request_id, has_length(36)) - assert_that(response.data.status, is_in(LookupStatusEnum)) - assert_that(response.data.result, instance_of(list)) - assert_that(response.data.result[0], instance_of(LookupResult)) - assert_that(response.data.result[0].response_code, instance_of(int)) - assert_that(response.data.result[0].message, instance_of(str)) - assert_that(response.data.result[0].e_164_format, has_length(12)) - assert_that(response.data.result[0].formatted, has_length(14)) - assert_that(response.data.result[0].country, instance_of(str)) - assert_that(response.data.result[0].line_type, instance_of(str)) - assert_that(response.data.result[0].line_provider, instance_of(str)) - assert_that(response.data.result[0].mobile_country_code, instance_of(str)) - assert_that(response.data.result[0].mobile_network_code, instance_of(str)) - assert_that(response.data.failed_telephone_numbers, instance_of(list)) - assert_that(response.data.failed_telephone_numbers[0], instance_of(str)) + assert_that(response.data, is_not(none())) + assert_that(response.data, instance_of(CreateSyncLookupResponse)) + assert_that(response.data.links, is_not(none())) + assert_that(response.data.links[0], instance_of(LinkSchema)) + assert_that(response.data.links[0].rel, instance_of(str)) + assert_that(response.data.links[0].href, instance_of(str)) + assert_that(response.data.links[0].method, instance_of(str)) + assert_that(response.data.data, is_not(none())) + assert_that(response.data.data.request_id, instance_of(UUID)) + assert_that(response.data.data.status, instance_of(CompletedLookupStatusEnum)) + assert_that(response.data.data.status, equal_to(CompletedLookupStatusEnum('COMPLETE'))) + assert_that(response.data.data.results, instance_of(list)) + assert_that(response.data.data.results[0], instance_of(LookupResult)) + assert_that(response.data.data.results[0].phone_number, instance_of(str)) + assert_that(response.data.data.results[0].line_type, instance_of(LineTypeEnum)) + assert_that(response.data.data.results[0].line_type, equal_to(LineTypeEnum('MOBILE'))) + assert_that(response.data.data.results[0].messaging_provider, instance_of(str)) + assert_that(response.data.data.results[0].voice_provider, instance_of(str)) + assert_that(response.data.data.results[0].country_code_a3, instance_of(str)) + assert_that(response.data.data.results[0].latest_message_delivery_status, instance_of(LatestMessageDeliveryStatusEnum)) + assert_that(response.data.data.results[0].latest_message_delivery_status, equal_to(LatestMessageDeliveryStatusEnum('ACTIVE'))) + assert_that(response.data.data.results[0].initial_message_delivery_status_date, instance_of(date)) + assert_that(response.data.data.results[0].latest_message_delivery_status_date, instance_of(date)) + assert_that(response.data.errors, instance_of(list)) + + + def test_get_async_bulk_lookup(self) -> None: + """Test case for get_async_bulk_lookup + + Get Asynchronous Bulk Number Lookup + """ + request_id = UUID('123e4567-e89b-12d3-a456-426614174000') + response = self.api.get_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request_id) + assert_that(response, is_not(none())) + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, is_not(none())) + assert_that(response.data, instance_of(GetAsyncBulkLookupResponse)) + assert_that(response.data.links, is_not(none())) + assert_that(response.data.links[0], instance_of(LinkSchema)) + assert_that(response.data.links[0].rel, instance_of(str)) + assert_that(response.data.links[0].href, instance_of(str)) + assert_that(response.data.links[0].method, instance_of(str)) + assert_that(response.data.data, is_not(none())) + assert_that(response.data.data.request_id, instance_of(UUID)) + assert_that(response.data.data.status, instance_of(InProgressLookupStatusEnum)) + assert_that(response.data.data.status, equal_to(InProgressLookupStatusEnum('COMPLETE'))) + assert_that(response.data.data.results, instance_of(list)) + assert_that(response.data.data.results[0], instance_of(LookupResult)) + assert_that(response.data.data.results[0].phone_number, instance_of(str)) + assert_that(response.data.data.results[0].line_type, instance_of(LineTypeEnum)) + assert_that(response.data.data.results[0].messaging_provider, instance_of(str)) + assert_that(response.data.data.results[0].voice_provider, instance_of(str)) + assert_that(response.data.data.results[0].country_code_a3, instance_of(str)) + assert_that(response.data.data.results[0].latest_message_delivery_status, instance_of(LatestMessageDeliveryStatusEnum)) + assert_that(response.data.data.results[0].latest_message_delivery_status, equal_to(LatestMessageDeliveryStatusEnum('ACTIVE'))) + assert_that(response.data.data.results[0].initial_message_delivery_status_date, instance_of(date)) + assert_that(response.data.data.results[0].latest_message_delivery_status_date, instance_of(date)) + assert_that(response.data.errors, instance_of(list)) if __name__ == '__main__': unittest.main() diff --git a/test/unit/api/test_toll_free_verification_api.py b/test/unit/api/test_toll_free_verification_api.py index 4cb0d54a..ad56c899 100644 --- a/test/unit/api/test_toll_free_verification_api.py +++ b/test/unit/api/test_toll_free_verification_api.py @@ -15,6 +15,7 @@ import unittest from datetime import datetime +from uuid import UUID from hamcrest import * from test.utils.env_variables import * @@ -130,7 +131,7 @@ def test_get_toll_free_verification_status(self) -> None: assert_that(response.data, instance_of(TfvStatus)) assert_that(response.data.phone_number, instance_of(str)) assert_that(response.data.status, is_in(TfvStatusEnum)) - assert_that(response.data.internal_ticket_number, instance_of(str)) + assert_that(response.data.internal_ticket_number, instance_of(UUID)) assert_that(response.data.decline_reason_description, instance_of(str)) assert_that(response.data.resubmit_allowed, instance_of(bool)) assert_that(response.data.created_date_time, instance_of(datetime)) diff --git a/test/unit/models/test_create_lookup_response.py b/test/unit/models/test_async_lookup_request.py similarity index 50% rename from test/unit/models/test_create_lookup_response.py rename to test/unit/models/test_async_lookup_request.py index aada4e79..afbd26e5 100644 --- a/test/unit/models/test_create_lookup_response.py +++ b/test/unit/models/test_async_lookup_request.py @@ -15,10 +15,10 @@ import unittest -from bandwidth.models.create_lookup_response import CreateLookupResponse +from bandwidth.models.async_lookup_request import AsyncLookupRequest -class TestCreateLookupResponse(unittest.TestCase): - """CreateLookupResponse unit test stubs""" +class TestAsyncLookupRequest(unittest.TestCase): + """AsyncLookupRequest unit test stubs""" def setUp(self): pass @@ -26,27 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> CreateLookupResponse: - """Test CreateLookupResponse + def make_instance(self, include_optional) -> AsyncLookupRequest: + """Test AsyncLookupRequest include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ if include_optional: - return CreateLookupResponse( - request_id = '', - status = 'COMPLETE' + return AsyncLookupRequest( + phone_numbers = [ + '+680728880015' + ] ) else: - return CreateLookupResponse( + return AsyncLookupRequest( + phone_numbers = [ + '+680728880015' + ], ) - def testCreateLookupResponse(self): - """Test CreateLookupResponse""" + def testAsyncLookupRequest(self): + """Test AsyncLookupRequest""" instance = self.make_instance(True) assert instance is not None - assert isinstance(instance, CreateLookupResponse) - assert instance.request_id == '' - assert instance.status == 'COMPLETE' + assert isinstance(instance, AsyncLookupRequest) + assert instance.phone_numbers == ['+680728880015'] if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_blocked_webhook.py b/test/unit/models/test_blocked_webhook.py index 6685f921..5609062b 100644 --- a/test/unit/models/test_blocked_webhook.py +++ b/test/unit/models/test_blocked_webhook.py @@ -14,6 +14,7 @@ import unittest +from uuid import UUID from bandwidth.models.blocked_webhook import BlockedWebhook @@ -38,7 +39,7 @@ def make_instance(self, include_optional) -> BlockedWebhook: account_id = '1234567', phone_number = '+18005555555', status = 'VERIFIED', - internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333', + internal_ticket_number = UUID('acde070d-8c4c-4f0d-9d8a-162843c10333'), blocked = True, blocked_reason = 'Toll-free number was used to send spam messages' ) @@ -54,7 +55,7 @@ def testBlockedWebhook(self): assert instance.account_id == '1234567' assert instance.phone_number == '+18005555555' assert instance.status == 'VERIFIED' - assert instance.internal_ticket_number == 'acde070d-8c4c-4f0d-9d8a-162843c10333' + assert instance.internal_ticket_number == UUID('acde070d-8c4c-4f0d-9d8a-162843c10333') assert instance.blocked == True assert instance.blocked_reason == 'Toll-free number was used to send spam messages' diff --git a/test/unit/models/test_business_entity_type_enum.py b/test/unit/models/test_business_entity_type_enum.py index 2ef6abb1..ad7c6689 100644 --- a/test/unit/models/test_business_entity_type_enum.py +++ b/test/unit/models/test_business_entity_type_enum.py @@ -28,16 +28,11 @@ def tearDown(self): def testBusinessEntityTypeEnum(self): """Test BusinessEntityTypeEnum""" - sole_proprietor = BusinessEntityTypeEnum('SOLE_PROPRIETOR') - private_profit = BusinessEntityTypeEnum('PRIVATE_PROFIT') - public_profit = BusinessEntityTypeEnum('PUBLIC_PROFIT') - non_profit = BusinessEntityTypeEnum('NON_PROFIT') - government = BusinessEntityTypeEnum('GOVERNMENT') - assert sole_proprietor == 'SOLE_PROPRIETOR' - assert private_profit == 'PRIVATE_PROFIT' - assert public_profit == 'PUBLIC_PROFIT' - assert non_profit == 'NON_PROFIT' - assert government == 'GOVERNMENT' + assert BusinessEntityTypeEnum('SOLE_PROPRIETOR') == 'SOLE_PROPRIETOR' + assert BusinessEntityTypeEnum('PRIVATE_PROFIT') == 'PRIVATE_PROFIT' + assert BusinessEntityTypeEnum('PUBLIC_PROFIT') == 'PUBLIC_PROFIT' + assert BusinessEntityTypeEnum('NON_PROFIT') == 'NON_PROFIT' + assert BusinessEntityTypeEnum('GOVERNMENT') == 'GOVERNMENT' if __name__ == '__main__': diff --git a/test/unit/models/test_business_registration_type_enum.py b/test/unit/models/test_business_registration_type_enum.py index 1a2b7723..ea587f66 100644 --- a/test/unit/models/test_business_registration_type_enum.py +++ b/test/unit/models/test_business_registration_type_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testBusinessRegistrationTypeEnum(self): """Test BusinessRegistrationTypeEnum""" - ein = BusinessRegistrationTypeEnum('EIN') - cbn = BusinessRegistrationTypeEnum('CBN') - assert ein == 'EIN' - assert cbn == 'CBN' + assert BusinessRegistrationTypeEnum('EIN') == 'EIN' + assert BusinessRegistrationTypeEnum('CBN') == 'CBN' diff --git a/test/unit/models/test_call_direction_enum.py b/test/unit/models/test_call_direction_enum.py index b55d731e..0d151fb5 100644 --- a/test/unit/models/test_call_direction_enum.py +++ b/test/unit/models/test_call_direction_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testCallDirectionEnum(self): """Test CallDirectionEnum""" - inbound = CallDirectionEnum('inbound') - outbound = CallDirectionEnum('outbound') - assert inbound == 'inbound' - assert outbound == 'outbound' + assert CallDirectionEnum('inbound') == 'inbound' + assert CallDirectionEnum('outbound') == 'outbound' if __name__ == '__main__': diff --git a/test/unit/models/test_call_state_enum.py b/test/unit/models/test_call_state_enum.py index 34b6e0d1..c14a2732 100644 --- a/test/unit/models/test_call_state_enum.py +++ b/test/unit/models/test_call_state_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testCallStateEnum(self): """Test CallStateEnum""" - active = CallStateEnum('active') - completed = CallStateEnum('completed') - assert active == 'active' - assert completed == 'completed' + assert CallStateEnum('active') == 'active' + assert CallStateEnum('completed') == 'completed' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_call_transcription_detected_language_enum.py b/test/unit/models/test_call_transcription_detected_language_enum.py index 68c6d56b..96823bb7 100644 --- a/test/unit/models/test_call_transcription_detected_language_enum.py +++ b/test/unit/models/test_call_transcription_detected_language_enum.py @@ -28,12 +28,9 @@ def tearDown(self): def testCallTranscriptionDetectedLanguageEnum(self): """Test CallTranscriptionDetectedLanguageEnum""" - enus = CallTranscriptionDetectedLanguageEnum('en-US') - esus = CallTranscriptionDetectedLanguageEnum('es-US') - frfr = CallTranscriptionDetectedLanguageEnum('fr-FR') - assert enus == 'en-US' - assert esus == 'es-US' - assert frfr == 'fr-FR' + assert CallTranscriptionDetectedLanguageEnum('en-US') == 'en-US' + assert CallTranscriptionDetectedLanguageEnum('es-US') == 'es-US' + assert CallTranscriptionDetectedLanguageEnum('fr-FR') == 'fr-FR' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_call_transcription_track_enum.py b/test/unit/models/test_call_transcription_track_enum.py index e76e5535..8d7d00a4 100644 --- a/test/unit/models/test_call_transcription_track_enum.py +++ b/test/unit/models/test_call_transcription_track_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testCallTranscriptionTrackEnum(self): """Test CallTranscriptionTrackEnum""" - inbound = CallTranscriptionTrackEnum('inbound') - outbound = CallTranscriptionTrackEnum('outbound') - assert inbound == 'inbound' - assert outbound == 'outbound' + assert CallTranscriptionTrackEnum('inbound') == 'inbound' + assert CallTranscriptionTrackEnum('outbound') == 'outbound' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_callback_method_enum.py b/test/unit/models/test_callback_method_enum.py index 05d8c9df..654ce09e 100644 --- a/test/unit/models/test_callback_method_enum.py +++ b/test/unit/models/test_callback_method_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testCallbackMethodEnum(self): """Test CallbackMethodEnum""" - post = CallbackMethodEnum('POST') - get = CallbackMethodEnum('GET') - assert post == 'POST' - assert get == 'GET' + assert CallbackMethodEnum('POST') == 'POST' + assert CallbackMethodEnum('GET') == 'GET' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_card_width_enum.py b/test/unit/models/test_card_width_enum.py index d6ba49bc..b7a7e00b 100644 --- a/test/unit/models/test_card_width_enum.py +++ b/test/unit/models/test_card_width_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testCardWidthEnum(self): """Test CardWidthEnum""" - small = CardWidthEnum('SMALL') - medium = CardWidthEnum('MEDIUM') - assert small == 'SMALL' - assert medium == 'MEDIUM' + assert CardWidthEnum('SMALL') == 'SMALL' + assert CardWidthEnum('MEDIUM') == 'MEDIUM' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_completed_lookup_status_enum.py b/test/unit/models/test_completed_lookup_status_enum.py new file mode 100644 index 00000000..74662c2a --- /dev/null +++ b/test/unit/models/test_completed_lookup_status_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.completed_lookup_status_enum import CompletedLookupStatusEnum + +class TestCompletedLookupStatusEnum(unittest.TestCase): + """CompletedLookupStatusEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCompletedLookupStatusEnum(self): + """Test CompletedLookupStatusEnum""" + assert CompletedLookupStatusEnum('COMPLETE') == 'COMPLETE' + assert CompletedLookupStatusEnum('PARTIAL_COMPLETE') == 'PARTIAL_COMPLETE' + assert CompletedLookupStatusEnum('FAILED') == 'FAILED' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_conference_state_enum.py b/test/unit/models/test_conference_state_enum.py index 24fb25fb..abdf8c5e 100644 --- a/test/unit/models/test_conference_state_enum.py +++ b/test/unit/models/test_conference_state_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testConferenceStateEnum(self): """Test ConferenceStateEnum""" - active = ConferenceStateEnum('active') - completed = ConferenceStateEnum('completed') - assert active == 'active' - assert completed == 'completed' + assert ConferenceStateEnum('active') == 'active' + assert ConferenceStateEnum('completed') == 'completed' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_create_async_bulk_lookup_response.py b/test/unit/models/test_create_async_bulk_lookup_response.py new file mode 100644 index 00000000..098f7770 --- /dev/null +++ b/test/unit/models/test_create_async_bulk_lookup_response.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from uuid import UUID + +from bandwidth.models.create_async_bulk_lookup_response import CreateAsyncBulkLookupResponse +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData +from bandwidth.models.link_schema import LinkSchema +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum + +class TestCreateAsyncBulkLookupResponse(unittest.TestCase): + """CreateAsyncBulkLookupResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateAsyncBulkLookupResponse: + """Test CreateAsyncBulkLookupResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return CreateAsyncBulkLookupResponse( + links = [ + LinkSchema( + href = '/relative/uri', + rel = 'aRelatedResource', + method = 'GET', ) + ], + data = CreateAsyncBulkLookupResponseData( + request_id = UUID('004223a0-8b17-41b1-bf81-20732adf5590'), + status = InProgressLookupStatusEnum('COMPLETE'), ), + errors = [ + LookupErrorSchema( + code = 'NO-MATCH', + description = 'Example error description', + type = 'NumberInventory', + meta = LookupErrorSchemaMeta( + phone_numbers = ["+13992077164","+19196104424"], + message = 'Invalid TNs', + code = 1001, ), ) + ] + ) + else: + return CreateAsyncBulkLookupResponse( + ) + + def testCreateAsyncBulkLookupResponse(self): + """Test CreateAsyncBulkLookupResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateAsyncBulkLookupResponse) + assert instance.links is not None + assert isinstance(instance.links[0], LinkSchema) + assert instance.links[0].href == '/relative/uri' + assert instance.links[0].rel == 'aRelatedResource' + assert instance.links[0].method == 'GET' + assert instance.data is not None + assert isinstance(instance.data, CreateAsyncBulkLookupResponseData) + assert instance.data.request_id == UUID('004223a0-8b17-41b1-bf81-20732adf5590') + assert instance.data.status == InProgressLookupStatusEnum('COMPLETE') + assert instance.errors is not None + assert isinstance(instance.errors[0], LookupErrorSchema) + assert instance.errors[0].code == 'NO-MATCH' + assert instance.errors[0].description == 'Example error description' + assert instance.errors[0].type == 'NumberInventory' + assert instance.errors[0].meta is not None + assert isinstance(instance.errors[0].meta, LookupErrorSchemaMeta) + assert instance.errors[0].meta.phone_numbers == ["+13992077164","+19196104424"] + assert instance.errors[0].meta.message == 'Invalid TNs' + assert instance.errors[0].meta.code == 1001 + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_create_async_bulk_lookup_response_data.py b/test/unit/models/test_create_async_bulk_lookup_response_data.py new file mode 100644 index 00000000..03a7d62b --- /dev/null +++ b/test/unit/models/test_create_async_bulk_lookup_response_data.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from uuid import UUID + +from bandwidth.models.create_async_bulk_lookup_response_data import CreateAsyncBulkLookupResponseData +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum + +class TestCreateAsyncBulkLookupResponseData(unittest.TestCase): + """CreateAsyncBulkLookupResponseData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateAsyncBulkLookupResponseData: + """Test CreateAsyncBulkLookupResponseData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return CreateAsyncBulkLookupResponseData( + request_id = UUID('004223a0-8b17-41b1-bf81-20732adf5590'), + status = InProgressLookupStatusEnum('COMPLETE') + ) + else: + return CreateAsyncBulkLookupResponseData( + ) + + def testCreateAsyncBulkLookupResponseData(self): + """Test CreateAsyncBulkLookupResponseData""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateAsyncBulkLookupResponseData) + assert instance.request_id == UUID('004223a0-8b17-41b1-bf81-20732adf5590') + assert instance.status == InProgressLookupStatusEnum('COMPLETE') + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_create_multi_channel_message_response.py b/test/unit/models/test_create_multi_channel_message_response.py new file mode 100644 index 00000000..1227832a --- /dev/null +++ b/test/unit/models/test_create_multi_channel_message_response.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import datetime + +from bandwidth.models.create_multi_channel_message_response import CreateMultiChannelMessageResponse +from bandwidth.models.multi_channel_message_response_data import MultiChannelMessageResponseData +from bandwidth.models.multi_channel_message_response_data_channel_list_inner import MultiChannelMessageResponseDataChannelListInner +from bandwidth.models.multi_channel_channel_list_object_content import MultiChannelChannelListObjectContent + +class TestCreateMultiChannelMessageResponse(unittest.TestCase): + """CreateMultiChannelMessageResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateMultiChannelMessageResponse: + """Test CreateMultiChannelMessageResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return CreateMultiChannelMessageResponse( + links = [], + data = MultiChannelMessageResponseData( + id = '1589228074636lm4k2je7j7jklbn2', + time = '2025-01-01T18:20:16Z', + direction = 'in', + to = ["+15554443333"], + channel_list = [ + MultiChannelMessageResponseDataChannelListInner( + var_from = 'BandwidthRBM', + application_id = '93de2206-9669-4e07-948d-329f4b722ee2', + channel = 'RBM', + content = MultiChannelChannelListObjectContent(), + owner = 'owner', + )], + tag = 'custom string', + priority = 'default', + expiration = '2021-02-01T11:29:18-05:00', ), + errors = [] + ) + else: + return CreateMultiChannelMessageResponse( + ) + + def testCreateMultiChannelMessageResponse(self): + """Test CreateMultiChannelMessageResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateMultiChannelMessageResponse) + assert instance.links == [] + assert instance.data is not None + assert isinstance(instance.data, MultiChannelMessageResponseData) + assert instance.data.id == '1589228074636lm4k2je7j7jklbn2' + assert isinstance(instance.data.time, datetime) + assert instance.data.direction == 'in' + assert instance.data.to == ["+15554443333"] + assert isinstance(instance.data.channel_list, list) + assert isinstance(instance.data.channel_list[0], MultiChannelMessageResponseDataChannelListInner) + assert instance.data.tag == 'custom string' + assert instance.data.priority == 'default' + assert isinstance(instance.data.expiration, datetime) + assert instance.errors == [] + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_create_sync_lookup_response.py b/test/unit/models/test_create_sync_lookup_response.py new file mode 100644 index 00000000..f894c8b5 --- /dev/null +++ b/test/unit/models/test_create_sync_lookup_response.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import date +from uuid import UUID + +from bandwidth.models.create_sync_lookup_response import CreateSyncLookupResponse +from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData +from bandwidth.models.lookup_result import LookupResult +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta + +class TestCreateSyncLookupResponse(unittest.TestCase): + """CreateSyncLookupResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateSyncLookupResponse: + """Test CreateSyncLookupResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return CreateSyncLookupResponse( + links = [], + data = CreateSyncLookupResponseData( + request_id = UUID('004223a0-8b17-41b1-bf81-20732adf5590'), + status = 'COMPLETE', + results = [ + LookupResult( + phone_number = '+10072904498', + line_type = 'MOBILE', + messaging_provider = 'Verizon Wireless', + voice_provider = 'Verizon Wireless', + country_code_a3 = 'USA', + deactivation_reporter = '', + deactivation_date = '2025-06-20 18:35', + deactivation_event = 'DEACTIVATED', + latest_message_delivery_status = 'ACTIVE', + initial_message_delivery_status_date = '2025-06-20', + latest_message_delivery_status_date = '2025-06-20', ) + ], ), + errors = [ + LookupErrorSchema( + code = 'NO-MATCH', + description = 'Example error description', + type = 'NumberInventory', + meta = LookupErrorSchemaMeta( + phone_numbers = ["+13992077164","+19196104424"], + message = 'Invalid TNs', + code = 1001, ), ) + ] + ) + else: + return CreateSyncLookupResponse( + ) + + + def testCreateSyncLookupResponse(self): + """Test CreateSyncLookupResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateSyncLookupResponse) + assert instance.links is not None + assert isinstance(instance.data, CreateSyncLookupResponseData) + assert instance.data.request_id == UUID('004223a0-8b17-41b1-bf81-20732adf5590') + assert instance.data.status == 'COMPLETE' + assert instance.data.results is not None + assert isinstance(instance.data.results, list) + assert isinstance(instance.data.results[0], LookupResult) + assert instance.data.results[0].phone_number == '+10072904498' + assert instance.data.results[0].line_type == 'MOBILE' + assert instance.data.results[0].messaging_provider == 'Verizon Wireless' + assert instance.data.results[0].voice_provider == 'Verizon Wireless' + assert instance.data.results[0].country_code_a3 == 'USA' + assert instance.data.results[0].deactivation_reporter == '' + assert instance.data.results[0].deactivation_date == '2025-06-20 18:35' + assert instance.data.results[0].deactivation_event == 'DEACTIVATED' + assert instance.data.results[0].latest_message_delivery_status == 'ACTIVE' + assert isinstance(instance.data.results[0].initial_message_delivery_status_date, date) + assert isinstance(instance.data.results[0].latest_message_delivery_status_date, date) + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_create_sync_lookup_response_data.py b/test/unit/models/test_create_sync_lookup_response_data.py new file mode 100644 index 00000000..49c2bb59 --- /dev/null +++ b/test/unit/models/test_create_sync_lookup_response_data.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import date +from uuid import UUID + +from bandwidth.models.create_sync_lookup_response_data import CreateSyncLookupResponseData +from bandwidth.models.lookup_result import LookupResult + +class TestCreateSyncLookupResponseData(unittest.TestCase): + """CreateSyncLookupResponseData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreateSyncLookupResponseData: + """Test CreateSyncLookupResponseData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return CreateSyncLookupResponseData( + request_id = UUID('004223a0-8b17-41b1-bf81-20732adf5590'), + status = 'COMPLETE', + results = [ + LookupResult( + phone_number = '+10072904498', + line_type = 'MOBILE', + messaging_provider = 'Verizon Wireless', + voice_provider = 'Verizon Wireless', + country_code_a3 = 'USA', + deactivation_reporter = '', + deactivation_date = '2025-06-20 18:35', + deactivation_event = 'DEACTIVATED', + latest_message_delivery_status = 'ACTIVE', + initial_message_delivery_status_date = '2025-06-20', + latest_message_delivery_status_date = '2025-06-20', ) + ] + ) + else: + return CreateSyncLookupResponseData( + ) + + def testCreateSyncLookupResponseData(self): + """Test CreateSyncLookupResponseData""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, CreateSyncLookupResponseData) + assert instance.request_id == UUID('004223a0-8b17-41b1-bf81-20732adf5590') + assert instance.status == 'COMPLETE' + assert instance.results is not None + assert isinstance(instance.results, list) + assert isinstance(instance.results[0], LookupResult) + assert instance.results[0].phone_number == '+10072904498' + assert instance.results[0].line_type == 'MOBILE' + assert instance.results[0].messaging_provider == 'Verizon Wireless' + assert instance.results[0].voice_provider == 'Verizon Wireless' + assert instance.results[0].country_code_a3 == 'USA' + assert instance.results[0].deactivation_reporter == '' + assert instance.results[0].deactivation_date == '2025-06-20 18:35' + assert instance.results[0].deactivation_event == 'DEACTIVATED' + assert instance.results[0].latest_message_delivery_status == 'ACTIVE' + assert isinstance(instance.results[0].initial_message_delivery_status_date, date) + assert isinstance(instance.results[0].latest_message_delivery_status_date, date) + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_deactivation_event_enum.py b/test/unit/models/test_deactivation_event_enum.py new file mode 100644 index 00000000..3d50dd16 --- /dev/null +++ b/test/unit/models/test_deactivation_event_enum.py @@ -0,0 +1,34 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.deactivation_event_enum import DeactivationEventEnum + +class TestDeactivationEventEnum(unittest.TestCase): + """DeactivationEventEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDeactivationEventEnum(self): + """Test DeactivationEventEnum""" + assert DeactivationEventEnum('DEACTIVATED') == 'DEACTIVATED' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_failure_webhook.py b/test/unit/models/test_failure_webhook.py index 4ea4704a..d5c61058 100644 --- a/test/unit/models/test_failure_webhook.py +++ b/test/unit/models/test_failure_webhook.py @@ -14,6 +14,7 @@ import unittest +from uuid import UUID from bandwidth.models.failure_webhook import FailureWebhook @@ -40,7 +41,7 @@ def make_instance(self, include_optional) -> FailureWebhook: errors = [ 'optInWorkflowImageURLs: Entries must be a valid array of objects.' ], - internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333' + internal_ticket_number = UUID('acde070d-8c4c-4f0d-9d8a-162843c10333') ) else: return FailureWebhook( @@ -58,7 +59,7 @@ def testFailureWebhook(self): assert isinstance(instance.errors, list) assert len(instance.errors) == 1 assert instance.errors[0] == 'optInWorkflowImageURLs: Entries must be a valid array of objects.' - assert instance.internal_ticket_number == 'acde070d-8c4c-4f0d-9d8a-162843c10333' + assert instance.internal_ticket_number == UUID('acde070d-8c4c-4f0d-9d8a-162843c10333') if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_file_format_enum.py b/test/unit/models/test_file_format_enum.py index 53b0057b..44f88f31 100644 --- a/test/unit/models/test_file_format_enum.py +++ b/test/unit/models/test_file_format_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testFileFormatEnum(self): """Test FileFormatEnum""" - wav = FileFormatEnum('wav') - mp3 = FileFormatEnum('mp3') - assert wav == 'wav' - assert mp3 == 'mp3' + assert FileFormatEnum('wav') == 'wav' + assert FileFormatEnum('mp3') == 'mp3' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_get_async_bulk_lookup_response.py b/test/unit/models/test_get_async_bulk_lookup_response.py new file mode 100644 index 00000000..21875946 --- /dev/null +++ b/test/unit/models/test_get_async_bulk_lookup_response.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import date +from uuid import UUID + +from bandwidth.models.get_async_bulk_lookup_response import GetAsyncBulkLookupResponse +from bandwidth.models.get_async_bulk_lookup_response_data import GetAsyncBulkLookupResponseData +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta +from bandwidth.models.lookup_result import LookupResult + +class TestGetAsyncBulkLookupResponse(unittest.TestCase): + """GetAsyncBulkLookupResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetAsyncBulkLookupResponse: + """Test GetAsyncBulkLookupResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return GetAsyncBulkLookupResponse( + links = [], + data = GetAsyncBulkLookupResponseData( + request_id = UUID('004223a0-8b17-41b1-bf81-20732adf5590'), + status = 'COMPLETE', + results = [ + LookupResult( + phone_number = '+10072904498', + line_type = 'MOBILE', + messaging_provider = 'Verizon Wireless', + voice_provider = 'Verizon Wireless', + country_code_a3 = 'USA', + deactivation_reporter = '', + deactivation_date = '2025-06-20 18:35', + deactivation_event = 'DEACTIVATED', + latest_message_delivery_status = 'ACTIVE', + initial_message_delivery_status_date = '2025-06-20', + latest_message_delivery_status_date = '2025-06-20', ) + ], ), + errors = [ + LookupErrorSchema( + code = 'NO-MATCH', + description = 'Example error description', + type = 'NumberInventory', + meta = LookupErrorSchemaMeta( + phone_numbers = ["+13992077164","+19196104424"], + message = 'Invalid TNs', + code = 1001, ), ) + ] + ) + else: + return GetAsyncBulkLookupResponse( + ) + + def testGetAsyncBulkLookupResponse(self): + """Test GetAsyncBulkLookupResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, GetAsyncBulkLookupResponse) + assert instance.data is not None + assert isinstance(instance.data, GetAsyncBulkLookupResponseData) + assert instance.data.request_id == UUID('004223a0-8b17-41b1-bf81-20732adf5590') + assert instance.data.status == 'COMPLETE' + assert len(instance.data.results) == 1 + result = instance.data.results[0] + assert result.phone_number == '+10072904498' + assert result.line_type == 'MOBILE' + assert result.messaging_provider == 'Verizon Wireless' + assert result.voice_provider == 'Verizon Wireless' + assert result.country_code_a3 == 'USA' + assert result.deactivation_reporter == '' + assert result.deactivation_date == '2025-06-20 18:35' + assert result.deactivation_event == 'DEACTIVATED' + assert result.latest_message_delivery_status == 'ACTIVE' + assert isinstance(result.initial_message_delivery_status_date, date) + assert isinstance(result.latest_message_delivery_status_date, date) + assert instance.errors is not None + assert isinstance(instance.errors[0], LookupErrorSchema) + assert instance.errors[0].code == 'NO-MATCH' + assert instance.errors[0].description == 'Example error description' + assert instance.errors[0].type == 'NumberInventory' + assert instance.errors[0].meta is not None + assert isinstance(instance.errors[0].meta, LookupErrorSchemaMeta) + assert instance.errors[0].meta.phone_numbers == ["+13992077164","+19196104424"] + assert instance.errors[0].meta.message == 'Invalid TNs' + assert instance.errors[0].meta.code == 1001 + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_get_async_bulk_lookup_response_data.py b/test/unit/models/test_get_async_bulk_lookup_response_data.py new file mode 100644 index 00000000..be496790 --- /dev/null +++ b/test/unit/models/test_get_async_bulk_lookup_response_data.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +from datetime import date +from uuid import UUID + +from bandwidth.models.get_async_bulk_lookup_response_data import GetAsyncBulkLookupResponseData +from bandwidth.models.lookup_result import LookupResult + +class TestGetAsyncBulkLookupResponseData(unittest.TestCase): + """GetAsyncBulkLookupResponseData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetAsyncBulkLookupResponseData: + """Test GetAsyncBulkLookupResponseData + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return GetAsyncBulkLookupResponseData( + request_id = UUID('004223a0-8b17-41b1-bf81-20732adf5590'), + status = 'COMPLETE', + results = [ + LookupResult( + phone_number = '+10072904498', + line_type = 'MOBILE', + messaging_provider = 'Verizon Wireless', + voice_provider = 'Verizon Wireless', + country_code_a3 = 'USA', + deactivation_reporter = '', + deactivation_date = '2025-06-20 18:35', + deactivation_event = 'DEACTIVATED', + latest_message_delivery_status = 'ACTIVE', + initial_message_delivery_status_date = '2025-06-20', + latest_message_delivery_status_date = '2025-06-20', ) + ] + ) + else: + return GetAsyncBulkLookupResponseData( + ) + + def testGetAsyncBulkLookupResponseData(self): + """Test GetAsyncBulkLookupResponseData""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, GetAsyncBulkLookupResponseData) + assert instance.request_id == UUID('004223a0-8b17-41b1-bf81-20732adf5590') + assert instance.status == 'COMPLETE' + assert len(instance.results) == 1 + result = instance.results[0] + assert result.phone_number == '+10072904498' + assert result.line_type == 'MOBILE' + assert result.messaging_provider == 'Verizon Wireless' + assert result.voice_provider == 'Verizon Wireless' + assert result.country_code_a3 == 'USA' + assert result.deactivation_reporter == '' + assert result.deactivation_date == '2025-06-20 18:35' + assert result.deactivation_event == 'DEACTIVATED' + assert result.latest_message_delivery_status == 'ACTIVE' + assert isinstance(result.initial_message_delivery_status_date, date) + assert isinstance(result.latest_message_delivery_status_date, date) + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_in_progress_lookup_status_enum.py b/test/unit/models/test_in_progress_lookup_status_enum.py new file mode 100644 index 00000000..8b9030df --- /dev/null +++ b/test/unit/models/test_in_progress_lookup_status_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.in_progress_lookup_status_enum import InProgressLookupStatusEnum + +class TestInProgressLookupStatusEnum(unittest.TestCase): + """InProgressLookupStatusEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInProgressLookupStatusEnum(self): + """Test InProgressLookupStatusEnum""" + assert InProgressLookupStatusEnum('IN_PROGRESS') == 'IN_PROGRESS' + assert InProgressLookupStatusEnum('COMPLETE') == 'COMPLETE' + assert InProgressLookupStatusEnum('PARTIAL_COMPLETE') == 'PARTIAL_COMPLETE' + assert InProgressLookupStatusEnum('FAILED') == 'FAILED' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_inbound_callback_type_enum.py b/test/unit/models/test_inbound_callback_type_enum.py index e88ef079..2aa888bf 100644 --- a/test/unit/models/test_inbound_callback_type_enum.py +++ b/test/unit/models/test_inbound_callback_type_enum.py @@ -28,12 +28,9 @@ def tearDown(self): def testInboundCallbackTypeEnum(self): """Test InboundCallbackTypeEnum""" - message_received = InboundCallbackTypeEnum('message-received') - request_location_response = InboundCallbackTypeEnum('request-location-response') - suggestion_response = InboundCallbackTypeEnum('suggestion-response') - assert message_received == 'message-received' - assert request_location_response == 'request-location-response' - assert suggestion_response == 'suggestion-response' + assert InboundCallbackTypeEnum('message-received') == 'message-received' + assert InboundCallbackTypeEnum('request-location-response') == 'request-location-response' + assert InboundCallbackTypeEnum('suggestion-response') == 'suggestion-response' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_latest_message_delivery_status_enum.py b/test/unit/models/test_latest_message_delivery_status_enum.py new file mode 100644 index 00000000..68af465c --- /dev/null +++ b/test/unit/models/test_latest_message_delivery_status_enum.py @@ -0,0 +1,36 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.latest_message_delivery_status_enum import LatestMessageDeliveryStatusEnum + +class TestLatestMessageDeliveryStatusEnum(unittest.TestCase): + """LatestMessageDeliveryStatusEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testLatestMessageDeliveryStatusEnum(self): + """Test LatestMessageDeliveryStatusEnum""" + assert LatestMessageDeliveryStatusEnum('ACTIVE') == 'ACTIVE' + assert LatestMessageDeliveryStatusEnum('DEACTIVATED') == 'DEACTIVATED' + assert LatestMessageDeliveryStatusEnum('UNKNOWN') == 'UNKNOWN' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_line_type_enum.py b/test/unit/models/test_line_type_enum.py new file mode 100644 index 00000000..dd26d65f --- /dev/null +++ b/test/unit/models/test_line_type_enum.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.line_type_enum import LineTypeEnum + +class TestLineTypeEnum(unittest.TestCase): + """LineTypeEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testLineTypeEnum(self): + """Test LineTypeEnum""" + assert LineTypeEnum('FIXED') == 'FIXED' + assert LineTypeEnum('VOIP-FIXED') == 'VOIP-FIXED' + assert LineTypeEnum('MOBILE') == 'MOBILE' + assert LineTypeEnum('VOIP') == 'VOIP' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_tn_lookup_request_error.py b/test/unit/models/test_link_schema.py similarity index 53% rename from test/unit/models/test_tn_lookup_request_error.py rename to test/unit/models/test_link_schema.py index 7f752257..9de16399 100644 --- a/test/unit/models/test_tn_lookup_request_error.py +++ b/test/unit/models/test_link_schema.py @@ -15,10 +15,10 @@ import unittest -from bandwidth.models.tn_lookup_request_error import TnLookupRequestError +from bandwidth.models.link_schema import LinkSchema -class TestTnLookupRequestError(unittest.TestCase): - """TnLookupRequestError unit test stubs""" +class TestLinkSchema(unittest.TestCase): + """LinkSchema unit test stubs""" def setUp(self): pass @@ -26,25 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> TnLookupRequestError: - """Test TnLookupRequestError + def make_instance(self, include_optional) -> LinkSchema: + """Test LinkSchema include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ if include_optional: - return TnLookupRequestError( - message = 'example error message' + return LinkSchema( + href = '/relative/uri', + rel = 'aRelatedResource', + method = 'GET' ) else: - return TnLookupRequestError( + return LinkSchema( ) - def testTnLookupRequestError(self): - """Test TnLookupRequestError""" + def testLinkSchema(self): + """Test LinkSchema""" instance = self.make_instance(True) assert instance is not None - assert isinstance(instance, TnLookupRequestError) - assert instance.message == 'example error message' + assert isinstance(instance, LinkSchema) + assert instance.href == '/relative/uri' + assert instance.rel == 'aRelatedResource' + assert instance.method == 'GET' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_list_message_direction_enum.py b/test/unit/models/test_list_message_direction_enum.py index 0be98e1d..977bc36b 100644 --- a/test/unit/models/test_list_message_direction_enum.py +++ b/test/unit/models/test_list_message_direction_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testListMessageDirectionEnum(self): """Test ListMessageDirectionEnum""" - inbound = ListMessageDirectionEnum('INBOUND') - outbound = ListMessageDirectionEnum('OUTBOUND') - assert inbound == 'INBOUND' - assert outbound == 'OUTBOUND' + assert ListMessageDirectionEnum('INBOUND') == 'INBOUND' + assert ListMessageDirectionEnum('OUTBOUND') == 'OUTBOUND' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_lookup_error_response.py b/test/unit/models/test_lookup_error_response.py new file mode 100644 index 00000000..664a9a53 --- /dev/null +++ b/test/unit/models/test_lookup_error_response.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.lookup_error_response import LookupErrorResponse +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta + +class TestLookupErrorResponse(unittest.TestCase): + """LookupErrorResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> LookupErrorResponse: + """Test LookupErrorResponse + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return LookupErrorResponse( + links = [], + data = None, + errors = [ + LookupErrorSchema( + code = 'NO-MATCH', + description = 'Example error description', + type = 'NumberInventory', + meta = LookupErrorSchemaMeta( + phone_numbers = ["+13992077164","+19196104424"], + message = 'Invalid TNs', + code = 1001, ), ) + ] + ) + else: + return LookupErrorResponse( + ) + + def testLookupErrorResponse(self): + """Test LookupErrorResponse""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, LookupErrorResponse) + assert instance.links == [] + assert instance.data is None + assert len(instance.errors) == 1 + error = instance.errors[0] + assert error.code == 'NO-MATCH' + assert error.description == 'Example error description' + assert error.type == 'NumberInventory' + assert error.meta.phone_numbers == ["+13992077164", "+19196104424"] + assert error.meta.message == 'Invalid TNs' + assert error.meta.code == 1001 + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_lookup_error_schema.py b/test/unit/models/test_lookup_error_schema.py new file mode 100644 index 00000000..99faed18 --- /dev/null +++ b/test/unit/models/test_lookup_error_schema.py @@ -0,0 +1,63 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.lookup_error_schema import LookupErrorSchema +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta + +class TestLookupErrorSchema(unittest.TestCase): + """LookupErrorSchema unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> LookupErrorSchema: + """Test LookupErrorSchema + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return LookupErrorSchema( + code = 'NO-MATCH', + description = 'Example error description', + type = 'NumberInventory', + meta = LookupErrorSchemaMeta( + phone_numbers = ["+13992077164","+19196104424"], + message = 'Invalid TNs', + code = 1001, ) + ) + else: + return LookupErrorSchema( + ) + + def testLookupErrorSchema(self): + """Test LookupErrorSchema""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, LookupErrorSchema) + assert instance.code == 'NO-MATCH' + assert instance.description == 'Example error description' + assert instance.type == 'NumberInventory' + assert instance.meta is not None + assert instance.meta.phone_numbers == ["+13992077164","+19196104424"] + assert instance.meta.message == 'Invalid TNs' + assert instance.meta.code == 1001 + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_lookup_error_schema_meta.py b/test/unit/models/test_lookup_error_schema_meta.py new file mode 100644 index 00000000..abed5d5f --- /dev/null +++ b/test/unit/models/test_lookup_error_schema_meta.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Bandwidth + + Bandwidth's Communication APIs + + The version of the OpenAPI document: 1.0.0 + Contact: letstalk@bandwidth.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from bandwidth.models.lookup_error_schema_meta import LookupErrorSchemaMeta + +class TestLookupErrorSchemaMeta(unittest.TestCase): + """LookupErrorSchemaMeta unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> LookupErrorSchemaMeta: + """Test LookupErrorSchemaMeta + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + if include_optional: + return LookupErrorSchemaMeta( + phone_numbers = ["+13992077164","+19196104424"], + message = 'Invalid TNs', + code = 1001 + ) + else: + return LookupErrorSchemaMeta( + ) + + def testLookupErrorSchemaMeta(self): + """Test LookupErrorSchemaMeta""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, LookupErrorSchemaMeta) + assert instance.phone_numbers == ["+13992077164","+19196104424"] + assert instance.message == 'Invalid TNs' + assert instance.code == 1001 + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_lookup_result.py b/test/unit/models/test_lookup_result.py index d8e201cc..d0e6d67a 100644 --- a/test/unit/models/test_lookup_result.py +++ b/test/unit/models/test_lookup_result.py @@ -14,6 +14,7 @@ import unittest +from datetime import date from bandwidth.models.lookup_result import LookupResult @@ -33,16 +34,17 @@ def make_instance(self, include_optional) -> LookupResult: optional params are included """ if include_optional: return LookupResult( - response_code = 0, - message = 'NOERROR', - e_164_format = '+19195551234', - formatted = '(919) 555-1234', - country = 'US', - line_type = 'Mobile', - line_provider = 'Verizon Wireless', - mobile_country_code = '310', - mobile_network_code = '010' - ) + phone_number = '+10072904498', + line_type = 'MOBILE', + messaging_provider = 'Verizon Wireless', + voice_provider = 'Verizon Wireless', + country_code_a3 = 'USA', + deactivation_reporter = '', + deactivation_date = '2025-06-20 18:35', + deactivation_event = 'DEACTIVATED', + latest_message_delivery_status = 'ACTIVE', + initial_message_delivery_status_date = '2025-06-20', + latest_message_delivery_status_date = '2025-06-20', ) else: return LookupResult( ) @@ -52,15 +54,17 @@ def testLookupResult(self): instance = self.make_instance(True) assert instance is not None assert isinstance(instance, LookupResult) - assert instance.response_code == 0 - assert instance.message == 'NOERROR' - assert instance.e_164_format == '+19195551234' - assert instance.formatted == '(919) 555-1234' - assert instance.country == 'US' - assert instance.line_type == 'Mobile' - assert instance.line_provider == 'Verizon Wireless' - assert instance.mobile_country_code == '310' - assert instance.mobile_network_code == '010' + assert instance.phone_number == '+10072904498' + assert instance.line_type == 'MOBILE' + assert instance.messaging_provider == 'Verizon Wireless' + assert instance.voice_provider == 'Verizon Wireless' + assert instance.country_code_a3 == 'USA' + assert instance.deactivation_reporter == '' + assert instance.deactivation_date == '2025-06-20 18:35' + assert instance.deactivation_event == 'DEACTIVATED' + assert instance.latest_message_delivery_status == 'ACTIVE' + assert isinstance(instance.initial_message_delivery_status_date, date) + assert isinstance(instance.latest_message_delivery_status_date, date) if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_lookup_status.py b/test/unit/models/test_lookup_status.py deleted file mode 100644 index b0c082cf..00000000 --- a/test/unit/models/test_lookup_status.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding: utf-8 - -""" - Bandwidth - - Bandwidth's Communication APIs - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from bandwidth.models.lookup_status import LookupStatus -from bandwidth.models.lookup_result import LookupResult - -class TestLookupStatus(unittest.TestCase): - """LookupStatus unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> LookupStatus: - """Test LookupStatus - include_optional is a boolean, when False only required - params are included, when True both required and - optional params are included """ - if include_optional: - return LookupStatus( - request_id = '004223a0-8b17-41b1-bf81-20732adf5590', - status = 'COMPLETE', - result = [ - LookupResult( - response_code = 0, - message = 'NOERROR', - e_164_format = '+19195551234', - formatted = '(919) 555-1234', - country = 'US', - line_type = 'Mobile', - line_provider = 'Verizon Wireless', - mobile_country_code = '310', - mobile_network_code = '010', ) - ], - failed_telephone_numbers = ["+191955512345"] - ) - else: - return LookupStatus( - ) - - def testLookupStatus(self): - """Test LookupStatus""" - instance = self.make_instance(True) - assert instance is not None - assert isinstance(instance, LookupStatus) - assert instance.request_id == '004223a0-8b17-41b1-bf81-20732adf5590' - assert instance.status == 'COMPLETE' - assert isinstance(instance.result, list) - assert len(instance.result) == 1 - assert isinstance(instance.result[0], LookupResult) - assert instance.result[0].response_code == 0 - assert instance.result[0].message == 'NOERROR' - assert instance.result[0].e_164_format == '+19195551234' - assert instance.result[0].formatted == '(919) 555-1234' - assert instance.result[0].country == 'US' - assert instance.result[0].line_type == 'Mobile' - assert instance.result[0].line_provider == 'Verizon Wireless' - assert instance.result[0].mobile_country_code == '310' - assert instance.result[0].mobile_network_code == '010' - assert instance.failed_telephone_numbers == ["+191955512345"] - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/models/test_lookup_status_enum.py b/test/unit/models/test_lookup_status_enum.py deleted file mode 100644 index ffb49078..00000000 --- a/test/unit/models/test_lookup_status_enum.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding: utf-8 - -""" - Bandwidth - - Bandwidth's Communication APIs - - The version of the OpenAPI document: 1.0.0 - Contact: letstalk@bandwidth.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from bandwidth.models.lookup_status_enum import LookupStatusEnum - -class TestLookupStatusEnum(unittest.TestCase): - """LookupStatusEnum unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testLookupStatusEnum(self): - """Test LookupStatusEnum""" - in_progress = LookupStatusEnum('IN_PROGRESS') - complete = LookupStatusEnum('COMPLETE') - partial_complete = LookupStatusEnum('PARTIAL_COMPLETE') - failed = LookupStatusEnum('FAILED') - assert in_progress == 'IN_PROGRESS' - assert complete == 'COMPLETE' - assert partial_complete == 'PARTIAL_COMPLETE' - assert failed == 'FAILED' - -if __name__ == '__main__': - unittest.main() diff --git a/test/unit/models/test_machine_detection_mode_enum.py b/test/unit/models/test_machine_detection_mode_enum.py index 668a3614..052c734d 100644 --- a/test/unit/models/test_machine_detection_mode_enum.py +++ b/test/unit/models/test_machine_detection_mode_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testMachineDetectionModeEnum(self): """Test MachineDetectionModeEnum""" - sync = MachineDetectionModeEnum('sync') - async_ = MachineDetectionModeEnum('async') - assert sync == 'sync' - assert async_ == 'async' + assert MachineDetectionModeEnum('sync') == 'sync' + assert MachineDetectionModeEnum('async') == 'async' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_message_direction_enum.py b/test/unit/models/test_message_direction_enum.py index 879abb30..a3c8e234 100644 --- a/test/unit/models/test_message_direction_enum.py +++ b/test/unit/models/test_message_direction_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testMessageDirectionEnum(self): """Test MessageDirectionEnum""" - in_ = MessageDirectionEnum('in') - out = MessageDirectionEnum('out') - assert in_ == 'in' - assert out == 'out' + assert MessageDirectionEnum('in') == 'in' + assert MessageDirectionEnum('out') == 'out' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_message_status_enum.py b/test/unit/models/test_message_status_enum.py index ccf934cf..c9166404 100644 --- a/test/unit/models/test_message_status_enum.py +++ b/test/unit/models/test_message_status_enum.py @@ -28,22 +28,14 @@ def tearDown(self): def testMessageStatusEnum(self): """Test MessageStatusEnum""" - received = MessageStatusEnum('RECEIVED') - queued = MessageStatusEnum('QUEUED') - sending = MessageStatusEnum('SENDING') - sent = MessageStatusEnum('SENT') - failed = MessageStatusEnum('FAILED') - delivered = MessageStatusEnum('DELIVERED') - accepted = MessageStatusEnum('ACCEPTED') - undelivered = MessageStatusEnum('UNDELIVERED') - assert received == 'RECEIVED' - assert queued == 'QUEUED' - assert sending == 'SENDING' - assert sent == 'SENT' - assert failed == 'FAILED' - assert delivered == 'DELIVERED' - assert accepted == 'ACCEPTED' - assert undelivered == 'UNDELIVERED' + assert MessageStatusEnum('RECEIVED') == 'RECEIVED' + assert MessageStatusEnum('QUEUED') == 'QUEUED' + assert MessageStatusEnum('SENDING') == 'SENDING' + assert MessageStatusEnum('SENT') == 'SENT' + assert MessageStatusEnum('FAILED') == 'FAILED' + assert MessageStatusEnum('DELIVERED') == 'DELIVERED' + assert MessageStatusEnum('ACCEPTED') == 'ACCEPTED' + assert MessageStatusEnum('UNDELIVERED') == 'UNDELIVERED' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_message_type_enum.py b/test/unit/models/test_message_type_enum.py index abfb99ed..dba22575 100644 --- a/test/unit/models/test_message_type_enum.py +++ b/test/unit/models/test_message_type_enum.py @@ -28,12 +28,9 @@ def tearDown(self): def testMessageTypeEnum(self): """Test MessageTypeEnum""" - sms = MessageTypeEnum('sms') - mms = MessageTypeEnum('mms') - rcs = MessageTypeEnum('rcs') - assert sms == 'sms' - assert mms == 'mms' - assert rcs == 'rcs' + assert MessageTypeEnum('sms') == 'sms' + assert MessageTypeEnum('mms') == 'mms' + assert MessageTypeEnum('rcs') == 'rcs' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_multi_channel_message_channel_enum.py b/test/unit/models/test_multi_channel_message_channel_enum.py index 89e83207..bb476d93 100644 --- a/test/unit/models/test_multi_channel_message_channel_enum.py +++ b/test/unit/models/test_multi_channel_message_channel_enum.py @@ -28,12 +28,9 @@ def tearDown(self): def testMultiChannelMessageChannelEnum(self): """Test MultiChannelMessageChannelEnum""" - rbm = MultiChannelMessageChannelEnum('RBM') - sms = MultiChannelMessageChannelEnum('SMS') - mms = MultiChannelMessageChannelEnum('MMS') - assert rbm == 'RBM' - assert sms == 'SMS' - assert mms == 'MMS' + assert MultiChannelMessageChannelEnum('RBM') == 'RBM' + assert MultiChannelMessageChannelEnum('SMS') == 'SMS' + assert MultiChannelMessageChannelEnum('MMS') == 'MMS' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_priority_enum.py b/test/unit/models/test_priority_enum.py index 54ca8c64..ce6840be 100644 --- a/test/unit/models/test_priority_enum.py +++ b/test/unit/models/test_priority_enum.py @@ -30,8 +30,8 @@ def testPriorityEnum(self): """Test PriorityEnum""" default = PriorityEnum('default') high = PriorityEnum('high') - assert default == 'default' - assert high == 'high' + assert PriorityEnum('default') == 'default' + assert PriorityEnum('high') == 'high' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_product_type_enum.py b/test/unit/models/test_product_type_enum.py index 74f31b08..97cb71ed 100644 --- a/test/unit/models/test_product_type_enum.py +++ b/test/unit/models/test_product_type_enum.py @@ -28,24 +28,15 @@ def tearDown(self): def testProductTypeEnum(self): """Test ProductTypeEnum""" - local_a2p = ProductTypeEnum('LOCAL_A2P') - p2p = ProductTypeEnum('P2P') - short_code_reach = ProductTypeEnum('SHORT_CODE_REACH') - toll_free = ProductTypeEnum('TOLL_FREE') - hosted_short_code = ProductTypeEnum('HOSTED_SHORT_CODE') - alpha_numeric = ProductTypeEnum('ALPHA_NUMERIC') - rbm_media = ProductTypeEnum('RBM_MEDIA') - rbm_rich = ProductTypeEnum('RBM_RICH') - rbm_conversational = ProductTypeEnum('RBM_CONVERSATIONAL') - assert local_a2p == 'LOCAL_A2P' - assert p2p == 'P2P' - assert short_code_reach == 'SHORT_CODE_REACH' - assert toll_free == 'TOLL_FREE' - assert hosted_short_code == 'HOSTED_SHORT_CODE' - assert alpha_numeric == 'ALPHA_NUMERIC' - assert rbm_media == 'RBM_MEDIA' - assert rbm_rich == 'RBM_RICH' - assert rbm_conversational == 'RBM_CONVERSATIONAL' + assert ProductTypeEnum('LOCAL_A2P') == 'LOCAL_A2P' + assert ProductTypeEnum('P2P') == 'P2P' + assert ProductTypeEnum('SHORT_CODE_REACH') == 'SHORT_CODE_REACH' + assert ProductTypeEnum('TOLL_FREE') == 'TOLL_FREE' + assert ProductTypeEnum('HOSTED_SHORT_CODE') == 'HOSTED_SHORT_CODE' + assert ProductTypeEnum('ALPHA_NUMERIC') == 'ALPHA_NUMERIC' + assert ProductTypeEnum('RBM_MEDIA') == 'RBM_MEDIA' + assert ProductTypeEnum('RBM_RICH') == 'RBM_RICH' + assert ProductTypeEnum('RBM_CONVERSATIONAL') == 'RBM_CONVERSATIONAL' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_rbm_action_type_enum.py b/test/unit/models/test_rbm_action_type_enum.py index af1754ac..7c5e132c 100644 --- a/test/unit/models/test_rbm_action_type_enum.py +++ b/test/unit/models/test_rbm_action_type_enum.py @@ -28,18 +28,12 @@ def tearDown(self): def testRbmActionTypeEnum(self): """Test RbmActionTypeEnum""" - reply = RbmActionTypeEnum('REPLY') - dial_phone = RbmActionTypeEnum('DIAL_PHONE') - show_location = RbmActionTypeEnum('SHOW_LOCATION') - create_calendar_event = RbmActionTypeEnum('CREATE_CALENDAR_EVENT') - open_url = RbmActionTypeEnum('OPEN_URL') - request_location = RbmActionTypeEnum('REQUEST_LOCATION') - assert reply == 'REPLY' - assert dial_phone == 'DIAL_PHONE' - assert show_location == 'SHOW_LOCATION' - assert create_calendar_event == 'CREATE_CALENDAR_EVENT' - assert open_url == 'OPEN_URL' - assert request_location == 'REQUEST_LOCATION' + assert RbmActionTypeEnum('REPLY') == 'REPLY' + assert RbmActionTypeEnum('DIAL_PHONE') == 'DIAL_PHONE' + assert RbmActionTypeEnum('SHOW_LOCATION') == 'SHOW_LOCATION' + assert RbmActionTypeEnum('CREATE_CALENDAR_EVENT') == 'CREATE_CALENDAR_EVENT' + assert RbmActionTypeEnum('OPEN_URL') == 'OPEN_URL' + assert RbmActionTypeEnum('REQUEST_LOCATION') == 'REQUEST_LOCATION' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_rbm_media_height_enum.py b/test/unit/models/test_rbm_media_height_enum.py index ab4f99a7..91940e85 100644 --- a/test/unit/models/test_rbm_media_height_enum.py +++ b/test/unit/models/test_rbm_media_height_enum.py @@ -28,12 +28,9 @@ def tearDown(self): def testRbmMediaHeightEnum(self): """Test RbmMediaHeightEnum""" - short = RbmMediaHeightEnum('SHORT') - medium = RbmMediaHeightEnum('MEDIUM') - tall = RbmMediaHeightEnum('TALL') - assert short == 'SHORT' - assert medium == 'MEDIUM' - assert tall == 'TALL' + assert RbmMediaHeightEnum('SHORT') == 'SHORT' + assert RbmMediaHeightEnum('MEDIUM') == 'MEDIUM' + assert RbmMediaHeightEnum('TALL') == 'TALL' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_recording_state_enum.py b/test/unit/models/test_recording_state_enum.py index 85d34468..eabfdd9c 100644 --- a/test/unit/models/test_recording_state_enum.py +++ b/test/unit/models/test_recording_state_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testRecordingStateEnum(self): """Test RecordingStateEnum""" - paused = RecordingStateEnum('paused') - recording = RecordingStateEnum('recording') - assert paused == 'paused' - assert recording == 'recording' + assert RecordingStateEnum('paused') == 'paused' + assert RecordingStateEnum('recording') == 'recording' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_redirect_method_enum.py b/test/unit/models/test_redirect_method_enum.py index 6f8fa1b7..5ed1bd5d 100644 --- a/test/unit/models/test_redirect_method_enum.py +++ b/test/unit/models/test_redirect_method_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testRedirectMethodEnum(self): """Test RedirectMethodEnum""" - get = RedirectMethodEnum('GET') - post = RedirectMethodEnum('POST') - assert get == 'GET' - assert post == 'POST' + assert RedirectMethodEnum('GET') == 'GET' + assert RedirectMethodEnum('POST') == 'POST' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_standalone_card_orientation_enum.py b/test/unit/models/test_standalone_card_orientation_enum.py index 717e3ea6..99743b05 100644 --- a/test/unit/models/test_standalone_card_orientation_enum.py +++ b/test/unit/models/test_standalone_card_orientation_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testStandaloneCardOrientationEnum(self): """Test StandaloneCardOrientationEnum""" - horizontal = StandaloneCardOrientationEnum('HORIZONTAL') - vertical = StandaloneCardOrientationEnum('VERTICAL') - assert horizontal == 'HORIZONTAL' - assert vertical == 'VERTICAL' + assert StandaloneCardOrientationEnum('HORIZONTAL') == 'HORIZONTAL' + assert StandaloneCardOrientationEnum('VERTICAL') == 'VERTICAL' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_status_callback_type_enum.py b/test/unit/models/test_status_callback_type_enum.py index 69cacae9..e33dc4f8 100644 --- a/test/unit/models/test_status_callback_type_enum.py +++ b/test/unit/models/test_status_callback_type_enum.py @@ -28,14 +28,10 @@ def tearDown(self): def testStatusCallbackTypeEnum(self): """Test StatusCallbackTypeEnum""" - message_sending = StatusCallbackTypeEnum('message-sending') - message_delivered = StatusCallbackTypeEnum('message-delivered') - message_failed = StatusCallbackTypeEnum('message-failed') - message_read = StatusCallbackTypeEnum('message-read') - assert message_sending == 'message-sending' - assert message_delivered == 'message-delivered' - assert message_failed == 'message-failed' - assert message_read == 'message-read' + assert StatusCallbackTypeEnum('message-sending') == 'message-sending' + assert StatusCallbackTypeEnum('message-delivered') == 'message-delivered' + assert StatusCallbackTypeEnum('message-failed') == 'message-failed' + assert StatusCallbackTypeEnum('message-read') == 'message-read' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_lookup_request.py b/test/unit/models/test_sync_lookup_request.py similarity index 54% rename from test/unit/models/test_lookup_request.py rename to test/unit/models/test_sync_lookup_request.py index 5e974aac..d73fcb54 100644 --- a/test/unit/models/test_lookup_request.py +++ b/test/unit/models/test_sync_lookup_request.py @@ -15,10 +15,10 @@ import unittest -from bandwidth.models.lookup_request import LookupRequest +from bandwidth.models.sync_lookup_request import SyncLookupRequest -class TestLookupRequest(unittest.TestCase): - """LookupRequest unit test stubs""" +class TestSyncLookupRequest(unittest.TestCase): + """SyncLookupRequest unit test stubs""" def setUp(self): pass @@ -26,30 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> LookupRequest: - """Test LookupRequest + def make_instance(self, include_optional) -> SyncLookupRequest: + """Test SyncLookupRequest include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ if include_optional: - return LookupRequest( - tns = [ - '' + return SyncLookupRequest( + phone_numbers = [ + '+680728880015' ] ) else: - return LookupRequest( - tns = [ - '' + return SyncLookupRequest( + phone_numbers = [ + '+680728880015' ], ) - def testLookupRequest(self): - """Test LookupRequest""" + def testSyncLookupRequest(self): + """Test SyncLookupRequest""" instance = self.make_instance(True) assert instance is not None - assert isinstance(instance, LookupRequest) - assert instance.tns == [''] + assert isinstance(instance, SyncLookupRequest) + assert instance.phone_numbers == ['+680728880015'] if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_tfv_callback_status_enum.py b/test/unit/models/test_tfv_callback_status_enum.py index f66b8897..2c95db59 100644 --- a/test/unit/models/test_tfv_callback_status_enum.py +++ b/test/unit/models/test_tfv_callback_status_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testTfvCallbackStatusEnum(self): """Test TfvCallbackStatusEnum""" - verified = TfvCallbackStatusEnum('VERIFIED') - unverified = TfvCallbackStatusEnum('UNVERIFIED') - assert verified == 'VERIFIED' - assert unverified == 'UNVERIFIED' + assert TfvCallbackStatusEnum('VERIFIED') == 'VERIFIED' + assert TfvCallbackStatusEnum('UNVERIFIED') == 'UNVERIFIED' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_tfv_status.py b/test/unit/models/test_tfv_status.py index 82220553..2bd8e243 100644 --- a/test/unit/models/test_tfv_status.py +++ b/test/unit/models/test_tfv_status.py @@ -15,6 +15,7 @@ import unittest from datetime import datetime +from uuid import UUID from bandwidth.models.tfv_status import TfvStatus from bandwidth.models.tfv_submission_info import TfvSubmissionInfo @@ -40,7 +41,7 @@ def make_instance(self, include_optional) -> TfvStatus: return TfvStatus( phone_number = '+18005555555', status = 'VERIFIED', - internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333', + internal_ticket_number = UUID('acde070d-8c4c-4f0d-9d8a-162843c10333'), decline_reason_description = 'Invalid Information - Can\'t Validate URL - Website is not accessible / not available', resubmit_allowed = True, created_date_time = '2021-06-08T06:45:13Z', @@ -92,7 +93,7 @@ def testTfvStatus(self): assert isinstance(instance, TfvStatus) assert instance.phone_number == '+18005555555' assert instance.status == 'VERIFIED' - assert instance.internal_ticket_number == 'acde070d-8c4c-4f0d-9d8a-162843c10333' + assert instance.internal_ticket_number == UUID('acde070d-8c4c-4f0d-9d8a-162843c10333') assert instance.decline_reason_description == 'Invalid Information - Can\'t Validate URL - Website is not accessible / not available' assert instance.resubmit_allowed == True assert isinstance(instance.created_date_time, datetime) diff --git a/test/unit/models/test_tfv_status_enum.py b/test/unit/models/test_tfv_status_enum.py index 3388982a..c3c4e93d 100644 --- a/test/unit/models/test_tfv_status_enum.py +++ b/test/unit/models/test_tfv_status_enum.py @@ -28,12 +28,9 @@ def tearDown(self): def testTfvStatusEnum(self): """Test TfvStatusEnum""" - verified = TfvStatusEnum('VERIFIED') - unverified = TfvStatusEnum('UNVERIFIED') - pending = TfvStatusEnum('PENDING') - assert verified == 'VERIFIED' - assert unverified == 'UNVERIFIED' - assert pending == 'PENDING' + assert TfvStatusEnum('VERIFIED') == 'VERIFIED' + assert TfvStatusEnum('UNVERIFIED') == 'UNVERIFIED' + assert TfvStatusEnum('PENDING') == 'PENDING' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_thumbnail_alignment_enum.py b/test/unit/models/test_thumbnail_alignment_enum.py index d59568b0..76b9ee98 100644 --- a/test/unit/models/test_thumbnail_alignment_enum.py +++ b/test/unit/models/test_thumbnail_alignment_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testThumbnailAlignmentEnum(self): """Test ThumbnailAlignmentEnum""" - left = ThumbnailAlignmentEnum('LEFT') - right = ThumbnailAlignmentEnum('RIGHT') - assert left == 'LEFT' - assert right == 'RIGHT' + assert ThumbnailAlignmentEnum('LEFT') == 'LEFT' + assert ThumbnailAlignmentEnum('RIGHT') == 'RIGHT' if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_verification_denial_webhook.py b/test/unit/models/test_verification_denial_webhook.py index 04420b07..0e698914 100644 --- a/test/unit/models/test_verification_denial_webhook.py +++ b/test/unit/models/test_verification_denial_webhook.py @@ -14,6 +14,7 @@ import unittest +from uuid import UUID from bandwidth.models.verification_denial_webhook import VerificationDenialWebhook @@ -37,7 +38,7 @@ def make_instance(self, include_optional) -> VerificationDenialWebhook: additional_denial_reasons = [{"statusCode":512,"reason":"Reason A","resubmitAllowed":True},{"statusCode":513,"reason":"Reason B","resubmitAllowed":True}], decline_reason_description = 'Invalid Information - Can\'t Validate URL - Website is not accessible / not available', denial_status_code = 511, - internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333', + internal_ticket_number = UUID('acde070d-8c4c-4f0d-9d8a-162843c10333'), phone_number = '+18005555555', resubmit_allowed = True, status = 'UNVERIFIED', @@ -64,7 +65,7 @@ def testVerificationDenialWebhook(self): assert instance.additional_denial_reasons[1].resubmit_allowed == True assert instance.decline_reason_description == 'Invalid Information - Can\'t Validate URL - Website is not accessible / not available' assert instance.denial_status_code == 511 - assert instance.internal_ticket_number == 'acde070d-8c4c-4f0d-9d8a-162843c10333' + assert instance.internal_ticket_number == UUID('acde070d-8c4c-4f0d-9d8a-162843c10333') assert instance.phone_number == '+18005555555' assert instance.resubmit_allowed == True assert instance.status == 'UNVERIFIED' diff --git a/test/unit/models/test_verification_webhook.py b/test/unit/models/test_verification_webhook.py index c53df78a..80fcb6bf 100644 --- a/test/unit/models/test_verification_webhook.py +++ b/test/unit/models/test_verification_webhook.py @@ -14,6 +14,7 @@ import unittest +from uuid import UUID from bandwidth.models.verification_webhook import VerificationWebhook @@ -36,7 +37,7 @@ def make_instance(self, include_optional) -> VerificationWebhook: account_id = '1234567', phone_number = '+18005555555', status = 'VERIFIED', - internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333' + internal_ticket_number = UUID('acde070d-8c4c-4f0d-9d8a-162843c10333') ) else: return VerificationWebhook( @@ -50,7 +51,7 @@ def testVerificationWebhook(self): assert instance.account_id == '1234567' assert instance.phone_number == '+18005555555' assert instance.status == 'VERIFIED' - assert instance.internal_ticket_number == 'acde070d-8c4c-4f0d-9d8a-162843c10333' + assert instance.internal_ticket_number == UUID('acde070d-8c4c-4f0d-9d8a-162843c10333') if __name__ == '__main__': unittest.main() diff --git a/test/unit/models/test_webhook_subscription_type_enum.py b/test/unit/models/test_webhook_subscription_type_enum.py index f35ae7fc..4fbd54df 100644 --- a/test/unit/models/test_webhook_subscription_type_enum.py +++ b/test/unit/models/test_webhook_subscription_type_enum.py @@ -28,10 +28,8 @@ def tearDown(self): def testWebhookSubscriptionTypeEnum(self): """Test WebhookSubscriptionTypeEnum""" - tvs = WebhookSubscriptionTypeEnum('TOLLFREE_VERIFICATION_STATUS') - mpas = WebhookSubscriptionTypeEnum('MESSAGING_PORTOUT_APPROVAL_STATUS') - assert tvs == 'TOLLFREE_VERIFICATION_STATUS' - assert mpas == 'MESSAGING_PORTOUT_APPROVAL_STATUS' + assert WebhookSubscriptionTypeEnum('TOLLFREE_VERIFICATION_STATUS') == 'TOLLFREE_VERIFICATION_STATUS' + assert WebhookSubscriptionTypeEnum('MESSAGING_PORTOUT_APPROVAL_STATUS') == 'MESSAGING_PORTOUT_APPROVAL_STATUS' if __name__ == '__main__': unittest.main()