diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bf0624f5..ffd531dc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,7 +43,7 @@ jobs: fi - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Ruby uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 8b2b2467..db0c7e97 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -36,7 +36,7 @@ jobs: fail-fast: false steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -47,7 +47,7 @@ jobs: run: | npm install -g @stoplight/prism-cli bundle install - prism mock ./bandwidth.yml & (sleep 3; rake unit) + prism mock ./bandwidth.yml & (sleep 4; rake unit) env: RUBY_VERSION: ${{ matrix.ruby-version }} OPERATING_SYSTEM: ${{ matrix.os }} diff --git a/.github/workflows/test-smoke.yml b/.github/workflows/test-smoke.yml index ba2f43fd..f222edc8 100644 --- a/.github/workflows/test-smoke.yml +++ b/.github/workflows/test-smoke.yml @@ -35,7 +35,7 @@ jobs: MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3acca0e7..8b6cec2d 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -8,6 +8,7 @@ docs/AccountStatistics.md docs/AdditionalDenialReason.md docs/Address.md docs/AnswerCallback.md +docs/AsyncLookupRequest.md docs/BlockedWebhook.md docs/BridgeCompleteCallback.md docs/BridgeTargetCompleteCallback.md @@ -27,6 +28,7 @@ docs/CallbackMethodEnum.md docs/CallsApi.md docs/CardWidthEnum.md docs/CodeRequest.md +docs/CompletedLookupStatusEnum.md docs/Conference.md docs/ConferenceCompletedCallback.md docs/ConferenceCreatedCallback.md @@ -39,11 +41,15 @@ docs/ConferenceRedirectCallback.md docs/ConferenceStateEnum.md docs/ConferencesApi.md docs/Contact.md +docs/CreateAsyncBulkLookupResponse.md +docs/CreateAsyncBulkLookupResponseData.md docs/CreateCall.md docs/CreateCallResponse.md -docs/CreateLookupResponse.md docs/CreateMessageRequestError.md docs/CreateMultiChannelMessageResponse.md +docs/CreateSyncLookupResponse.md +docs/CreateSyncLookupResponseData.md +docs/DeactivationEventEnum.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md @@ -54,18 +60,24 @@ docs/FailureWebhook.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md +docs/GetAsyncBulkLookupResponse.md +docs/GetAsyncBulkLookupResponseData.md +docs/InProgressLookupStatusEnum.md docs/InboundCallback.md docs/InboundCallbackMessage.md docs/InboundCallbackTypeEnum.md docs/InitiateCallback.md +docs/LatestMessageDeliveryStatusEnum.md +docs/LineTypeEnum.md docs/Link.md +docs/LinkSchema.md docs/LinksObject.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md -docs/LookupRequest.md +docs/LookupErrorResponse.md +docs/LookupErrorSchema.md +docs/LookupErrorSchemaMeta.md docs/LookupResult.md -docs/LookupStatus.md -docs/LookupStatusEnum.md docs/MFAApi.md docs/MachineDetectionCompleteCallback.md docs/MachineDetectionConfiguration.md @@ -134,6 +146,7 @@ docs/StatusCallback.md docs/StatusCallbackMessage.md docs/StatusCallbackTypeEnum.md docs/StirShaken.md +docs/SyncLookupRequest.md docs/TelephoneNumber.md docs/TfvBasicAuthentication.md docs/TfvCallbackStatusEnum.md @@ -143,7 +156,6 @@ docs/TfvStatusEnum.md docs/TfvSubmissionInfo.md docs/TfvSubmissionWrapper.md docs/ThumbnailAlignmentEnum.md -docs/TnLookupRequestError.md docs/TollFreeVerificationApi.md docs/TranscribeRecording.md docs/Transcription.md @@ -189,6 +201,7 @@ lib/bandwidth-sdk/models/account_statistics.rb lib/bandwidth-sdk/models/additional_denial_reason.rb lib/bandwidth-sdk/models/address.rb lib/bandwidth-sdk/models/answer_callback.rb +lib/bandwidth-sdk/models/async_lookup_request.rb lib/bandwidth-sdk/models/blocked_webhook.rb lib/bandwidth-sdk/models/bridge_complete_callback.rb lib/bandwidth-sdk/models/bridge_target_complete_callback.rb @@ -207,6 +220,7 @@ lib/bandwidth-sdk/models/callback.rb lib/bandwidth-sdk/models/callback_method_enum.rb lib/bandwidth-sdk/models/card_width_enum.rb lib/bandwidth-sdk/models/code_request.rb +lib/bandwidth-sdk/models/completed_lookup_status_enum.rb lib/bandwidth-sdk/models/conference.rb lib/bandwidth-sdk/models/conference_completed_callback.rb lib/bandwidth-sdk/models/conference_created_callback.rb @@ -218,11 +232,15 @@ lib/bandwidth-sdk/models/conference_recording_metadata.rb lib/bandwidth-sdk/models/conference_redirect_callback.rb lib/bandwidth-sdk/models/conference_state_enum.rb lib/bandwidth-sdk/models/contact.rb +lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb +lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb lib/bandwidth-sdk/models/create_call.rb lib/bandwidth-sdk/models/create_call_response.rb -lib/bandwidth-sdk/models/create_lookup_response.rb lib/bandwidth-sdk/models/create_message_request_error.rb lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +lib/bandwidth-sdk/models/create_sync_lookup_response.rb +lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb +lib/bandwidth-sdk/models/deactivation_event_enum.rb lib/bandwidth-sdk/models/disconnect_callback.rb lib/bandwidth-sdk/models/diversion.rb lib/bandwidth-sdk/models/dtmf_callback.rb @@ -233,18 +251,24 @@ lib/bandwidth-sdk/models/failure_webhook.rb lib/bandwidth-sdk/models/field_error.rb lib/bandwidth-sdk/models/file_format_enum.rb lib/bandwidth-sdk/models/gather_callback.rb +lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb +lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb +lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb lib/bandwidth-sdk/models/inbound_callback.rb lib/bandwidth-sdk/models/inbound_callback_message.rb lib/bandwidth-sdk/models/inbound_callback_type_enum.rb lib/bandwidth-sdk/models/initiate_callback.rb +lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb +lib/bandwidth-sdk/models/line_type_enum.rb lib/bandwidth-sdk/models/link.rb +lib/bandwidth-sdk/models/link_schema.rb lib/bandwidth-sdk/models/links_object.rb lib/bandwidth-sdk/models/list_message_direction_enum.rb lib/bandwidth-sdk/models/list_message_item.rb -lib/bandwidth-sdk/models/lookup_request.rb +lib/bandwidth-sdk/models/lookup_error_response.rb +lib/bandwidth-sdk/models/lookup_error_schema.rb +lib/bandwidth-sdk/models/lookup_error_schema_meta.rb lib/bandwidth-sdk/models/lookup_result.rb -lib/bandwidth-sdk/models/lookup_status.rb -lib/bandwidth-sdk/models/lookup_status_enum.rb lib/bandwidth-sdk/models/machine_detection_complete_callback.rb lib/bandwidth-sdk/models/machine_detection_configuration.rb lib/bandwidth-sdk/models/machine_detection_mode_enum.rb @@ -306,6 +330,7 @@ lib/bandwidth-sdk/models/status_callback.rb lib/bandwidth-sdk/models/status_callback_message.rb lib/bandwidth-sdk/models/status_callback_type_enum.rb lib/bandwidth-sdk/models/stir_shaken.rb +lib/bandwidth-sdk/models/sync_lookup_request.rb lib/bandwidth-sdk/models/telephone_number.rb lib/bandwidth-sdk/models/tfv_basic_authentication.rb lib/bandwidth-sdk/models/tfv_callback_status_enum.rb @@ -315,7 +340,6 @@ lib/bandwidth-sdk/models/tfv_status_enum.rb lib/bandwidth-sdk/models/tfv_submission_info.rb lib/bandwidth-sdk/models/tfv_submission_wrapper.rb lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb -lib/bandwidth-sdk/models/tn_lookup_request_error.rb lib/bandwidth-sdk/models/transcribe_recording.rb lib/bandwidth-sdk/models/transcription.rb lib/bandwidth-sdk/models/transcription_available_callback.rb diff --git a/README.md b/README.md index bbdeb6af..ea5a5e84 100644 --- a/README.md +++ b/README.md @@ -131,8 +131,9 @@ Class | Method | HTTP request | Description *Bandwidth::MessagesApi* | [**create_message**](docs/MessagesApi.md#create_message) | **POST** /users/{accountId}/messages | Create Message *Bandwidth::MessagesApi* | [**list_messages**](docs/MessagesApi.md#list_messages) | **GET** /users/{accountId}/messages | List Messages *Bandwidth::MultiChannelApi* | [**create_multi_channel_message**](docs/MultiChannelApi.md#create_multi_channel_message) | **POST** /users/{accountId}/messages/multiChannel | Create Multi-Channel Message -*Bandwidth::PhoneNumberLookupApi* | [**create_lookup**](docs/PhoneNumberLookupApi.md#create_lookup) | **POST** /accounts/{accountId}/tnlookup | Create Lookup -*Bandwidth::PhoneNumberLookupApi* | [**get_lookup_status**](docs/PhoneNumberLookupApi.md#get_lookup_status) | **GET** /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status +*Bandwidth::PhoneNumberLookupApi* | [**create_async_bulk_lookup**](docs/PhoneNumberLookupApi.md#create_async_bulk_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup +*Bandwidth::PhoneNumberLookupApi* | [**create_sync_lookup**](docs/PhoneNumberLookupApi.md#create_sync_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup +*Bandwidth::PhoneNumberLookupApi* | [**get_async_bulk_lookup**](docs/PhoneNumberLookupApi.md#get_async_bulk_lookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup *Bandwidth::RecordingsApi* | [**delete_recording**](docs/RecordingsApi.md#delete_recording) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording *Bandwidth::RecordingsApi* | [**delete_recording_media**](docs/RecordingsApi.md#delete_recording_media) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media *Bandwidth::RecordingsApi* | [**delete_recording_transcription**](docs/RecordingsApi.md#delete_recording_transcription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription @@ -164,6 +165,7 @@ Class | Method | HTTP request | Description - [Bandwidth::AdditionalDenialReason](docs/AdditionalDenialReason.md) - [Bandwidth::Address](docs/Address.md) - [Bandwidth::AnswerCallback](docs/AnswerCallback.md) + - [Bandwidth::AsyncLookupRequest](docs/AsyncLookupRequest.md) - [Bandwidth::BlockedWebhook](docs/BlockedWebhook.md) - [Bandwidth::BridgeCompleteCallback](docs/BridgeCompleteCallback.md) - [Bandwidth::BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md) @@ -182,6 +184,7 @@ Class | Method | HTTP request | Description - [Bandwidth::CallbackMethodEnum](docs/CallbackMethodEnum.md) - [Bandwidth::CardWidthEnum](docs/CardWidthEnum.md) - [Bandwidth::CodeRequest](docs/CodeRequest.md) + - [Bandwidth::CompletedLookupStatusEnum](docs/CompletedLookupStatusEnum.md) - [Bandwidth::Conference](docs/Conference.md) - [Bandwidth::ConferenceCompletedCallback](docs/ConferenceCompletedCallback.md) - [Bandwidth::ConferenceCreatedCallback](docs/ConferenceCreatedCallback.md) @@ -193,11 +196,15 @@ Class | Method | HTTP request | Description - [Bandwidth::ConferenceRedirectCallback](docs/ConferenceRedirectCallback.md) - [Bandwidth::ConferenceStateEnum](docs/ConferenceStateEnum.md) - [Bandwidth::Contact](docs/Contact.md) + - [Bandwidth::CreateAsyncBulkLookupResponse](docs/CreateAsyncBulkLookupResponse.md) + - [Bandwidth::CreateAsyncBulkLookupResponseData](docs/CreateAsyncBulkLookupResponseData.md) - [Bandwidth::CreateCall](docs/CreateCall.md) - [Bandwidth::CreateCallResponse](docs/CreateCallResponse.md) - - [Bandwidth::CreateLookupResponse](docs/CreateLookupResponse.md) - [Bandwidth::CreateMessageRequestError](docs/CreateMessageRequestError.md) - [Bandwidth::CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) + - [Bandwidth::CreateSyncLookupResponse](docs/CreateSyncLookupResponse.md) + - [Bandwidth::CreateSyncLookupResponseData](docs/CreateSyncLookupResponseData.md) + - [Bandwidth::DeactivationEventEnum](docs/DeactivationEventEnum.md) - [Bandwidth::DisconnectCallback](docs/DisconnectCallback.md) - [Bandwidth::Diversion](docs/Diversion.md) - [Bandwidth::DtmfCallback](docs/DtmfCallback.md) @@ -208,18 +215,24 @@ Class | Method | HTTP request | Description - [Bandwidth::FieldError](docs/FieldError.md) - [Bandwidth::FileFormatEnum](docs/FileFormatEnum.md) - [Bandwidth::GatherCallback](docs/GatherCallback.md) + - [Bandwidth::GetAsyncBulkLookupResponse](docs/GetAsyncBulkLookupResponse.md) + - [Bandwidth::GetAsyncBulkLookupResponseData](docs/GetAsyncBulkLookupResponseData.md) + - [Bandwidth::InProgressLookupStatusEnum](docs/InProgressLookupStatusEnum.md) - [Bandwidth::InboundCallback](docs/InboundCallback.md) - [Bandwidth::InboundCallbackMessage](docs/InboundCallbackMessage.md) - [Bandwidth::InboundCallbackTypeEnum](docs/InboundCallbackTypeEnum.md) - [Bandwidth::InitiateCallback](docs/InitiateCallback.md) + - [Bandwidth::LatestMessageDeliveryStatusEnum](docs/LatestMessageDeliveryStatusEnum.md) + - [Bandwidth::LineTypeEnum](docs/LineTypeEnum.md) - [Bandwidth::Link](docs/Link.md) + - [Bandwidth::LinkSchema](docs/LinkSchema.md) - [Bandwidth::LinksObject](docs/LinksObject.md) - [Bandwidth::ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [Bandwidth::ListMessageItem](docs/ListMessageItem.md) - - [Bandwidth::LookupRequest](docs/LookupRequest.md) + - [Bandwidth::LookupErrorResponse](docs/LookupErrorResponse.md) + - [Bandwidth::LookupErrorSchema](docs/LookupErrorSchema.md) + - [Bandwidth::LookupErrorSchemaMeta](docs/LookupErrorSchemaMeta.md) - [Bandwidth::LookupResult](docs/LookupResult.md) - - [Bandwidth::LookupStatus](docs/LookupStatus.md) - - [Bandwidth::LookupStatusEnum](docs/LookupStatusEnum.md) - [Bandwidth::MachineDetectionCompleteCallback](docs/MachineDetectionCompleteCallback.md) - [Bandwidth::MachineDetectionConfiguration](docs/MachineDetectionConfiguration.md) - [Bandwidth::MachineDetectionModeEnum](docs/MachineDetectionModeEnum.md) @@ -281,6 +294,7 @@ Class | Method | HTTP request | Description - [Bandwidth::StatusCallbackMessage](docs/StatusCallbackMessage.md) - [Bandwidth::StatusCallbackTypeEnum](docs/StatusCallbackTypeEnum.md) - [Bandwidth::StirShaken](docs/StirShaken.md) + - [Bandwidth::SyncLookupRequest](docs/SyncLookupRequest.md) - [Bandwidth::TelephoneNumber](docs/TelephoneNumber.md) - [Bandwidth::TfvBasicAuthentication](docs/TfvBasicAuthentication.md) - [Bandwidth::TfvCallbackStatusEnum](docs/TfvCallbackStatusEnum.md) @@ -290,7 +304,6 @@ Class | Method | HTTP request | Description - [Bandwidth::TfvSubmissionInfo](docs/TfvSubmissionInfo.md) - [Bandwidth::TfvSubmissionWrapper](docs/TfvSubmissionWrapper.md) - [Bandwidth::ThumbnailAlignmentEnum](docs/ThumbnailAlignmentEnum.md) - - [Bandwidth::TnLookupRequestError](docs/TnLookupRequestError.md) - [Bandwidth::TranscribeRecording](docs/TranscribeRecording.md) - [Bandwidth::Transcription](docs/Transcription.md) - [Bandwidth::TranscriptionAvailableCallback](docs/TranscriptionAvailableCallback.md) diff --git a/bandwidth.yml b/bandwidth.yml index bf2c9ab0..0c613484 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -1328,62 +1328,66 @@ paths: '500': $ref: '#/components/responses/mfaInternalServerError' servers: *ref_2 - /accounts/{accountId}/tnlookup: + /accounts/{accountId}/phoneNumberLookup: post: - deprecated: true - summary: Create Lookup - description: Create a Phone Number Lookup Request. - operationId: createLookup + summary: Create Synchronous Number Lookup + description: >- + Creates a synchronous phone number lookup request. Maximum of 100 + telephone numbers per request. + operationId: createSyncLookup tags: - Phone Number Lookup parameters: - - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/accountId1' requestBody: - $ref: '#/components/requestBodies/createLookupRequest' + $ref: '#/components/requestBodies/createSyncLookupRequest' responses: - '202': - $ref: '#/components/responses/createLookupResponse' - '400': - $ref: '#/components/responses/tnLookupBadRequestError' - '401': - $ref: '#/components/responses/tnLookupUnauthorizedError' - '403': - $ref: '#/components/responses/tnLookupForbiddenError' - '415': - $ref: '#/components/responses/tnLookupMediaTypeError' - '429': - $ref: '#/components/responses/tnLookupTooManyRequestsError' - '500': - $ref: '#/components/responses/tnLookupInternalServerError' + '200': + $ref: '#/components/responses/createSyncLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' servers: &ref_3 - - url: https://numbers.bandwidth.com/api/v1 + - url: https://api.bandwidth.com/v2 description: Production - /accounts/{accountId}/tnlookup/{requestId}: + /accounts/{accountId}/phoneNumberLookup/bulk: + post: + summary: Create Asynchronous Bulk Number Lookup + description: >- + Creates an asynchronous bulk phone number lookup request. Maximum of + 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk + Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) + endpoint to check the status of the request and view the results. + operationId: createAsyncBulkLookup + tags: + - Phone Number Lookup + parameters: + - $ref: '#/components/parameters/accountId1' + requestBody: + $ref: '#/components/requestBodies/createAsyncBulkLookupRequest' + responses: + '202': + $ref: '#/components/responses/createAsyncBulkLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' + servers: *ref_3 + /accounts/{accountId}/phoneNumberLookup/bulk/{requestId}: get: - deprecated: true - summary: Get Lookup Request Status - description: Get an existing Phone Number Lookup Request. - operationId: getLookupStatus + summary: Get Asynchronous Bulk Number Lookup + description: >- + Get an existing [Asynchronous Bulk Number + Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use + this endpoint to check the status of the request and view the results. + operationId: getAsyncBulkLookup tags: - Phone Number Lookup parameters: - - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/accountId1' - $ref: '#/components/parameters/requestId' responses: '200': - $ref: '#/components/responses/getLookupResponse' - '400': - $ref: '#/components/responses/tnLookupBadRequestError' - '401': - $ref: '#/components/responses/tnLookupUnauthorizedError' - '403': - $ref: '#/components/responses/tnLookupForbiddenError' - '404': - $ref: '#/components/responses/tnLookupNotFoundError' - '429': - $ref: '#/components/responses/tnLookupTooManyRequestsError' - '500': - $ref: '#/components/responses/tnLookupInternalServerError' + $ref: '#/components/responses/getAsyncBulkLookupResponse' + default: + $ref: '#/components/responses/tnLookupDefaultResponse' servers: *ref_3 /accounts/{accountId}/tollFreeVerification: post: @@ -5368,112 +5372,291 @@ components: The message containing the reason behind the request being forbidden. example: Missing Authentication Token - lookupStatusEnum: + completedLookupStatusEnum: + type: string + enum: + - COMPLETE + - PARTIAL_COMPLETE + - FAILED + example: COMPLETE + inProgressLookupStatusEnum: type: string - description: >- - The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or - FAILED). enum: - IN_PROGRESS - COMPLETE - PARTIAL_COMPLETE - FAILED example: COMPLETE - lookupRequest: + deactivationEventEnum: + type: string + description: > + [DNI-Only](#section/DNI-Only). + + `DEACTIVATED` if the carrier reported a deactivation event for this + phone number. + enum: + - DEACTIVATED + latestMessageDeliveryStatusEnum: + type: string + description: >- + [DNI-Only](#section/DNI-Only). The current delivery status of the phone + number. + + - ACTIVE: A message was successfully sent to the number (delivery code + 0). + + - DEACTIVATED: A message was not delivered to a number (delivery code + 720) + + - UNKNOWN: Bandwidth cannot find an delivery status entry for the + number. + enum: + - ACTIVE + - DEACTIVATED + - UNKNOWN + lineTypeEnum: + type: string + enum: + - FIXED + - VOIP-FIXED + - MOBILE + - VOIP + example: MOBILE + requestId: + type: string + format: uuid + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + linkSchema: + title: Link type: object - description: Create phone number lookup request. properties: - tns: + href: + type: string + description: URI of the link. + example: /relative/uri + rel: + type: string + description: Specifies the relationship between this link and the resource. + example: aRelatedResource + method: + type: string + description: HTTP method to be used. + example: GET + lookupErrorSchema: + type: object + properties: + code: + type: string + description: Validation error code + example: NO-MATCH + description: + type: string + description: Description of validation error + example: Example error description + type: + type: string + description: Type of validation error + example: NumberInventory + meta: + type: object + properties: + phoneNumbers: + type: array + items: + type: string + description: Phone number experiencing the error. + example: + - '+13992077164' + - '+19196104424' + message: + type: string + description: Message describing the error + example: Invalid TNs + code: + type: integer + description: Error code associated with the message + example: 1001 + syncLookupRequest: + type: object + properties: + phoneNumbers: + description: Telephone numbers in E.164 format. type: array + minimum: 1 + maximum: 100 items: type: string + pattern: ^\+[1-9]\d{1,14}$ required: - - tns - createLookupResponse: + - phoneNumbers + asyncLookupRequest: type: object - description: >- - The request has been accepted for processing but not yet finished and in - a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). properties: - requestId: - type: string - description: The phone number lookup request ID from Bandwidth. - status: - $ref: '#/components/schemas/lookupStatusEnum' - lookupStatus: + phoneNumbers: + description: Telephone numbers in E.164 format. + type: array + minimum: 1 + maximum: 15000 + items: + type: string + pattern: ^\+[1-9]\d{1,14}$ + required: + - phoneNumbers + createSyncLookupResponse: type: object - description: >- - If requestId exists, the result for that request is returned. See the - Examples for details on the various responses that you can receive. - Generally, if you see a Response Code of 0 in a result for a TN, - information will be available for it. Any other Response Code will - indicate no information was available for the TN. properties: - requestId: - type: string - description: The requestId. - example: 004223a0-8b17-41b1-bf81-20732adf5590 - status: - $ref: '#/components/schemas/lookupStatusEnum' - result: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/completedLookupStatusEnum' + results: + type: array + description: >- + The carrier information results for the specified telephone + numbers. + items: + $ref: '#/components/schemas/lookupResult' + errors: type: array - description: The carrier information results for the specified telephone number. items: - $ref: '#/components/schemas/lookupResult' - failedTelephoneNumbers: + $ref: '#/components/schemas/lookupErrorSchema' + createAsyncBulkLookupResponse: + type: object + properties: + links: type: array - description: The telephone numbers whose lookup failed. + description: Links for pagination (if applicable) items: - type: string - example: - - '+191955512345' + $ref: '#/components/schemas/linkSchema' + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/inProgressLookupStatusEnum' + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + getAsyncBulkLookupResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + properties: + requestId: + $ref: '#/components/schemas/requestId' + status: + $ref: '#/components/schemas/inProgressLookupStatusEnum' + results: + type: array + description: >- + The carrier information results for the specified telephone + number. + items: + $ref: '#/components/schemas/lookupResult' + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' + lookupErrorResponse: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/linkSchema' + example: [] + data: + type: object + description: The phone number lookup response data + errors: + type: array + items: + $ref: '#/components/schemas/lookupErrorSchema' lookupResult: type: object description: Carrier information results for the specified telephone number. properties: - Response Code: - type: integer - description: Our vendor's response code. - example: 0 - Message: - type: string - description: Message associated with the response code. - example: NOERROR - E.164 Format: + phoneNumber: type: string description: The telephone number in E.164 format. - example: '+19195551234' - Formatted: - type: string - description: The formatted version of the telephone number. - example: (919) 555-1234 - Country: - type: string - description: The country of the telephone number. - example: US - Line Type: - type: string - description: The line type of the telephone number. - example: Mobile - Line Provider: + example: '+10072904498' + lineType: + $ref: '#/components/schemas/lineTypeEnum' + messagingProvider: type: string description: The messaging service provider of the telephone number. example: Verizon Wireless - Mobile Country Code: + voiceProvider: type: string - description: The first half of the Home Network Identity (HNI). - example: '310' - Mobile Network Code: + description: The voice service provider of the telephone number. + example: Verizon Wireless + countryCodeA3: type: string - description: The second half of the HNI. - example: '010' - tnLookupRequestError: - type: object - properties: - message: + description: >- + The country code of the telephone number in ISO 3166-1 alpha-3 + format. + example: USA + deactivationReporter: + type: string + description: > + [DNI-Only](#section/DNI-Only). + + The carrier that reported a deactivation event for this phone + number. + deactivationDate: + type: string + format: date-time-local + description: >- + [DNI-Only](#section/DNI-Only). The datetime the carrier reported a + deactivation event. + example: 2025-06-20 18:35 + deactivationEvent: + $ref: '#/components/schemas/deactivationEventEnum' + latestMessageDeliveryStatus: + $ref: '#/components/schemas/latestMessageDeliveryStatusEnum' + initialMessageDeliveryStatusDate: + type: string + format: date + description: >- + [DNI-Only](#section/DNI-Only). The date the phone number entered the + status described in `latestMessageDeliveryStatus`. + + Think of this as the "start time" for that status. + + Value resets every time the `latestMessageDeliveryStatus` changes. + example: '2025-06-20' + latestMessageDeliveryStatusDate: type: string - description: A description of what validation error occurred. - example: example error message + format: date + description: >- + [DNI-Only](#section/DNI-Only). The date bandwidth last received + delivery status information for this phone number. + + Use this field to understand how up-to-date the + `latestMessageDeliveryStatus` is. + + Value resets every time the `latestMessageDeliveryStatus` changes. + example: '2025-06-21' accountId1: type: string description: User's account ID. @@ -6720,109 +6903,68 @@ components: application/json: schema: $ref: '#/components/schemas/mfaRequestError' - createLookupResponse: + createSyncLookupResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/createSyncLookupResponse' + examples: + lookupCompleteWithDniExample: + $ref: '#/components/examples/lookupCompleteWithDniExample' + lookupCompleteExample: + $ref: '#/components/examples/lookupCompleteExample' + lookupPartialExample: + $ref: '#/components/examples/lookupPartialExample' + lookupFailedExample: + $ref: '#/components/examples/lookupFailedExample' + createAsyncBulkLookupResponse: description: Accepted content: application/json: schema: - $ref: '#/components/schemas/createLookupResponse' + $ref: '#/components/schemas/createAsyncBulkLookupResponse' examples: - lookupResponseExample: + lookupInProgressExample: $ref: '#/components/examples/lookupInProgressExample' - getLookupResponse: + getAsyncBulkLookupResponse: description: OK content: application/json: schema: - $ref: '#/components/schemas/lookupStatus' + $ref: '#/components/schemas/getAsyncBulkLookupResponse' examples: + lookupCompleteWithDniExample: + $ref: '#/components/examples/lookupCompleteWithDniExample' + lookupCompleteExample: + $ref: '#/components/examples/lookupCompleteExample' lookupInProgressExample: $ref: '#/components/examples/lookupInProgressExample' + lookupPartialExample: + $ref: '#/components/examples/lookupPartialExample' lookupFailedExample: $ref: '#/components/examples/lookupFailedExample' - lookupSingleNumberCompleteExample: - $ref: '#/components/examples/lookupSingleNumberCompleteExample' - lookupMultipleNumbersCompleteExample: - $ref: '#/components/examples/lookupMultipleNumbersCompleteExample' - lookupMultipleNumbersPartialCompleteExample: - $ref: >- - #/components/examples/lookupMultipleNumbersPartialCompleteExample - lookupSingleNumberCompleteNoInfoExample: - $ref: '#/components/examples/lookupSingleNumberCompleteNoInfoExample' - tnLookupBadRequestError: + tnLookupDefaultResponse: description: Bad Request content: application/json: schema: - $ref: '#/components/schemas/tnLookupRequestError' + $ref: '#/components/schemas/lookupErrorResponse' examples: badRequest: - summary: Example Bad Request Error - value: - message: 'Some tns do not match e164 format: 1234' - tnLookupUnauthorizedError: - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: + $ref: '#/components/examples/badRequestExample' unauthorized: - summary: Example Unauthorized Error - value: - message: Unauthorized - tnLookupForbiddenError: - description: Forbidden - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: + $ref: '#/components/examples/unauthorizedExample' forbidden: - summary: Example Forbidden Error - value: - message: >- - Authorization header requires 'Credential' parameter. - Authorization header requires 'Signature' parameter. - Authorization header requires 'SignedHeaders' parameter. - Authorization header requires existence of either a - 'X-Amz-Date' or a 'Date' header. Authorization=Basic - Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' - tnLookupMediaTypeError: - description: Unsupported Media Type - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: - mediaType: - summary: Example Unsupported Media Type Error - value: - message: Content-Type must be application/json. - tnLookupNotFoundError: - description: Not Found - tnLookupTooManyRequestsError: - description: Too Many Requests - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: + $ref: '#/components/examples/forbiddenExample' mediaType: - summary: Example Too Many Requests Error - value: - message: Too many requests. - tnLookupInternalServerError: - description: Internal Server Error - content: - application/json: - schema: - $ref: '#/components/schemas/tnLookupRequestError' - examples: - mediaType: - summary: Example Internal Server Error Error - value: - message: Request has not been passed further. + $ref: '#/components/examples/unsupportedMediaTypeExample' + notFound: + $ref: '#/components/examples/notFoundExample' + tooManyRequests: + $ref: '#/components/examples/tooManyRequestsExample' + internalServer: + $ref: '#/components/examples/internalServerErrorExample' getTollFreeVerificationStatusResponse: description: OK content: @@ -7405,14 +7547,23 @@ components: type: string description: Filter results to calls with specified call Disconnect Cause. example: hangup + accountId1: + in: path + name: accountId + required: true + schema: + type: string + description: Your Bandwidth Account ID. + example: '9900000' requestId: - name: requestId in: path + name: requestId required: true schema: type: string - description: The phone number lookup request ID from Bandwidth. - example: 004223a0-8b17-41b1-bf81-20732adf5590 + format: uuid + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 tfPhoneNumberPathParam: in: path name: phoneNumber @@ -7651,95 +7802,208 @@ components: type: validation description: 'Invalid answerUrl: only http and https are allowed.' singleNumberRequestExample: - summary: Example Number Lookup Request for One Number + summary: Number Lookup Request value: - tns: - - '+19195551234' + phoneNumbers: + - '+19196104423' multipleNumberRequestExample: - summary: Example Number Lookup Request for Multiple Numbers + summary: Number Lookup Request for Multiple Numbers value: - tns: - - '+19195551234' - - '+19195554321' + phoneNumbers: + - '+19196104423' + - '+19196104424' lookupInProgressExample: - summary: Example Lookup In Progress Response + summary: Numbers Lookup In Progress value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: IN_PROGRESS + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + results: [] + errors: [] lookupFailedExample: - summary: Example Lookup Failed Response + summary: Numbers Lookup Failed + value: + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: FAILED + results: [] + errors: + - code: NO-MATCH + description: The following TNs could not be found in the Number Industry data + meta: + phoneNumbers: + - '+13992077164' + message: Invalid TNs + code: 1001 + type: NumberInventory + lookupPartialExample: + summary: Numbers Lookup Partial Complete + value: + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: PARTIAL_COMPLETE + results: + - phoneNumber: '+19196104423' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + - phoneNumber: '+19196104424' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + errors: + - code: NO-MATCH + description: The following TNs could not be found in the Number Industry data + meta: + phoneNumbers: + - '+13992077164' + message: Invalid TNs + code: 1001 + type: NumberInventory + lookupCompleteExample: + summary: Numbers Lookup Complete (without DNI) + value: + links: + - href: href + rel: rel + method: GET + data: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + lineType: MOBILE + messagingProvider: Verizon Wireless + voiceProvider: Verizon Wireless + countryCodeA3: USA + - phoneNumber: '+10072904498' + lineType: MOBILE + messagingProvider: T-Mobile USA + voiceProvider: T-Mobile USA + countryCodeA3: USA + errors: [] + lookupCompleteWithDniExample: + summary: Numbers Lookup Complete (with DNI) value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: FAILED - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteExample: - summary: Example Single Number Lookup Complete Response + links: + - href: href + rel: rel + method: GET + data: + requestId: 20732adf-bf81-8b17-41b1-004223a05590 + status: COMPLETE + results: + - phoneNumber: '+10072904497' + countryCodeA3: USA + lineType: MOBILE + messagingProvider: T-MOBILE USA INC + voiceProvider: T-MOBILE USA INC + latestMessageDeliveryStatus: ACTIVE + initialMessageDeliveryStatusDate: '2025-05-14' + latestMessageDeliveryStatusDate: '2025-05-18' + - phoneNumber: '+10072904498' + countryCodeA3: USA + lineType: FIXED + voiceProvider: VERIZON + latestMessageDeliveryStatus: DEACTIVATED + initialMessageDeliveryStatusDate: '2025-09-05' + latestMessageDeliveryStatusDate: '2025-09-05' + - phoneNumber: '+10072904499' + lineType: MOBILE + countryCodeA3: USA + messagingProvider: VERIZON + voiceProvider: VERIZON + deactivationReporter: Verizon Wireless + deactivationDate: '2025-09-29 01:23:00' + deactivationEvent: DEACTIVATED + latestMessageDeliveryStatus: UNKNOWN + errors: [] + badRequestExample: + summary: Example Bad Request Error + value: + links: [] + data: {} + errors: + - type: bad-request + description: >- + Bad Request. Ensure that you have set the requestId as a URL path + parameter. + unauthorizedExample: + summary: Unauthorized Error + value: + links: [] + data: {} + errors: + - type: Unauthorized + description: You are not authorized to access this resource. + code: '1' + page: null + forbiddenExample: + summary: Forbidden Error + value: + links: [] + data: {} + errors: + - type: Forbidden + description: You do not have permission to access this resource. + code: '2' + page: null + unsupportedMediaTypeExample: + summary: Unsupported Media Type Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - lookupMultipleNumbersCompleteExample: - summary: Example Multiple Numbers Lookup Complete Response + links: [] + data: {} + errors: + - type: invalid-content-type + description: >- + Invalid content-type. Ensure that your content-type header is set + to application/json. + notFoundExample: + summary: Not Found Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195554321' - Formatted: (919) 555-4321 - Country: US - Line Type: Mobile - Line Provider: T-Mobile USA - Mobile Country Code: '310' - Mobile Network Code: '160' - lookupMultipleNumbersPartialCompleteExample: - summary: Example Multiple Numbers Lookup Partial Complete Response + links: [] + data: {} + errors: + - type: not-found + description: >- + RequestId not found. Ensure that the requestId used in the URL + path is valid and maps to a previous request that was submitted. + tooManyRequestsExample: + summary: Too Many Requests Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: PARTIAL_COMPLETE - result: - - Response Code: 0 - Message: NOERROR - E.164 Format: '+19195551234' - Formatted: (919) 555-1234 - Country: US - Line Type: Mobile - Line Provider: Verizon Wireless - Mobile Country Code: '310' - Mobile Network Code: '010' - failedTelephoneNumbers: - - '+191955512345' - lookupSingleNumberCompleteNoInfoExample: - summary: Example Single Number Lookup Complete with No Information Response + links: [] + data: {} + errors: + - type: rate-limiting + description: >- + Rate limit exceeded. Wait for the time specified in the + Retry-After header before sending another request. + internalServerErrorExample: + summary: Internal Server Error value: - requestId: 004223a0-8b17-41b1-bf81-20732adf5590 - status: COMPLETE - result: - - Response Code: 3 - Message: NXDOMAIN - E.164 Format: '+19195550000' - Formatted: (919) 555-0000 - Country: US + links: [] + data: {} + errors: + - code: '500' + type: unexpected-error + description: >- + Unexpected error. Please contact Bandwidth Support if your + requests are receiving this status code for an extended period of + time. requestBodies: createMessageRequest: content: @@ -8039,18 +8303,28 @@ components: application/json: schema: $ref: '#/components/schemas/verifyCodeRequest' - createLookupRequest: - description: Phone number lookup request. + createSyncLookupRequest: + description: Synchronous phone number lookup request. required: true content: application/json: schema: - $ref: '#/components/schemas/lookupRequest' + $ref: '#/components/schemas/syncLookupRequest' examples: singleNumberRequestExample: $ref: '#/components/examples/singleNumberRequestExample' multipleNumberRequestExample: $ref: '#/components/examples/multipleNumberRequestExample' + createAsyncBulkLookupRequest: + description: Asynchronous bulk phone number lookup request. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/asyncLookupRequest' + examples: + multipleNumberRequestExample: + $ref: '#/components/examples/multipleNumberRequestExample' requestTollFreeVerificationRequest: description: Request for verification of a toll-free phone number. required: true diff --git a/docs/AsyncLookupRequest.md b/docs/AsyncLookupRequest.md new file mode 100644 index 00000000..af51dace --- /dev/null +++ b/docs/AsyncLookupRequest.md @@ -0,0 +1,18 @@ +# Bandwidth::AsyncLookupRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone_numbers** | **Array<String>** | Telephone numbers in E.164 format. | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::AsyncLookupRequest.new( + phone_numbers: null +) +``` + diff --git a/docs/LookupRequest.md b/docs/CompletedLookupStatusEnum.md similarity index 53% rename from docs/LookupRequest.md rename to docs/CompletedLookupStatusEnum.md index 566786c8..cb29c5ba 100644 --- a/docs/LookupRequest.md +++ b/docs/CompletedLookupStatusEnum.md @@ -1,18 +1,15 @@ -# Bandwidth::LookupRequest +# Bandwidth::CompletedLookupStatusEnum ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **tns** | **Array<String>** | | | ## Example ```ruby require 'bandwidth-sdk' -instance = Bandwidth::LookupRequest.new( - tns: null -) +instance = Bandwidth::CompletedLookupStatusEnum.new() ``` diff --git a/docs/CreateAsyncBulkLookupResponse.md b/docs/CreateAsyncBulkLookupResponse.md new file mode 100644 index 00000000..2be7ebdc --- /dev/null +++ b/docs/CreateAsyncBulkLookupResponse.md @@ -0,0 +1,22 @@ +# Bandwidth::CreateAsyncBulkLookupResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **links** | [**Array<LinkSchema>**](LinkSchema.md) | Links for pagination (if applicable) | [optional] | +| **data** | [**CreateAsyncBulkLookupResponseData**](CreateAsyncBulkLookupResponseData.md) | | [optional] | +| **errors** | [**Array<LookupErrorSchema>**](LookupErrorSchema.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::CreateAsyncBulkLookupResponse.new( + links: null, + data: null, + errors: null +) +``` + diff --git a/docs/CreateLookupResponse.md b/docs/CreateAsyncBulkLookupResponseData.md similarity index 50% rename from docs/CreateLookupResponse.md rename to docs/CreateAsyncBulkLookupResponseData.md index dae614e2..bbb8cd05 100644 --- a/docs/CreateLookupResponse.md +++ b/docs/CreateAsyncBulkLookupResponseData.md @@ -1,19 +1,19 @@ -# Bandwidth::CreateLookupResponse +# Bandwidth::CreateAsyncBulkLookupResponseData ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **request_id** | **String** | The phone number lookup request ID from Bandwidth. | [optional] | -| **status** | [**LookupStatusEnum**](LookupStatusEnum.md) | | [optional] | +| **status** | [**InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [optional] | ## Example ```ruby require 'bandwidth-sdk' -instance = Bandwidth::CreateLookupResponse.new( - request_id: null, +instance = Bandwidth::CreateAsyncBulkLookupResponseData.new( + request_id: 004223a0-8b17-41b1-bf81-20732adf5590, status: null ) ``` diff --git a/docs/CreateSyncLookupResponse.md b/docs/CreateSyncLookupResponse.md new file mode 100644 index 00000000..20047ce6 --- /dev/null +++ b/docs/CreateSyncLookupResponse.md @@ -0,0 +1,22 @@ +# Bandwidth::CreateSyncLookupResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **links** | [**Array<LinkSchema>**](LinkSchema.md) | | [optional] | +| **data** | [**CreateSyncLookupResponseData**](CreateSyncLookupResponseData.md) | | [optional] | +| **errors** | [**Array<LookupErrorSchema>**](LookupErrorSchema.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::CreateSyncLookupResponse.new( + links: [], + data: null, + errors: null +) +``` + diff --git a/docs/CreateSyncLookupResponseData.md b/docs/CreateSyncLookupResponseData.md new file mode 100644 index 00000000..b498a949 --- /dev/null +++ b/docs/CreateSyncLookupResponseData.md @@ -0,0 +1,22 @@ +# Bandwidth::CreateSyncLookupResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | The phone number lookup request ID from Bandwidth. | [optional] | +| **status** | [**CompletedLookupStatusEnum**](CompletedLookupStatusEnum.md) | | [optional] | +| **results** | [**Array<LookupResult>**](LookupResult.md) | The carrier information results for the specified telephone numbers. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::CreateSyncLookupResponseData.new( + request_id: 004223a0-8b17-41b1-bf81-20732adf5590, + status: null, + results: null +) +``` + diff --git a/docs/DeactivationEventEnum.md b/docs/DeactivationEventEnum.md new file mode 100644 index 00000000..76150bea --- /dev/null +++ b/docs/DeactivationEventEnum.md @@ -0,0 +1,15 @@ +# Bandwidth::DeactivationEventEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::DeactivationEventEnum.new() +``` + diff --git a/docs/GetAsyncBulkLookupResponse.md b/docs/GetAsyncBulkLookupResponse.md new file mode 100644 index 00000000..832e0eb8 --- /dev/null +++ b/docs/GetAsyncBulkLookupResponse.md @@ -0,0 +1,22 @@ +# Bandwidth::GetAsyncBulkLookupResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **links** | [**Array<LinkSchema>**](LinkSchema.md) | | [optional] | +| **data** | [**GetAsyncBulkLookupResponseData**](GetAsyncBulkLookupResponseData.md) | | [optional] | +| **errors** | [**Array<LookupErrorSchema>**](LookupErrorSchema.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::GetAsyncBulkLookupResponse.new( + links: [], + data: null, + errors: null +) +``` + diff --git a/docs/GetAsyncBulkLookupResponseData.md b/docs/GetAsyncBulkLookupResponseData.md new file mode 100644 index 00000000..eebf9e25 --- /dev/null +++ b/docs/GetAsyncBulkLookupResponseData.md @@ -0,0 +1,22 @@ +# Bandwidth::GetAsyncBulkLookupResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | The phone number lookup request ID from Bandwidth. | [optional] | +| **status** | [**InProgressLookupStatusEnum**](InProgressLookupStatusEnum.md) | | [optional] | +| **results** | [**Array<LookupResult>**](LookupResult.md) | The carrier information results for the specified telephone number. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::GetAsyncBulkLookupResponseData.new( + request_id: 004223a0-8b17-41b1-bf81-20732adf5590, + status: null, + results: null +) +``` + diff --git a/docs/InProgressLookupStatusEnum.md b/docs/InProgressLookupStatusEnum.md new file mode 100644 index 00000000..25ddb85d --- /dev/null +++ b/docs/InProgressLookupStatusEnum.md @@ -0,0 +1,15 @@ +# Bandwidth::InProgressLookupStatusEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::InProgressLookupStatusEnum.new() +``` + diff --git a/docs/LatestMessageDeliveryStatusEnum.md b/docs/LatestMessageDeliveryStatusEnum.md new file mode 100644 index 00000000..15466118 --- /dev/null +++ b/docs/LatestMessageDeliveryStatusEnum.md @@ -0,0 +1,15 @@ +# Bandwidth::LatestMessageDeliveryStatusEnum + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::LatestMessageDeliveryStatusEnum.new() +``` + diff --git a/docs/LookupStatusEnum.md b/docs/LineTypeEnum.md similarity index 65% rename from docs/LookupStatusEnum.md rename to docs/LineTypeEnum.md index f3dbe4d0..635c18c8 100644 --- a/docs/LookupStatusEnum.md +++ b/docs/LineTypeEnum.md @@ -1,4 +1,4 @@ -# Bandwidth::LookupStatusEnum +# Bandwidth::LineTypeEnum ## Properties @@ -10,6 +10,6 @@ ```ruby require 'bandwidth-sdk' -instance = Bandwidth::LookupStatusEnum.new() +instance = Bandwidth::LineTypeEnum.new() ``` diff --git a/docs/LinkSchema.md b/docs/LinkSchema.md new file mode 100644 index 00000000..94a76a84 --- /dev/null +++ b/docs/LinkSchema.md @@ -0,0 +1,22 @@ +# Bandwidth::LinkSchema + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **href** | **String** | URI of the link. | [optional] | +| **rel** | **String** | Specifies the relationship between this link and the resource. | [optional] | +| **method** | **String** | HTTP method to be used. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::LinkSchema.new( + href: /relative/uri, + rel: aRelatedResource, + method: GET +) +``` + diff --git a/docs/LookupErrorResponse.md b/docs/LookupErrorResponse.md new file mode 100644 index 00000000..4772ec18 --- /dev/null +++ b/docs/LookupErrorResponse.md @@ -0,0 +1,22 @@ +# Bandwidth::LookupErrorResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **links** | [**Array<LinkSchema>**](LinkSchema.md) | | [optional] | +| **data** | **Object** | The phone number lookup response data | [optional] | +| **errors** | [**Array<LookupErrorSchema>**](LookupErrorSchema.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::LookupErrorResponse.new( + links: [], + data: null, + errors: null +) +``` + diff --git a/docs/LookupErrorSchema.md b/docs/LookupErrorSchema.md new file mode 100644 index 00000000..d37c5ecc --- /dev/null +++ b/docs/LookupErrorSchema.md @@ -0,0 +1,24 @@ +# Bandwidth::LookupErrorSchema + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **code** | **String** | Validation error code | [optional] | +| **description** | **String** | Description of validation error | [optional] | +| **type** | **String** | Type of validation error | [optional] | +| **meta** | [**LookupErrorSchemaMeta**](LookupErrorSchemaMeta.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::LookupErrorSchema.new( + code: NO-MATCH, + description: Example error description, + type: NumberInventory, + meta: null +) +``` + diff --git a/docs/LookupErrorSchemaMeta.md b/docs/LookupErrorSchemaMeta.md new file mode 100644 index 00000000..4f0d6328 --- /dev/null +++ b/docs/LookupErrorSchemaMeta.md @@ -0,0 +1,22 @@ +# Bandwidth::LookupErrorSchemaMeta + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone_numbers** | **Array<String>** | | [optional] | +| **message** | **String** | Message describing the error | [optional] | +| **code** | **Integer** | Error code associated with the message | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::LookupErrorSchemaMeta.new( + phone_numbers: ["+13992077164","+19196104424"], + message: Invalid TNs, + code: 1001 +) +``` + diff --git a/docs/LookupResult.md b/docs/LookupResult.md index 647963b8..eab2940b 100644 --- a/docs/LookupResult.md +++ b/docs/LookupResult.md @@ -4,15 +4,17 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **response_code** | **Integer** | Our vendor's response code. | [optional] | -| **message** | **String** | Message associated with the response code. | [optional] | -| **e_164_format** | **String** | The telephone number in E.164 format. | [optional] | -| **formatted** | **String** | The formatted version of the telephone number. | [optional] | -| **country** | **String** | The country of the telephone number. | [optional] | -| **line_type** | **String** | The line type of the telephone number. | [optional] | -| **line_provider** | **String** | The messaging service provider of the telephone number. | [optional] | -| **mobile_country_code** | **String** | The first half of the Home Network Identity (HNI). | [optional] | -| **mobile_network_code** | **String** | The second half of the HNI. | [optional] | +| **phone_number** | **String** | The telephone number in E.164 format. | [optional] | +| **line_type** | [**LineTypeEnum**](LineTypeEnum.md) | | [optional] | +| **messaging_provider** | **String** | The messaging service provider of the telephone number. | [optional] | +| **voice_provider** | **String** | The voice service provider of the telephone number. | [optional] | +| **country_code_a3** | **String** | The country code of the telephone number in ISO 3166-1 alpha-3 format. | [optional] | +| **deactivation_reporter** | **String** | [DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number. | [optional] | +| **deactivation_date** | **String** | [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. | [optional] | +| **deactivation_event** | [**DeactivationEventEnum**](DeactivationEventEnum.md) | | [optional] | +| **latest_message_delivery_status** | [**LatestMessageDeliveryStatusEnum**](LatestMessageDeliveryStatusEnum.md) | | [optional] | +| **initial_message_delivery_status_date** | **Date** | [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] | +| **latest_message_delivery_status_date** | **Date** | [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. | [optional] | ## Example @@ -20,15 +22,17 @@ require 'bandwidth-sdk' instance = Bandwidth::LookupResult.new( - response_code: 0, - message: NOERROR, - e_164_format: +19195551234, - formatted: (919) 555-1234, - country: US, - line_type: Mobile, - line_provider: Verizon Wireless, - mobile_country_code: 310, - mobile_network_code: 010 + phone_number: +10072904498, + line_type: null, + messaging_provider: Verizon Wireless, + voice_provider: Verizon Wireless, + country_code_a3: USA, + deactivation_reporter: null, + deactivation_date: 2025-06-20 18:35, + deactivation_event: null, + latest_message_delivery_status: null, + initial_message_delivery_status_date: Thu Jun 19 20:00:00 EDT 2025, + latest_message_delivery_status_date: Fri Jun 20 20:00:00 EDT 2025 ) ``` diff --git a/docs/LookupStatus.md b/docs/LookupStatus.md deleted file mode 100644 index 4864c861..00000000 --- a/docs/LookupStatus.md +++ /dev/null @@ -1,24 +0,0 @@ -# Bandwidth::LookupStatus - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **request_id** | **String** | The requestId. | [optional] | -| **status** | [**LookupStatusEnum**](LookupStatusEnum.md) | | [optional] | -| **result** | [**Array<LookupResult>**](LookupResult.md) | The carrier information results for the specified telephone number. | [optional] | -| **failed_telephone_numbers** | **Array<String>** | The telephone numbers whose lookup failed. | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::LookupStatus.new( - request_id: 004223a0-8b17-41b1-bf81-20732adf5590, - status: null, - result: null, - failed_telephone_numbers: ["+191955512345"] -) -``` - diff --git a/docs/PhoneNumberLookupApi.md b/docs/PhoneNumberLookupApi.md index 52a9d1cb..9bd235c2 100644 --- a/docs/PhoneNumberLookupApi.md +++ b/docs/PhoneNumberLookupApi.md @@ -4,17 +4,18 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**create_lookup**](PhoneNumberLookupApi.md#create_lookup) | **POST** /accounts/{accountId}/tnlookup | Create Lookup | -| [**get_lookup_status**](PhoneNumberLookupApi.md#get_lookup_status) | **GET** /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status | +| [**create_async_bulk_lookup**](PhoneNumberLookupApi.md#create_async_bulk_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup/bulk | Create Asynchronous Bulk Number Lookup | +| [**create_sync_lookup**](PhoneNumberLookupApi.md#create_sync_lookup) | **POST** /accounts/{accountId}/phoneNumberLookup | Create Synchronous Number Lookup | +| [**get_async_bulk_lookup**](PhoneNumberLookupApi.md#get_async_bulk_lookup) | **GET** /accounts/{accountId}/phoneNumberLookup/bulk/{requestId} | Get Asynchronous Bulk Number Lookup | -## create_lookup +## create_async_bulk_lookup -> create_lookup(account_id, lookup_request) +> create_async_bulk_lookup(account_id, async_lookup_request) -Create Lookup +Create Asynchronous Bulk Number Lookup -Create a Phone Number Lookup Request. +Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. ### Examples @@ -29,33 +30,33 @@ Bandwidth.configure do |config| end api_instance = Bandwidth::PhoneNumberLookupApi.new -account_id = '9900000' # String | Your Bandwidth Account ID. -lookup_request = Bandwidth::LookupRequest.new({tns: ['tns_example']}) # LookupRequest | Phone number lookup request. +account_id = '9900000' # String | +async_lookup_request = Bandwidth::AsyncLookupRequest.new({phone_numbers: ['phone_numbers_example']}) # AsyncLookupRequest | Asynchronous bulk phone number lookup request. begin - # Create Lookup - result = api_instance.create_lookup(account_id, lookup_request) + # Create Asynchronous Bulk Number Lookup + result = api_instance.create_async_bulk_lookup(account_id, async_lookup_request) p result rescue Bandwidth::ApiError => e - puts "Error when calling PhoneNumberLookupApi->create_lookup: #{e}" + puts "Error when calling PhoneNumberLookupApi->create_async_bulk_lookup: #{e}" end ``` -#### Using the create_lookup_with_http_info variant +#### Using the create_async_bulk_lookup_with_http_info variant This returns an Array which contains the response data, status code and headers. -> , Integer, Hash)> create_lookup_with_http_info(account_id, lookup_request) +> , Integer, Hash)> create_async_bulk_lookup_with_http_info(account_id, async_lookup_request) ```ruby begin - # Create Lookup - data, status_code, headers = api_instance.create_lookup_with_http_info(account_id, lookup_request) + # Create Asynchronous Bulk Number Lookup + data, status_code, headers = api_instance.create_async_bulk_lookup_with_http_info(account_id, async_lookup_request) p status_code # => 2xx p headers # => { ... } - p data # => + p data # => rescue Bandwidth::ApiError => e - puts "Error when calling PhoneNumberLookupApi->create_lookup_with_http_info: #{e}" + puts "Error when calling PhoneNumberLookupApi->create_async_bulk_lookup_with_http_info: #{e}" end ``` @@ -63,12 +64,12 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **account_id** | **String** | Your Bandwidth Account ID. | | -| **lookup_request** | [**LookupRequest**](LookupRequest.md) | Phone number lookup request. | | +| **account_id** | **String** | | | +| **async_lookup_request** | [**AsyncLookupRequest**](AsyncLookupRequest.md) | Asynchronous bulk phone number lookup request. | | ### Return type -[**CreateLookupResponse**](CreateLookupResponse.md) +[**CreateAsyncBulkLookupResponse**](CreateAsyncBulkLookupResponse.md) ### Authorization @@ -80,13 +81,13 @@ end - **Accept**: application/json -## get_lookup_status +## create_sync_lookup -> get_lookup_status(account_id, request_id) +> create_sync_lookup(account_id, sync_lookup_request) -Get Lookup Request Status +Create Synchronous Number Lookup -Get an existing Phone Number Lookup Request. +Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. ### Examples @@ -101,33 +102,33 @@ Bandwidth.configure do |config| end api_instance = Bandwidth::PhoneNumberLookupApi.new -account_id = '9900000' # String | Your Bandwidth Account ID. -request_id = '004223a0-8b17-41b1-bf81-20732adf5590' # String | The phone number lookup request ID from Bandwidth. +account_id = '9900000' # String | +sync_lookup_request = Bandwidth::SyncLookupRequest.new({phone_numbers: ['phone_numbers_example']}) # SyncLookupRequest | Synchronous phone number lookup request. begin - # Get Lookup Request Status - result = api_instance.get_lookup_status(account_id, request_id) + # Create Synchronous Number Lookup + result = api_instance.create_sync_lookup(account_id, sync_lookup_request) p result rescue Bandwidth::ApiError => e - puts "Error when calling PhoneNumberLookupApi->get_lookup_status: #{e}" + puts "Error when calling PhoneNumberLookupApi->create_sync_lookup: #{e}" end ``` -#### Using the get_lookup_status_with_http_info variant +#### Using the create_sync_lookup_with_http_info variant This returns an Array which contains the response data, status code and headers. -> , Integer, Hash)> get_lookup_status_with_http_info(account_id, request_id) +> , Integer, Hash)> create_sync_lookup_with_http_info(account_id, sync_lookup_request) ```ruby begin - # Get Lookup Request Status - data, status_code, headers = api_instance.get_lookup_status_with_http_info(account_id, request_id) + # Create Synchronous Number Lookup + data, status_code, headers = api_instance.create_sync_lookup_with_http_info(account_id, sync_lookup_request) p status_code # => 2xx p headers # => { ... } - p data # => + p data # => rescue Bandwidth::ApiError => e - puts "Error when calling PhoneNumberLookupApi->get_lookup_status_with_http_info: #{e}" + puts "Error when calling PhoneNumberLookupApi->create_sync_lookup_with_http_info: #{e}" end ``` @@ -135,12 +136,84 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **account_id** | **String** | Your Bandwidth Account ID. | | -| **request_id** | **String** | The phone number lookup request ID from Bandwidth. | | +| **account_id** | **String** | | | +| **sync_lookup_request** | [**SyncLookupRequest**](SyncLookupRequest.md) | Synchronous phone number lookup request. | | ### Return type -[**LookupStatus**](LookupStatus.md) +[**CreateSyncLookupResponse**](CreateSyncLookupResponse.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## get_async_bulk_lookup + +> get_async_bulk_lookup(account_id, request_id) + +Get Asynchronous Bulk Number Lookup + +Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. + +### Examples + +```ruby +require 'time' +require 'bandwidth-sdk' +# setup authorization +Bandwidth.configure do |config| + # Configure HTTP basic authorization: Basic + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = Bandwidth::PhoneNumberLookupApi.new +account_id = '9900000' # String | +request_id = '004223a0-8b17-41b1-bf81-20732adf5590' # String | + +begin + # Get Asynchronous Bulk Number Lookup + result = api_instance.get_async_bulk_lookup(account_id, request_id) + p result +rescue Bandwidth::ApiError => e + puts "Error when calling PhoneNumberLookupApi->get_async_bulk_lookup: #{e}" +end +``` + +#### Using the get_async_bulk_lookup_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_async_bulk_lookup_with_http_info(account_id, request_id) + +```ruby +begin + # Get Asynchronous Bulk Number Lookup + data, status_code, headers = api_instance.get_async_bulk_lookup_with_http_info(account_id, request_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Bandwidth::ApiError => e + puts "Error when calling PhoneNumberLookupApi->get_async_bulk_lookup_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | | | +| **request_id** | **String** | | | + +### Return type + +[**GetAsyncBulkLookupResponse**](GetAsyncBulkLookupResponse.md) ### Authorization diff --git a/docs/RbmActionBase.md b/docs/RbmActionBase.md index 28ea77d5..10add779 100644 --- a/docs/RbmActionBase.md +++ b/docs/RbmActionBase.md @@ -16,7 +16,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionBase.new( type: null, text: Hello world, - postback_data: [B@a93c798 + postback_data: [B@1d33e72e ) ``` diff --git a/docs/RbmSuggestionResponse.md b/docs/RbmSuggestionResponse.md index a00359ca..9f7bac91 100644 --- a/docs/RbmSuggestionResponse.md +++ b/docs/RbmSuggestionResponse.md @@ -14,7 +14,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmSuggestionResponse.new( text: Yes, I would like to proceed, - postback_data: [B@a93c798 + postback_data: [B@1d33e72e ) ``` diff --git a/docs/SyncLookupRequest.md b/docs/SyncLookupRequest.md new file mode 100644 index 00000000..c8f80430 --- /dev/null +++ b/docs/SyncLookupRequest.md @@ -0,0 +1,18 @@ +# Bandwidth::SyncLookupRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phone_numbers** | **Array<String>** | Telephone numbers in E.164 format. | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::SyncLookupRequest.new( + phone_numbers: null +) +``` + diff --git a/docs/TnLookupRequestError.md b/docs/TnLookupRequestError.md deleted file mode 100644 index ed31bd7f..00000000 --- a/docs/TnLookupRequestError.md +++ /dev/null @@ -1,18 +0,0 @@ -# Bandwidth::TnLookupRequestError - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **message** | **String** | A description of what validation error occurred. | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::TnLookupRequestError.new( - message: example error message -) -``` - diff --git a/lib/bandwidth-sdk.rb b/lib/bandwidth-sdk.rb index c865cd01..152aa571 100644 --- a/lib/bandwidth-sdk.rb +++ b/lib/bandwidth-sdk.rb @@ -21,6 +21,7 @@ require 'bandwidth-sdk/models/additional_denial_reason' require 'bandwidth-sdk/models/address' require 'bandwidth-sdk/models/answer_callback' +require 'bandwidth-sdk/models/async_lookup_request' require 'bandwidth-sdk/models/blocked_webhook' require 'bandwidth-sdk/models/bridge_complete_callback' require 'bandwidth-sdk/models/bridge_target_complete_callback' @@ -39,6 +40,7 @@ require 'bandwidth-sdk/models/callback_method_enum' require 'bandwidth-sdk/models/card_width_enum' require 'bandwidth-sdk/models/code_request' +require 'bandwidth-sdk/models/completed_lookup_status_enum' require 'bandwidth-sdk/models/conference' require 'bandwidth-sdk/models/conference_completed_callback' require 'bandwidth-sdk/models/conference_created_callback' @@ -50,11 +52,15 @@ require 'bandwidth-sdk/models/conference_redirect_callback' require 'bandwidth-sdk/models/conference_state_enum' require 'bandwidth-sdk/models/contact' +require 'bandwidth-sdk/models/create_async_bulk_lookup_response' +require 'bandwidth-sdk/models/create_async_bulk_lookup_response_data' require 'bandwidth-sdk/models/create_call' require 'bandwidth-sdk/models/create_call_response' -require 'bandwidth-sdk/models/create_lookup_response' require 'bandwidth-sdk/models/create_message_request_error' require 'bandwidth-sdk/models/create_multi_channel_message_response' +require 'bandwidth-sdk/models/create_sync_lookup_response' +require 'bandwidth-sdk/models/create_sync_lookup_response_data' +require 'bandwidth-sdk/models/deactivation_event_enum' require 'bandwidth-sdk/models/disconnect_callback' require 'bandwidth-sdk/models/diversion' require 'bandwidth-sdk/models/dtmf_callback' @@ -65,18 +71,24 @@ require 'bandwidth-sdk/models/field_error' require 'bandwidth-sdk/models/file_format_enum' require 'bandwidth-sdk/models/gather_callback' +require 'bandwidth-sdk/models/get_async_bulk_lookup_response' +require 'bandwidth-sdk/models/get_async_bulk_lookup_response_data' +require 'bandwidth-sdk/models/in_progress_lookup_status_enum' require 'bandwidth-sdk/models/inbound_callback' require 'bandwidth-sdk/models/inbound_callback_message' require 'bandwidth-sdk/models/inbound_callback_type_enum' require 'bandwidth-sdk/models/initiate_callback' +require 'bandwidth-sdk/models/latest_message_delivery_status_enum' +require 'bandwidth-sdk/models/line_type_enum' require 'bandwidth-sdk/models/link' +require 'bandwidth-sdk/models/link_schema' require 'bandwidth-sdk/models/links_object' require 'bandwidth-sdk/models/list_message_direction_enum' require 'bandwidth-sdk/models/list_message_item' -require 'bandwidth-sdk/models/lookup_request' +require 'bandwidth-sdk/models/lookup_error_response' +require 'bandwidth-sdk/models/lookup_error_schema' +require 'bandwidth-sdk/models/lookup_error_schema_meta' require 'bandwidth-sdk/models/lookup_result' -require 'bandwidth-sdk/models/lookup_status' -require 'bandwidth-sdk/models/lookup_status_enum' require 'bandwidth-sdk/models/machine_detection_complete_callback' require 'bandwidth-sdk/models/machine_detection_configuration' require 'bandwidth-sdk/models/machine_detection_mode_enum' @@ -138,6 +150,7 @@ require 'bandwidth-sdk/models/status_callback_message' require 'bandwidth-sdk/models/status_callback_type_enum' require 'bandwidth-sdk/models/stir_shaken' +require 'bandwidth-sdk/models/sync_lookup_request' require 'bandwidth-sdk/models/telephone_number' require 'bandwidth-sdk/models/tfv_basic_authentication' require 'bandwidth-sdk/models/tfv_callback_status_enum' @@ -147,7 +160,6 @@ require 'bandwidth-sdk/models/tfv_submission_info' require 'bandwidth-sdk/models/tfv_submission_wrapper' require 'bandwidth-sdk/models/thumbnail_alignment_enum' -require 'bandwidth-sdk/models/tn_lookup_request_error' require 'bandwidth-sdk/models/transcribe_recording' require 'bandwidth-sdk/models/transcription' require 'bandwidth-sdk/models/transcription_available_callback' diff --git a/lib/bandwidth-sdk/api/phone_number_lookup_api.rb b/lib/bandwidth-sdk/api/phone_number_lookup_api.rb index 68f00640..611a44dd 100644 --- a/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +++ b/lib/bandwidth-sdk/api/phone_number_lookup_api.rb @@ -19,39 +19,37 @@ class PhoneNumberLookupApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # Create Lookup - # Create a Phone Number Lookup Request. - # @param account_id [String] Your Bandwidth Account ID. - # @param lookup_request [LookupRequest] Phone number lookup request. + # Create Asynchronous Bulk Number Lookup + # Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. + # @param account_id [String] + # @param async_lookup_request [AsyncLookupRequest] Asynchronous bulk phone number lookup request. # @param [Hash] opts the optional parameters - # @return [CreateLookupResponse] - def create_lookup(account_id, lookup_request, opts = {}) - warn '[DEPRECATION NOTICE] `create_lookup` is deprecated.' - data, _status_code, _headers = create_lookup_with_http_info(account_id, lookup_request, opts) + # @return [CreateAsyncBulkLookupResponse] + def create_async_bulk_lookup(account_id, async_lookup_request, opts = {}) + data, _status_code, _headers = create_async_bulk_lookup_with_http_info(account_id, async_lookup_request, opts) data end - # Create Lookup - # Create a Phone Number Lookup Request. - # @param account_id [String] Your Bandwidth Account ID. - # @param lookup_request [LookupRequest] Phone number lookup request. + # Create Asynchronous Bulk Number Lookup + # Creates an asynchronous bulk phone number lookup request. Maximum of 15,000 telephone numbers per request. Use the [Get Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/getAsyncBulkLookup) endpoint to check the status of the request and view the results. + # @param account_id [String] + # @param async_lookup_request [AsyncLookupRequest] Asynchronous bulk phone number lookup request. # @param [Hash] opts the optional parameters - # @return [Array<(CreateLookupResponse, Integer, Hash)>] CreateLookupResponse data, response status code and response headers - def create_lookup_with_http_info(account_id, lookup_request, opts = {}) - warn '[DEPRECATION NOTICE] `create_lookup_with_http_info` is deprecated.' + # @return [Array<(CreateAsyncBulkLookupResponse, Integer, Hash)>] CreateAsyncBulkLookupResponse data, response status code and response headers + def create_async_bulk_lookup_with_http_info(account_id, async_lookup_request, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_lookup ...' + @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_async_bulk_lookup ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? - fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_lookup" + fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_async_bulk_lookup" end - # verify the required parameter 'lookup_request' is set - if @api_client.config.client_side_validation && lookup_request.nil? - fail ArgumentError, "Missing the required parameter 'lookup_request' when calling PhoneNumberLookupApi.create_lookup" + # verify the required parameter 'async_lookup_request' is set + if @api_client.config.client_side_validation && async_lookup_request.nil? + fail ArgumentError, "Missing the required parameter 'async_lookup_request' when calling PhoneNumberLookupApi.create_async_bulk_lookup" end # resource path - local_var_path = '/accounts/{accountId}/tnlookup'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) + local_var_path = '/accounts/{accountId}/phoneNumberLookup/bulk'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -70,16 +68,16 @@ def create_lookup_with_http_info(account_id, lookup_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(lookup_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(async_lookup_request) # return_type - return_type = opts[:debug_return_type] || 'CreateLookupResponse' + return_type = opts[:debug_return_type] || 'CreateAsyncBulkLookupResponse' # auth_names auth_names = opts[:debug_auth_names] || ['Basic'] new_options = opts.merge( - :operation => :"PhoneNumberLookupApi.create_lookup", + :operation => :"PhoneNumberLookupApi.create_async_bulk_lookup", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -90,44 +88,116 @@ def create_lookup_with_http_info(account_id, lookup_request, opts = {}) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_async_bulk_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Get Lookup Request Status - # Get an existing Phone Number Lookup Request. - # @param account_id [String] Your Bandwidth Account ID. - # @param request_id [String] The phone number lookup request ID from Bandwidth. + # Create Synchronous Number Lookup + # Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. + # @param account_id [String] + # @param sync_lookup_request [SyncLookupRequest] Synchronous phone number lookup request. # @param [Hash] opts the optional parameters - # @return [LookupStatus] - def get_lookup_status(account_id, request_id, opts = {}) - warn '[DEPRECATION NOTICE] `get_lookup_status` is deprecated.' - data, _status_code, _headers = get_lookup_status_with_http_info(account_id, request_id, opts) + # @return [CreateSyncLookupResponse] + def create_sync_lookup(account_id, sync_lookup_request, opts = {}) + data, _status_code, _headers = create_sync_lookup_with_http_info(account_id, sync_lookup_request, opts) data end - # Get Lookup Request Status - # Get an existing Phone Number Lookup Request. - # @param account_id [String] Your Bandwidth Account ID. - # @param request_id [String] The phone number lookup request ID from Bandwidth. + # Create Synchronous Number Lookup + # Creates a synchronous phone number lookup request. Maximum of 100 telephone numbers per request. + # @param account_id [String] + # @param sync_lookup_request [SyncLookupRequest] Synchronous phone number lookup request. # @param [Hash] opts the optional parameters - # @return [Array<(LookupStatus, Integer, Hash)>] LookupStatus data, response status code and response headers - def get_lookup_status_with_http_info(account_id, request_id, opts = {}) - warn '[DEPRECATION NOTICE] `get_lookup_status_with_http_info` is deprecated.' + # @return [Array<(CreateSyncLookupResponse, Integer, Hash)>] CreateSyncLookupResponse data, response status code and response headers + def create_sync_lookup_with_http_info(account_id, sync_lookup_request, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.get_lookup_status ...' + @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.create_sync_lookup ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? - fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.get_lookup_status" + fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.create_sync_lookup" + end + # verify the required parameter 'sync_lookup_request' is set + if @api_client.config.client_side_validation && sync_lookup_request.nil? + fail ArgumentError, "Missing the required parameter 'sync_lookup_request' when calling PhoneNumberLookupApi.create_sync_lookup" + end + # resource path + local_var_path = '/accounts/{accountId}/phoneNumberLookup'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(sync_lookup_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateSyncLookupResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"PhoneNumberLookupApi.create_sync_lookup", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PhoneNumberLookupApi#create_sync_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get Asynchronous Bulk Number Lookup + # Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. + # @param account_id [String] + # @param request_id [String] + # @param [Hash] opts the optional parameters + # @return [GetAsyncBulkLookupResponse] + def get_async_bulk_lookup(account_id, request_id, opts = {}) + data, _status_code, _headers = get_async_bulk_lookup_with_http_info(account_id, request_id, opts) + data + end + + # Get Asynchronous Bulk Number Lookup + # Get an existing [Asynchronous Bulk Number Lookup](#tag/Phone-Number-Lookup/operation/createAsyncBulkLookup). Use this endpoint to check the status of the request and view the results. + # @param account_id [String] + # @param request_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(GetAsyncBulkLookupResponse, Integer, Hash)>] GetAsyncBulkLookupResponse data, response status code and response headers + def get_async_bulk_lookup_with_http_info(account_id, request_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PhoneNumberLookupApi.get_async_bulk_lookup ...' + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling PhoneNumberLookupApi.get_async_bulk_lookup" end # verify the required parameter 'request_id' is set if @api_client.config.client_side_validation && request_id.nil? - fail ArgumentError, "Missing the required parameter 'request_id' when calling PhoneNumberLookupApi.get_lookup_status" + fail ArgumentError, "Missing the required parameter 'request_id' when calling PhoneNumberLookupApi.get_async_bulk_lookup" end # resource path - local_var_path = '/accounts/{accountId}/tnlookup/{requestId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'requestId' + '}', CGI.escape(request_id.to_s)) + local_var_path = '/accounts/{accountId}/phoneNumberLookup/bulk/{requestId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'requestId' + '}', CGI.escape(request_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -144,13 +214,13 @@ def get_lookup_status_with_http_info(account_id, request_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'LookupStatus' + return_type = opts[:debug_return_type] || 'GetAsyncBulkLookupResponse' # auth_names auth_names = opts[:debug_auth_names] || ['Basic'] new_options = opts.merge( - :operation => :"PhoneNumberLookupApi.get_lookup_status", + :operation => :"PhoneNumberLookupApi.get_async_bulk_lookup", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -161,7 +231,7 @@ def get_lookup_status_with_http_info(account_id, request_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: PhoneNumberLookupApi#get_lookup_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PhoneNumberLookupApi#get_async_bulk_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/bandwidth-sdk/configuration.rb b/lib/bandwidth-sdk/configuration.rb index a576b582..07792627 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -414,15 +414,21 @@ def operation_server_settings description: "Production", } ], - "PhoneNumberLookupApi.create_lookup": [ + "PhoneNumberLookupApi.create_async_bulk_lookup": [ { - url: "https://numbers.bandwidth.com/api/v1", + url: "https://api.bandwidth.com/v2", description: "Production", } ], - "PhoneNumberLookupApi.get_lookup_status": [ + "PhoneNumberLookupApi.create_sync_lookup": [ { - url: "https://numbers.bandwidth.com/api/v1", + url: "https://api.bandwidth.com/v2", + description: "Production", + } + ], + "PhoneNumberLookupApi.get_async_bulk_lookup": [ + { + url: "https://api.bandwidth.com/v2", description: "Production", } ], diff --git a/lib/bandwidth-sdk/models/async_lookup_request.rb b/lib/bandwidth-sdk/models/async_lookup_request.rb new file mode 100644 index 00000000..81f63e47 --- /dev/null +++ b/lib/bandwidth-sdk/models/async_lookup_request.rb @@ -0,0 +1,232 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class AsyncLookupRequest + # Telephone numbers in E.164 format. + attr_accessor :phone_numbers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phone_numbers' => :'phoneNumbers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phone_numbers' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::AsyncLookupRequest` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AsyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phone_numbers') + if (value = attributes[:'phone_numbers']).is_a?(Array) + self.phone_numbers = value + end + else + self.phone_numbers = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @phone_numbers.nil? + invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @phone_numbers.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] phone_numbers Value to be assigned + def phone_numbers=(phone_numbers) + if phone_numbers.nil? + fail ArgumentError, 'phone_numbers cannot be nil' + end + + @phone_numbers = phone_numbers + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phone_numbers == o.phone_numbers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phone_numbers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb b/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb new file mode 100644 index 00000000..acc4e519 --- /dev/null +++ b/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb @@ -0,0 +1,41 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class CompletedLookupStatusEnum + COMPLETE = 'COMPLETE'.freeze + PARTIAL_COMPLETE = 'PARTIAL_COMPLETE'.freeze + FAILED = 'FAILED'.freeze + + def self.all_vars + @all_vars ||= [COMPLETE, PARTIAL_COMPLETE, FAILED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if CompletedLookupStatusEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #CompletedLookupStatusEnum" + end + end +end diff --git a/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb new file mode 100644 index 00000000..4211079b --- /dev/null +++ b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb @@ -0,0 +1,235 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class CreateAsyncBulkLookupResponse + # Links for pagination (if applicable) + attr_accessor :links + + attr_accessor :data + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'links' => :'links', + :'data' => :'data', + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'links' => :'Array', + :'data' => :'CreateAsyncBulkLookupResponseData', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateAsyncBulkLookupResponse` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'links') + if (value = attributes[:'links']).is_a?(Array) + self.links = value + end + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + links == o.links && + data == o.data && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [links, data, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/create_lookup_response.rb b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb similarity index 94% rename from lib/bandwidth-sdk/models/create_lookup_response.rb rename to lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb index fb69bf23..84b9277b 100644 --- a/lib/bandwidth-sdk/models/create_lookup_response.rb +++ b/lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb @@ -14,8 +14,8 @@ require 'time' module Bandwidth - # The request has been accepted for processing but not yet finished and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). - class CreateLookupResponse + # The phone number lookup response data + class CreateAsyncBulkLookupResponseData # The phone number lookup request ID from Bandwidth. attr_accessor :request_id @@ -60,7 +60,7 @@ def self.acceptable_attributes def self.openapi_types { :'request_id' => :'String', - :'status' => :'LookupStatusEnum' + :'status' => :'InProgressLookupStatusEnum' } end @@ -74,13 +74,13 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateLookupResponse` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateAsyncBulkLookupResponseData` initialize method' end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } diff --git a/lib/bandwidth-sdk/models/create_sync_lookup_response.rb b/lib/bandwidth-sdk/models/create_sync_lookup_response.rb new file mode 100644 index 00000000..4182bb86 --- /dev/null +++ b/lib/bandwidth-sdk/models/create_sync_lookup_response.rb @@ -0,0 +1,234 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class CreateSyncLookupResponse + attr_accessor :links + + attr_accessor :data + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'links' => :'links', + :'data' => :'data', + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'links' => :'Array', + :'data' => :'CreateSyncLookupResponseData', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateSyncLookupResponse` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateSyncLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'links') + if (value = attributes[:'links']).is_a?(Array) + self.links = value + end + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + links == o.links && + data == o.data && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [links, data, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/lookup_status.rb b/lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb similarity index 83% rename from lib/bandwidth-sdk/models/lookup_status.rb rename to lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb index 3264a26d..4465ab3f 100644 --- a/lib/bandwidth-sdk/models/lookup_status.rb +++ b/lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb @@ -14,18 +14,15 @@ require 'time' module Bandwidth - # If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no information was available for the TN. - class LookupStatus - # The requestId. + # The phone number lookup response data + class CreateSyncLookupResponseData + # The phone number lookup request ID from Bandwidth. attr_accessor :request_id attr_accessor :status - # The carrier information results for the specified telephone number. - attr_accessor :result - - # The telephone numbers whose lookup failed. - attr_accessor :failed_telephone_numbers + # The carrier information results for the specified telephone numbers. + attr_accessor :results class EnumAttributeValidator attr_reader :datatype @@ -54,8 +51,7 @@ def self.attribute_map { :'request_id' => :'requestId', :'status' => :'status', - :'result' => :'result', - :'failed_telephone_numbers' => :'failedTelephoneNumbers' + :'results' => :'results' } end @@ -68,9 +64,8 @@ def self.acceptable_attributes def self.openapi_types { :'request_id' => :'String', - :'status' => :'LookupStatusEnum', - :'result' => :'Array', - :'failed_telephone_numbers' => :'Array' + :'status' => :'CompletedLookupStatusEnum', + :'results' => :'Array' } end @@ -84,13 +79,13 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupStatus` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::CreateSyncLookupResponseData` initialize method' end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::CreateSyncLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } @@ -103,15 +98,9 @@ def initialize(attributes = {}) self.status = attributes[:'status'] end - if attributes.key?(:'result') - if (value = attributes[:'result']).is_a?(Array) - self.result = value - end - end - - if attributes.key?(:'failed_telephone_numbers') - if (value = attributes[:'failed_telephone_numbers']).is_a?(Array) - self.failed_telephone_numbers = value + if attributes.key?(:'results') + if (value = attributes[:'results']).is_a?(Array) + self.results = value end end end @@ -138,8 +127,7 @@ def ==(o) self.class == o.class && request_id == o.request_id && status == o.status && - result == o.result && - failed_telephone_numbers == o.failed_telephone_numbers + results == o.results end # @see the `==` method @@ -151,7 +139,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [request_id, status, result, failed_telephone_numbers].hash + [request_id, status, results].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/deactivation_event_enum.rb b/lib/bandwidth-sdk/models/deactivation_event_enum.rb new file mode 100644 index 00000000..02e45555 --- /dev/null +++ b/lib/bandwidth-sdk/models/deactivation_event_enum.rb @@ -0,0 +1,39 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class DeactivationEventEnum + DEACTIVATED = 'DEACTIVATED'.freeze + + def self.all_vars + @all_vars ||= [DEACTIVATED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if DeactivationEventEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #DeactivationEventEnum" + end + end +end diff --git a/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb new file mode 100644 index 00000000..7b51cda2 --- /dev/null +++ b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb @@ -0,0 +1,234 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class GetAsyncBulkLookupResponse + attr_accessor :links + + attr_accessor :data + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'links' => :'links', + :'data' => :'data', + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'links' => :'Array', + :'data' => :'GetAsyncBulkLookupResponseData', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::GetAsyncBulkLookupResponse` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GetAsyncBulkLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'links') + if (value = attributes[:'links']).is_a?(Array) + self.links = value + end + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + links == o.links && + data == o.data && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [links, data, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb new file mode 100644 index 00000000..1ae2ba30 --- /dev/null +++ b/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb @@ -0,0 +1,257 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + # The phone number lookup response data + class GetAsyncBulkLookupResponseData + # The phone number lookup request ID from Bandwidth. + attr_accessor :request_id + + attr_accessor :status + + # The carrier information results for the specified telephone number. + attr_accessor :results + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'request_id' => :'requestId', + :'status' => :'status', + :'results' => :'results' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'request_id' => :'String', + :'status' => :'InProgressLookupStatusEnum', + :'results' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::GetAsyncBulkLookupResponseData` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::GetAsyncBulkLookupResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'results') + if (value = attributes[:'results']).is_a?(Array) + self.results = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + request_id == o.request_id && + status == o.status && + results == o.results + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [request_id, status, results].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/lookup_status_enum.rb b/lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb similarity index 82% rename from lib/bandwidth-sdk/models/lookup_status_enum.rb rename to lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb index badcabfc..ee8e3e90 100644 --- a/lib/bandwidth-sdk/models/lookup_status_enum.rb +++ b/lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb @@ -14,7 +14,7 @@ require 'time' module Bandwidth - class LookupStatusEnum + class InProgressLookupStatusEnum IN_PROGRESS = 'IN_PROGRESS'.freeze COMPLETE = 'COMPLETE'.freeze PARTIAL_COMPLETE = 'PARTIAL_COMPLETE'.freeze @@ -35,8 +35,8 @@ def self.build_from_hash(value) # @param [String] The enum value in the form of the string # @return [String] The enum value def build_from_hash(value) - return value if LookupStatusEnum.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #LookupStatusEnum" + return value if InProgressLookupStatusEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #InProgressLookupStatusEnum" end end end diff --git a/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb b/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb new file mode 100644 index 00000000..a12caa2d --- /dev/null +++ b/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb @@ -0,0 +1,41 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class LatestMessageDeliveryStatusEnum + ACTIVE = 'ACTIVE'.freeze + DEACTIVATED = 'DEACTIVATED'.freeze + UNKNOWN = 'UNKNOWN'.freeze + + def self.all_vars + @all_vars ||= [ACTIVE, DEACTIVATED, UNKNOWN].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if LatestMessageDeliveryStatusEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #LatestMessageDeliveryStatusEnum" + end + end +end diff --git a/lib/bandwidth-sdk/models/line_type_enum.rb b/lib/bandwidth-sdk/models/line_type_enum.rb new file mode 100644 index 00000000..9503fe1a --- /dev/null +++ b/lib/bandwidth-sdk/models/line_type_enum.rb @@ -0,0 +1,42 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class LineTypeEnum + FIXED = 'FIXED'.freeze + VOIP_FIXED = 'VOIP-FIXED'.freeze + MOBILE = 'MOBILE'.freeze + VOIP = 'VOIP'.freeze + + def self.all_vars + @all_vars ||= [FIXED, VOIP_FIXED, MOBILE, VOIP].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if LineTypeEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #LineTypeEnum" + end + end +end diff --git a/lib/bandwidth-sdk/models/lookup_request.rb b/lib/bandwidth-sdk/models/link_schema.rb similarity index 86% rename from lib/bandwidth-sdk/models/lookup_request.rb rename to lib/bandwidth-sdk/models/link_schema.rb index 7466f122..ce6132cb 100644 --- a/lib/bandwidth-sdk/models/lookup_request.rb +++ b/lib/bandwidth-sdk/models/link_schema.rb @@ -14,14 +14,22 @@ require 'time' module Bandwidth - # Create phone number lookup request. - class LookupRequest - attr_accessor :tns + class LinkSchema + # URI of the link. + attr_accessor :href + + # Specifies the relationship between this link and the resource. + attr_accessor :rel + + # HTTP method to be used. + attr_accessor :method # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'tns' => :'tns' + :'href' => :'href', + :'rel' => :'rel', + :'method' => :'method' } end @@ -33,7 +41,9 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'tns' => :'Array' + :'href' => :'String', + :'rel' => :'String', + :'method' => :'String' } end @@ -47,23 +57,27 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupRequest` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LinkSchema` initialize method' end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LinkSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } - if attributes.key?(:'tns') - if (value = attributes[:'tns']).is_a?(Array) - self.tns = value - end - else - self.tns = nil + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'rel') + self.rel = attributes[:'rel'] + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] end end @@ -72,10 +86,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @tns.nil? - invalid_properties.push('invalid value for "tns", tns cannot be nil.') - end - invalid_properties end @@ -83,7 +93,6 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @tns.nil? true end @@ -92,7 +101,9 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - tns == o.tns + href == o.href && + rel == o.rel && + method == o.method end # @see the `==` method @@ -104,7 +115,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [tns].hash + [href, rel, method].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/lookup_error_response.rb b/lib/bandwidth-sdk/models/lookup_error_response.rb new file mode 100644 index 00000000..118a4572 --- /dev/null +++ b/lib/bandwidth-sdk/models/lookup_error_response.rb @@ -0,0 +1,235 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class LookupErrorResponse + attr_accessor :links + + # The phone number lookup response data + attr_accessor :data + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'links' => :'links', + :'data' => :'data', + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'links' => :'Array', + :'data' => :'Object', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupErrorResponse` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'links') + if (value = attributes[:'links']).is_a?(Array) + self.links = value + end + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + links == o.links && + data == o.data && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [links, data, errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/lookup_error_schema.rb b/lib/bandwidth-sdk/models/lookup_error_schema.rb new file mode 100644 index 00000000..a48f08a1 --- /dev/null +++ b/lib/bandwidth-sdk/models/lookup_error_schema.rb @@ -0,0 +1,242 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class LookupErrorSchema + # Validation error code + attr_accessor :code + + # Description of validation error + attr_accessor :description + + # Type of validation error + attr_accessor :type + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'description' => :'description', + :'type' => :'type', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'code' => :'String', + :'description' => :'String', + :'type' => :'String', + :'meta' => :'LookupErrorSchemaMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupErrorSchema` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + description == o.description && + type == o.type && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [code, description, type, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/bandwidth-sdk/models/tn_lookup_request_error.rb b/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb similarity index 85% rename from lib/bandwidth-sdk/models/tn_lookup_request_error.rb rename to lib/bandwidth-sdk/models/lookup_error_schema_meta.rb index 8e23b488..6fe60570 100644 --- a/lib/bandwidth-sdk/models/tn_lookup_request_error.rb +++ b/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb @@ -14,14 +14,21 @@ require 'time' module Bandwidth - class TnLookupRequestError - # A description of what validation error occurred. + class LookupErrorSchemaMeta + attr_accessor :phone_numbers + + # Message describing the error attr_accessor :message + # Error code associated with the message + attr_accessor :code + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'message' => :'message' + :'phone_numbers' => :'phoneNumbers', + :'message' => :'message', + :'code' => :'code' } end @@ -33,7 +40,9 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'message' => :'String' + :'phone_numbers' => :'Array', + :'message' => :'String', + :'code' => :'Integer' } end @@ -47,20 +56,30 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TnLookupRequestError` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::LookupErrorSchemaMeta` initialize method' end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TnLookupRequestError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::LookupErrorSchemaMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } + if attributes.key?(:'phone_numbers') + if (value = attributes[:'phone_numbers']).is_a?(Array) + self.phone_numbers = value + end + end + if attributes.key?(:'message') self.message = attributes[:'message'] end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -83,7 +102,9 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - message == o.message + phone_numbers == o.phone_numbers && + message == o.message && + code == o.code end # @see the `==` method @@ -95,7 +116,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [message].hash + [phone_numbers, message, code].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/lookup_result.rb b/lib/bandwidth-sdk/models/lookup_result.rb index b701d414..5a036e72 100644 --- a/lib/bandwidth-sdk/models/lookup_result.rb +++ b/lib/bandwidth-sdk/models/lookup_result.rb @@ -16,45 +16,72 @@ module Bandwidth # Carrier information results for the specified telephone number. class LookupResult - # Our vendor's response code. - attr_accessor :response_code + # The telephone number in E.164 format. + attr_accessor :phone_number - # Message associated with the response code. - attr_accessor :message + attr_accessor :line_type - # The telephone number in E.164 format. - attr_accessor :e_164_format + # The messaging service provider of the telephone number. + attr_accessor :messaging_provider - # The formatted version of the telephone number. - attr_accessor :formatted + # The voice service provider of the telephone number. + attr_accessor :voice_provider - # The country of the telephone number. - attr_accessor :country + # The country code of the telephone number in ISO 3166-1 alpha-3 format. + attr_accessor :country_code_a3 - # The line type of the telephone number. - attr_accessor :line_type + # [DNI-Only](#section/DNI-Only). The carrier that reported a deactivation event for this phone number. + attr_accessor :deactivation_reporter - # The messaging service provider of the telephone number. - attr_accessor :line_provider + # [DNI-Only](#section/DNI-Only). The datetime the carrier reported a deactivation event. + attr_accessor :deactivation_date - # The first half of the Home Network Identity (HNI). - attr_accessor :mobile_country_code + attr_accessor :deactivation_event + + attr_accessor :latest_message_delivery_status + + # [DNI-Only](#section/DNI-Only). The date the phone number entered the status described in `latestMessageDeliveryStatus`. Think of this as the \"start time\" for that status. Value resets every time the `latestMessageDeliveryStatus` changes. + attr_accessor :initial_message_delivery_status_date + + # [DNI-Only](#section/DNI-Only). The date bandwidth last received delivery status information for this phone number. Use this field to understand how up-to-date the `latestMessageDeliveryStatus` is. Value resets every time the `latestMessageDeliveryStatus` changes. + attr_accessor :latest_message_delivery_status_date + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end - # The second half of the HNI. - attr_accessor :mobile_network_code + def valid?(value) + !value || allowable_values.include?(value) + end + end # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'response_code' => :'Response Code', - :'message' => :'Message', - :'e_164_format' => :'E.164 Format', - :'formatted' => :'Formatted', - :'country' => :'Country', - :'line_type' => :'Line Type', - :'line_provider' => :'Line Provider', - :'mobile_country_code' => :'Mobile Country Code', - :'mobile_network_code' => :'Mobile Network Code' + :'phone_number' => :'phoneNumber', + :'line_type' => :'lineType', + :'messaging_provider' => :'messagingProvider', + :'voice_provider' => :'voiceProvider', + :'country_code_a3' => :'countryCodeA3', + :'deactivation_reporter' => :'deactivationReporter', + :'deactivation_date' => :'deactivationDate', + :'deactivation_event' => :'deactivationEvent', + :'latest_message_delivery_status' => :'latestMessageDeliveryStatus', + :'initial_message_delivery_status_date' => :'initialMessageDeliveryStatusDate', + :'latest_message_delivery_status_date' => :'latestMessageDeliveryStatusDate' } end @@ -66,15 +93,17 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'response_code' => :'Integer', - :'message' => :'String', - :'e_164_format' => :'String', - :'formatted' => :'String', - :'country' => :'String', - :'line_type' => :'String', - :'line_provider' => :'String', - :'mobile_country_code' => :'String', - :'mobile_network_code' => :'String' + :'phone_number' => :'String', + :'line_type' => :'LineTypeEnum', + :'messaging_provider' => :'String', + :'voice_provider' => :'String', + :'country_code_a3' => :'String', + :'deactivation_reporter' => :'String', + :'deactivation_date' => :'String', + :'deactivation_event' => :'DeactivationEventEnum', + :'latest_message_delivery_status' => :'LatestMessageDeliveryStatusEnum', + :'initial_message_delivery_status_date' => :'Date', + :'latest_message_delivery_status_date' => :'Date' } end @@ -99,40 +128,48 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'response_code') - self.response_code = attributes[:'response_code'] + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'line_type') + self.line_type = attributes[:'line_type'] end - if attributes.key?(:'message') - self.message = attributes[:'message'] + if attributes.key?(:'messaging_provider') + self.messaging_provider = attributes[:'messaging_provider'] end - if attributes.key?(:'e_164_format') - self.e_164_format = attributes[:'e_164_format'] + if attributes.key?(:'voice_provider') + self.voice_provider = attributes[:'voice_provider'] end - if attributes.key?(:'formatted') - self.formatted = attributes[:'formatted'] + if attributes.key?(:'country_code_a3') + self.country_code_a3 = attributes[:'country_code_a3'] end - if attributes.key?(:'country') - self.country = attributes[:'country'] + if attributes.key?(:'deactivation_reporter') + self.deactivation_reporter = attributes[:'deactivation_reporter'] end - if attributes.key?(:'line_type') - self.line_type = attributes[:'line_type'] + if attributes.key?(:'deactivation_date') + self.deactivation_date = attributes[:'deactivation_date'] + end + + if attributes.key?(:'deactivation_event') + self.deactivation_event = attributes[:'deactivation_event'] end - if attributes.key?(:'line_provider') - self.line_provider = attributes[:'line_provider'] + if attributes.key?(:'latest_message_delivery_status') + self.latest_message_delivery_status = attributes[:'latest_message_delivery_status'] end - if attributes.key?(:'mobile_country_code') - self.mobile_country_code = attributes[:'mobile_country_code'] + if attributes.key?(:'initial_message_delivery_status_date') + self.initial_message_delivery_status_date = attributes[:'initial_message_delivery_status_date'] end - if attributes.key?(:'mobile_network_code') - self.mobile_network_code = attributes[:'mobile_network_code'] + if attributes.key?(:'latest_message_delivery_status_date') + self.latest_message_delivery_status_date = attributes[:'latest_message_delivery_status_date'] end end @@ -156,15 +193,17 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - response_code == o.response_code && - message == o.message && - e_164_format == o.e_164_format && - formatted == o.formatted && - country == o.country && + phone_number == o.phone_number && line_type == o.line_type && - line_provider == o.line_provider && - mobile_country_code == o.mobile_country_code && - mobile_network_code == o.mobile_network_code + messaging_provider == o.messaging_provider && + voice_provider == o.voice_provider && + country_code_a3 == o.country_code_a3 && + deactivation_reporter == o.deactivation_reporter && + deactivation_date == o.deactivation_date && + deactivation_event == o.deactivation_event && + latest_message_delivery_status == o.latest_message_delivery_status && + initial_message_delivery_status_date == o.initial_message_delivery_status_date && + latest_message_delivery_status_date == o.latest_message_delivery_status_date end # @see the `==` method @@ -176,7 +215,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [response_code, message, e_164_format, formatted, country, line_type, line_provider, mobile_country_code, mobile_network_code].hash + [phone_number, line_type, messaging_provider, voice_provider, country_code_a3, deactivation_reporter, deactivation_date, deactivation_event, latest_message_delivery_status, initial_message_delivery_status_date, latest_message_delivery_status_date].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/sync_lookup_request.rb b/lib/bandwidth-sdk/models/sync_lookup_request.rb new file mode 100644 index 00000000..64b477cc --- /dev/null +++ b/lib/bandwidth-sdk/models/sync_lookup_request.rb @@ -0,0 +1,232 @@ +=begin +#Bandwidth + +#Bandwidth's Communication APIs + +The version of the OpenAPI document: 1.0.0 +Contact: letstalk@bandwidth.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Bandwidth + class SyncLookupRequest + # Telephone numbers in E.164 format. + attr_accessor :phone_numbers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phone_numbers' => :'phoneNumbers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'phone_numbers' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::SyncLookupRequest` initialize method' + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phone_numbers') + if (value = attributes[:'phone_numbers']).is_a?(Array) + self.phone_numbers = value + end + else + self.phone_numbers = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @phone_numbers.nil? + invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @phone_numbers.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] phone_numbers Value to be assigned + def phone_numbers=(phone_numbers) + if phone_numbers.nil? + fail ArgumentError, 'phone_numbers cannot be nil' + end + + @phone_numbers = phone_numbers + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phone_numbers == o.phone_numbers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phone_numbers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Bandwidth.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/spec/smoke/multi_channel_api_spec.rb b/spec/smoke/multi_channel_api_spec.rb index 350252e3..8f81da42 100644 --- a/spec/smoke/multi_channel_api_spec.rb +++ b/spec/smoke/multi_channel_api_spec.rb @@ -1,4 +1,4 @@ -# Unit tests for Bandwidth::MultiChannelApi +# Integration tests for Bandwidth::MultiChannelApi describe 'MultiChannelApi' do before(:all) do Bandwidth.configure do |config| diff --git a/spec/smoke/phone_number_lookup_api_spec.rb b/spec/smoke/phone_number_lookup_api_spec.rb index 563d13c7..72321fac 100644 --- a/spec/smoke/phone_number_lookup_api_spec.rb +++ b/spec/smoke/phone_number_lookup_api_spec.rb @@ -1,91 +1,86 @@ -# Integration Tests for Bandwidth::PhoneNumberLookupApi -describe 'PhoneNumberLookupApi Integration Tests' do +# Integration tests for Bandwidth::PhoneNumberLookupApi +describe 'PhoneNumberLookupApi' do + let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] } + before(:all) do Bandwidth.configure do |config| config.username = BW_USERNAME config.password = BW_PASSWORD end - @api_instance_tnlookup = Bandwidth::PhoneNumberLookupApi.new - - # lookup info - $lookup_request_id = '' + @api_instance = Bandwidth::PhoneNumberLookupApi.new + end + describe 'test an instance of PhoneNumberLookupApi' do + it 'should create an instance of PhoneNumberLookupApi' do + expect(@api_instance).to be_instance_of(Bandwidth::PhoneNumberLookupApi) + end end - # Create Lookup - describe 'create_lookup' do - it 'creates a tn lookup request' do - tn_body = Bandwidth::LookupRequest.new( - tns: [BW_NUMBER] + # Create Asynchronous Bulk Number Lookup + describe 'create_get_async_bulk_lookup test' do + it 'should work' do + request = Bandwidth::AsyncLookupRequest.new( + phone_numbers: phone_numbers, ) - data, status_code = @api_instance_tnlookup.create_lookup_with_http_info(BW_ACCOUNT_ID, tn_body) - expect(status_code).to eq(202) - expect(data).to be_instance_of(Bandwidth::CreateLookupResponse) - expect(data.request_id.length).to eq(36) - expect(data.status).to be_instance_of(String) + create_data, create_status_code = @api_instance.create_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request) - $lookup_request_id = data.request_id - sleep(1) - end - end + expect(create_status_code).to eq(202) + expect(create_data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponse) + expect(create_data.links[0]).to be_instance_of(Bandwidth::LinkSchema) + expect(create_data.links[0].rel).to be_instance_of(String) + expect(create_data.links[0].href).to be_instance_of(String) + expect(create_data.links[0].method).to be_instance_of(String) + expect(create_data.data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponseData) + expect(create_data.data.request_id).to be_instance_of(String) + expect(create_data.data.status).to be_one_of(Bandwidth::InProgressLookupStatusEnum.all_vars) + expect(create_data.errors).to be_instance_of(Array) - # Get Lookup Status - describe 'get_lookup_status' do - it 'gets lookup status' do - data, status_code = @api_instance_tnlookup.get_lookup_status_with_http_info(BW_ACCOUNT_ID, $lookup_request_id) + request_id = create_data.data.request_id + sleep(10) - expect(status_code).to eq(200) - expect(data).to be_instance_of(Bandwidth::LookupStatus) - expect(data.request_id).to eq($lookup_request_id) - expect(data.status).to be_instance_of(String) - expect(data.result).to be_instance_of(Array) - expect(data.result[0].response_code).to be_instance_of(Integer) - expect(data.result[0].e_164_format).to eq(BW_NUMBER) + get_data, get_status_code = @api_instance.get_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request_id) + expect(get_status_code).to equal_to(200) + expect(get_data).to be_instance_of(Bandwidth::GetAsyncBulkLookupResponse) + expect(get_data.links[0]).to be_instance_of(Bandwidth::LinkSchema) + expect(get_data.links[0].rel).to be_instance_of(String) + expect(get_data.links[0].href).to be_instance_of(String) + expect(get_data.links[0].method).to be_instance_of(String) + expect(get_data.data.request_id).to eq(request_id) + expect(get_data.data.status).to eq(Bandwidth::InProgressLookupStatusEnum::COMPLETE) + expect(get_data.data.results).to be_instance_of(Array) + expect(get_data.data.results[0]).to be_instance_of(Bandwidth::LookupResult) + expect(get_data.data.results[0].phone_number).to be_instance_of(String) + expect(get_data.data.results[0].line_type).to be_one_of(Bandwidth::LineTypeEnum.all_vars) + expect(get_data.data.results[0].messaging_provider).to be_instance_of(String) + expect(get_data.data.results[0].voice_provider).to be_instance_of(String) + expect(get_data.data.results[0].country_code_a3).to be_instance_of(String) end end - # HTTP 4XX Errors - describe 'http error' do - it 'causes a 400 error' do - tn_body_bad = Bandwidth::LookupRequest.new( - tns: ['+1invalid'] + # Create Synchronous Number Lookup + describe 'create_sync_lookup test' do + it 'should work' do + request = Bandwidth::SyncLookupRequest.new( + phone_numbers: phone_numbers, ) - expect { - @api_instance_tnlookup.create_lookup_with_http_info(BW_ACCOUNT_ID, tn_body_bad) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(400) - } - end - - it 'causes a 404 error' do - req_id_dne = '12345678-abcd-cdef-9876-12345678abcd' - - expect { - @api_instance_tnlookup.get_lookup_status_with_http_info(BW_ACCOUNT_ID, req_id_dne) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(404) - } - end - - it 'causes a 401 error' do - Bandwidth.configure do |config| - config.username = UNAUTHORIZED_USERNAME - config.password = UNAUTHORIZED_PASSWORD - end - - tn_body = Bandwidth::LookupRequest.new( - tns: [BW_NUMBER] - ) + data, status_code = @api_instance.create_sync_lookup_with_http_info(BW_ACCOUNT_ID, request) - expect { - @api_instance_tnlookup.create_lookup_with_http_info(BW_ACCOUNT_ID, tn_body) - }.to raise_error { |e| - expect(e).to be_instance_of(Bandwidth::ApiError) - expect(e.code).to eq(401) - } + expect(status_code).to equal_to(200) + expect(data).to be_instance_of(Bandwidth::CreateSyncLookupResponse) + expect(data.links[0]).to be_instance_of(Bandwidth::LinkSchema) + expect(data.links[0].rel).to be_instance_of(String) + expect(data.links[0].href).to be_instance_of(String) + expect(data.links[0].method).to be_instance_of(String) + expect(data.data.request_id).to be_instance_of(String) + expect(data.data.status).to eq(Bandwidth::CompletedLookupStatusEnum::COMPLETE) + expect(data.data.results).to be_instance_of(Array) + expect(data.data.results[0]).to be_instance_of(Bandwidth::LookupResult) + expect(data.data.results[0].phone_number).to be_instance_of(String) + expect(data.data.results[0].line_type).to be_one_of(Bandwidth::LineTypeEnum.all_vars) + expect(data.data.results[0].messaging_provider).to be_instance_of(String) + expect(data.data.results[0].voice_provider).to be_instance_of(String) + expect(data.data.results[0].country_code_a3).to be_instance_of(String) end end end diff --git a/spec/unit/api/phone_number_lookup_api_spec.rb b/spec/unit/api/phone_number_lookup_api_spec.rb index def659d7..43e58d50 100644 --- a/spec/unit/api/phone_number_lookup_api_spec.rb +++ b/spec/unit/api/phone_number_lookup_api_spec.rb @@ -1,6 +1,7 @@ # Unit tests for Bandwidth::PhoneNumberLookupApi describe 'PhoneNumberLookupApi' do - let(:request_id) { '21e6d818-eaa9-4ca9-b1d8-d6085f5c79d4' } + let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] } + let(:request_id) { '123e4567-e89b-12d3-a456-426614174000' } before(:all) do Bandwidth.configure do |config| @@ -10,77 +11,91 @@ config.ignore_operation_servers = true config.host = '127.0.0.1:4010' end - @phone_number_lookup_api_instance = Bandwidth::PhoneNumberLookupApi.new + @api_instance = Bandwidth::PhoneNumberLookupApi.new end - describe 'test an instance of PhoneNumberLookupApi' do it 'should create an instance of PhoneNumberLookupApi' do - expect(@phone_number_lookup_api_instance).to be_instance_of(Bandwidth::PhoneNumberLookupApi) + expect(@api_instance).to be_instance_of(Bandwidth::PhoneNumberLookupApi) end end - # Create Lookup - describe 'create_lookup' do - it 'creates a tn lookup request' do - tn_body = Bandwidth::LookupRequest.new( - tns: [BW_NUMBER] + # Create Asynchronous Bulk Number Lookup + describe 'create_async_bulk_lookup test' do + it 'should work' do + request = Bandwidth::AsyncLookupRequest.new( + phone_numbers: phone_numbers, ) - data, status_code = @phone_number_lookup_api_instance.create_lookup_with_http_info(BW_ACCOUNT_ID, tn_body) - expect(status_code).to eq(202) - expect(data).to be_instance_of(Bandwidth::CreateLookupResponse) - expect(data.request_id.length).to eq(36) - expect(data.status).to be_one_of(Bandwidth::LookupStatusEnum.all_vars) - end - - it 'causes an ArgumentError for a missing account_id' do - expect { - @phone_number_lookup_api_instance.create_lookup(nil, {}) - }.to raise_error(ArgumentError) - end + data, status_code = @api_instance.create_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request) - it 'causes an ArgumentError for a missing lookup_request' do - expect { - @phone_number_lookup_api_instance.create_lookup(BW_ACCOUNT_ID, nil) - }.to raise_error(ArgumentError) + expect(status_code).to eq(202) + expect(data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponse) + expect(data.links[0]).to be_instance_of(Bandwidth::LinkSchema) + expect(data.links[0].rel).to be_instance_of(String) + expect(data.links[0].href).to be_instance_of(String) + expect(data.links[0].method).to be_instance_of(String) + expect(data.data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponseData) + expect(data.data.request_id).to be_instance_of(String) + expect(data.data.status).to eq(Bandwidth::InProgressLookupStatusEnum::IN_PROGRESS) + expect(data.errors).to be_instance_of(Array) end end - # Get Lookup Status - describe 'get_lookup_status' do - it 'gets lookup status' do - data, status_code = @phone_number_lookup_api_instance.get_lookup_status_with_http_info( - BW_ACCOUNT_ID, request_id, { header_params: { 'Prefer' => 'example=lookupMultipleNumbersPartialCompleteExample' } }) + # Create Synchronous Number Lookup + describe 'create_sync_lookup test' do + it 'should work' do + request = Bandwidth::SyncLookupRequest.new( + phone_numbers: phone_numbers, + ) - expect(status_code).to eq(200) - expect(data).to be_instance_of(Bandwidth::LookupStatus) - expect(data.request_id.length).to eq(36) - expect(data.status).to be_one_of(Bandwidth::LookupStatusEnum.all_vars) - expect(data.result).to be_instance_of(Array) - expect(data.result[0]).to be_instance_of(Bandwidth::LookupResult) - expect(data.result[0].response_code).to be_instance_of(Integer) - expect(data.result[0].message).to be_instance_of(String) - expect(data.result[0].e_164_format.length).to eq(12) - expect(data.result[0].formatted.length).to eq(14) - expect(data.result[0].country).to be_instance_of(String) - expect(data.result[0].line_type).to be_instance_of(String) - expect(data.result[0].line_provider).to be_instance_of(String) - expect(data.result[0].mobile_country_code).to be_instance_of(String) - expect(data.result[0].mobile_network_code).to be_instance_of(String) - expect(data.failed_telephone_numbers).to be_instance_of(Array) - expect(data.failed_telephone_numbers[0]).to be_instance_of(String) - end + data, status_code = @api_instance.create_sync_lookup_with_http_info(BW_ACCOUNT_ID, request) - it 'causes an ArgumentError for a missing account_id' do - expect { - @phone_number_lookup_api_instance.get_lookup_status(nil, '') - }.to raise_error(ArgumentError) + expect(status_code).to equal_to(200) + expect(data).to be_instance_of(Bandwidth::CreateSyncLookupResponse) + expect(data.links[0]).to be_instance_of(Bandwidth::LinkSchema) + expect(data.links[0].rel).to be_instance_of(String) + expect(data.links[0].href).to be_instance_of(String) + expect(data.links[0].method).to be_instance_of(String) + expect(data.data.request_id).to be_instance_of(String) + expect(data.data.status).to eq(Bandwidth::CompletedLookupStatusEnum::COMPLETE) + expect(data.data.results).to be_instance_of(Array) + expect(data.data.results[0]).to be_instance_of(Bandwidth::LookupResult) + expect(data.data.results[0].phone_number).to be_instance_of(String) + expect(data.data.results[0].line_type).to eq(Bandwidth::LineTypeEnum::MOBILE) + expect(data.data.results[0].messaging_provider).to be_instance_of(String) + expect(data.data.results[0].voice_provider).to be_instance_of(String) + expect(data.data.results[0].country_code_a3).to be_instance_of(String) + expect(data.data.results[0].latest_message_delivery_status).to eq(Bandwidth::LatestMessageDeliveryStatusEnum::ACTIVE) + expect(data.data.results[0].initial_message_delivery_status_date).to be_instance_of(Date) + expect(data.data.results[0].latest_message_delivery_status_date).to be_instance_of(Date) + expect(data.errors).to be_instance_of(Array) end + end + + # Get Asynchronous Bulk Number Lookup + describe 'get_async_bulk_lookup test' do + it 'should work' do + data, status_code = @api_instance.get_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request_id) - it 'causes an ArgumentError for a missing request_id' do - expect { - @phone_number_lookup_api_instance.get_lookup_status(BW_ACCOUNT_ID, nil) - }.to raise_error(ArgumentError) + expect(status_code).to equal_to(200) + expect(data).to be_instance_of(Bandwidth::GetAsyncBulkLookupResponse) + expect(data.links[0]).to be_instance_of(Bandwidth::LinkSchema) + expect(data.links[0].rel).to be_instance_of(String) + expect(data.links[0].href).to be_instance_of(String) + expect(data.links[0].method).to be_instance_of(String) + expect(data.data.request_id).to be_instance_of(String) + expect(data.data.status).to eq(Bandwidth::InProgressLookupStatusEnum::COMPLETE) + expect(data.data.results).to be_instance_of(Array) + expect(data.data.results[0]).to be_instance_of(Bandwidth::LookupResult) + expect(data.data.results[0].phone_number).to be_instance_of(String) + expect(data.data.results[0].line_type).to eq(Bandwidth::LineTypeEnum::MOBILE) + expect(data.data.results[0].messaging_provider).to be_instance_of(String) + expect(data.data.results[0].voice_provider).to be_instance_of(String) + expect(data.data.results[0].country_code_a3).to be_instance_of(String) + expect(data.data.results[0].latest_message_delivery_status).to eq(Bandwidth::LatestMessageDeliveryStatusEnum::ACTIVE) + expect(data.data.results[0].initial_message_delivery_status_date).to be_instance_of(Date) + expect(data.data.results[0].latest_message_delivery_status_date).to be_instance_of(Date) + expect(data.errors).to be_instance_of(Array) end end end