diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 2d4e02e6..200e71e2 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -11,6 +11,7 @@ bandwidth/api/mfa_api.py bandwidth/api/phone_number_lookup_api.py bandwidth/api/recordings_api.py bandwidth/api/statistics_api.py +bandwidth/api/toll_free_verification_api.py bandwidth/api/transcriptions_api.py bandwidth/api_client.py bandwidth/api_response.py @@ -18,6 +19,8 @@ bandwidth/configuration.py bandwidth/exceptions.py bandwidth/models/__init__.py bandwidth/models/account_statistics.py +bandwidth/models/additional_denial_reason.py +bandwidth/models/address.py bandwidth/models/answer_callback.py bandwidth/models/bridge_complete_callback.py bandwidth/models/bridge_target_complete_callback.py @@ -43,6 +46,7 @@ bandwidth/models/conference_recording_available_callback.py 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_call.py bandwidth/models/create_call_response.py bandwidth/models/create_lookup_response.py @@ -51,10 +55,13 @@ bandwidth/models/deferred_result.py bandwidth/models/disconnect_callback.py bandwidth/models/diversion.py bandwidth/models/dtmf_callback.py +bandwidth/models/error.py +bandwidth/models/failure_webhook.py bandwidth/models/field_error.py bandwidth/models/file_format_enum.py bandwidth/models/gather_callback.py bandwidth/models/initiate_callback.py +bandwidth/models/links_object.py bandwidth/models/list_message_direction_enum.py bandwidth/models/list_message_item.py bandwidth/models/lookup_request.py @@ -79,6 +86,7 @@ bandwidth/models/messaging_request_error.py bandwidth/models/mfa_forbidden_request_error.py bandwidth/models/mfa_request_error.py bandwidth/models/mfa_unauthorized_request_error.py +bandwidth/models/opt_in_workflow.py bandwidth/models/page_info.py bandwidth/models/priority_enum.py bandwidth/models/recording_available_callback.py @@ -90,6 +98,14 @@ bandwidth/models/redirect_callback.py bandwidth/models/redirect_method_enum.py bandwidth/models/stir_shaken.py bandwidth/models/tag.py +bandwidth/models/telephone_number.py +bandwidth/models/tfv_basic_authentication.py +bandwidth/models/tfv_callback_status_enum.py +bandwidth/models/tfv_error.py +bandwidth/models/tfv_status.py +bandwidth/models/tfv_status_enum.py +bandwidth/models/tfv_submission_info.py +bandwidth/models/tfv_submission_wrapper.py bandwidth/models/tn_lookup_request_error.py bandwidth/models/transcribe_recording.py bandwidth/models/transcription.py @@ -101,13 +117,24 @@ bandwidth/models/update_call.py bandwidth/models/update_call_recording.py bandwidth/models/update_conference.py bandwidth/models/update_conference_member.py +bandwidth/models/verification_denial_webhook.py +bandwidth/models/verification_request.py +bandwidth/models/verification_update_request.py +bandwidth/models/verification_webhook.py bandwidth/models/verify_code_request.py bandwidth/models/verify_code_response.py bandwidth/models/voice_api_error.py bandwidth/models/voice_code_response.py +bandwidth/models/webhook_subscription.py +bandwidth/models/webhook_subscription_basic_authentication.py +bandwidth/models/webhook_subscription_request_schema.py +bandwidth/models/webhook_subscription_type_enum.py +bandwidth/models/webhook_subscriptions_list_body.py bandwidth/py.typed bandwidth/rest.py docs/AccountStatistics.md +docs/AdditionalDenialReason.md +docs/Address.md docs/AnswerCallback.md docs/BridgeCompleteCallback.md docs/BridgeTargetCompleteCallback.md @@ -135,6 +162,7 @@ docs/ConferenceRecordingMetadata.md docs/ConferenceRedirectCallback.md docs/ConferenceStateEnum.md docs/ConferencesApi.md +docs/Contact.md docs/CreateCall.md docs/CreateCallResponse.md docs/CreateLookupResponse.md @@ -143,10 +171,13 @@ docs/DeferredResult.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md +docs/Error.md +docs/FailureWebhook.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md docs/InitiateCallback.md +docs/LinksObject.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md docs/LookupRequest.md @@ -174,6 +205,7 @@ docs/MessagingRequestError.md docs/MfaForbiddenRequestError.md docs/MfaRequestError.md docs/MfaUnauthorizedRequestError.md +docs/OptInWorkflow.md docs/PageInfo.md docs/PhoneNumberLookupApi.md docs/PriorityEnum.md @@ -188,7 +220,16 @@ docs/RedirectMethodEnum.md docs/StatisticsApi.md docs/StirShaken.md docs/Tag.md +docs/TelephoneNumber.md +docs/TfvBasicAuthentication.md +docs/TfvCallbackStatusEnum.md +docs/TfvError.md +docs/TfvStatus.md +docs/TfvStatusEnum.md +docs/TfvSubmissionInfo.md +docs/TfvSubmissionWrapper.md docs/TnLookupRequestError.md +docs/TollFreeVerificationApi.md docs/TranscribeRecording.md docs/Transcription.md docs/TranscriptionAvailableCallback.md @@ -200,10 +241,19 @@ docs/UpdateCall.md docs/UpdateCallRecording.md docs/UpdateConference.md docs/UpdateConferenceMember.md +docs/VerificationDenialWebhook.md +docs/VerificationRequest.md +docs/VerificationUpdateRequest.md +docs/VerificationWebhook.md docs/VerifyCodeRequest.md docs/VerifyCodeResponse.md docs/VoiceApiError.md docs/VoiceCodeResponse.md +docs/WebhookSubscription.md +docs/WebhookSubscriptionBasicAuthentication.md +docs/WebhookSubscriptionRequestSchema.md +docs/WebhookSubscriptionTypeEnum.md +docs/WebhookSubscriptionsListBody.md git_push.sh pyproject.toml setup.py diff --git a/README.md b/README.md index 97bbb299..7e6188ea 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,14 @@ Class | Method | HTTP request | Description *RecordingsApi* | [**transcribe_call_recording**](docs/RecordingsApi.md#transcribe_call_recording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request *RecordingsApi* | [**update_call_recording_state**](docs/RecordingsApi.md#update_call_recording_state) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording *StatisticsApi* | [**get_statistics**](docs/StatisticsApi.md#get_statistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics +*TollFreeVerificationApi* | [**create_webhook_subscription**](docs/TollFreeVerificationApi.md#create_webhook_subscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription +*TollFreeVerificationApi* | [**delete_webhook_subscription**](docs/TollFreeVerificationApi.md#delete_webhook_subscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription +*TollFreeVerificationApi* | [**get_toll_free_verification_status**](docs/TollFreeVerificationApi.md#get_toll_free_verification_status) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status +*TollFreeVerificationApi* | [**list_toll_free_use_cases**](docs/TollFreeVerificationApi.md#list_toll_free_use_cases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases +*TollFreeVerificationApi* | [**list_webhook_subscriptions**](docs/TollFreeVerificationApi.md#list_webhook_subscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions +*TollFreeVerificationApi* | [**request_toll_free_verification**](docs/TollFreeVerificationApi.md#request_toll_free_verification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification +*TollFreeVerificationApi* | [**update_toll_free_verification_request**](docs/TollFreeVerificationApi.md#update_toll_free_verification_request) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request +*TollFreeVerificationApi* | [**update_webhook_subscription**](docs/TollFreeVerificationApi.md#update_webhook_subscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription *TranscriptionsApi* | [**delete_real_time_transcription**](docs/TranscriptionsApi.md#delete_real_time_transcription) | **DELETE** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Delete a specific transcription *TranscriptionsApi* | [**get_real_time_transcription**](docs/TranscriptionsApi.md#get_real_time_transcription) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions/{transcriptionId} | Retrieve a specific transcription *TranscriptionsApi* | [**list_real_time_transcriptions**](docs/TranscriptionsApi.md#list_real_time_transcriptions) | **GET** /accounts/{accountId}/calls/{callId}/transcriptions | Enumerate transcriptions made with StartTranscription @@ -141,6 +149,8 @@ Class | Method | HTTP request | Description ## Documentation For Models - [AccountStatistics](docs/AccountStatistics.md) + - [AdditionalDenialReason](docs/AdditionalDenialReason.md) + - [Address](docs/Address.md) - [AnswerCallback](docs/AnswerCallback.md) - [BridgeCompleteCallback](docs/BridgeCompleteCallback.md) - [BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md) @@ -166,6 +176,7 @@ Class | Method | HTTP request | Description - [ConferenceRecordingMetadata](docs/ConferenceRecordingMetadata.md) - [ConferenceRedirectCallback](docs/ConferenceRedirectCallback.md) - [ConferenceStateEnum](docs/ConferenceStateEnum.md) + - [Contact](docs/Contact.md) - [CreateCall](docs/CreateCall.md) - [CreateCallResponse](docs/CreateCallResponse.md) - [CreateLookupResponse](docs/CreateLookupResponse.md) @@ -174,10 +185,13 @@ Class | Method | HTTP request | Description - [DisconnectCallback](docs/DisconnectCallback.md) - [Diversion](docs/Diversion.md) - [DtmfCallback](docs/DtmfCallback.md) + - [Error](docs/Error.md) + - [FailureWebhook](docs/FailureWebhook.md) - [FieldError](docs/FieldError.md) - [FileFormatEnum](docs/FileFormatEnum.md) - [GatherCallback](docs/GatherCallback.md) - [InitiateCallback](docs/InitiateCallback.md) + - [LinksObject](docs/LinksObject.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [ListMessageItem](docs/ListMessageItem.md) - [LookupRequest](docs/LookupRequest.md) @@ -202,6 +216,7 @@ Class | Method | HTTP request | Description - [MfaForbiddenRequestError](docs/MfaForbiddenRequestError.md) - [MfaRequestError](docs/MfaRequestError.md) - [MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) + - [OptInWorkflow](docs/OptInWorkflow.md) - [PageInfo](docs/PageInfo.md) - [PriorityEnum](docs/PriorityEnum.md) - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) @@ -213,6 +228,14 @@ Class | Method | HTTP request | Description - [RedirectMethodEnum](docs/RedirectMethodEnum.md) - [StirShaken](docs/StirShaken.md) - [Tag](docs/Tag.md) + - [TelephoneNumber](docs/TelephoneNumber.md) + - [TfvBasicAuthentication](docs/TfvBasicAuthentication.md) + - [TfvCallbackStatusEnum](docs/TfvCallbackStatusEnum.md) + - [TfvError](docs/TfvError.md) + - [TfvStatus](docs/TfvStatus.md) + - [TfvStatusEnum](docs/TfvStatusEnum.md) + - [TfvSubmissionInfo](docs/TfvSubmissionInfo.md) + - [TfvSubmissionWrapper](docs/TfvSubmissionWrapper.md) - [TnLookupRequestError](docs/TnLookupRequestError.md) - [TranscribeRecording](docs/TranscribeRecording.md) - [Transcription](docs/Transcription.md) @@ -224,10 +247,19 @@ Class | Method | HTTP request | Description - [UpdateCallRecording](docs/UpdateCallRecording.md) - [UpdateConference](docs/UpdateConference.md) - [UpdateConferenceMember](docs/UpdateConferenceMember.md) + - [VerificationDenialWebhook](docs/VerificationDenialWebhook.md) + - [VerificationRequest](docs/VerificationRequest.md) + - [VerificationUpdateRequest](docs/VerificationUpdateRequest.md) + - [VerificationWebhook](docs/VerificationWebhook.md) - [VerifyCodeRequest](docs/VerifyCodeRequest.md) - [VerifyCodeResponse](docs/VerifyCodeResponse.md) - [VoiceApiError](docs/VoiceApiError.md) - [VoiceCodeResponse](docs/VoiceCodeResponse.md) + - [WebhookSubscription](docs/WebhookSubscription.md) + - [WebhookSubscriptionBasicAuthentication](docs/WebhookSubscriptionBasicAuthentication.md) + - [WebhookSubscriptionRequestSchema](docs/WebhookSubscriptionRequestSchema.md) + - [WebhookSubscriptionTypeEnum](docs/WebhookSubscriptionTypeEnum.md) + - [WebhookSubscriptionsListBody](docs/WebhookSubscriptionsListBody.md) diff --git a/bandwidth.yml b/bandwidth.yml index 87921dfa..70ca20d3 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -19,6 +19,7 @@ tags: - name: Transcriptions - name: MFA - name: Phone Number Lookup + - name: Toll-Free Verification paths: /users/{accountId}/media: get: @@ -1328,6 +1329,270 @@ paths: '500': $ref: '#/components/responses/tnLookupInternalServerError' servers: *ref_3 + /accounts/{accountId}/tollFreeVerification: + post: + tags: + - Toll-Free Verification + summary: Request Toll-Free Verification + description: Submit a request for verification of a toll-free phone number. + operationId: requestTollFreeVerification + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/requestTollFreeVerificationRequest' + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + servers: &ref_4 + - url: https://api.bandwidth.com/api/v2 + description: Production + /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification: + get: + tags: + - Toll-Free Verification + summary: Get Toll-Free Verification Status + description: >- + 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. + operationId: getTollFreeVerificationStatus + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + responses: + '200': + $ref: '#/components/responses/getTollFreeVerificationStatusResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Toll-Free Verification Request + description: >- + 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). + operationId: updateTollFreeVerificationRequest + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + requestBody: + $ref: '#/components/requestBodies/updateTollFreeVerificationRequestRequest' + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions: + get: + tags: + - Toll-Free Verification + summary: List Webhook Subscriptions + description: >- + 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). + operationId: listWebhookSubscriptions + parameters: + - $ref: '#/components/parameters/accountId' + responses: + '200': + $ref: '#/components/responses/listWebhookSubscriptionsResponse' + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + post: + tags: + - Toll-Free Verification + summary: Create Webhook Subscription + description: >- + 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. + operationId: createWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '201': + $ref: '#/components/responses/createWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}: + delete: + tags: + - Toll-Free Verification + summary: Delete Webhook Subscription + description: Delete a webhook subscription by ID. + operationId: deleteWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Webhook Subscription + description: >- + Update an existing webhook subscription (`callbackUrl` and + `basicAuthentication` can be updated). + operationId: updateWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '200': + $ref: '#/components/responses/updateWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /tollFreeVerification/useCases: + get: + tags: + - Toll-Free Verification + summary: List Toll-Free Use Cases + description: Lists valid toll-free use cases. + operationId: listTollFreeUseCases + responses: + '200': + $ref: '#/components/responses/listTollFreeUseCasesResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 components: schemas: callbackTypeEnum: @@ -4410,6 +4675,640 @@ components: type: string description: A description of what validation error occurred. example: example error message + accountId1: + type: string + description: User's account ID. + example: '1234567' + tfPhoneNumber: + type: string + description: Toll-free telephone number in E.164 format. + minLength: 12 + maxLength: 12 + nullable: false + pattern: ^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$ + example: '+18005555555' + tfvWebhookErrors: + type: array + description: Details of the errors that were encountered when processing the request. + items: + type: string + example: 'optInWorkflowImageURLs: Entries must be a valid array of objects.' + tfvCallbackStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + example: VERIFIED + tfvUnverifiedStatus: + type: string + default: UNVERIFIED + example: UNVERIFIED + declineReasonDescription: + type: string + description: Explanation for why a verification request was declined. + nullable: false + example: >- + Invalid Information - Can't Validate URL - Website is not accessible / + not available + denialStatusCode: + description: Reason code for denial. + type: integer + example: 511 + resubmitAllowed: + description: >- + Whether a Toll-Free Verification request qualifies for resubmission via + PUT. + example: true + type: boolean + additionalDenialReason: + properties: + statusCode: + $ref: '#/components/schemas/denialStatusCode' + reason: + $ref: '#/components/schemas/declineReasonDescription' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + required: + - statusCode + - reason + - resubmitAllowed + type: object + internalTicketNumber: + type: string + format: uuid + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number - included in all webhook + payloads. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + internalTicketNumberForWebhook: + type: string + format: uuid + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + businessContactPhoneNumber: + description: Contact telephone number + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: '+19192654500' + verificationRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - phoneNumbers + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + phoneNumbers: + type: array + minItems: 1 + maxItems: 10 + items: + $ref: '#/components/schemas/tfPhoneNumber' + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 1 + maxLength: 500 + nullable: false + productionMessageContent: + type: string + description: Example of message content. + minLength: 1 + maxLength: 500 + nullable: false + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + isvReseller: + $ref: '#/components/schemas/isvReseller' + verificationUpdateRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 0 + maxLength: 500 + nullable: false + productionMessageContent: + type: string + description: Example of message content. + minLength: 0 + maxLength: 500 + nullable: false + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + isvReseller: + $ref: '#/components/schemas/isvReseller' + tfvBasicAuthentication: + type: object + properties: + username: + type: string + maxLength: 100 + password: + type: string + maxLength: 200 + required: + - username + - password + webhookSubscriptionRequestSchema: + type: object + properties: + basicAuthentication: + $ref: '#/components/schemas/tfvBasicAuthentication' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + sharedSecretKey: + $ref: '#/components/schemas/sharedSecretKey' + required: + - callbackUrl + failureWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + errorCode: + type: string + 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. + example: '400' + errorDescription: + type: string + description: A description of the error that was encountered. + example: cannot process request. + errors: + $ref: '#/components/schemas/tfvWebhookErrors' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + verificationDenialWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + additionalDenialReasons: + description: >- + An optional list of denial reasons in addition to + declineReasonDescription when multiple reasons apply. + items: + $ref: '#/components/schemas/additionalDenialReason' + example: + - statusCode: 512 + reason: Reason A + resubmitAllowed: true + - statusCode: 513 + reason: Reason B + resubmitAllowed: true + type: array + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + denialStatusCode: + $ref: '#/components/schemas/denialStatusCode' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + status: + $ref: '#/components/schemas/tfvUnverifiedStatus' + verificationWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvCallbackStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + tfvSubmissionWrapper: + type: object + properties: + submission: + $ref: '#/components/schemas/verificationUpdateRequest' + address: + type: object + nullable: false + required: + - name + - addr1 + - city + - state + - zip + - url + properties: + name: + type: string + description: The name of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Bandwidth Inc. + addr1: + type: string + description: The address of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: 2230 Bandmate Way + addr2: + type: string + description: The address of the business using the toll-free number. + minLength: 0 + maxLength: 500 + nullable: true + city: + type: string + description: The city of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Raleigh + state: + type: string + description: The state of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: NC + zip: + type: string + description: The zip of the business using the toll-free number. + nullable: false + example: '27606' + pattern: '[- A-Za-z0-9]{0,500}' + url: + type: string + format: url + description: The website of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + optInWorkflow: + type: object + nullable: false + required: + - description + - imageUrls + properties: + description: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: Opt In Flow + imageUrls: + type: array + items: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + isvReseller: + type: string + description: ISV name. + minLength: 0 + maxLength: 500 + nullable: true + example: Test ISV + contact: + type: object + nullable: false + required: + - firstName + - lastName + - email + - phoneNumber + properties: + firstName: + type: string + description: The first name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: John + lastName: + type: string + description: The last name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Doe + email: + $ref: '#/components/schemas/email' + phoneNumber: + $ref: '#/components/schemas/businessContactPhoneNumber' + email: + type: string + format: email + minLength: 0 + maxLength: 500 + nullable: false + pattern: >- + ^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$ + example: foo@bar.com + useCases: + type: array + items: + type: string + example: + - 2FA + - App Notifications + - Appointments + - Auctions + - Auto Repair Services + - Bank Transfers + - Billing + - Booking Confirmations + - Business Updates + - COVID-19 Alerts + useCase: + type: string + description: The category of the use case. + minLength: 0 + maxLength: 500 + example: 2FA + webhookSubscriptionsListBody: + description: >- + A list of all webhook subscriptions registered for this account ID for + this particular feature (unpaginated). + type: object + required: + - data + properties: + links: + $ref: '#/components/schemas/linksObject' + errors: + type: array + items: + $ref: '#/components/schemas/error' + data: + items: + $ref: '#/components/schemas/webhookSubscription' + type: array + linksObject: + type: object + properties: + first: + description: The first (or only) page of results matching the query. + type: string + next: + description: >- + If more results exist than specified by 'size', this link returns + the next page of 'size' results. + type: string + previous: + description: >- + If the results are more than one page, this link returns the + previous page of 'size' results. + type: string + last: + description: >- + If more results exist than specified by 'size', this link return the + last page of result. + type: string + error: + type: object + properties: + code: + type: integer + description: + type: string + telephoneNumbers: + type: array + items: + $ref: '#/components/schemas/telephoneNumber' + telephoneNumber: + type: object + properties: + telephoneNumber: + description: Simple Telephone Number. + type: string + webhookSubscriptionTypeEnum: + type: string + enum: + - TOLLFREE_VERIFICATION_STATUS + - MESSAGING_PORTOUT_APPROVAL_STATUS + example: TOLLFREE_VERIFICATION_STATUS + webhookSubscription: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer has subscribed to. + type: object + required: + - callbackUrl + properties: + id: + type: string + example: 7hICGStfAfeGxEq3N0lQwO + accountId: + type: string + example: '1234567' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + type: + $ref: '#/components/schemas/webhookSubscriptionTypeEnum' + basicAuthentication: + description: >- + Basic authentication credentials are not required, but if present, + both username and password must be provided. + type: object + required: + - username + - password + properties: + username: + type: string + maxLength: 100 + password: + type: string + maxLength: 200 + createdDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + modifiedDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + webhookUrl: + description: >- + Callback URL to receive status updates from Bandwidth. When a webhook + subscription is registered with Bandwidth under a given account ID, it + will be used to send status updates for all requests submitted under + that account ID. + type: string + format: url + minLength: 0 + maxLength: 2000 + nullable: true + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + tfvError: + description: A generic error object. + properties: + type: + type: string + example: Error Type + description: + type: string + example: Error Message + errors: + type: object + description: >- + Each key of this errors object refers to a field of the submitted + object (using dot notation for nested objects), with the field being + a key to an array of one or more errors for that field. + example: + field: error message + type: object + tfvStatus: + type: object + properties: + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumber' + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + createdDateTime: + type: string + description: Date and time the verification request was created. + format: date-time + example: '2021-06-08T06:45:13.0Z' + modifiedDateTime: + type: string + description: Date and time the verification request was last modified. + format: date-time + example: '2021-06-08T06:45:13.0Z' + submission: + $ref: '#/components/schemas/tfvSubmissionInfo' + tfvSubmissionInfo: + type: object + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 0 + maxLength: 500 + nullable: false + example: Text summarizing the use case for the toll-free number + productionMessageContent: + type: string + description: Example of message content. + minLength: 0 + maxLength: 500 + nullable: false + example: Production message content + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + example: Any additional information + isvReseller: + $ref: '#/components/schemas/isvReseller' + tfvStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + - PENDING + - PARTIALLY_VERIFIED + - INVALID_STATUS + example: VERIFIED + sharedSecretKey: + description: >- + An ASCII string submitted by the user as a shared secret key for + generating an HMAC header for callbacks. + example: This is my $3cret + maxLength: 64 + minLength: 16 + nullable: true + pattern: ^[ -~]{16,64}$ + type: string responses: createMessageResponse: description: Accepted @@ -4860,6 +5759,120 @@ components: summary: Example Internal Server Error Error value: message: Request has not been passed further. + getTollFreeVerificationStatusResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/tfvStatus' + listWebhookSubscriptionsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionsListBody' + createWebhookSubscriptionResponse: + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + updateWebhookSubscriptionResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + listTollFreeUseCasesResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/useCases' + tfvBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot process request. + type: bad request + tfvPostBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: cannot process request. + errors: + businessName: Business name is required. + businessContactEmail: Business contact email is not a valid email address. + optInWorkflowImageURLs: Entries must be a valid array of objects. + tfvUnauthorizedResponse: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + tfvForbiddenResponse: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is not authorized for the action. + type: forbidden + tfvNotFoundResponse: + description: Cannot find the requested resource. + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot find the requested resource. + type: Not Found + tfvNotAllowedResponse: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Method is not allowed. + type: Method Not Allowed + tfvTooManyRequestsResponse: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Throttling error. Too many requests. + type: Too Many Requests + tfvServerErrorResponse: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Internal Server Error. + type: Internal Server Error + tfvServiceUnavailableResponse: + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Service Unavailable Error. + type: Service Unavailable parameters: accountId: in: path @@ -5227,6 +6240,22 @@ components: type: string description: The phone number lookup request ID from Bandwidth. example: 004223a0-8b17-41b1-bf81-20732adf5590 + tfPhoneNumberPathParam: + in: path + name: phoneNumber + required: true + schema: + $ref: '#/components/schemas/tfPhoneNumber' + description: Valid Toll-Free telephone number in E.164 format. + example: '+18885555555' + webhookSubscriptionIdPathParam: + in: path + name: id + required: true + schema: + type: string + description: Webhook subscription ID + example: 7bt57JcsVYJrN9K1OcV1Nu examples: smsMessageReceivedCallbackExample: summary: An example of a sms message-received callback body. @@ -5843,6 +6872,39 @@ components: $ref: '#/components/examples/singleNumberRequestExample' multipleNumberRequestExample: $ref: '#/components/examples/multipleNumberRequestExample' + requestTollFreeVerificationRequest: + description: Request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/verificationRequest' + updateTollFreeVerificationRequestRequest: + description: Update a request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tfvSubmissionWrapper' + verificationWebhookRequest: + description: Verification callback status of a toll-free phone number. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/verificationWebhook' + - $ref: '#/components/schemas/verificationDenialWebhook' + - $ref: '#/components/schemas/failureWebhook' + webhookSubscriptionRequest: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer is trying to subscribe to. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionRequestSchema' securitySchemes: Basic: type: http @@ -5913,3 +6975,43 @@ components: responses: '200': description: OK + tfVerificationStatus: + your_url.com/webhookService: + post: + summary: TFV status updates sent to customer's webhook URL. + description: >- + Unique webhook URL provided by customers to which Bandwidth sends a + POST request to notify customer regarding TFV status updates. + operationId: tfvRequest + parameters: + - description: >- + 64-character lowercase hexidecimal HMAC calculated with a shared + secret key, the canonicalized request body, and SHA256. It is + only included when a shared secret key is set through webhook + subscription. + example: ca7b9e9816c90d336f5dca529e733354b81535c7af027b81878ac98afb2dbaa2 + in: header + name: x-bandwidth-signature-hmac-sha256 + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/verificationWebhookRequest' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' diff --git a/bandwidth/__init__.py b/bandwidth/__init__.py index 6ad4b33f..90e1b7a4 100644 --- a/bandwidth/__init__.py +++ b/bandwidth/__init__.py @@ -26,6 +26,7 @@ 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 # import ApiClient @@ -41,6 +42,8 @@ # 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.bridge_complete_callback import BridgeCompleteCallback from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback @@ -66,6 +69,7 @@ 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 @@ -74,10 +78,13 @@ 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.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.initiate_callback import InitiateCallback +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 @@ -102,6 +109,7 @@ 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.opt_in_workflow import OptInWorkflow from bandwidth.models.page_info import PageInfo from bandwidth.models.priority_enum import PriorityEnum from bandwidth.models.recording_available_callback import RecordingAvailableCallback @@ -113,6 +121,14 @@ from bandwidth.models.redirect_method_enum import RedirectMethodEnum from bandwidth.models.stir_shaken import StirShaken from bandwidth.models.tag import Tag +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.tn_lookup_request_error import TnLookupRequestError from bandwidth.models.transcribe_recording import TranscribeRecording from bandwidth.models.transcription import Transcription @@ -124,7 +140,16 @@ 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 diff --git a/bandwidth/api/__init__.py b/bandwidth/api/__init__.py index e7d2d1bb..60b8fcc5 100644 --- a/bandwidth/api/__init__.py +++ b/bandwidth/api/__init__.py @@ -9,5 +9,6 @@ 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 diff --git a/bandwidth/api/toll_free_verification_api.py b/bandwidth/api/toll_free_verification_api.py new file mode 100644 index 00000000..d2523476 --- /dev/null +++ b/bandwidth/api/toll_free_verification_api.py @@ -0,0 +1,2481 @@ +# 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 warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr, field_validator +from typing import List +from typing_extensions import Annotated +from bandwidth.models.tfv_status import TfvStatus +from bandwidth.models.tfv_submission_wrapper import TfvSubmissionWrapper +from bandwidth.models.verification_request import VerificationRequest +from bandwidth.models.webhook_subscription import WebhookSubscription +from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema +from bandwidth.models.webhook_subscriptions_list_body import WebhookSubscriptionsListBody + +from bandwidth.api_client import ApiClient, RequestSerialized +from bandwidth.api_response import ApiResponse +from bandwidth.rest import RESTResponseType + + +class TollFreeVerificationApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_webhook_subscription( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + webhook_subscription_request_schema: Annotated[WebhookSubscriptionRequestSchema, Field(description="Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.")], + _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, + ) -> WebhookSubscription: + """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. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param webhook_subscription_request_schema: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + :type webhook_subscription_request_schema: WebhookSubscriptionRequestSchema + :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_webhook_subscription_serialize( + account_id=account_id, + webhook_subscription_request_schema=webhook_subscription_request_schema, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "WebhookSubscription", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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_webhook_subscription_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + webhook_subscription_request_schema: Annotated[WebhookSubscriptionRequestSchema, Field(description="Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.")], + _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[WebhookSubscription]: + """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. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param webhook_subscription_request_schema: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + :type webhook_subscription_request_schema: WebhookSubscriptionRequestSchema + :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_webhook_subscription_serialize( + account_id=account_id, + webhook_subscription_request_schema=webhook_subscription_request_schema, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "WebhookSubscription", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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_webhook_subscription_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + webhook_subscription_request_schema: Annotated[WebhookSubscriptionRequestSchema, Field(description="Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.")], + _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 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. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param webhook_subscription_request_schema: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + :type webhook_subscription_request_schema: WebhookSubscriptionRequestSchema + :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_webhook_subscription_serialize( + account_id=account_id, + webhook_subscription_request_schema=webhook_subscription_request_schema, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "WebhookSubscription", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_webhook_subscription_serialize( + self, + account_id, + webhook_subscription_request_schema, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _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 webhook_subscription_request_schema is not None: + _body_params = webhook_subscription_request_schema + + + # 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}/tollFreeVerification/webhooks/subscriptions', + 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 delete_webhook_subscription( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + id: Annotated[StrictStr, Field(description="Webhook subscription ID")], + _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, + ) -> None: + """Delete Webhook Subscription + + Delete a webhook subscription by ID. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param id: Webhook subscription ID (required) + :type id: str + :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._delete_webhook_subscription_serialize( + account_id=account_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 delete_webhook_subscription_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + id: Annotated[StrictStr, Field(description="Webhook subscription ID")], + _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[None]: + """Delete Webhook Subscription + + Delete a webhook subscription by ID. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param id: Webhook subscription ID (required) + :type id: str + :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._delete_webhook_subscription_serialize( + account_id=account_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 delete_webhook_subscription_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + id: Annotated[StrictStr, Field(description="Webhook subscription ID")], + _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: + """Delete Webhook Subscription + + Delete a webhook subscription by ID. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param id: Webhook subscription ID (required) + :type id: str + :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._delete_webhook_subscription_serialize( + account_id=account_id, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_webhook_subscription_serialize( + self, + account_id, + id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Basic' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}', + 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_toll_free_verification_status( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + phone_number: Annotated[str, Field(min_length=12, strict=True, max_length=12, description="Valid Toll-Free telephone number in E.164 format.")], + _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, + ) -> TfvStatus: + """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. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param phone_number: Valid Toll-Free telephone number in E.164 format. (required) + :type phone_number: str + :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._get_toll_free_verification_status_serialize( + account_id=account_id, + phone_number=phone_number, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TfvStatus", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 get_toll_free_verification_status_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + phone_number: Annotated[str, Field(min_length=12, strict=True, max_length=12, description="Valid Toll-Free telephone number in E.164 format.")], + _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[TfvStatus]: + """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. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param phone_number: Valid Toll-Free telephone number in E.164 format. (required) + :type phone_number: str + :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._get_toll_free_verification_status_serialize( + account_id=account_id, + phone_number=phone_number, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TfvStatus", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 get_toll_free_verification_status_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + phone_number: Annotated[str, Field(min_length=12, strict=True, max_length=12, description="Valid Toll-Free telephone number in E.164 format.")], + _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: + """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. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param phone_number: Valid Toll-Free telephone number in E.164 format. (required) + :type phone_number: str + :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._get_toll_free_verification_status_serialize( + account_id=account_id, + phone_number=phone_number, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TfvStatus", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_toll_free_verification_status_serialize( + self, + account_id, + phone_number, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + if phone_number is not None: + _path_params['phoneNumber'] = phone_number + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Basic' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification', + 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 list_toll_free_use_cases( + self, + _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, + ) -> List[str]: + """List Toll-Free Use Cases + + Lists valid toll-free use cases. + + :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._list_toll_free_use_cases_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 list_toll_free_use_cases_with_http_info( + self, + _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[List[str]]: + """List Toll-Free Use Cases + + Lists valid toll-free use cases. + + :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._list_toll_free_use_cases_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 list_toll_free_use_cases_without_preload_content( + self, + _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: + """List Toll-Free Use Cases + + Lists valid toll-free use cases. + + :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._list_toll_free_use_cases_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_toll_free_use_cases_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Basic' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/tollFreeVerification/useCases', + 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 list_webhook_subscriptions( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + _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, + ) -> WebhookSubscriptionsListBody: + """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). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :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._list_webhook_subscriptions_serialize( + account_id=account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookSubscriptionsListBody", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 list_webhook_subscriptions_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + _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[WebhookSubscriptionsListBody]: + """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). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :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._list_webhook_subscriptions_serialize( + account_id=account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookSubscriptionsListBody", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 list_webhook_subscriptions_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + _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: + """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). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :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._list_webhook_subscriptions_serialize( + account_id=account_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookSubscriptionsListBody", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_webhook_subscriptions_serialize( + self, + account_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _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 + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'Basic' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions', + 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 request_toll_free_verification( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + verification_request: Annotated[VerificationRequest, Field(description="Request for verification of a toll-free phone number.")], + _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, + ) -> None: + """Request Toll-Free Verification + + Submit a request for verification of a toll-free phone number. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param verification_request: Request for verification of a toll-free phone number. (required) + :type verification_request: VerificationRequest + :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._request_toll_free_verification_serialize( + account_id=account_id, + verification_request=verification_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 request_toll_free_verification_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + verification_request: Annotated[VerificationRequest, Field(description="Request for verification of a toll-free phone number.")], + _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[None]: + """Request Toll-Free Verification + + Submit a request for verification of a toll-free phone number. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param verification_request: Request for verification of a toll-free phone number. (required) + :type verification_request: VerificationRequest + :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._request_toll_free_verification_serialize( + account_id=account_id, + verification_request=verification_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 request_toll_free_verification_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + verification_request: Annotated[VerificationRequest, Field(description="Request for verification of a toll-free phone number.")], + _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: + """Request Toll-Free Verification + + Submit a request for verification of a toll-free phone number. + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param verification_request: Request for verification of a toll-free phone number. (required) + :type verification_request: VerificationRequest + :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._request_toll_free_verification_serialize( + account_id=account_id, + verification_request=verification_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _request_toll_free_verification_serialize( + self, + account_id, + verification_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _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 verification_request is not None: + _body_params = verification_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}/tollFreeVerification', + 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 update_toll_free_verification_request( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + phone_number: Annotated[str, Field(min_length=12, strict=True, max_length=12, description="Valid Toll-Free telephone number in E.164 format.")], + tfv_submission_wrapper: Annotated[TfvSubmissionWrapper, Field(description="Update a request for verification of a toll-free phone number.")], + _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, + ) -> None: + """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). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param phone_number: Valid Toll-Free telephone number in E.164 format. (required) + :type phone_number: str + :param tfv_submission_wrapper: Update a request for verification of a toll-free phone number. (required) + :type tfv_submission_wrapper: TfvSubmissionWrapper + :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._update_toll_free_verification_request_serialize( + account_id=account_id, + phone_number=phone_number, + tfv_submission_wrapper=tfv_submission_wrapper, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 update_toll_free_verification_request_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + phone_number: Annotated[str, Field(min_length=12, strict=True, max_length=12, description="Valid Toll-Free telephone number in E.164 format.")], + tfv_submission_wrapper: Annotated[TfvSubmissionWrapper, Field(description="Update a request for verification of a toll-free phone number.")], + _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[None]: + """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). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param phone_number: Valid Toll-Free telephone number in E.164 format. (required) + :type phone_number: str + :param tfv_submission_wrapper: Update a request for verification of a toll-free phone number. (required) + :type tfv_submission_wrapper: TfvSubmissionWrapper + :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._update_toll_free_verification_request_serialize( + account_id=account_id, + phone_number=phone_number, + tfv_submission_wrapper=tfv_submission_wrapper, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 update_toll_free_verification_request_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + phone_number: Annotated[str, Field(min_length=12, strict=True, max_length=12, description="Valid Toll-Free telephone number in E.164 format.")], + tfv_submission_wrapper: Annotated[TfvSubmissionWrapper, Field(description="Update a request for verification of a toll-free phone number.")], + _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: + """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). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param phone_number: Valid Toll-Free telephone number in E.164 format. (required) + :type phone_number: str + :param tfv_submission_wrapper: Update a request for verification of a toll-free phone number. (required) + :type tfv_submission_wrapper: TfvSubmissionWrapper + :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._update_toll_free_verification_request_serialize( + account_id=account_id, + phone_number=phone_number, + tfv_submission_wrapper=tfv_submission_wrapper, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '202': None, + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_toll_free_verification_request_serialize( + self, + account_id, + phone_number, + tfv_submission_wrapper, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + if phone_number is not None: + _path_params['phoneNumber'] = phone_number + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if tfv_submission_wrapper is not None: + _body_params = tfv_submission_wrapper + + + # 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='PUT', + resource_path='/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification', + 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 update_webhook_subscription( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + id: Annotated[StrictStr, Field(description="Webhook subscription ID")], + webhook_subscription_request_schema: Annotated[WebhookSubscriptionRequestSchema, Field(description="Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.")], + _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, + ) -> WebhookSubscription: + """Update Webhook Subscription + + Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param id: Webhook subscription ID (required) + :type id: str + :param webhook_subscription_request_schema: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + :type webhook_subscription_request_schema: WebhookSubscriptionRequestSchema + :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._update_webhook_subscription_serialize( + account_id=account_id, + id=id, + webhook_subscription_request_schema=webhook_subscription_request_schema, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookSubscription", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 update_webhook_subscription_with_http_info( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + id: Annotated[StrictStr, Field(description="Webhook subscription ID")], + webhook_subscription_request_schema: Annotated[WebhookSubscriptionRequestSchema, Field(description="Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.")], + _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[WebhookSubscription]: + """Update Webhook Subscription + + Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param id: Webhook subscription ID (required) + :type id: str + :param webhook_subscription_request_schema: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + :type webhook_subscription_request_schema: WebhookSubscriptionRequestSchema + :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._update_webhook_subscription_serialize( + account_id=account_id, + id=id, + webhook_subscription_request_schema=webhook_subscription_request_schema, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookSubscription", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + 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 update_webhook_subscription_without_preload_content( + self, + account_id: Annotated[StrictStr, Field(description="Your Bandwidth Account ID.")], + id: Annotated[StrictStr, Field(description="Webhook subscription ID")], + webhook_subscription_request_schema: Annotated[WebhookSubscriptionRequestSchema, Field(description="Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to.")], + _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: + """Update Webhook Subscription + + Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + + :param account_id: Your Bandwidth Account ID. (required) + :type account_id: str + :param id: Webhook subscription ID (required) + :type id: str + :param webhook_subscription_request_schema: Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. (required) + :type webhook_subscription_request_schema: WebhookSubscriptionRequestSchema + :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._update_webhook_subscription_serialize( + account_id=account_id, + id=id, + webhook_subscription_request_schema=webhook_subscription_request_schema, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "WebhookSubscription", + '400': "TfvError", + '401': "TfvError", + '403': "TfvError", + '404': "TfvError", + '405': "TfvError", + '429': "TfvError", + '500': "TfvError", + '503': "TfvError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_webhook_subscription_serialize( + self, + account_id, + id, + webhook_subscription_request_schema, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _hosts = [ + 'https://api.bandwidth.com/api/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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if account_id is not None: + _path_params['accountId'] = account_id + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if webhook_subscription_request_schema is not None: + _body_params = webhook_subscription_request_schema + + + # 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='PUT', + resource_path='/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}', + 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 + ) + + diff --git a/bandwidth/models/__init__.py b/bandwidth/models/__init__.py index c92ffced..adb1705b 100644 --- a/bandwidth/models/__init__.py +++ b/bandwidth/models/__init__.py @@ -16,6 +16,8 @@ # 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.bridge_complete_callback import BridgeCompleteCallback from bandwidth.models.bridge_target_complete_callback import BridgeTargetCompleteCallback @@ -41,6 +43,7 @@ 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 @@ -49,10 +52,13 @@ 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.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.initiate_callback import InitiateCallback +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 @@ -77,6 +83,7 @@ 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.opt_in_workflow import OptInWorkflow from bandwidth.models.page_info import PageInfo from bandwidth.models.priority_enum import PriorityEnum from bandwidth.models.recording_available_callback import RecordingAvailableCallback @@ -88,6 +95,14 @@ from bandwidth.models.redirect_method_enum import RedirectMethodEnum from bandwidth.models.stir_shaken import StirShaken from bandwidth.models.tag import Tag +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.tn_lookup_request_error import TnLookupRequestError from bandwidth.models.transcribe_recording import TranscribeRecording from bandwidth.models.transcription import Transcription @@ -99,7 +114,16 @@ 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 diff --git a/bandwidth/models/additional_denial_reason.py b/bandwidth/models/additional_denial_reason.py new file mode 100644 index 00000000..12d662f4 --- /dev/null +++ b/bandwidth/models/additional_denial_reason.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, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AdditionalDenialReason(BaseModel): + """ + AdditionalDenialReason + """ # noqa: E501 + status_code: StrictInt = Field(description="Reason code for denial.", alias="statusCode") + reason: StrictStr = Field(description="Explanation for why a verification request was declined.") + resubmit_allowed: StrictBool = Field(description="Whether a Toll-Free Verification request qualifies for resubmission via PUT.", alias="resubmitAllowed") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["statusCode", "reason", "resubmitAllowed"] + + 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 AdditionalDenialReason 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 AdditionalDenialReason from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "statusCode": obj.get("statusCode"), + "reason": obj.get("reason"), + "resubmitAllowed": obj.get("resubmitAllowed") + }) + # 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/address.py b/bandwidth/models/address.py new file mode 100644 index 00000000..a74c07fa --- /dev/null +++ b/bandwidth/models/address.py @@ -0,0 +1,126 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class Address(BaseModel): + """ + Address + """ # noqa: E501 + name: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="The name of the business using the toll-free number.") + addr1: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="The address of the business using the toll-free number.") + addr2: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="The address of the business using the toll-free number.") + city: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="The city of the business using the toll-free number.") + state: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="The state of the business using the toll-free number.") + zip: Annotated[str, Field(strict=True)] = Field(description="The zip of the business using the toll-free number.") + url: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="The website of the business using the toll-free number.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "addr1", "addr2", "city", "state", "zip", "url"] + + @field_validator('zip') + def zip_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"[- A-Za-z0-9]{0,500}", value): + raise ValueError(r"must validate the regular expression /[- A-Za-z0-9]{0,500}/") + return value + + 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 Address 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 + + # set to None if addr2 (nullable) is None + # and model_fields_set contains the field + if self.addr2 is None and "addr2" in self.model_fields_set: + _dict['addr2'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Address from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "addr1": obj.get("addr1"), + "addr2": obj.get("addr2"), + "city": obj.get("city"), + "state": obj.get("state"), + "zip": obj.get("zip"), + "url": obj.get("url") + }) + # 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/contact.py b/bandwidth/models/contact.py new file mode 100644 index 00000000..426b3ed9 --- /dev/null +++ b/bandwidth/models/contact.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, 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 Contact(BaseModel): + """ + Contact + """ # noqa: E501 + first_name: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="The first name of the business contact using the toll-free number.", alias="firstName") + last_name: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="The last name of the business contact using the toll-free number.", alias="lastName") + email: Annotated[str, Field(min_length=0, strict=True, max_length=500)] + phone_number: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="Contact telephone number", alias="phoneNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["firstName", "lastName", "email", "phoneNumber"] + + @field_validator('email') + def email_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^(?:[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$", value): + raise ValueError(r"must validate the regular expression /^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/") + return value + + 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 Contact 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 Contact from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "email": obj.get("email"), + "phoneNumber": obj.get("phoneNumber") + }) + # 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/error.py b/bandwidth/models/error.py new file mode 100644 index 00000000..de70c7fe --- /dev/null +++ b/bandwidth/models/error.py @@ -0,0 +1,113 @@ +# 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 bandwidth.models.telephone_number import TelephoneNumber +from typing import Optional, Set +from typing_extensions import Self + +class Error(BaseModel): + """ + Error + """ # noqa: E501 + code: Optional[StrictInt] = None + description: Optional[StrictStr] = None + telephone_numbers: Optional[List[TelephoneNumber]] = Field(default=None, alias="telephoneNumbers") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "description", "telephoneNumbers"] + + 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 Error 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 telephone_numbers (list) + _items = [] + if self.telephone_numbers: + for _item in self.telephone_numbers: + if _item: + _items.append(_item.to_dict()) + _dict['telephoneNumbers'] = _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 Error 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"), + "telephoneNumbers": [TelephoneNumber.from_dict(_item) for _item in obj["telephoneNumbers"]] if obj.get("telephoneNumbers") 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/failure_webhook.py b/bandwidth/models/failure_webhook.py new file mode 100644 index 00000000..c3798d1b --- /dev/null +++ b/bandwidth/models/failure_webhook.py @@ -0,0 +1,122 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class FailureWebhook(BaseModel): + """ + FailureWebhook + """ # noqa: E501 + 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") + 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_description: Optional[StrictStr] = Field(default=None, description="A description of the error that was encountered.", alias="errorDescription") + 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") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["accountId", "phoneNumber", "errorCode", "errorDescription", "errors", "internalTicketNumber"] + + @field_validator('phone_number') + def phone_number_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$", value): + raise ValueError(r"must validate the regular expression /^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/") + return value + + 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 FailureWebhook 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 FailureWebhook from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountId": obj.get("accountId"), + "phoneNumber": obj.get("phoneNumber"), + "errorCode": obj.get("errorCode"), + "errorDescription": obj.get("errorDescription"), + "errors": obj.get("errors"), + "internalTicketNumber": obj.get("internalTicketNumber") + }) + # 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/links_object.py b/bandwidth/models/links_object.py new file mode 100644 index 00000000..d1a9464a --- /dev/null +++ b/bandwidth/models/links_object.py @@ -0,0 +1,107 @@ +# 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 LinksObject(BaseModel): + """ + LinksObject + """ # noqa: E501 + first: Optional[StrictStr] = Field(default=None, description="The first (or only) page of results matching the query.") + next: Optional[StrictStr] = Field(default=None, description="If more results exist than specified by 'size', this link returns the next page of 'size' results.") + previous: Optional[StrictStr] = Field(default=None, description="If the results are more than one page, this link returns the previous page of 'size' results.") + last: Optional[StrictStr] = Field(default=None, description="If more results exist than specified by 'size', this link return the last page of result.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["first", "next", "previous", "last"] + + 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 LinksObject 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 LinksObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "first": obj.get("first"), + "next": obj.get("next"), + "previous": obj.get("previous"), + "last": obj.get("last") + }) + # 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/opt_in_workflow.py b/bandwidth/models/opt_in_workflow.py new file mode 100644 index 00000000..fbae5303 --- /dev/null +++ b/bandwidth/models/opt_in_workflow.py @@ -0,0 +1,104 @@ +# 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, 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 OptInWorkflow(BaseModel): + """ + OptInWorkflow + """ # noqa: E501 + description: Annotated[str, Field(min_length=1, strict=True, max_length=500)] + image_urls: List[Annotated[str, Field(min_length=1, strict=True, max_length=500)]] = Field(alias="imageUrls") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["description", "imageUrls"] + + 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 OptInWorkflow 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 OptInWorkflow from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "description": obj.get("description"), + "imageUrls": obj.get("imageUrls") + }) + # 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/telephone_number.py b/bandwidth/models/telephone_number.py new file mode 100644 index 00000000..1c49dd00 --- /dev/null +++ b/bandwidth/models/telephone_number.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 + + +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 TelephoneNumber(BaseModel): + """ + TelephoneNumber + """ # noqa: E501 + telephone_number: Optional[StrictStr] = Field(default=None, description="Simple Telephone Number.", alias="telephoneNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["telephoneNumber"] + + 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 TelephoneNumber 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 TelephoneNumber from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "telephoneNumber": obj.get("telephoneNumber") + }) + # 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/tfv_basic_authentication.py b/bandwidth/models/tfv_basic_authentication.py new file mode 100644 index 00000000..c5fbe43d --- /dev/null +++ b/bandwidth/models/tfv_basic_authentication.py @@ -0,0 +1,104 @@ +# 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 +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class TfvBasicAuthentication(BaseModel): + """ + TfvBasicAuthentication + """ # noqa: E501 + username: Annotated[str, Field(strict=True, max_length=100)] + password: Annotated[str, Field(strict=True, max_length=200)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["username", "password"] + + 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 TfvBasicAuthentication 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 TfvBasicAuthentication from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "username": obj.get("username"), + "password": obj.get("password") + }) + # 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/tfv_callback_status_enum.py b/bandwidth/models/tfv_callback_status_enum.py new file mode 100644 index 00000000..ed65c98d --- /dev/null +++ b/bandwidth/models/tfv_callback_status_enum.py @@ -0,0 +1,38 @@ +# 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 TfvCallbackStatusEnum(str, Enum): + """ + TfvCallbackStatusEnum + """ + + """ + allowed enum values + """ + VERIFIED = 'VERIFIED' + UNVERIFIED = 'UNVERIFIED' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TfvCallbackStatusEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/tfv_error.py b/bandwidth/models/tfv_error.py new file mode 100644 index 00000000..73654fda --- /dev/null +++ b/bandwidth/models/tfv_error.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 TfvError(BaseModel): + """ + A generic error object. + """ # noqa: E501 + type: Optional[StrictStr] = None + description: Optional[StrictStr] = None + errors: Optional[Dict[str, Any]] = Field(default=None, description="Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "description", "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 TfvError 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 TfvError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "description": obj.get("description"), + "errors": obj.get("errors") + }) + # 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/tfv_status.py b/bandwidth/models/tfv_status.py new file mode 100644 index 00000000..ef40ce5c --- /dev/null +++ b/bandwidth/models/tfv_status.py @@ -0,0 +1,132 @@ +# 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 datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.tfv_status_enum import TfvStatusEnum +from bandwidth.models.tfv_submission_info import TfvSubmissionInfo +from typing import Optional, Set +from typing_extensions import Self + +class TfvStatus(BaseModel): + """ + TfvStatus + """ # 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") + 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") + modified_date_time: Optional[datetime] = Field(default=None, description="Date and time the verification request was last modified.", alias="modifiedDateTime") + submission: Optional[TfvSubmissionInfo] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["phoneNumber", "status", "internalTicketNumber", "declineReasonDescription", "resubmitAllowed", "createdDateTime", "modifiedDateTime", "submission"] + + @field_validator('phone_number') + def phone_number_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$", value): + raise ValueError(r"must validate the regular expression /^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/") + return value + + 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 TfvStatus 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 submission + if self.submission: + _dict['submission'] = self.submission.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 TfvStatus from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "phoneNumber": obj.get("phoneNumber"), + "status": obj.get("status"), + "internalTicketNumber": obj.get("internalTicketNumber"), + "declineReasonDescription": obj.get("declineReasonDescription"), + "resubmitAllowed": obj.get("resubmitAllowed"), + "createdDateTime": obj.get("createdDateTime"), + "modifiedDateTime": obj.get("modifiedDateTime"), + "submission": TfvSubmissionInfo.from_dict(obj["submission"]) if obj.get("submission") 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/tfv_status_enum.py b/bandwidth/models/tfv_status_enum.py new file mode 100644 index 00000000..61607290 --- /dev/null +++ b/bandwidth/models/tfv_status_enum.py @@ -0,0 +1,41 @@ +# 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 TfvStatusEnum(str, Enum): + """ + TfvStatusEnum + """ + + """ + allowed enum values + """ + VERIFIED = 'VERIFIED' + UNVERIFIED = 'UNVERIFIED' + PENDING = 'PENDING' + PARTIALLY_VERIFIED = 'PARTIALLY_VERIFIED' + INVALID_STATUS = 'INVALID_STATUS' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TfvStatusEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/tfv_submission_info.py b/bandwidth/models/tfv_submission_info.py new file mode 100644 index 00000000..28a94d62 --- /dev/null +++ b/bandwidth/models/tfv_submission_info.py @@ -0,0 +1,140 @@ +# 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 typing_extensions import Annotated +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow +from typing import Optional, Set +from typing_extensions import Self + +class TfvSubmissionInfo(BaseModel): + """ + TfvSubmissionInfo + """ # noqa: E501 + business_address: Optional[Address] = Field(default=None, alias="businessAddress") + business_contact: Optional[Contact] = Field(default=None, alias="businessContact") + message_volume: Optional[Annotated[int, Field(le=10000000, strict=True, ge=10)]] = Field(default=None, description="Estimated monthly volume of messages from the toll-free number.", alias="messageVolume") + use_case: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="The category of the use case.", alias="useCase") + use_case_summary: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="A general idea of the use case and customer.", alias="useCaseSummary") + production_message_content: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="Example of message content.", alias="productionMessageContent") + opt_in_workflow: Optional[OptInWorkflow] = Field(default=None, alias="optInWorkflow") + additional_information: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="Any additional information.", alias="additionalInformation") + isv_reseller: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="ISV name.", alias="isvReseller") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller"] + + 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 TfvSubmissionInfo 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 business_address + if self.business_address: + _dict['businessAddress'] = self.business_address.to_dict() + # override the default output from pydantic by calling `to_dict()` of business_contact + if self.business_contact: + _dict['businessContact'] = self.business_contact.to_dict() + # override the default output from pydantic by calling `to_dict()` of opt_in_workflow + if self.opt_in_workflow: + _dict['optInWorkflow'] = self.opt_in_workflow.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 + + # set to None if additional_information (nullable) is None + # and model_fields_set contains the field + if self.additional_information is None and "additional_information" in self.model_fields_set: + _dict['additionalInformation'] = None + + # set to None if isv_reseller (nullable) is None + # and model_fields_set contains the field + if self.isv_reseller is None and "isv_reseller" in self.model_fields_set: + _dict['isvReseller'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TfvSubmissionInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "businessAddress": Address.from_dict(obj["businessAddress"]) if obj.get("businessAddress") is not None else None, + "businessContact": Contact.from_dict(obj["businessContact"]) if obj.get("businessContact") is not None else None, + "messageVolume": obj.get("messageVolume"), + "useCase": obj.get("useCase"), + "useCaseSummary": obj.get("useCaseSummary"), + "productionMessageContent": obj.get("productionMessageContent"), + "optInWorkflow": OptInWorkflow.from_dict(obj["optInWorkflow"]) if obj.get("optInWorkflow") is not None else None, + "additionalInformation": obj.get("additionalInformation"), + "isvReseller": obj.get("isvReseller") + }) + # 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/tfv_submission_wrapper.py b/bandwidth/models/tfv_submission_wrapper.py new file mode 100644 index 00000000..7325e420 --- /dev/null +++ b/bandwidth/models/tfv_submission_wrapper.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 +from typing import Any, ClassVar, Dict, List, Optional +from bandwidth.models.verification_update_request import VerificationUpdateRequest +from typing import Optional, Set +from typing_extensions import Self + +class TfvSubmissionWrapper(BaseModel): + """ + TfvSubmissionWrapper + """ # noqa: E501 + submission: Optional[VerificationUpdateRequest] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["submission"] + + 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 TfvSubmissionWrapper 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 submission + if self.submission: + _dict['submission'] = self.submission.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 TfvSubmissionWrapper from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "submission": VerificationUpdateRequest.from_dict(obj["submission"]) if obj.get("submission") 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/verification_denial_webhook.py b/bandwidth/models/verification_denial_webhook.py new file mode 100644 index 00000000..98136d20 --- /dev/null +++ b/bandwidth/models/verification_denial_webhook.py @@ -0,0 +1,134 @@ +# 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.additional_denial_reason import AdditionalDenialReason +from typing import Optional, Set +from typing_extensions import Self + +class VerificationDenialWebhook(BaseModel): + """ + VerificationDenialWebhook + """ # noqa: E501 + account_id: Optional[StrictStr] = Field(default=None, description="User's account ID.", alias="accountId") + 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") + 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' + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["accountId", "additionalDenialReasons", "declineReasonDescription", "denialStatusCode", "internalTicketNumber", "phoneNumber", "resubmitAllowed", "status"] + + @field_validator('phone_number') + def phone_number_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$", value): + raise ValueError(r"must validate the regular expression /^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/") + return value + + 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 VerificationDenialWebhook 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 additional_denial_reasons (list) + _items = [] + if self.additional_denial_reasons: + for _item in self.additional_denial_reasons: + if _item: + _items.append(_item.to_dict()) + _dict['additionalDenialReasons'] = _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 VerificationDenialWebhook from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountId": obj.get("accountId"), + "additionalDenialReasons": [AdditionalDenialReason.from_dict(_item) for _item in obj["additionalDenialReasons"]] if obj.get("additionalDenialReasons") is not None else None, + "declineReasonDescription": obj.get("declineReasonDescription"), + "denialStatusCode": obj.get("denialStatusCode"), + "internalTicketNumber": obj.get("internalTicketNumber"), + "phoneNumber": obj.get("phoneNumber"), + "resubmitAllowed": obj.get("resubmitAllowed"), + "status": obj.get("status") if obj.get("status") is not None else 'UNVERIFIED' + }) + # 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/verification_request.py b/bandwidth/models/verification_request.py new file mode 100644 index 00000000..b561d66f --- /dev/null +++ b/bandwidth/models/verification_request.py @@ -0,0 +1,142 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow +from typing import Optional, Set +from typing_extensions import Self + +class VerificationRequest(BaseModel): + """ + VerificationRequest + """ # noqa: E501 + business_address: Address = Field(alias="businessAddress") + business_contact: Contact = Field(alias="businessContact") + message_volume: Annotated[int, Field(le=10000000, strict=True, ge=10)] = Field(description="Estimated monthly volume of messages from the toll-free number.", alias="messageVolume") + phone_numbers: Annotated[List[Annotated[str, Field(min_length=12, strict=True, max_length=12)]], Field(min_length=1, max_length=10)] = Field(alias="phoneNumbers") + use_case: Annotated[str, Field(min_length=0, strict=True, max_length=500)] = Field(description="The category of the use case.", alias="useCase") + use_case_summary: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="A general idea of the use case and customer.", alias="useCaseSummary") + production_message_content: Annotated[str, Field(min_length=1, strict=True, max_length=500)] = Field(description="Example of message content.", alias="productionMessageContent") + opt_in_workflow: OptInWorkflow = Field(alias="optInWorkflow") + additional_information: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="Any additional information.", alias="additionalInformation") + isv_reseller: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="ISV name.", alias="isvReseller") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "phoneNumbers", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller"] + + 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 VerificationRequest 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 business_address + if self.business_address: + _dict['businessAddress'] = self.business_address.to_dict() + # override the default output from pydantic by calling `to_dict()` of business_contact + if self.business_contact: + _dict['businessContact'] = self.business_contact.to_dict() + # override the default output from pydantic by calling `to_dict()` of opt_in_workflow + if self.opt_in_workflow: + _dict['optInWorkflow'] = self.opt_in_workflow.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 + + # set to None if additional_information (nullable) is None + # and model_fields_set contains the field + if self.additional_information is None and "additional_information" in self.model_fields_set: + _dict['additionalInformation'] = None + + # set to None if isv_reseller (nullable) is None + # and model_fields_set contains the field + if self.isv_reseller is None and "isv_reseller" in self.model_fields_set: + _dict['isvReseller'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VerificationRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "businessAddress": Address.from_dict(obj["businessAddress"]) if obj.get("businessAddress") is not None else None, + "businessContact": Contact.from_dict(obj["businessContact"]) if obj.get("businessContact") is not None else None, + "messageVolume": obj.get("messageVolume"), + "phoneNumbers": obj.get("phoneNumbers"), + "useCase": obj.get("useCase"), + "useCaseSummary": obj.get("useCaseSummary"), + "productionMessageContent": obj.get("productionMessageContent"), + "optInWorkflow": OptInWorkflow.from_dict(obj["optInWorkflow"]) if obj.get("optInWorkflow") is not None else None, + "additionalInformation": obj.get("additionalInformation"), + "isvReseller": obj.get("isvReseller") + }) + # 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/verification_update_request.py b/bandwidth/models/verification_update_request.py new file mode 100644 index 00000000..f71107ca --- /dev/null +++ b/bandwidth/models/verification_update_request.py @@ -0,0 +1,140 @@ +# 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 typing_extensions import Annotated +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow +from typing import Optional, Set +from typing_extensions import Self + +class VerificationUpdateRequest(BaseModel): + """ + VerificationUpdateRequest + """ # noqa: E501 + business_address: Address = Field(alias="businessAddress") + business_contact: Contact = Field(alias="businessContact") + message_volume: Annotated[int, Field(le=10000000, strict=True, ge=10)] = Field(description="Estimated monthly volume of messages from the toll-free number.", alias="messageVolume") + use_case: Annotated[str, Field(min_length=0, strict=True, max_length=500)] = Field(description="The category of the use case.", alias="useCase") + use_case_summary: Annotated[str, Field(min_length=0, strict=True, max_length=500)] = Field(description="A general idea of the use case and customer.", alias="useCaseSummary") + production_message_content: Annotated[str, Field(min_length=0, strict=True, max_length=500)] = Field(description="Example of message content.", alias="productionMessageContent") + opt_in_workflow: OptInWorkflow = Field(alias="optInWorkflow") + additional_information: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="Any additional information.", alias="additionalInformation") + isv_reseller: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=500)]] = Field(default=None, description="ISV name.", alias="isvReseller") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["businessAddress", "businessContact", "messageVolume", "useCase", "useCaseSummary", "productionMessageContent", "optInWorkflow", "additionalInformation", "isvReseller"] + + 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 VerificationUpdateRequest 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 business_address + if self.business_address: + _dict['businessAddress'] = self.business_address.to_dict() + # override the default output from pydantic by calling `to_dict()` of business_contact + if self.business_contact: + _dict['businessContact'] = self.business_contact.to_dict() + # override the default output from pydantic by calling `to_dict()` of opt_in_workflow + if self.opt_in_workflow: + _dict['optInWorkflow'] = self.opt_in_workflow.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 + + # set to None if additional_information (nullable) is None + # and model_fields_set contains the field + if self.additional_information is None and "additional_information" in self.model_fields_set: + _dict['additionalInformation'] = None + + # set to None if isv_reseller (nullable) is None + # and model_fields_set contains the field + if self.isv_reseller is None and "isv_reseller" in self.model_fields_set: + _dict['isvReseller'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VerificationUpdateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "businessAddress": Address.from_dict(obj["businessAddress"]) if obj.get("businessAddress") is not None else None, + "businessContact": Contact.from_dict(obj["businessContact"]) if obj.get("businessContact") is not None else None, + "messageVolume": obj.get("messageVolume"), + "useCase": obj.get("useCase"), + "useCaseSummary": obj.get("useCaseSummary"), + "productionMessageContent": obj.get("productionMessageContent"), + "optInWorkflow": OptInWorkflow.from_dict(obj["optInWorkflow"]) if obj.get("optInWorkflow") is not None else None, + "additionalInformation": obj.get("additionalInformation"), + "isvReseller": obj.get("isvReseller") + }) + # 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/verification_webhook.py b/bandwidth/models/verification_webhook.py new file mode 100644 index 00000000..458fa3af --- /dev/null +++ b/bandwidth/models/verification_webhook.py @@ -0,0 +1,119 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.tfv_callback_status_enum import TfvCallbackStatusEnum +from typing import Optional, Set +from typing_extensions import Self + +class VerificationWebhook(BaseModel): + """ + VerificationWebhook + """ # noqa: E501 + 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") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["accountId", "phoneNumber", "status", "internalTicketNumber"] + + @field_validator('phone_number') + def phone_number_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$", value): + raise ValueError(r"must validate the regular expression /^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/") + return value + + 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 VerificationWebhook 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 VerificationWebhook from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountId": obj.get("accountId"), + "phoneNumber": obj.get("phoneNumber"), + "status": obj.get("status"), + "internalTicketNumber": obj.get("internalTicketNumber") + }) + # 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/webhook_subscription.py b/bandwidth/models/webhook_subscription.py new file mode 100644 index 00000000..a32189c9 --- /dev/null +++ b/bandwidth/models/webhook_subscription.py @@ -0,0 +1,135 @@ +# 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 datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication +from bandwidth.models.webhook_subscription_type_enum import WebhookSubscriptionTypeEnum +from typing import Optional, Set +from typing_extensions import Self + +class WebhookSubscription(BaseModel): + """ + Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to. + """ # noqa: E501 + id: Optional[StrictStr] = None + account_id: Optional[StrictStr] = Field(default=None, alias="accountId") + callback_url: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=2000)]] = Field(description="Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID.", alias="callbackUrl") + type: Optional[WebhookSubscriptionTypeEnum] = None + basic_authentication: Optional[WebhookSubscriptionBasicAuthentication] = Field(default=None, alias="basicAuthentication") + created_date: Optional[datetime] = Field(default=None, alias="createdDate") + modified_date: Optional[datetime] = Field(default=None, alias="modifiedDate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "accountId", "callbackUrl", "type", "basicAuthentication", "createdDate", "modifiedDate"] + + @field_validator('callback_url') + def callback_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)", value): + raise ValueError(r"must validate the regular expression /^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/") + return value + + 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 WebhookSubscription 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 basic_authentication + if self.basic_authentication: + _dict['basicAuthentication'] = self.basic_authentication.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 + + # set to None if callback_url (nullable) is None + # and model_fields_set contains the field + if self.callback_url is None and "callback_url" in self.model_fields_set: + _dict['callbackUrl'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WebhookSubscription from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "accountId": obj.get("accountId"), + "callbackUrl": obj.get("callbackUrl"), + "type": obj.get("type"), + "basicAuthentication": WebhookSubscriptionBasicAuthentication.from_dict(obj["basicAuthentication"]) if obj.get("basicAuthentication") is not None else None, + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate") + }) + # 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/webhook_subscription_basic_authentication.py b/bandwidth/models/webhook_subscription_basic_authentication.py new file mode 100644 index 00000000..e5e906bd --- /dev/null +++ b/bandwidth/models/webhook_subscription_basic_authentication.py @@ -0,0 +1,104 @@ +# 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 +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class WebhookSubscriptionBasicAuthentication(BaseModel): + """ + Basic authentication credentials are not required, but if present, both username and password must be provided. + """ # noqa: E501 + username: Annotated[str, Field(strict=True, max_length=100)] + password: Annotated[str, Field(strict=True, max_length=200)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["username", "password"] + + 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 WebhookSubscriptionBasicAuthentication 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 WebhookSubscriptionBasicAuthentication from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "username": obj.get("username"), + "password": obj.get("password") + }) + # 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/webhook_subscription_request_schema.py b/bandwidth/models/webhook_subscription_request_schema.py new file mode 100644 index 00000000..1db18b8a --- /dev/null +++ b/bandwidth/models/webhook_subscription_request_schema.py @@ -0,0 +1,140 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from bandwidth.models.tfv_basic_authentication import TfvBasicAuthentication +from typing import Optional, Set +from typing_extensions import Self + +class WebhookSubscriptionRequestSchema(BaseModel): + """ + WebhookSubscriptionRequestSchema + """ # noqa: E501 + basic_authentication: Optional[TfvBasicAuthentication] = Field(default=None, alias="basicAuthentication") + callback_url: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=2000)]] = Field(description="Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID.", alias="callbackUrl") + shared_secret_key: Optional[Annotated[str, Field(min_length=16, strict=True, max_length=64)]] = Field(default=None, description="An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks.", alias="sharedSecretKey") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["basicAuthentication", "callbackUrl", "sharedSecretKey"] + + @field_validator('callback_url') + def callback_url_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)", value): + raise ValueError(r"must validate the regular expression /^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&\/\/=]*)/") + return value + + @field_validator('shared_secret_key') + def shared_secret_key_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[ -~]{16,64}$", value): + raise ValueError(r"must validate the regular expression /^[ -~]{16,64}$/") + return value + + 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 WebhookSubscriptionRequestSchema 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 basic_authentication + if self.basic_authentication: + _dict['basicAuthentication'] = self.basic_authentication.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 + + # set to None if callback_url (nullable) is None + # and model_fields_set contains the field + if self.callback_url is None and "callback_url" in self.model_fields_set: + _dict['callbackUrl'] = None + + # set to None if shared_secret_key (nullable) is None + # and model_fields_set contains the field + if self.shared_secret_key is None and "shared_secret_key" in self.model_fields_set: + _dict['sharedSecretKey'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WebhookSubscriptionRequestSchema from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "basicAuthentication": TfvBasicAuthentication.from_dict(obj["basicAuthentication"]) if obj.get("basicAuthentication") is not None else None, + "callbackUrl": obj.get("callbackUrl"), + "sharedSecretKey": obj.get("sharedSecretKey") + }) + # 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/webhook_subscription_type_enum.py b/bandwidth/models/webhook_subscription_type_enum.py new file mode 100644 index 00000000..408a46cb --- /dev/null +++ b/bandwidth/models/webhook_subscription_type_enum.py @@ -0,0 +1,38 @@ +# 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 WebhookSubscriptionTypeEnum(str, Enum): + """ + WebhookSubscriptionTypeEnum + """ + + """ + allowed enum values + """ + TOLLFREE_VERIFICATION_STATUS = 'TOLLFREE_VERIFICATION_STATUS' + MESSAGING_PORTOUT_APPROVAL_STATUS = 'MESSAGING_PORTOUT_APPROVAL_STATUS' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of WebhookSubscriptionTypeEnum from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/bandwidth/models/webhook_subscriptions_list_body.py b/bandwidth/models/webhook_subscriptions_list_body.py new file mode 100644 index 00000000..b3f73ddb --- /dev/null +++ b/bandwidth/models/webhook_subscriptions_list_body.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.error import Error +from bandwidth.models.links_object import LinksObject +from bandwidth.models.webhook_subscription import WebhookSubscription +from typing import Optional, Set +from typing_extensions import Self + +class WebhookSubscriptionsListBody(BaseModel): + """ + A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated). + """ # noqa: E501 + links: Optional[LinksObject] = None + errors: Optional[List[Error]] = None + data: List[WebhookSubscription] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["links", "errors", "data"] + + 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 WebhookSubscriptionsListBody 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 links + if self.links: + _dict['links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item in self.errors: + if _item: + _items.append(_item.to_dict()) + _dict['errors'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item in self.data: + if _item: + _items.append(_item.to_dict()) + _dict['data'] = _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 WebhookSubscriptionsListBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "links": LinksObject.from_dict(obj["links"]) if obj.get("links") is not None else None, + "errors": [Error.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None, + "data": [WebhookSubscription.from_dict(_item) for _item in obj["data"]] if obj.get("data") 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/docs/AdditionalDenialReason.md b/docs/AdditionalDenialReason.md new file mode 100644 index 00000000..2833dcbc --- /dev/null +++ b/docs/AdditionalDenialReason.md @@ -0,0 +1,31 @@ +# AdditionalDenialReason + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status_code** | **int** | Reason code for denial. | +**reason** | **str** | Explanation for why a verification request was declined. | +**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | + +## Example + +```python +from bandwidth.models.additional_denial_reason import AdditionalDenialReason + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalDenialReason from a JSON string +additional_denial_reason_instance = AdditionalDenialReason.from_json(json) +# print the JSON string representation of the object +print(AdditionalDenialReason.to_json()) + +# convert the object into a dict +additional_denial_reason_dict = additional_denial_reason_instance.to_dict() +# create an instance of AdditionalDenialReason from a dict +additional_denial_reason_from_dict = AdditionalDenialReason.from_dict(additional_denial_reason_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/Address.md b/docs/Address.md new file mode 100644 index 00000000..cf6ca9eb --- /dev/null +++ b/docs/Address.md @@ -0,0 +1,35 @@ +# Address + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the business using the toll-free number. | +**addr1** | **str** | The address of the business using the toll-free number. | +**addr2** | **str** | The address of the business using the toll-free number. | [optional] +**city** | **str** | The city of the business using the toll-free number. | +**state** | **str** | The state of the business using the toll-free number. | +**zip** | **str** | The zip of the business using the toll-free number. | +**url** | **str** | The website of the business using the toll-free number. | + +## Example + +```python +from bandwidth.models.address import Address + +# TODO update the JSON string below +json = "{}" +# create an instance of Address from a JSON string +address_instance = Address.from_json(json) +# print the JSON string representation of the object +print(Address.to_json()) + +# convert the object into a dict +address_dict = address_instance.to_dict() +# create an instance of Address from a dict +address_from_dict = Address.from_dict(address_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/Contact.md b/docs/Contact.md new file mode 100644 index 00000000..7527c5a8 --- /dev/null +++ b/docs/Contact.md @@ -0,0 +1,32 @@ +# Contact + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**first_name** | **str** | The first name of the business contact using the toll-free number. | +**last_name** | **str** | The last name of the business contact using the toll-free number. | +**email** | **str** | | +**phone_number** | **str** | Contact telephone number | + +## Example + +```python +from bandwidth.models.contact import Contact + +# TODO update the JSON string below +json = "{}" +# create an instance of Contact from a JSON string +contact_instance = Contact.from_json(json) +# print the JSON string representation of the object +print(Contact.to_json()) + +# convert the object into a dict +contact_dict = contact_instance.to_dict() +# create an instance of Contact from a dict +contact_from_dict = Contact.from_dict(contact_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/Error.md b/docs/Error.md new file mode 100644 index 00000000..2eab7688 --- /dev/null +++ b/docs/Error.md @@ -0,0 +1,31 @@ +# Error + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**description** | **str** | | [optional] +**telephone_numbers** | [**List[TelephoneNumber]**](TelephoneNumber.md) | | [optional] + +## Example + +```python +from bandwidth.models.error import Error + +# TODO update the JSON string below +json = "{}" +# create an instance of Error from a JSON string +error_instance = Error.from_json(json) +# print the JSON string representation of the object +print(Error.to_json()) + +# convert the object into a dict +error_dict = error_instance.to_dict() +# create an instance of Error from a dict +error_from_dict = Error.from_dict(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/FailureWebhook.md b/docs/FailureWebhook.md new file mode 100644 index 00000000..cc605798 --- /dev/null +++ b/docs/FailureWebhook.md @@ -0,0 +1,34 @@ +# FailureWebhook + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **str** | User's account ID. | [optional] +**phone_number** | **str** | Toll-free telephone number in E.164 format. | [optional] +**error_code** | **str** | 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. | [optional] +**error_description** | **str** | A description of the error that was encountered. | [optional] +**errors** | **List[str]** | Details of the errors that were encountered when processing the request. | [optional] +**internal_ticket_number** | **str** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] + +## Example + +```python +from bandwidth.models.failure_webhook import FailureWebhook + +# TODO update the JSON string below +json = "{}" +# create an instance of FailureWebhook from a JSON string +failure_webhook_instance = FailureWebhook.from_json(json) +# print the JSON string representation of the object +print(FailureWebhook.to_json()) + +# convert the object into a dict +failure_webhook_dict = failure_webhook_instance.to_dict() +# create an instance of FailureWebhook from a dict +failure_webhook_from_dict = FailureWebhook.from_dict(failure_webhook_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/LinksObject.md b/docs/LinksObject.md new file mode 100644 index 00000000..fb639e56 --- /dev/null +++ b/docs/LinksObject.md @@ -0,0 +1,32 @@ +# LinksObject + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**first** | **str** | The first (or only) page of results matching the query. | [optional] +**next** | **str** | If more results exist than specified by 'size', this link returns the next page of 'size' results. | [optional] +**previous** | **str** | If the results are more than one page, this link returns the previous page of 'size' results. | [optional] +**last** | **str** | If more results exist than specified by 'size', this link return the last page of result. | [optional] + +## Example + +```python +from bandwidth.models.links_object import LinksObject + +# TODO update the JSON string below +json = "{}" +# create an instance of LinksObject from a JSON string +links_object_instance = LinksObject.from_json(json) +# print the JSON string representation of the object +print(LinksObject.to_json()) + +# convert the object into a dict +links_object_dict = links_object_instance.to_dict() +# create an instance of LinksObject from a dict +links_object_from_dict = LinksObject.from_dict(links_object_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/OptInWorkflow.md b/docs/OptInWorkflow.md new file mode 100644 index 00000000..6f42e17d --- /dev/null +++ b/docs/OptInWorkflow.md @@ -0,0 +1,30 @@ +# OptInWorkflow + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **str** | | +**image_urls** | **List[str]** | | + +## Example + +```python +from bandwidth.models.opt_in_workflow import OptInWorkflow + +# TODO update the JSON string below +json = "{}" +# create an instance of OptInWorkflow from a JSON string +opt_in_workflow_instance = OptInWorkflow.from_json(json) +# print the JSON string representation of the object +print(OptInWorkflow.to_json()) + +# convert the object into a dict +opt_in_workflow_dict = opt_in_workflow_instance.to_dict() +# create an instance of OptInWorkflow from a dict +opt_in_workflow_from_dict = OptInWorkflow.from_dict(opt_in_workflow_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/TelephoneNumber.md b/docs/TelephoneNumber.md new file mode 100644 index 00000000..a9134261 --- /dev/null +++ b/docs/TelephoneNumber.md @@ -0,0 +1,29 @@ +# TelephoneNumber + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**telephone_number** | **str** | Simple Telephone Number. | [optional] + +## Example + +```python +from bandwidth.models.telephone_number import TelephoneNumber + +# TODO update the JSON string below +json = "{}" +# create an instance of TelephoneNumber from a JSON string +telephone_number_instance = TelephoneNumber.from_json(json) +# print the JSON string representation of the object +print(TelephoneNumber.to_json()) + +# convert the object into a dict +telephone_number_dict = telephone_number_instance.to_dict() +# create an instance of TelephoneNumber from a dict +telephone_number_from_dict = TelephoneNumber.from_dict(telephone_number_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/TfvBasicAuthentication.md b/docs/TfvBasicAuthentication.md new file mode 100644 index 00000000..d05ff1ae --- /dev/null +++ b/docs/TfvBasicAuthentication.md @@ -0,0 +1,30 @@ +# TfvBasicAuthentication + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | | +**password** | **str** | | + +## Example + +```python +from bandwidth.models.tfv_basic_authentication import TfvBasicAuthentication + +# TODO update the JSON string below +json = "{}" +# create an instance of TfvBasicAuthentication from a JSON string +tfv_basic_authentication_instance = TfvBasicAuthentication.from_json(json) +# print the JSON string representation of the object +print(TfvBasicAuthentication.to_json()) + +# convert the object into a dict +tfv_basic_authentication_dict = tfv_basic_authentication_instance.to_dict() +# create an instance of TfvBasicAuthentication from a dict +tfv_basic_authentication_from_dict = TfvBasicAuthentication.from_dict(tfv_basic_authentication_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/TfvCallbackStatusEnum.md b/docs/TfvCallbackStatusEnum.md new file mode 100644 index 00000000..fbfb00c9 --- /dev/null +++ b/docs/TfvCallbackStatusEnum.md @@ -0,0 +1,12 @@ +# TfvCallbackStatusEnum + + +## Enum + +* `VERIFIED` (value: `'VERIFIED'`) + +* `UNVERIFIED` (value: `'UNVERIFIED'`) + +[[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/TfvError.md b/docs/TfvError.md new file mode 100644 index 00000000..02f337df --- /dev/null +++ b/docs/TfvError.md @@ -0,0 +1,32 @@ +# TfvError + +A generic error object. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**description** | **str** | | [optional] +**errors** | **object** | Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field. | [optional] + +## Example + +```python +from bandwidth.models.tfv_error import TfvError + +# TODO update the JSON string below +json = "{}" +# create an instance of TfvError from a JSON string +tfv_error_instance = TfvError.from_json(json) +# print the JSON string representation of the object +print(TfvError.to_json()) + +# convert the object into a dict +tfv_error_dict = tfv_error_instance.to_dict() +# create an instance of TfvError from a dict +tfv_error_from_dict = TfvError.from_dict(tfv_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/TfvStatus.md b/docs/TfvStatus.md new file mode 100644 index 00000000..e2d3c7ca --- /dev/null +++ b/docs/TfvStatus.md @@ -0,0 +1,36 @@ +# TfvStatus + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phone_number** | **str** | Toll-free telephone number in E.164 format. | [optional] +**status** | [**TfvStatusEnum**](TfvStatusEnum.md) | | [optional] +**internal_ticket_number** | **str** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. | [optional] +**decline_reason_description** | **str** | Explanation for why a verification request was declined. | [optional] +**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] +**created_date_time** | **datetime** | Date and time the verification request was created. | [optional] +**modified_date_time** | **datetime** | Date and time the verification request was last modified. | [optional] +**submission** | [**TfvSubmissionInfo**](TfvSubmissionInfo.md) | | [optional] + +## Example + +```python +from bandwidth.models.tfv_status import TfvStatus + +# TODO update the JSON string below +json = "{}" +# create an instance of TfvStatus from a JSON string +tfv_status_instance = TfvStatus.from_json(json) +# print the JSON string representation of the object +print(TfvStatus.to_json()) + +# convert the object into a dict +tfv_status_dict = tfv_status_instance.to_dict() +# create an instance of TfvStatus from a dict +tfv_status_from_dict = TfvStatus.from_dict(tfv_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/TfvStatusEnum.md b/docs/TfvStatusEnum.md new file mode 100644 index 00000000..c022f0fd --- /dev/null +++ b/docs/TfvStatusEnum.md @@ -0,0 +1,18 @@ +# TfvStatusEnum + + +## Enum + +* `VERIFIED` (value: `'VERIFIED'`) + +* `UNVERIFIED` (value: `'UNVERIFIED'`) + +* `PENDING` (value: `'PENDING'`) + +* `PARTIALLY_VERIFIED` (value: `'PARTIALLY_VERIFIED'`) + +* `INVALID_STATUS` (value: `'INVALID_STATUS'`) + +[[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/TfvSubmissionInfo.md b/docs/TfvSubmissionInfo.md new file mode 100644 index 00000000..f74a62fc --- /dev/null +++ b/docs/TfvSubmissionInfo.md @@ -0,0 +1,37 @@ +# TfvSubmissionInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**business_address** | [**Address**](Address.md) | | [optional] +**business_contact** | [**Contact**](Contact.md) | | [optional] +**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. | [optional] +**use_case** | **str** | The category of the use case. | [optional] +**use_case_summary** | **str** | A general idea of the use case and customer. | [optional] +**production_message_content** | **str** | Example of message content. | [optional] +**opt_in_workflow** | [**OptInWorkflow**](OptInWorkflow.md) | | [optional] +**additional_information** | **str** | Any additional information. | [optional] +**isv_reseller** | **str** | ISV name. | [optional] + +## Example + +```python +from bandwidth.models.tfv_submission_info import TfvSubmissionInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of TfvSubmissionInfo from a JSON string +tfv_submission_info_instance = TfvSubmissionInfo.from_json(json) +# print the JSON string representation of the object +print(TfvSubmissionInfo.to_json()) + +# convert the object into a dict +tfv_submission_info_dict = tfv_submission_info_instance.to_dict() +# create an instance of TfvSubmissionInfo from a dict +tfv_submission_info_from_dict = TfvSubmissionInfo.from_dict(tfv_submission_info_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/TfvSubmissionWrapper.md b/docs/TfvSubmissionWrapper.md new file mode 100644 index 00000000..d2935c03 --- /dev/null +++ b/docs/TfvSubmissionWrapper.md @@ -0,0 +1,29 @@ +# TfvSubmissionWrapper + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**submission** | [**VerificationUpdateRequest**](VerificationUpdateRequest.md) | | [optional] + +## Example + +```python +from bandwidth.models.tfv_submission_wrapper import TfvSubmissionWrapper + +# TODO update the JSON string below +json = "{}" +# create an instance of TfvSubmissionWrapper from a JSON string +tfv_submission_wrapper_instance = TfvSubmissionWrapper.from_json(json) +# print the JSON string representation of the object +print(TfvSubmissionWrapper.to_json()) + +# convert the object into a dict +tfv_submission_wrapper_dict = tfv_submission_wrapper_instance.to_dict() +# create an instance of TfvSubmissionWrapper from a dict +tfv_submission_wrapper_from_dict = TfvSubmissionWrapper.from_dict(tfv_submission_wrapper_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 new file mode 100644 index 00000000..c6cb94e5 --- /dev/null +++ b/docs/TollFreeVerificationApi.md @@ -0,0 +1,715 @@ +# bandwidth.TollFreeVerificationApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_webhook_subscription**](TollFreeVerificationApi.md#create_webhook_subscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription +[**delete_webhook_subscription**](TollFreeVerificationApi.md#delete_webhook_subscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription +[**get_toll_free_verification_status**](TollFreeVerificationApi.md#get_toll_free_verification_status) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status +[**list_toll_free_use_cases**](TollFreeVerificationApi.md#list_toll_free_use_cases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases +[**list_webhook_subscriptions**](TollFreeVerificationApi.md#list_webhook_subscriptions) | **GET** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | List Webhook Subscriptions +[**request_toll_free_verification**](TollFreeVerificationApi.md#request_toll_free_verification) | **POST** /accounts/{accountId}/tollFreeVerification | Request Toll-Free Verification +[**update_toll_free_verification_request**](TollFreeVerificationApi.md#update_toll_free_verification_request) | **PUT** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Update Toll-Free Verification Request +[**update_webhook_subscription**](TollFreeVerificationApi.md#update_webhook_subscription) | **PUT** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Update Webhook Subscription + + +# **create_webhook_subscription** +> WebhookSubscription create_webhook_subscription(account_id, webhook_subscription_request_schema) + +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. + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +from bandwidth.models.webhook_subscription import WebhookSubscription +from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema +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.TollFreeVerificationApi(api_client) + account_id = '9900000' # str | Your Bandwidth Account ID. + webhook_subscription_request_schema = bandwidth.WebhookSubscriptionRequestSchema() # WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + + try: + # Create Webhook Subscription + api_response = api_instance.create_webhook_subscription(account_id, webhook_subscription_request_schema) + print("The response of TollFreeVerificationApi->create_webhook_subscription:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->create_webhook_subscription: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **webhook_subscription_request_schema** | [**WebhookSubscriptionRequestSchema**](WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | + +### Return type + +[**WebhookSubscription**](WebhookSubscription.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**404** | Cannot find the requested resource. | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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) + +# **delete_webhook_subscription** +> delete_webhook_subscription(account_id, id) + +Delete Webhook Subscription + +Delete a webhook subscription by ID. + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +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.TollFreeVerificationApi(api_client) + account_id = '9900000' # str | Your Bandwidth Account ID. + id = '7bt57JcsVYJrN9K1OcV1Nu' # str | Webhook subscription ID + + try: + # Delete Webhook Subscription + api_instance.delete_webhook_subscription(account_id, id) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->delete_webhook_subscription: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **id** | **str**| Webhook subscription ID | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | No Content | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**404** | Cannot find the requested resource. | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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_toll_free_verification_status** +> TfvStatus get_toll_free_verification_status(account_id, phone_number) + +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. + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +from bandwidth.models.tfv_status import TfvStatus +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.TollFreeVerificationApi(api_client) + account_id = '9900000' # str | Your Bandwidth Account ID. + phone_number = '+18885555555' # str | Valid Toll-Free telephone number in E.164 format. + + try: + # Get Toll-Free Verification Status + api_response = api_instance.get_toll_free_verification_status(account_id, phone_number) + print("The response of TollFreeVerificationApi->get_toll_free_verification_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->get_toll_free_verification_status: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **phone_number** | **str**| Valid Toll-Free telephone number in E.164 format. | + +### Return type + +[**TfvStatus**](TfvStatus.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**404** | Cannot find the requested resource. | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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) + +# **list_toll_free_use_cases** +> List[str] list_toll_free_use_cases() + +List Toll-Free Use Cases + +Lists valid toll-free use cases. + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +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.TollFreeVerificationApi(api_client) + + try: + # List Toll-Free Use Cases + api_response = api_instance.list_toll_free_use_cases() + print("The response of TollFreeVerificationApi->list_toll_free_use_cases:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->list_toll_free_use_cases: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**List[str]** + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**404** | Cannot find the requested resource. | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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) + +# **list_webhook_subscriptions** +> WebhookSubscriptionsListBody list_webhook_subscriptions(account_id) + +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). + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +from bandwidth.models.webhook_subscriptions_list_body import WebhookSubscriptionsListBody +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.TollFreeVerificationApi(api_client) + account_id = '9900000' # str | Your Bandwidth Account ID. + + try: + # List Webhook Subscriptions + api_response = api_instance.list_webhook_subscriptions(account_id) + print("The response of TollFreeVerificationApi->list_webhook_subscriptions:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->list_webhook_subscriptions: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + +### Return type + +[**WebhookSubscriptionsListBody**](WebhookSubscriptionsListBody.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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) + +# **request_toll_free_verification** +> request_toll_free_verification(account_id, verification_request) + +Request Toll-Free Verification + +Submit a request for verification of a toll-free phone number. + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +from bandwidth.models.verification_request import VerificationRequest +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.TollFreeVerificationApi(api_client) + account_id = '9900000' # str | Your Bandwidth Account ID. + verification_request = bandwidth.VerificationRequest() # VerificationRequest | Request for verification of a toll-free phone number. + + try: + # Request Toll-Free Verification + api_instance.request_toll_free_verification(account_id, verification_request) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->request_toll_free_verification: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **verification_request** | [**VerificationRequest**](VerificationRequest.md)| Request for verification of a toll-free phone number. | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Accepted | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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) + +# **update_toll_free_verification_request** +> update_toll_free_verification_request(account_id, phone_number, tfv_submission_wrapper) + +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). + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +from bandwidth.models.tfv_submission_wrapper import TfvSubmissionWrapper +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.TollFreeVerificationApi(api_client) + account_id = '9900000' # str | Your Bandwidth Account ID. + phone_number = '+18885555555' # str | Valid Toll-Free telephone number in E.164 format. + tfv_submission_wrapper = bandwidth.TfvSubmissionWrapper() # TfvSubmissionWrapper | Update a request for verification of a toll-free phone number. + + try: + # Update Toll-Free Verification Request + api_instance.update_toll_free_verification_request(account_id, phone_number, tfv_submission_wrapper) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->update_toll_free_verification_request: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **phone_number** | **str**| Valid Toll-Free telephone number in E.164 format. | + **tfv_submission_wrapper** | [**TfvSubmissionWrapper**](TfvSubmissionWrapper.md)| Update a request for verification of a toll-free phone number. | + +### Return type + +void (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Accepted | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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) + +# **update_webhook_subscription** +> WebhookSubscription update_webhook_subscription(account_id, id, webhook_subscription_request_schema) + +Update Webhook Subscription + +Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + +### Example + +* Basic Authentication (Basic): + +```python +import bandwidth +from bandwidth.models.webhook_subscription import WebhookSubscription +from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema +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.TollFreeVerificationApi(api_client) + account_id = '9900000' # str | Your Bandwidth Account ID. + id = '7bt57JcsVYJrN9K1OcV1Nu' # str | Webhook subscription ID + webhook_subscription_request_schema = bandwidth.WebhookSubscriptionRequestSchema() # WebhookSubscriptionRequestSchema | Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + + try: + # Update Webhook Subscription + api_response = api_instance.update_webhook_subscription(account_id, id, webhook_subscription_request_schema) + print("The response of TollFreeVerificationApi->update_webhook_subscription:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TollFreeVerificationApi->update_webhook_subscription: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_id** | **str**| Your Bandwidth Account ID. | + **id** | **str**| Webhook subscription ID | + **webhook_subscription_request_schema** | [**WebhookSubscriptionRequestSchema**](WebhookSubscriptionRequestSchema.md)| Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. | + +### Return type + +[**WebhookSubscription**](WebhookSubscription.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 | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Forbidden | - | +**404** | Cannot find the requested resource. | - | +**405** | Method Not Allowed | - | +**429** | Too Many Requests | - | +**500** | Internal Server Error | - | +**503** | Service Unavailable | - | + +[[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/VerificationDenialWebhook.md b/docs/VerificationDenialWebhook.md new file mode 100644 index 00000000..8b034a5b --- /dev/null +++ b/docs/VerificationDenialWebhook.md @@ -0,0 +1,36 @@ +# VerificationDenialWebhook + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **str** | User's account ID. | [optional] +**additional_denial_reasons** | [**List[AdditionalDenialReason]**](AdditionalDenialReason.md) | An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. | [optional] +**decline_reason_description** | **str** | Explanation for why a verification request was declined. | [optional] +**denial_status_code** | **int** | Reason code for denial. | [optional] +**internal_ticket_number** | **str** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] +**phone_number** | **str** | Toll-free telephone number in E.164 format. | [optional] +**resubmit_allowed** | **bool** | Whether a Toll-Free Verification request qualifies for resubmission via PUT. | [optional] +**status** | **str** | | [optional] [default to 'UNVERIFIED'] + +## Example + +```python +from bandwidth.models.verification_denial_webhook import VerificationDenialWebhook + +# TODO update the JSON string below +json = "{}" +# create an instance of VerificationDenialWebhook from a JSON string +verification_denial_webhook_instance = VerificationDenialWebhook.from_json(json) +# print the JSON string representation of the object +print(VerificationDenialWebhook.to_json()) + +# convert the object into a dict +verification_denial_webhook_dict = verification_denial_webhook_instance.to_dict() +# create an instance of VerificationDenialWebhook from a dict +verification_denial_webhook_from_dict = VerificationDenialWebhook.from_dict(verification_denial_webhook_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/VerificationRequest.md b/docs/VerificationRequest.md new file mode 100644 index 00000000..8991c3f7 --- /dev/null +++ b/docs/VerificationRequest.md @@ -0,0 +1,38 @@ +# VerificationRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**business_address** | [**Address**](Address.md) | | +**business_contact** | [**Contact**](Contact.md) | | +**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. | +**phone_numbers** | **List[str]** | | +**use_case** | **str** | The category of the use case. | +**use_case_summary** | **str** | A general idea of the use case and customer. | +**production_message_content** | **str** | Example of message content. | +**opt_in_workflow** | [**OptInWorkflow**](OptInWorkflow.md) | | +**additional_information** | **str** | Any additional information. | [optional] +**isv_reseller** | **str** | ISV name. | [optional] + +## Example + +```python +from bandwidth.models.verification_request import VerificationRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of VerificationRequest from a JSON string +verification_request_instance = VerificationRequest.from_json(json) +# print the JSON string representation of the object +print(VerificationRequest.to_json()) + +# convert the object into a dict +verification_request_dict = verification_request_instance.to_dict() +# create an instance of VerificationRequest from a dict +verification_request_from_dict = VerificationRequest.from_dict(verification_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/VerificationUpdateRequest.md b/docs/VerificationUpdateRequest.md new file mode 100644 index 00000000..1bd1e21f --- /dev/null +++ b/docs/VerificationUpdateRequest.md @@ -0,0 +1,37 @@ +# VerificationUpdateRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**business_address** | [**Address**](Address.md) | | +**business_contact** | [**Contact**](Contact.md) | | +**message_volume** | **int** | Estimated monthly volume of messages from the toll-free number. | +**use_case** | **str** | The category of the use case. | +**use_case_summary** | **str** | A general idea of the use case and customer. | +**production_message_content** | **str** | Example of message content. | +**opt_in_workflow** | [**OptInWorkflow**](OptInWorkflow.md) | | +**additional_information** | **str** | Any additional information. | [optional] +**isv_reseller** | **str** | ISV name. | [optional] + +## Example + +```python +from bandwidth.models.verification_update_request import VerificationUpdateRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of VerificationUpdateRequest from a JSON string +verification_update_request_instance = VerificationUpdateRequest.from_json(json) +# print the JSON string representation of the object +print(VerificationUpdateRequest.to_json()) + +# convert the object into a dict +verification_update_request_dict = verification_update_request_instance.to_dict() +# create an instance of VerificationUpdateRequest from a dict +verification_update_request_from_dict = VerificationUpdateRequest.from_dict(verification_update_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/VerificationWebhook.md b/docs/VerificationWebhook.md new file mode 100644 index 00000000..12b4bd28 --- /dev/null +++ b/docs/VerificationWebhook.md @@ -0,0 +1,32 @@ +# VerificationWebhook + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_id** | **str** | User's account ID. | [optional] +**phone_number** | **str** | Toll-free telephone number in E.164 format. | [optional] +**status** | [**TfvCallbackStatusEnum**](TfvCallbackStatusEnum.md) | | [optional] +**internal_ticket_number** | **str** | Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. | [optional] + +## Example + +```python +from bandwidth.models.verification_webhook import VerificationWebhook + +# TODO update the JSON string below +json = "{}" +# create an instance of VerificationWebhook from a JSON string +verification_webhook_instance = VerificationWebhook.from_json(json) +# print the JSON string representation of the object +print(VerificationWebhook.to_json()) + +# convert the object into a dict +verification_webhook_dict = verification_webhook_instance.to_dict() +# create an instance of VerificationWebhook from a dict +verification_webhook_from_dict = VerificationWebhook.from_dict(verification_webhook_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/WebhookSubscription.md b/docs/WebhookSubscription.md new file mode 100644 index 00000000..4aa9a15d --- /dev/null +++ b/docs/WebhookSubscription.md @@ -0,0 +1,36 @@ +# WebhookSubscription + +Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**account_id** | **str** | | [optional] +**callback_url** | **str** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. | +**type** | [**WebhookSubscriptionTypeEnum**](WebhookSubscriptionTypeEnum.md) | | [optional] +**basic_authentication** | [**WebhookSubscriptionBasicAuthentication**](WebhookSubscriptionBasicAuthentication.md) | | [optional] +**created_date** | **datetime** | | [optional] +**modified_date** | **datetime** | | [optional] + +## Example + +```python +from bandwidth.models.webhook_subscription import WebhookSubscription + +# TODO update the JSON string below +json = "{}" +# create an instance of WebhookSubscription from a JSON string +webhook_subscription_instance = WebhookSubscription.from_json(json) +# print the JSON string representation of the object +print(WebhookSubscription.to_json()) + +# convert the object into a dict +webhook_subscription_dict = webhook_subscription_instance.to_dict() +# create an instance of WebhookSubscription from a dict +webhook_subscription_from_dict = WebhookSubscription.from_dict(webhook_subscription_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/WebhookSubscriptionBasicAuthentication.md b/docs/WebhookSubscriptionBasicAuthentication.md new file mode 100644 index 00000000..f793fc4b --- /dev/null +++ b/docs/WebhookSubscriptionBasicAuthentication.md @@ -0,0 +1,31 @@ +# WebhookSubscriptionBasicAuthentication + +Basic authentication credentials are not required, but if present, both username and password must be provided. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | | +**password** | **str** | | + +## Example + +```python +from bandwidth.models.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication + +# TODO update the JSON string below +json = "{}" +# create an instance of WebhookSubscriptionBasicAuthentication from a JSON string +webhook_subscription_basic_authentication_instance = WebhookSubscriptionBasicAuthentication.from_json(json) +# print the JSON string representation of the object +print(WebhookSubscriptionBasicAuthentication.to_json()) + +# convert the object into a dict +webhook_subscription_basic_authentication_dict = webhook_subscription_basic_authentication_instance.to_dict() +# create an instance of WebhookSubscriptionBasicAuthentication from a dict +webhook_subscription_basic_authentication_from_dict = WebhookSubscriptionBasicAuthentication.from_dict(webhook_subscription_basic_authentication_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/WebhookSubscriptionRequestSchema.md b/docs/WebhookSubscriptionRequestSchema.md new file mode 100644 index 00000000..c927c40a --- /dev/null +++ b/docs/WebhookSubscriptionRequestSchema.md @@ -0,0 +1,31 @@ +# WebhookSubscriptionRequestSchema + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**basic_authentication** | [**TfvBasicAuthentication**](TfvBasicAuthentication.md) | | [optional] +**callback_url** | **str** | Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. | +**shared_secret_key** | **str** | An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. | [optional] + +## Example + +```python +from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema + +# TODO update the JSON string below +json = "{}" +# create an instance of WebhookSubscriptionRequestSchema from a JSON string +webhook_subscription_request_schema_instance = WebhookSubscriptionRequestSchema.from_json(json) +# print the JSON string representation of the object +print(WebhookSubscriptionRequestSchema.to_json()) + +# convert the object into a dict +webhook_subscription_request_schema_dict = webhook_subscription_request_schema_instance.to_dict() +# create an instance of WebhookSubscriptionRequestSchema from a dict +webhook_subscription_request_schema_from_dict = WebhookSubscriptionRequestSchema.from_dict(webhook_subscription_request_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/WebhookSubscriptionTypeEnum.md b/docs/WebhookSubscriptionTypeEnum.md new file mode 100644 index 00000000..6493b479 --- /dev/null +++ b/docs/WebhookSubscriptionTypeEnum.md @@ -0,0 +1,12 @@ +# WebhookSubscriptionTypeEnum + + +## Enum + +* `TOLLFREE_VERIFICATION_STATUS` (value: `'TOLLFREE_VERIFICATION_STATUS'`) + +* `MESSAGING_PORTOUT_APPROVAL_STATUS` (value: `'MESSAGING_PORTOUT_APPROVAL_STATUS'`) + +[[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/WebhookSubscriptionsListBody.md b/docs/WebhookSubscriptionsListBody.md new file mode 100644 index 00000000..1c5d5ac4 --- /dev/null +++ b/docs/WebhookSubscriptionsListBody.md @@ -0,0 +1,32 @@ +# WebhookSubscriptionsListBody + +A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**LinksObject**](LinksObject.md) | | [optional] +**errors** | [**List[Error]**](Error.md) | | [optional] +**data** | [**List[WebhookSubscription]**](WebhookSubscription.md) | | + +## Example + +```python +from bandwidth.models.webhook_subscriptions_list_body import WebhookSubscriptionsListBody + +# TODO update the JSON string below +json = "{}" +# create an instance of WebhookSubscriptionsListBody from a JSON string +webhook_subscriptions_list_body_instance = WebhookSubscriptionsListBody.from_json(json) +# print the JSON string representation of the object +print(WebhookSubscriptionsListBody.to_json()) + +# convert the object into a dict +webhook_subscriptions_list_body_dict = webhook_subscriptions_list_body_instance.to_dict() +# create an instance of WebhookSubscriptionsListBody from a dict +webhook_subscriptions_list_body_from_dict = WebhookSubscriptionsListBody.from_dict(webhook_subscriptions_list_body_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/test/smoke/test_toll_free_verification_api.py b/test/smoke/test_toll_free_verification_api.py new file mode 100644 index 00000000..95a66a67 --- /dev/null +++ b/test/smoke/test_toll_free_verification_api.py @@ -0,0 +1,98 @@ +# 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 hamcrest import * +from test.utils.env_variables import * +from bandwidth import ApiClient, Configuration +from bandwidth.api.toll_free_verification_api import TollFreeVerificationApi + + +class TestTollFreeVerificationApi(unittest.TestCase): + """TollFreeVerificationApi unit test stubs""" + + def setUp(self) -> None: + configuration = Configuration( + username=BW_USERNAME, + password=BW_PASSWORD + ) + self.api_client = ApiClient(configuration) + self.api_instance = TollFreeVerificationApi(self.api_client) + self.account_id = BW_ACCOUNT_ID + + def test_create_webhook_subscription(self) -> None: + """Test case for create_webhook_subscription + + Create Webhook Subscription + """ + pass + + def test_delete_webhook_subscription(self) -> None: + """Test case for delete_webhook_subscription + + Delete Webhook Subscription + """ + pass + + def test_get_toll_free_verification_status(self) -> None: + """Test case for get_toll_free_verification_status + + Get Toll-Free Verification Status + """ + pass + + def test_list_toll_free_use_cases(self) -> None: + """Test case for list_toll_free_use_cases + + List Toll-Free Use Cases + """ + api_response_with_http_info = self.api_instance.list_toll_free_use_cases_with_http_info() + self.assertEqual(api_response_with_http_info.status_code, 200) + + api_response = self.api_instance.list_toll_free_use_cases() + self.assertIs(type(api_response), list) + + def test_list_webhook_subscriptions(self) -> None: + """Test case for list_webhook_subscriptions + + List Webhook Subscriptions + """ + pass + + def test_request_toll_free_verification(self) -> None: + """Test case for request_toll_free_verification + + Request Toll-Free Verification + """ + pass + + def test_update_toll_free_verification_request(self) -> None: + """Test case for update_toll_free_verification_request + + Update Toll-Free Verification Request + """ + pass + + def test_update_webhook_subscription(self) -> None: + """Test case for update_webhook_subscription + + Update Webhook Subscription + """ + pass + + +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 new file mode 100644 index 00000000..b9d57165 --- /dev/null +++ b/test/unit/api/test_toll_free_verification_api.py @@ -0,0 +1,222 @@ +# 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 hamcrest import * +from test.utils.env_variables import * +from bandwidth import ApiClient, Configuration +from bandwidth.api.toll_free_verification_api import TollFreeVerificationApi +from bandwidth.models.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema +from bandwidth.models.tfv_basic_authentication import TfvBasicAuthentication +from bandwidth.models.webhook_subscription import WebhookSubscription +from bandwidth.models.webhook_subscription_type_enum import WebhookSubscriptionTypeEnum +from bandwidth.models.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication +from bandwidth.models.tfv_status import TfvStatus +from bandwidth.models.tfv_status_enum import TfvStatusEnum +from bandwidth.models.webhook_subscriptions_list_body import WebhookSubscriptionsListBody +from bandwidth.models.links_object import LinksObject +from bandwidth.models.telephone_number import TelephoneNumber +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow +from bandwidth.models.verification_request import VerificationRequest +from bandwidth.models.tfv_submission_wrapper import TfvSubmissionWrapper + + +class TestTollFreeVerificationApi(unittest.TestCase): + """TollFreeVerificationApi unit test stubs""" + + def setUp(self) -> None: + configuration = Configuration( + username=BW_USERNAME, + password=BW_PASSWORD, + host='http://127.0.0.1:4010', + ignore_operation_servers=True + ) + api_client = ApiClient(configuration) + self.tfv_api_instance = TollFreeVerificationApi(api_client) + + self.subscription_id = 'test-id-1234' + self.tf_phone_number = '+18005551234' + + self.webhook_subscription_request_schema = WebhookSubscriptionRequestSchema( + basic_authentication=TfvBasicAuthentication( + username='username', + password='password' + ), + callback_url='https://example.com', + shared_secret_key='shared-secret-key' + ) + + self.verification = { + 'businessAddress': Address( + name='name', + addr1='addr1', + addr2='addr2', + city='city', + state='state', + zip='zip', + url='https://example.com' + ), + 'businessContact': Contact( + firstName='first-name', + lastName='last-name', + email='email@email.com', + phoneNumber='+19195551234' + ), + 'messageVolume': 12, + 'useCase': 'useCase', + 'useCaseSummary': 'useCaseSummary', + 'productionMessageContent': 'productionMessageContent', + 'optInWorkflow': OptInWorkflow( + description='description', + image_urls=['https://example.com'] + ), + 'additionalInformation': 'additionalInformation', + 'isvReseller': 'isvReseller' + } + + def test_create_webhook_subscription(self) -> None: + """Test case for create_webhook_subscription + + Create Webhook Subscription + """ + response = self.tfv_api_instance.create_webhook_subscription_with_http_info(BW_ACCOUNT_ID, self.webhook_subscription_request_schema) + + assert_that(response.status_code, equal_to(201)) + assert_that(response.data, instance_of(WebhookSubscription)) + assert_that(response.data.id, instance_of(str)) + assert_that(response.data.account_id, has_length(7)) + assert_that(response.data.callback_url, instance_of(str)) + assert_that(response.data.type, is_in(WebhookSubscriptionTypeEnum)) + assert_that(response.data.basic_authentication, instance_of(WebhookSubscriptionBasicAuthentication)) + assert_that(response.data.basic_authentication.username, instance_of(str)) + assert_that(response.data.basic_authentication.password, instance_of(str)) + assert_that(response.data.created_date, instance_of(datetime)) + assert_that(response.data.modified_date, instance_of(datetime)) + + def test_delete_webhook_subscription(self) -> None: + """Test case for delete_webhook_subscription + + Delete Webhook Subscription + """ + response = self.tfv_api_instance.delete_webhook_subscription_with_http_info(BW_ACCOUNT_ID, self.subscription_id) + + assert_that(response.status_code, equal_to(204)) + + def test_get_toll_free_verification_status(self) -> None: + """Test case for get_toll_free_verification_status + + Get Toll-Free Verification Status + """ + response = self.tfv_api_instance.get_toll_free_verification_status_with_http_info(BW_ACCOUNT_ID, self.tf_phone_number) + + assert_that(response.status_code, equal_to(200)) + 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.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)) + assert_that(response.data.modified_date_time, instance_of(datetime)) + + def test_list_toll_free_use_cases(self) -> None: + """Test case for list_toll_free_use_cases + + List Toll-Free Use Cases + """ + response = self.tfv_api_instance.list_toll_free_use_cases_with_http_info() + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(list)) + assert_that(response.data[0], instance_of(str)) + + def test_list_webhook_subscriptions(self) -> None: + """Test case for list_webhook_subscriptions + + List Webhook Subscriptions + """ + response = self.tfv_api_instance.list_webhook_subscriptions_with_http_info(BW_ACCOUNT_ID) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(WebhookSubscriptionsListBody)) + assert_that(response.data.links, instance_of(LinksObject)) + assert_that(response.data.links.first, instance_of(str)) + assert_that(response.data.links.next, instance_of(str)) + assert_that(response.data.links.previous, instance_of(str)) + assert_that(response.data.links.last, instance_of(str)) + assert_that(response.data.errors, instance_of(list)) + assert_that(response.data.errors[0].code, instance_of(int)) + assert_that(response.data.errors[0].description, instance_of(str)) + assert_that(response.data.errors[0].telephone_numbers, instance_of(list)) + assert_that(response.data.errors[0].telephone_numbers[0], instance_of(TelephoneNumber)) + assert_that(response.data.errors[0].telephone_numbers[0].telephone_number, instance_of(str)) + assert_that(response.data.data, instance_of(list)) + assert_that(response.data.data[0], instance_of(WebhookSubscription)) + assert_that(response.data.data[0].id, instance_of(str)) + assert_that(response.data.data[0].account_id, instance_of(str)) + assert_that(response.data.data[0].callback_url, instance_of(str)) + assert_that(response.data.data[0].type, is_in(WebhookSubscriptionTypeEnum)) + assert_that(response.data.data[0].basic_authentication, instance_of(WebhookSubscriptionBasicAuthentication)) + assert_that(response.data.data[0].basic_authentication.username, instance_of(str)) + assert_that(response.data.data[0].basic_authentication.password, instance_of(str)) + assert_that(response.data.data[0].created_date, instance_of(datetime)) + assert_that(response.data.data[0].modified_date, instance_of(datetime)) + + def test_request_toll_free_verification(self) -> None: + """Test case for request_toll_free_verification + + Request Toll-Free Verification + """ + verification_request = VerificationRequest.from_dict(self.verification | { 'phoneNumbers': [self.tf_phone_number] }) + response = self.tfv_api_instance.request_toll_free_verification_with_http_info(BW_ACCOUNT_ID, verification_request) + + assert_that(response.status_code, equal_to(202)) + + def test_update_toll_free_verification_request(self) -> None: + """Test case for update_toll_free_verification_request + + Update Toll-Free Verification Request + """ + tfv_submission_wrapper = TfvSubmissionWrapper.from_dict({ 'submission': self.verification }) + response = self.tfv_api_instance.update_toll_free_verification_request_with_http_info(BW_ACCOUNT_ID, self.tf_phone_number, tfv_submission_wrapper) + + assert_that(response.status_code, equal_to(202)) + + def test_update_webhook_subscription(self) -> None: + """Test case for update_webhook_subscription + + Update Webhook Subscription + """ + response = self.tfv_api_instance.update_webhook_subscription_with_http_info(BW_ACCOUNT_ID, self.subscription_id, self.webhook_subscription_request_schema) + + assert_that(response.status_code, equal_to(200)) + assert_that(response.data, instance_of(WebhookSubscription)) + assert_that(response.data.id, instance_of(str)) + assert_that(response.data.account_id, has_length(7)) + assert_that(response.data.callback_url, instance_of(str)) + assert_that(response.data.type, is_in(WebhookSubscriptionTypeEnum)) + assert_that(response.data.basic_authentication, instance_of(WebhookSubscriptionBasicAuthentication)) + assert_that(response.data.basic_authentication.username, instance_of(str)) + assert_that(response.data.basic_authentication.password, instance_of(str)) + assert_that(response.data.created_date, instance_of(datetime)) + assert_that(response.data.modified_date, instance_of(datetime)) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_additional_denial_reason.py b/test/unit/models/test_additional_denial_reason.py new file mode 100644 index 00000000..cdbb02f7 --- /dev/null +++ b/test/unit/models/test_additional_denial_reason.py @@ -0,0 +1,57 @@ +# 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.additional_denial_reason import AdditionalDenialReason + +class TestAdditionalDenialReason(unittest.TestCase): + """AdditionalDenialReason unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalDenialReason: + """Test AdditionalDenialReason + 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 AdditionalDenialReason( + status_code = 511, + reason = "Invalid Information - Can't Validate URL - Website is not accessible / not available", + resubmit_allowed = True + ) + else: + return AdditionalDenialReason( + status_code = 511, + reason = "Invalid Information - Can't Validate URL - Website is not accessible / not available", + resubmit_allowed = True, + ) + + def testAdditionalDenialReason(self): + """Test AdditionalDenialReason""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, AdditionalDenialReason) + assert instance.status_code == 511 + assert instance.reason == "Invalid Information - Can't Validate URL - Website is not accessible / not available" + assert instance.resubmit_allowed == True + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_address.py b/test/unit/models/test_address.py new file mode 100644 index 00000000..bfebb469 --- /dev/null +++ b/test/unit/models/test_address.py @@ -0,0 +1,68 @@ +# 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.address import Address + +class TestAddress(unittest.TestCase): + """Address unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Address: + """Test Address + 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 Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource' + ) + else: + return Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', + ) + + def testAddress(self): + """Test Address""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, Address) + assert instance.name == 'Bandwidth Inc.' + assert instance.addr1 == '2230 Bandmate Way' + assert instance.addr2 == '' + assert instance.city == 'Raleigh' + assert instance.state == 'NC' + assert instance.zip == '27606' + assert instance.url == 'https://www.example.com/path/to/resource' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_contact.py b/test/unit/models/test_contact.py new file mode 100644 index 00000000..d1db8407 --- /dev/null +++ b/test/unit/models/test_contact.py @@ -0,0 +1,60 @@ +# 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.contact import Contact + +class TestContact(unittest.TestCase): + """Contact unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Contact: + """Test Contact + 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 Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500' + ) + else: + return Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', + ) + + def testContact(self): + """Test Contact""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, Contact) + assert instance.first_name == 'John' + assert instance.last_name == 'Doe' + assert instance.email == 'foo@bar.com' + assert instance.phone_number == '+19192654500' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_dtmf_callback.py b/test/unit/models/test_dtmf_callback.py index 5ab8c3ec..1bda05f9 100644 --- a/test/unit/models/test_dtmf_callback.py +++ b/test/unit/models/test_dtmf_callback.py @@ -58,7 +58,7 @@ def make_instance(self, include_optional) -> DtmfCallback: def testDtmfCallback(self): """Test DtmfCallback""" - instance = self.make_instance(include_optional=True) + instance = self.make_instance(True) self.assertTrue(instance is not None) self.assertTrue(isinstance(instance, DtmfCallback)) assert instance.event_type == 'bridgeComplete' diff --git a/test/unit/models/test_error.py b/test/unit/models/test_error.py new file mode 100644 index 00000000..59da3064 --- /dev/null +++ b/test/unit/models/test_error.py @@ -0,0 +1,61 @@ +# 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.error import Error +from bandwidth.models.telephone_number import TelephoneNumber + +class TestError(unittest.TestCase): + """Error unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Error: + """Test Error + 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 Error( + code = 56, + description = '', + telephone_numbers = [ + TelephoneNumber( + telephone_number = '', ) + ] + ) + else: + return Error( + ) + + def testError(self): + """Test Error""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, Error) + assert instance.code == 56 + assert instance.description == '' + assert isinstance(instance.telephone_numbers, list) + assert len(instance.telephone_numbers) == 1 + assert isinstance(instance.telephone_numbers[0], TelephoneNumber) + assert instance.telephone_numbers[0].telephone_number == '' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_failure_webhook.py b/test/unit/models/test_failure_webhook.py new file mode 100644 index 00000000..76f51368 --- /dev/null +++ b/test/unit/models/test_failure_webhook.py @@ -0,0 +1,64 @@ +# 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.failure_webhook import FailureWebhook + +class TestFailureWebhook(unittest.TestCase): + """FailureWebhook unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FailureWebhook: + """Test FailureWebhook + 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 FailureWebhook( + account_id = '1234567', + phone_number = '+18005555555', + error_code = '400', + error_description = 'cannot process request.', + errors = [ + 'optInWorkflowImageURLs: Entries must be a valid array of objects.' + ], + internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333' + ) + else: + return FailureWebhook( + ) + + def testFailureWebhook(self): + """Test FailureWebhook""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, FailureWebhook) + assert instance.account_id == '1234567' + assert instance.phone_number == '+18005555555' + assert instance.error_code == '400' + assert instance.error_description == 'cannot process request.' + 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' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_links_object.py b/test/unit/models/test_links_object.py new file mode 100644 index 00000000..f07725df --- /dev/null +++ b/test/unit/models/test_links_object.py @@ -0,0 +1,56 @@ +# 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.links_object import LinksObject + +class TestLinksObject(unittest.TestCase): + """LinksObject unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> LinksObject: + """Test LinksObject + 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 LinksObject( + first = 'https://api.com/abc/first', + next = 'https://api.com/abc/next', + previous = 'https://api.com/abc/previous', + last = 'https://api.com/abc/last' + ) + else: + return LinksObject( + ) + + def testLinksObject(self): + """Test LinksObject""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, LinksObject) + assert instance.first == 'https://api.com/abc/first' + assert instance.next == 'https://api.com/abc/next' + assert instance.previous == 'https://api.com/abc/previous' + assert instance.last == 'https://api.com/abc/last' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_opt_in_workflow.py b/test/unit/models/test_opt_in_workflow.py new file mode 100644 index 00000000..8aa813df --- /dev/null +++ b/test/unit/models/test_opt_in_workflow.py @@ -0,0 +1,60 @@ +# 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.opt_in_workflow import OptInWorkflow + +class TestOptInWorkflow(unittest.TestCase): + """OptInWorkflow unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> OptInWorkflow: + """Test OptInWorkflow + 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 OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ] + ) + else: + return OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], + ) + + def testOptInWorkflow(self): + """Test OptInWorkflow""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, OptInWorkflow) + assert instance.description == 'Opt In Flow' + assert isinstance(instance.image_urls, list) + assert len(instance.image_urls) == 1 + assert instance.image_urls[0] == 'https://www.example.com/path/to/resource' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_telephone_number.py b/test/unit/models/test_telephone_number.py new file mode 100644 index 00000000..97568eca --- /dev/null +++ b/test/unit/models/test_telephone_number.py @@ -0,0 +1,50 @@ +# 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.telephone_number import TelephoneNumber + +class TestTelephoneNumber(unittest.TestCase): + """TelephoneNumber unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TelephoneNumber: + """Test TelephoneNumber + 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 TelephoneNumber( + telephone_number = '+19195551234' + ) + else: + return TelephoneNumber( + ) + + def testTelephoneNumber(self): + """Test TelephoneNumber""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, TelephoneNumber) + assert instance.telephone_number == '+19195551234' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_tfv_basic_authentication.py b/test/unit/models/test_tfv_basic_authentication.py new file mode 100644 index 00000000..1dc5b9a8 --- /dev/null +++ b/test/unit/models/test_tfv_basic_authentication.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.tfv_basic_authentication import TfvBasicAuthentication + +class TestTfvBasicAuthentication(unittest.TestCase): + """TfvBasicAuthentication unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TfvBasicAuthentication: + """Test TfvBasicAuthentication + 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 TfvBasicAuthentication( + username = 'username', + password = 'password' + ) + else: + return TfvBasicAuthentication( + username = 'username', + password = 'password', + ) + + def testTfvBasicAuthentication(self): + """Test TfvBasicAuthentication""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, TfvBasicAuthentication) + assert instance.username == 'username' + assert instance.password == 'password' + +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 new file mode 100644 index 00000000..f66b8897 --- /dev/null +++ b/test/unit/models/test_tfv_callback_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.tfv_callback_status_enum import TfvCallbackStatusEnum + +class TestTfvCallbackStatusEnum(unittest.TestCase): + """TfvCallbackStatusEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTfvCallbackStatusEnum(self): + """Test TfvCallbackStatusEnum""" + verified = TfvCallbackStatusEnum('VERIFIED') + unverified = TfvCallbackStatusEnum('UNVERIFIED') + assert verified == 'VERIFIED' + assert unverified == 'UNVERIFIED' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_tfv_error.py b/test/unit/models/test_tfv_error.py new file mode 100644 index 00000000..7f56feeb --- /dev/null +++ b/test/unit/models/test_tfv_error.py @@ -0,0 +1,55 @@ +# 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.tfv_error import TfvError + +class TestTfvError(unittest.TestCase): + """TfvError unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TfvError: + """Test TfvError + 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 TfvError( + type = 'Error Type', + description = 'Error Message', + errors = {"field":"error message"} + ) + else: + return TfvError( + ) + + def testTfvError(self): + """Test TfvError""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, TfvError) + assert instance.type == 'Error Type' + assert instance.description == 'Error Message' + assert isinstance(instance.errors, dict) + assert instance.errors['field'] == 'error message' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_tfv_status.py b/test/unit/models/test_tfv_status.py new file mode 100644 index 00000000..7646777c --- /dev/null +++ b/test/unit/models/test_tfv_status.py @@ -0,0 +1,119 @@ +# 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.tfv_status import TfvStatus +from bandwidth.models.tfv_submission_info import TfvSubmissionInfo +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow + +class TestTfvStatus(unittest.TestCase): + """TfvStatus unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TfvStatus: + """Test TfvStatus + 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 TfvStatus( + phone_number = '+18005555555', + status = 'VERIFIED', + internal_ticket_number = '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', + modified_date_time = '2021-06-08T06:45:13Z', + submission = TfvSubmissionInfo( + business_address = Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', ), + business_contact = Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', ), + message_volume = 10000, + use_case = '2FA', + use_case_summary = 'Text summarizing the use case for the toll-free number', + production_message_content = 'Production message content', + opt_in_workflow = OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], ), + additional_information = 'Any additional information', + isv_reseller = 'Test ISV', ) + ) + else: + return TfvStatus( + ) + + def testTfvStatus(self): + """Test TfvStatus""" + instance = self.make_instance(True) + assert instance is not None + 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.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) + assert isinstance(instance.modified_date_time, datetime) + assert isinstance(instance.submission, TfvSubmissionInfo) + assert isinstance(instance.submission.business_address, Address) + assert instance.submission.business_address.name == 'Bandwidth Inc.' + assert instance.submission.business_address.addr1 == '2230 Bandmate Way' + assert instance.submission.business_address.addr2 == '' + assert instance.submission.business_address.city == 'Raleigh' + assert instance.submission.business_address.state == 'NC' + assert instance.submission.business_address.zip == '27606' + assert instance.submission.business_address.url == 'https://www.example.com/path/to/resource' + assert isinstance(instance.submission.business_contact, Contact) + assert instance.submission.business_contact.first_name == 'John' + assert instance.submission.business_contact.last_name == 'Doe' + assert instance.submission.business_contact.email == 'foo@bar.com' + assert instance.submission.business_contact.phone_number == '+19192654500' + assert instance.submission.message_volume == 10000 + assert instance.submission.use_case == '2FA' + assert instance.submission.use_case_summary == 'Text summarizing the use case for the toll-free number' + assert instance.submission.production_message_content == 'Production message content' + assert isinstance(instance.submission.opt_in_workflow, OptInWorkflow) + assert instance.submission.opt_in_workflow.description == 'Opt In Flow' + assert isinstance(instance.submission.opt_in_workflow.image_urls, list) + assert len(instance.submission.opt_in_workflow.image_urls) == 1 + assert instance.submission.opt_in_workflow.image_urls[0] == 'https://www.example.com/path/to/resource' + assert instance.submission.additional_information == 'Any additional information' + assert instance.submission.isv_reseller == 'Test ISV' + assert instance.submission.additional_information == 'Any additional information' + + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_tfv_status_enum.py b/test/unit/models/test_tfv_status_enum.py new file mode 100644 index 00000000..12563926 --- /dev/null +++ b/test/unit/models/test_tfv_status_enum.py @@ -0,0 +1,43 @@ +# 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.tfv_status_enum import TfvStatusEnum + +class TestTfvStatusEnum(unittest.TestCase): + """TfvStatusEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTfvStatusEnum(self): + """Test TfvStatusEnum""" + verified = TfvStatusEnum('VERIFIED') + unverified = TfvStatusEnum('UNVERIFIED') + pending = TfvStatusEnum('PENDING') + partially_verified = TfvStatusEnum('PARTIALLY_VERIFIED') + invalid_status = TfvStatusEnum('INVALID_STATUS') + assert verified == 'VERIFIED' + assert unverified == 'UNVERIFIED' + assert pending == 'PENDING' + assert partially_verified == 'PARTIALLY_VERIFIED' + assert invalid_status == 'INVALID_STATUS' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_tfv_submission_info.py b/test/unit/models/test_tfv_submission_info.py new file mode 100644 index 00000000..1771d32c --- /dev/null +++ b/test/unit/models/test_tfv_submission_info.py @@ -0,0 +1,99 @@ +# 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.tfv_submission_info import TfvSubmissionInfo +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow + +class TestTfvSubmissionInfo(unittest.TestCase): + """TfvSubmissionInfo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TfvSubmissionInfo: + """Test TfvSubmissionInfo + 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 TfvSubmissionInfo( + business_address = Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', ), + business_contact = Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', ), + message_volume = 10000, + use_case = '2FA', + use_case_summary = 'Text summarizing the use case for the toll-free number', + production_message_content = 'Production message content', + opt_in_workflow = OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], ), + additional_information = 'Any additional information', + isv_reseller = 'Test ISV' + ) + else: + return TfvSubmissionInfo( + ) + + def testTfvSubmissionInfo(self): + """Test TfvSubmissionInfo""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, TfvSubmissionInfo) + assert isinstance(instance.business_address, Address) + assert instance.business_address.name == 'Bandwidth Inc.' + assert instance.business_address.addr1 == '2230 Bandmate Way' + assert instance.business_address.addr2 == '' + assert instance.business_address.city == 'Raleigh' + assert instance.business_address.state == 'NC' + assert instance.business_address.zip == '27606' + assert instance.business_address.url == 'https://www.example.com/path/to/resource' + assert isinstance(instance.business_contact, Contact) + assert instance.business_contact.first_name == 'John' + assert instance.business_contact.last_name == 'Doe' + assert instance.business_contact.email == 'foo@bar.com' + assert instance.business_contact.phone_number == '+19192654500' + assert instance.message_volume == 10000 + assert instance.use_case == '2FA' + assert instance.use_case_summary == 'Text summarizing the use case for the toll-free number' + assert instance.production_message_content == 'Production message content' + assert isinstance(instance.opt_in_workflow, OptInWorkflow) + assert instance.opt_in_workflow.description == 'Opt In Flow' + assert isinstance(instance.opt_in_workflow.image_urls, list) + assert len(instance.opt_in_workflow.image_urls) == 1 + assert instance.opt_in_workflow.image_urls[0] == 'https://www.example.com/path/to/resource' + assert instance.additional_information == 'Any additional information' + assert instance.isv_reseller == 'Test ISV' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_tfv_submission_wrapper.py b/test/unit/models/test_tfv_submission_wrapper.py new file mode 100644 index 00000000..7f299ad7 --- /dev/null +++ b/test/unit/models/test_tfv_submission_wrapper.py @@ -0,0 +1,102 @@ +# 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.tfv_submission_wrapper import TfvSubmissionWrapper +from bandwidth.models.verification_update_request import VerificationUpdateRequest +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow + +class TestTfvSubmissionWrapper(unittest.TestCase): + """TfvSubmissionWrapper unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TfvSubmissionWrapper: + """Test TfvSubmissionWrapper + 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 TfvSubmissionWrapper( + submission = VerificationUpdateRequest( + business_address = Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', ), + business_contact = Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', ), + message_volume = 10000, + use_case = '2FA', + use_case_summary = 'Text summarizing the use case for the toll-free number', + production_message_content = 'Production message content', + opt_in_workflow = OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], ), + additional_information = 'Any additional information', + isv_reseller = 'Test ISV', ) + ) + else: + return TfvSubmissionWrapper( + ) + + def testTfvSubmissionWrapper(self): + """Test TfvSubmissionWrapper""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, TfvSubmissionWrapper) + assert isinstance(instance.submission, VerificationUpdateRequest) + assert isinstance(instance.submission.business_address, Address) + assert instance.submission.business_address.name == 'Bandwidth Inc.' + assert instance.submission.business_address.addr1 == '2230 Bandmate Way' + assert instance.submission.business_address.addr2 == '' + assert instance.submission.business_address.city == 'Raleigh' + assert instance.submission.business_address.state == 'NC' + assert instance.submission.business_address.zip == '27606' + assert instance.submission.business_address.url == 'https://www.example.com/path/to/resource' + assert isinstance(instance.submission.business_contact, Contact) + assert instance.submission.business_contact.first_name == 'John' + assert instance.submission.business_contact.last_name == 'Doe' + assert instance.submission.business_contact.email == 'foo@bar.com' + assert instance.submission.business_contact.phone_number == '+19192654500' + assert instance.submission.message_volume == 10000 + assert instance.submission.use_case == '2FA' + assert instance.submission.use_case_summary == 'Text summarizing the use case for the toll-free number' + assert instance.submission.production_message_content == 'Production message content' + assert isinstance(instance.submission.opt_in_workflow, OptInWorkflow) + assert instance.submission.opt_in_workflow.description == 'Opt In Flow' + assert isinstance(instance.submission.opt_in_workflow.image_urls, list) + assert len(instance.submission.opt_in_workflow.image_urls) == 1 + assert instance.submission.opt_in_workflow.image_urls[0] == 'https://www.example.com/path/to/resource' + assert instance.submission.additional_information == 'Any additional information' + assert instance.submission.isv_reseller == 'Test ISV' + +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 new file mode 100644 index 00000000..d840c36b --- /dev/null +++ b/test/unit/models/test_verification_denial_webhook.py @@ -0,0 +1,71 @@ +# 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.verification_denial_webhook import VerificationDenialWebhook + +class TestVerificationDenialWebhook(unittest.TestCase): + """VerificationDenialWebhook unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> VerificationDenialWebhook: + """Test VerificationDenialWebhook + 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 VerificationDenialWebhook( + account_id = '1234567', + 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', + phone_number = '+18005555555', + resubmit_allowed = True, + status = 'UNVERIFIED' + ) + else: + return VerificationDenialWebhook( + ) + + def testVerificationDenialWebhook(self): + """Test VerificationDenialWebhook""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, VerificationDenialWebhook) + assert instance.account_id == '1234567' + assert isinstance(instance.additional_denial_reasons, list) + assert len(instance.additional_denial_reasons) == 2 + assert instance.additional_denial_reasons[0].status_code == 512 + assert instance.additional_denial_reasons[0].reason == 'Reason A' + assert instance.additional_denial_reasons[0].resubmit_allowed == True + assert instance.additional_denial_reasons[1].status_code == 513 + assert instance.additional_denial_reasons[1].reason == 'Reason B' + 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.phone_number == '+18005555555' + assert instance.resubmit_allowed == True + assert instance.status == 'UNVERIFIED' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_verification_request.py b/test/unit/models/test_verification_request.py new file mode 100644 index 00000000..a83c12ce --- /dev/null +++ b/test/unit/models/test_verification_request.py @@ -0,0 +1,130 @@ +# 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.verification_request import VerificationRequest +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow + +class TestVerificationRequest(unittest.TestCase): + """VerificationRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> VerificationRequest: + """Test VerificationRequest + 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 VerificationRequest( + business_address = Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', ), + business_contact = Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', ), + message_volume = 10000, + phone_numbers = [ + '+18005555555' + ], + use_case = '2FA', + use_case_summary = 'Text summarizing the use case for the toll-free number', + production_message_content = 'Production message content', + opt_in_workflow = OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], ), + additional_information = '', + isv_reseller = 'Test ISV' + ) + else: + return VerificationRequest( + business_address = Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', ), + business_contact = Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', ), + message_volume = 10000, + phone_numbers = [ + '+18005555555' + ], + use_case = '2FA', + use_case_summary = 'Text summarizing the use case for the toll-free number', + production_message_content = 'Production message content', + opt_in_workflow = OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], ), + ) + + def testVerificationRequest(self): + """Test VerificationRequest""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, VerificationRequest) + assert isinstance(instance.business_address, Address) + assert instance.business_address.name == 'Bandwidth Inc.' + assert instance.business_address.addr1 == '2230 Bandmate Way' + assert instance.business_address.addr2 == '' + assert instance.business_address.city == 'Raleigh' + assert instance.business_address.state == 'NC' + assert instance.business_address.zip == '27606' + assert instance.business_address.url == 'https://www.example.com/path/to/resource' + assert isinstance(instance.business_contact, Contact) + assert instance.business_contact.first_name == 'John' + assert instance.business_contact.last_name == 'Doe' + assert instance.business_contact.email == 'foo@bar.com' + assert instance.business_contact.phone_number == '+19192654500' + assert instance.message_volume == 10000 + assert isinstance(instance.phone_numbers, list) + assert len(instance.phone_numbers) == 1 + assert instance.phone_numbers[0] == '+18005555555' + assert instance.use_case == '2FA' + assert instance.use_case_summary == 'Text summarizing the use case for the toll-free number' + assert instance.production_message_content == 'Production message content' + assert isinstance(instance.opt_in_workflow, OptInWorkflow) + assert instance.opt_in_workflow.description == 'Opt In Flow' + assert isinstance(instance.opt_in_workflow.image_urls, list) + assert len(instance.opt_in_workflow.image_urls) == 1 + assert instance.opt_in_workflow.image_urls[0] == 'https://www.example.com/path/to/resource' + assert instance.additional_information == '' + assert instance.isv_reseller == 'Test ISV' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_verification_update_request.py b/test/unit/models/test_verification_update_request.py new file mode 100644 index 00000000..ed29c664 --- /dev/null +++ b/test/unit/models/test_verification_update_request.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 + + +import unittest + +from bandwidth.models.verification_update_request import VerificationUpdateRequest +from bandwidth.models.address import Address +from bandwidth.models.contact import Contact +from bandwidth.models.opt_in_workflow import OptInWorkflow + +class TestVerificationUpdateRequest(unittest.TestCase): + """VerificationUpdateRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> VerificationUpdateRequest: + """Test VerificationUpdateRequest + 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 VerificationUpdateRequest( + business_address = Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', ), + business_contact = Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', ), + message_volume = 10000, + use_case = '2FA', + use_case_summary = 'Text summarizing the use case for the toll-free number', + production_message_content = 'Production message content', + opt_in_workflow = OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], ), + additional_information = '', + isv_reseller = 'Test ISV' + ) + else: + return VerificationUpdateRequest( + business_address = Address( + name = 'Bandwidth Inc.', + addr1 = '2230 Bandmate Way', + addr2 = '', + city = 'Raleigh', + state = 'NC', + zip = '27606', + url = 'https://www.example.com/path/to/resource', ), + business_contact = Contact( + first_name = 'John', + last_name = 'Doe', + email = 'foo@bar.com', + phone_number = '+19192654500', ), + message_volume = 10000, + use_case = '2FA', + use_case_summary = 'Text summarizing the use case for the toll-free number', + production_message_content = 'Production message content', + opt_in_workflow = OptInWorkflow( + description = 'Opt In Flow', + image_urls = [ + 'https://www.example.com/path/to/resource' + ], ), + ) + + def testVerificationUpdateRequest(self): + """Test VerificationUpdateRequest""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, VerificationUpdateRequest) + assert isinstance(instance.business_address, Address) + assert instance.business_address.name == 'Bandwidth Inc.' + assert instance.business_address.addr1 == '2230 Bandmate Way' + assert instance.business_address.addr2 == '' + assert instance.business_address.city == 'Raleigh' + assert instance.business_address.state == 'NC' + assert instance.business_address.zip == '27606' + assert instance.business_address.url == 'https://www.example.com/path/to/resource' + assert isinstance(instance.business_contact, Contact) + assert instance.business_contact.first_name == 'John' + assert instance.business_contact.last_name == 'Doe' + assert instance.business_contact.email == 'foo@bar.com' + assert instance.business_contact.phone_number == '+19192654500' + assert instance.message_volume == 10000 + assert instance.use_case == '2FA' + assert instance.use_case_summary == 'Text summarizing the use case for the toll-free number' + assert instance.production_message_content == 'Production message content' + assert isinstance(instance.opt_in_workflow, OptInWorkflow) + assert instance.opt_in_workflow.description == 'Opt In Flow' + assert isinstance(instance.opt_in_workflow.image_urls, list) + assert len(instance.opt_in_workflow.image_urls) == 1 + assert instance.opt_in_workflow.image_urls[0] == 'https://www.example.com/path/to/resource' + assert instance.additional_information == '' + assert instance.isv_reseller == 'Test ISV' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_verification_webhook.py b/test/unit/models/test_verification_webhook.py new file mode 100644 index 00000000..c53df78a --- /dev/null +++ b/test/unit/models/test_verification_webhook.py @@ -0,0 +1,56 @@ +# 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.verification_webhook import VerificationWebhook + +class TestVerificationWebhook(unittest.TestCase): + """VerificationWebhook unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> VerificationWebhook: + """Test VerificationWebhook + 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 VerificationWebhook( + account_id = '1234567', + phone_number = '+18005555555', + status = 'VERIFIED', + internal_ticket_number = 'acde070d-8c4c-4f0d-9d8a-162843c10333' + ) + else: + return VerificationWebhook( + ) + + def testVerificationWebhook(self): + """Test VerificationWebhook""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, VerificationWebhook) + assert instance.account_id == '1234567' + assert instance.phone_number == '+18005555555' + assert instance.status == 'VERIFIED' + assert instance.internal_ticket_number == 'acde070d-8c4c-4f0d-9d8a-162843c10333' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_webhook_subscription.py b/test/unit/models/test_webhook_subscription.py new file mode 100644 index 00000000..a2598830 --- /dev/null +++ b/test/unit/models/test_webhook_subscription.py @@ -0,0 +1,68 @@ +# 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.webhook_subscription import WebhookSubscription +from bandwidth.models.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication + +class TestWebhookSubscription(unittest.TestCase): + """WebhookSubscription unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> WebhookSubscription: + """Test WebhookSubscription + 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 WebhookSubscription( + id = '7hICGStfAfeGxEq3N0lQwO', + account_id = '1234567', + callback_url = 'https://www.example.com/path/to/resource', + type = 'TOLLFREE_VERIFICATION_STATUS', + basic_authentication = WebhookSubscriptionBasicAuthentication( + username = 'username', + password = 'password', ), + created_date = '2023-05-15T13:56:39.965Z', + modified_date = '2023-05-15T13:56:39.965Z' + ) + else: + return WebhookSubscription( + callback_url = 'https://www.example.com/path/to/resource', + ) + + def testWebhookSubscription(self): + """Test WebhookSubscription""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, WebhookSubscription) + assert instance.id == '7hICGStfAfeGxEq3N0lQwO' + assert instance.account_id == '1234567' + assert instance.callback_url == 'https://www.example.com/path/to/resource' + assert instance.type == 'TOLLFREE_VERIFICATION_STATUS' + assert instance.basic_authentication.username == 'username' + assert instance.basic_authentication.password == 'password' + assert isinstance(instance.created_date, datetime) + assert isinstance(instance.modified_date, datetime) + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_webhook_subscription_basic_authentication.py b/test/unit/models/test_webhook_subscription_basic_authentication.py new file mode 100644 index 00000000..5e2d01ea --- /dev/null +++ b/test/unit/models/test_webhook_subscription_basic_authentication.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.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication + +class TestWebhookSubscriptionBasicAuthentication(unittest.TestCase): + """WebhookSubscriptionBasicAuthentication unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> WebhookSubscriptionBasicAuthentication: + """Test WebhookSubscriptionBasicAuthentication + 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 WebhookSubscriptionBasicAuthentication( + username = 'username', + password = 'password' + ) + else: + return WebhookSubscriptionBasicAuthentication( + username = 'username', + password = 'password', + ) + + def testWebhookSubscriptionBasicAuthentication(self): + """Test WebhookSubscriptionBasicAuthentication""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, WebhookSubscriptionBasicAuthentication) + assert instance.username == 'username' + assert instance.password == 'password' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_webhook_subscription_request_schema.py b/test/unit/models/test_webhook_subscription_request_schema.py new file mode 100644 index 00000000..f697c2f9 --- /dev/null +++ b/test/unit/models/test_webhook_subscription_request_schema.py @@ -0,0 +1,59 @@ +# 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.webhook_subscription_request_schema import WebhookSubscriptionRequestSchema +from bandwidth.models.tfv_basic_authentication import TfvBasicAuthentication + +class TestWebhookSubscriptionRequestSchema(unittest.TestCase): + """WebhookSubscriptionRequestSchema unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> WebhookSubscriptionRequestSchema: + """Test WebhookSubscriptionRequestSchema + 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 WebhookSubscriptionRequestSchema( + basic_authentication = TfvBasicAuthentication( + username = 'username', + password = 'password', ), + callback_url = 'https://www.example.com/path/to/resource', + shared_secret_key = 'This is my $3cret' + ) + else: + return WebhookSubscriptionRequestSchema( + callback_url = 'https://www.example.com/path/to/resource', + ) + + def testWebhookSubscriptionRequestSchema(self): + """Test WebhookSubscriptionRequestSchema""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, WebhookSubscriptionRequestSchema) + assert instance.basic_authentication.username == 'username' + assert instance.basic_authentication.password == 'password' + assert instance.callback_url == 'https://www.example.com/path/to/resource' + assert instance.shared_secret_key == 'This is my $3cret' + +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 new file mode 100644 index 00000000..f35ae7fc --- /dev/null +++ b/test/unit/models/test_webhook_subscription_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.webhook_subscription_type_enum import WebhookSubscriptionTypeEnum + +class TestWebhookSubscriptionTypeEnum(unittest.TestCase): + """WebhookSubscriptionTypeEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + 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' + +if __name__ == '__main__': + unittest.main() diff --git a/test/unit/models/test_webhook_subscriptions_list_body.py b/test/unit/models/test_webhook_subscriptions_list_body.py new file mode 100644 index 00000000..82e245d9 --- /dev/null +++ b/test/unit/models/test_webhook_subscriptions_list_body.py @@ -0,0 +1,117 @@ +# 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.webhook_subscriptions_list_body import WebhookSubscriptionsListBody +from bandwidth.models.links_object import LinksObject +from bandwidth.models.error import Error +from bandwidth.models.telephone_number import TelephoneNumber +from bandwidth.models.webhook_subscription import WebhookSubscription +from bandwidth.models.webhook_subscription_basic_authentication import WebhookSubscriptionBasicAuthentication + +class TestWebhookSubscriptionsListBody(unittest.TestCase): + """WebhookSubscriptionsListBody unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> WebhookSubscriptionsListBody: + """Test WebhookSubscriptionsListBody + 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 WebhookSubscriptionsListBody( + links = LinksObject( + first = 'https://api.com/abc/first', + next = 'https://api.com/abc/next', + previous = 'https://api.com/abc/previous', + last = 'https://api.com/abc/last', ), + errors = [ + Error( + code = 56, + description = 'description', + telephone_numbers = [ + TelephoneNumber( + telephone_number = '+19195551234', ) + ], ) + ], + data = [ + WebhookSubscription( + id = '7hICGStfAfeGxEq3N0lQwO', + account_id = '1234567', + callback_url = 'https://www.example.com/path/to/resource', + type = 'TOLLFREE_VERIFICATION_STATUS', + basic_authentication = WebhookSubscriptionBasicAuthentication( + username = 'username', + password = 'password', ), + created_date = '2023-05-15T13:56:39.965Z', + modified_date = '2023-05-15T13:56:39.965Z', ) + ] + ) + else: + return WebhookSubscriptionsListBody( + data = [ + WebhookSubscription( + id = '7hICGStfAfeGxEq3N0lQwO', + account_id = '1234567', + callback_url = 'https://www.example.com/path/to/resource', + type = 'TOLLFREE_VERIFICATION_STATUS', + basic_authentication = WebhookSubscriptionBasicAuthentication( + username = 'username', + password = 'password', ), + created_date = '2023-05-15T13:56:39.965Z', + modified_date = '2023-05-15T13:56:39.965Z', ) + ], + ) + + def testWebhookSubscriptionsListBody(self): + """Test WebhookSubscriptionsListBody""" + instance = self.make_instance(True) + assert instance is not None + assert isinstance(instance, WebhookSubscriptionsListBody) + assert isinstance(instance.links, LinksObject) + assert instance.links.first == 'https://api.com/abc/first' + assert instance.links.next == 'https://api.com/abc/next' + assert instance.links.previous == 'https://api.com/abc/previous' + assert instance.links.last == 'https://api.com/abc/last' + assert isinstance(instance.errors, list) + assert len(instance.errors) == 1 + assert isinstance(instance.errors[0], Error) + assert instance.errors[0].code == 56 + assert instance.errors[0].description == 'description' + assert isinstance(instance.errors[0].telephone_numbers, list) + assert len(instance.errors[0].telephone_numbers) == 1 + assert isinstance(instance.errors[0].telephone_numbers[0], TelephoneNumber) + assert instance.errors[0].telephone_numbers[0].telephone_number == '+19195551234' + assert isinstance(instance.data, list) + assert len(instance.data) == 1 + assert isinstance(instance.data[0], WebhookSubscription) + assert instance.data[0].id == '7hICGStfAfeGxEq3N0lQwO' + assert instance.data[0].account_id == '1234567' + assert instance.data[0].callback_url == 'https://www.example.com/path/to/resource' + assert instance.data[0].type == 'TOLLFREE_VERIFICATION_STATUS' + assert instance.data[0].basic_authentication.username == 'username' + assert instance.data[0].basic_authentication.password == 'password' + assert isinstance(instance.data[0].created_date, datetime) + assert isinstance(instance.data[0].modified_date, datetime) + +if __name__ == '__main__': + unittest.main()