diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index f4109dcf..ce9ee26b 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -20,8 +20,8 @@ docs/CallTranscriptionDetectedLanguageEnum.md docs/CallTranscriptionMetadata.md docs/CallTranscriptionResponse.md docs/CallTranscriptionTrackEnum.md +docs/Callback.md docs/CallbackMethodEnum.md -docs/CallbackTypeEnum.md docs/CallsApi.md docs/CardWidthEnum.md docs/CodeRequest.md @@ -42,16 +42,19 @@ docs/CreateCallResponse.md docs/CreateLookupResponse.md docs/CreateMessageRequestError.md docs/CreateMultiChannelMessageResponse.md -docs/DeferredResult.md docs/DisconnectCallback.md docs/Diversion.md docs/DtmfCallback.md docs/Error.md docs/ErrorObject.md +docs/ErrorSource.md docs/FailureWebhook.md docs/FieldError.md docs/FileFormatEnum.md docs/GatherCallback.md +docs/InboundCallback.md +docs/InboundCallbackMessage.md +docs/InboundCallbackTypeEnum.md docs/InitiateCallback.md docs/Link.md docs/LinksObject.md @@ -69,8 +72,6 @@ docs/MachineDetectionResult.md docs/Media.md docs/MediaApi.md docs/Message.md -docs/MessageCallback.md -docs/MessageCallbackMessage.md docs/MessageDirectionEnum.md docs/MessageRequest.md docs/MessageStatusEnum.md @@ -83,18 +84,18 @@ docs/MfaForbiddenRequestError.md docs/MfaRequestError.md docs/MfaUnauthorizedRequestError.md docs/MmsMessageContent.md +docs/MmsMessageContentFile.md docs/MultiChannelAction.md docs/MultiChannelActionCalendarEvent.md docs/MultiChannelApi.md -docs/MultiChannelCallbackData.md docs/MultiChannelChannelListObject.md docs/MultiChannelChannelListObjectContent.md -docs/MultiChannelMessageCallbackData.md +docs/MultiChannelError.md docs/MultiChannelMessageChannelEnum.md -docs/MultiChannelMessageData.md -docs/MultiChannelMessageDirectionEnum.md +docs/MultiChannelMessageContent.md docs/MultiChannelMessageRequest.md -docs/MultiChannelStatusEnum.md +docs/MultiChannelMessageResponseData.md +docs/MultiChannelMessageResponseDataChannelListInner.md docs/OptInWorkflow.md docs/PageInfo.md docs/PhoneNumberLookupApi.md @@ -106,6 +107,7 @@ docs/RbmActionTypeEnum.md docs/RbmActionViewLocation.md docs/RbmCardContent.md docs/RbmCardContentMedia.md +docs/RbmLocationResponse.md docs/RbmMediaHeightEnum.md docs/RbmMessageCarouselCard.md docs/RbmMessageContentFile.md @@ -113,6 +115,7 @@ docs/RbmMessageContentRichCard.md docs/RbmMessageContentText.md docs/RbmMessageMedia.md docs/RbmStandaloneCard.md +docs/RbmSuggestionResponse.md docs/RecordingAvailableCallback.md docs/RecordingCompleteCallback.md docs/RecordingStateEnum.md @@ -124,6 +127,9 @@ docs/RedirectMethodEnum.md docs/SmsMessageContent.md docs/StandaloneCardOrientationEnum.md docs/StatisticsApi.md +docs/StatusCallback.md +docs/StatusCallbackMessage.md +docs/StatusCallbackTypeEnum.md docs/StirShaken.md docs/TelephoneNumber.md docs/TfvBasicAuthentication.md @@ -192,8 +198,8 @@ lib/bandwidth-sdk/models/call_transcription_detected_language_enum.rb lib/bandwidth-sdk/models/call_transcription_metadata.rb lib/bandwidth-sdk/models/call_transcription_response.rb lib/bandwidth-sdk/models/call_transcription_track_enum.rb +lib/bandwidth-sdk/models/callback.rb lib/bandwidth-sdk/models/callback_method_enum.rb -lib/bandwidth-sdk/models/callback_type_enum.rb lib/bandwidth-sdk/models/card_width_enum.rb lib/bandwidth-sdk/models/code_request.rb lib/bandwidth-sdk/models/conference.rb @@ -212,16 +218,19 @@ 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/deferred_result.rb lib/bandwidth-sdk/models/disconnect_callback.rb lib/bandwidth-sdk/models/diversion.rb lib/bandwidth-sdk/models/dtmf_callback.rb lib/bandwidth-sdk/models/error.rb lib/bandwidth-sdk/models/error_object.rb +lib/bandwidth-sdk/models/error_source.rb 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/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/link.rb lib/bandwidth-sdk/models/links_object.rb @@ -237,8 +246,6 @@ lib/bandwidth-sdk/models/machine_detection_mode_enum.rb lib/bandwidth-sdk/models/machine_detection_result.rb lib/bandwidth-sdk/models/media.rb lib/bandwidth-sdk/models/message.rb -lib/bandwidth-sdk/models/message_callback.rb -lib/bandwidth-sdk/models/message_callback_message.rb lib/bandwidth-sdk/models/message_direction_enum.rb lib/bandwidth-sdk/models/message_request.rb lib/bandwidth-sdk/models/message_status_enum.rb @@ -250,17 +257,17 @@ lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb lib/bandwidth-sdk/models/mfa_request_error.rb lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb lib/bandwidth-sdk/models/mms_message_content.rb +lib/bandwidth-sdk/models/mms_message_content_file.rb lib/bandwidth-sdk/models/multi_channel_action.rb lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb -lib/bandwidth-sdk/models/multi_channel_callback_data.rb lib/bandwidth-sdk/models/multi_channel_channel_list_object.rb lib/bandwidth-sdk/models/multi_channel_channel_list_object_content.rb -lib/bandwidth-sdk/models/multi_channel_message_callback_data.rb +lib/bandwidth-sdk/models/multi_channel_error.rb lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb -lib/bandwidth-sdk/models/multi_channel_message_data.rb -lib/bandwidth-sdk/models/multi_channel_message_direction_enum.rb +lib/bandwidth-sdk/models/multi_channel_message_content.rb lib/bandwidth-sdk/models/multi_channel_message_request.rb -lib/bandwidth-sdk/models/multi_channel_status_enum.rb +lib/bandwidth-sdk/models/multi_channel_message_response_data.rb +lib/bandwidth-sdk/models/multi_channel_message_response_data_channel_list_inner.rb lib/bandwidth-sdk/models/opt_in_workflow.rb lib/bandwidth-sdk/models/page_info.rb lib/bandwidth-sdk/models/priority_enum.rb @@ -271,6 +278,7 @@ lib/bandwidth-sdk/models/rbm_action_type_enum.rb lib/bandwidth-sdk/models/rbm_action_view_location.rb lib/bandwidth-sdk/models/rbm_card_content.rb lib/bandwidth-sdk/models/rbm_card_content_media.rb +lib/bandwidth-sdk/models/rbm_location_response.rb lib/bandwidth-sdk/models/rbm_media_height_enum.rb lib/bandwidth-sdk/models/rbm_message_carousel_card.rb lib/bandwidth-sdk/models/rbm_message_content_file.rb @@ -278,6 +286,7 @@ lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb lib/bandwidth-sdk/models/rbm_message_content_text.rb lib/bandwidth-sdk/models/rbm_message_media.rb lib/bandwidth-sdk/models/rbm_standalone_card.rb +lib/bandwidth-sdk/models/rbm_suggestion_response.rb lib/bandwidth-sdk/models/recording_available_callback.rb lib/bandwidth-sdk/models/recording_complete_callback.rb lib/bandwidth-sdk/models/recording_state_enum.rb @@ -287,6 +296,9 @@ lib/bandwidth-sdk/models/redirect_callback.rb lib/bandwidth-sdk/models/redirect_method_enum.rb lib/bandwidth-sdk/models/sms_message_content.rb lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb +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/telephone_number.rb lib/bandwidth-sdk/models/tfv_basic_authentication.rb diff --git a/README.md b/README.md index 5ff23960..97229bd7 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ Class | Method | HTTP request | Description *Bandwidth::RecordingsApi* | [**update_call_recording_state**](docs/RecordingsApi.md#update_call_recording_state) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording *Bandwidth::StatisticsApi* | [**get_statistics**](docs/StatisticsApi.md#get_statistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics *Bandwidth::TollFreeVerificationApi* | [**create_webhook_subscription**](docs/TollFreeVerificationApi.md#create_webhook_subscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription +*Bandwidth::TollFreeVerificationApi* | [**delete_verification_request**](docs/TollFreeVerificationApi.md#delete_verification_request) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission *Bandwidth::TollFreeVerificationApi* | [**delete_webhook_subscription**](docs/TollFreeVerificationApi.md#delete_webhook_subscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription *Bandwidth::TollFreeVerificationApi* | [**get_toll_free_verification_status**](docs/TollFreeVerificationApi.md#get_toll_free_verification_status) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status *Bandwidth::TollFreeVerificationApi* | [**list_toll_free_use_cases**](docs/TollFreeVerificationApi.md#list_toll_free_use_cases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases @@ -175,8 +176,8 @@ Class | Method | HTTP request | Description - [Bandwidth::CallTranscriptionMetadata](docs/CallTranscriptionMetadata.md) - [Bandwidth::CallTranscriptionResponse](docs/CallTranscriptionResponse.md) - [Bandwidth::CallTranscriptionTrackEnum](docs/CallTranscriptionTrackEnum.md) + - [Bandwidth::Callback](docs/Callback.md) - [Bandwidth::CallbackMethodEnum](docs/CallbackMethodEnum.md) - - [Bandwidth::CallbackTypeEnum](docs/CallbackTypeEnum.md) - [Bandwidth::CardWidthEnum](docs/CardWidthEnum.md) - [Bandwidth::CodeRequest](docs/CodeRequest.md) - [Bandwidth::Conference](docs/Conference.md) @@ -195,16 +196,19 @@ Class | Method | HTTP request | Description - [Bandwidth::CreateLookupResponse](docs/CreateLookupResponse.md) - [Bandwidth::CreateMessageRequestError](docs/CreateMessageRequestError.md) - [Bandwidth::CreateMultiChannelMessageResponse](docs/CreateMultiChannelMessageResponse.md) - - [Bandwidth::DeferredResult](docs/DeferredResult.md) - [Bandwidth::DisconnectCallback](docs/DisconnectCallback.md) - [Bandwidth::Diversion](docs/Diversion.md) - [Bandwidth::DtmfCallback](docs/DtmfCallback.md) - [Bandwidth::Error](docs/Error.md) - [Bandwidth::ErrorObject](docs/ErrorObject.md) + - [Bandwidth::ErrorSource](docs/ErrorSource.md) - [Bandwidth::FailureWebhook](docs/FailureWebhook.md) - [Bandwidth::FieldError](docs/FieldError.md) - [Bandwidth::FileFormatEnum](docs/FileFormatEnum.md) - [Bandwidth::GatherCallback](docs/GatherCallback.md) + - [Bandwidth::InboundCallback](docs/InboundCallback.md) + - [Bandwidth::InboundCallbackMessage](docs/InboundCallbackMessage.md) + - [Bandwidth::InboundCallbackTypeEnum](docs/InboundCallbackTypeEnum.md) - [Bandwidth::InitiateCallback](docs/InitiateCallback.md) - [Bandwidth::Link](docs/Link.md) - [Bandwidth::LinksObject](docs/LinksObject.md) @@ -220,8 +224,6 @@ Class | Method | HTTP request | Description - [Bandwidth::MachineDetectionResult](docs/MachineDetectionResult.md) - [Bandwidth::Media](docs/Media.md) - [Bandwidth::Message](docs/Message.md) - - [Bandwidth::MessageCallback](docs/MessageCallback.md) - - [Bandwidth::MessageCallbackMessage](docs/MessageCallbackMessage.md) - [Bandwidth::MessageDirectionEnum](docs/MessageDirectionEnum.md) - [Bandwidth::MessageRequest](docs/MessageRequest.md) - [Bandwidth::MessageStatusEnum](docs/MessageStatusEnum.md) @@ -233,17 +235,17 @@ Class | Method | HTTP request | Description - [Bandwidth::MfaRequestError](docs/MfaRequestError.md) - [Bandwidth::MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) - [Bandwidth::MmsMessageContent](docs/MmsMessageContent.md) + - [Bandwidth::MmsMessageContentFile](docs/MmsMessageContentFile.md) - [Bandwidth::MultiChannelAction](docs/MultiChannelAction.md) - [Bandwidth::MultiChannelActionCalendarEvent](docs/MultiChannelActionCalendarEvent.md) - - [Bandwidth::MultiChannelCallbackData](docs/MultiChannelCallbackData.md) - [Bandwidth::MultiChannelChannelListObject](docs/MultiChannelChannelListObject.md) - [Bandwidth::MultiChannelChannelListObjectContent](docs/MultiChannelChannelListObjectContent.md) - - [Bandwidth::MultiChannelMessageCallbackData](docs/MultiChannelMessageCallbackData.md) + - [Bandwidth::MultiChannelError](docs/MultiChannelError.md) - [Bandwidth::MultiChannelMessageChannelEnum](docs/MultiChannelMessageChannelEnum.md) - - [Bandwidth::MultiChannelMessageData](docs/MultiChannelMessageData.md) - - [Bandwidth::MultiChannelMessageDirectionEnum](docs/MultiChannelMessageDirectionEnum.md) + - [Bandwidth::MultiChannelMessageContent](docs/MultiChannelMessageContent.md) - [Bandwidth::MultiChannelMessageRequest](docs/MultiChannelMessageRequest.md) - - [Bandwidth::MultiChannelStatusEnum](docs/MultiChannelStatusEnum.md) + - [Bandwidth::MultiChannelMessageResponseData](docs/MultiChannelMessageResponseData.md) + - [Bandwidth::MultiChannelMessageResponseDataChannelListInner](docs/MultiChannelMessageResponseDataChannelListInner.md) - [Bandwidth::OptInWorkflow](docs/OptInWorkflow.md) - [Bandwidth::PageInfo](docs/PageInfo.md) - [Bandwidth::PriorityEnum](docs/PriorityEnum.md) @@ -254,6 +256,7 @@ Class | Method | HTTP request | Description - [Bandwidth::RbmActionViewLocation](docs/RbmActionViewLocation.md) - [Bandwidth::RbmCardContent](docs/RbmCardContent.md) - [Bandwidth::RbmCardContentMedia](docs/RbmCardContentMedia.md) + - [Bandwidth::RbmLocationResponse](docs/RbmLocationResponse.md) - [Bandwidth::RbmMediaHeightEnum](docs/RbmMediaHeightEnum.md) - [Bandwidth::RbmMessageCarouselCard](docs/RbmMessageCarouselCard.md) - [Bandwidth::RbmMessageContentFile](docs/RbmMessageContentFile.md) @@ -261,6 +264,7 @@ Class | Method | HTTP request | Description - [Bandwidth::RbmMessageContentText](docs/RbmMessageContentText.md) - [Bandwidth::RbmMessageMedia](docs/RbmMessageMedia.md) - [Bandwidth::RbmStandaloneCard](docs/RbmStandaloneCard.md) + - [Bandwidth::RbmSuggestionResponse](docs/RbmSuggestionResponse.md) - [Bandwidth::RecordingAvailableCallback](docs/RecordingAvailableCallback.md) - [Bandwidth::RecordingCompleteCallback](docs/RecordingCompleteCallback.md) - [Bandwidth::RecordingStateEnum](docs/RecordingStateEnum.md) @@ -270,6 +274,9 @@ Class | Method | HTTP request | Description - [Bandwidth::RedirectMethodEnum](docs/RedirectMethodEnum.md) - [Bandwidth::SmsMessageContent](docs/SmsMessageContent.md) - [Bandwidth::StandaloneCardOrientationEnum](docs/StandaloneCardOrientationEnum.md) + - [Bandwidth::StatusCallback](docs/StatusCallback.md) + - [Bandwidth::StatusCallbackMessage](docs/StatusCallbackMessage.md) + - [Bandwidth::StatusCallbackTypeEnum](docs/StatusCallbackTypeEnum.md) - [Bandwidth::StirShaken](docs/StirShaken.md) - [Bandwidth::TelephoneNumber](docs/TelephoneNumber.md) - [Bandwidth::TfvBasicAuthentication](docs/TfvBasicAuthentication.md) diff --git a/bandwidth.yml b/bandwidth.yml index 03769645..4b3681cb 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -223,6 +223,8 @@ paths: $ref: '#/components/responses/messagingForbiddenError' '404': $ref: '#/components/responses/messagingNotFoundError' + '405': + $ref: '#/components/responses/messagingMethodNotAllowedError' '406': $ref: '#/components/responses/messagingNotAcceptableError' '415': @@ -250,24 +252,26 @@ paths: '202': $ref: '#/components/responses/createMultiChannelMessageResponse' '400': - $ref: '#/components/responses/createMessageBadRequestError' + $ref: '#/components/responses/multiChannelBadRequestError' '401': - $ref: '#/components/responses/messagingUnauthorizedError' + $ref: '#/components/responses/multiChannelUnauthorizedError' '403': - $ref: '#/components/responses/messagingForbiddenError' + $ref: '#/components/responses/multiChannelForbiddenError' '404': - $ref: '#/components/responses/messagingNotFoundError' + $ref: '#/components/responses/multiChannelNotFoundError' + '405': + $ref: '#/components/responses/multiChannelMethodNotAllowedError' '406': - $ref: '#/components/responses/messagingNotAcceptableError' + $ref: '#/components/responses/multiChannelNotAcceptableError' '415': - $ref: '#/components/responses/messagingInvalidMediaTypeError' + $ref: '#/components/responses/multiChannelInvalidMediaTypeError' '429': - $ref: '#/components/responses/messagingTooManyRequestsError' + $ref: '#/components/responses/multiChannelTooManyRequestsError' '500': - $ref: '#/components/responses/messagingInternalServerError' + $ref: '#/components/responses/multiChannelInternalServerError' callbacks: - multiChannelCallback: - $ref: '#/components/callbacks/multiChannelMessageCallback' + statusCallback: + $ref: '#/components/callbacks/statusCallback' x-badges: - name: Beta color: '#076EA8' @@ -1471,6 +1475,34 @@ paths: callbacks: tfVerificationStatus: $ref: '#/components/callbacks/tfVerificationStatus' + delete: + description: Delete a toll-free verification submission for a toll-free number. + operationId: deleteVerificationRequest + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + responses: + '204': + $ref: '#/components/responses/noContentResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + summary: Delete a Toll-Free Verification Submission + tags: + - Toll-Free Verification servers: *ref_4 /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions: get: @@ -1554,7 +1586,7 @@ paths: - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' responses: '204': - description: No Content + $ref: '#/components/responses/noContentResponse' '400': $ref: '#/components/responses/tfvBadRequestResponse' '401': @@ -1639,24 +1671,12 @@ components: The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. example: 93de2206-9669-4e07-948d-329f4b722ee2 - callbackTypeEnum: - type: string - enum: - - message-received - - message-sending - - message-delivered - - message-failed - description: > - Indicates the type of the callback: - - - `message-received` for inbound callbacks. - - - One of `message-sending`, `message-delivered`, `message-failed` for - status callbacks. - example: message-delivered priorityEnum: type: string - description: The priority specified by the user. + description: >- + Specifies the message's sending priority with respect to other messages + in your account. For best results and optimal throughput, reserve the + 'high' priority setting for critical messages only. enum: - default - high @@ -1753,9 +1773,7 @@ components: messageType: $ref: '#/components/schemas/messageTypeEnum' segmentCount: - type: integer - description: The number of segments the message was sent as. - example: 1 + $ref: '#/components/schemas/segmentCount' errorCode: type: integer description: The numeric error code of the message. @@ -1863,6 +1881,12 @@ components: type: integer mediaName: type: string + segmentCount: + type: integer + description: >- + The number of segments the user's message is broken into before sending + over carrier networks. + example: 1 tag: title: Tag type: string @@ -1870,14 +1894,6 @@ components: A custom string that will be included in callback events of the message. Max 1024 characters. example: custom string - deferredResult: - title: DeferredResult - type: object - properties: - result: - type: object - setOrExpired: - type: boolean expiration: type: string format: date-time @@ -1887,6 +1903,16 @@ components: 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. example: '2021-02-01T11:29:18-05:00' + carrierName: + type: string + description: >- + The name of the Authorized Message Provider (AMP) that handled this + message. + + In the US, this is the carrier that the message was sent to. + + This field is present only when this account feature has been enabled. + example: AT&T message: title: Message type: object @@ -1900,20 +1926,14 @@ components: description: The Bandwidth phone number associated with the message. example: '+15554443333' applicationId: - type: string - description: The application ID associated with the message. - example: 93de2206-9669-4e07-948d-329f4b722ee2 + $ref: '#/components/schemas/applicationId' time: type: string format: date-time description: The datetime stamp of the message in ISO 8601 example: 2024-12-02T20:15:57.278Z segmentCount: - type: integer - description: >- - The number of segments the original message from the user is broken - into before sending over to carrier networks. - example: 2 + $ref: '#/components/schemas/segmentCount' direction: $ref: '#/components/schemas/messageDirectionEnum' to: @@ -1945,9 +1965,7 @@ components: description: The contents of the message. example: Hello world tag: - type: string - description: The custom string set by the user. - example: custom tag + $ref: '#/components/schemas/tag' priority: $ref: '#/components/schemas/priorityEnum' expiration: @@ -1961,11 +1979,7 @@ components: - from properties: applicationId: - type: string - description: >- - The ID of the Application your from number is associated with in the - Bandwidth Phone Number Dashboard. - example: 93de2206-9669-4e07-948d-329f4b722ee2 + $ref: '#/components/schemas/applicationId' to: uniqueItems: true type: array @@ -2021,12 +2035,69 @@ components: type: array items: $ref: '#/components/schemas/link' + example: [] + data: + $ref: '#/components/schemas/multiChannelMessageResponseData' + errors: + type: array + items: + $ref: '#/components/schemas/errorObject' + example: [] + multiChannelError: + type: object + properties: + links: + type: array + items: + $ref: '#/components/schemas/link' + example: [] data: - $ref: '#/components/schemas/multiChannelMessageData' + type: object + nullable: true + example: null errors: type: array items: $ref: '#/components/schemas/errorObject' + link: + type: object + properties: + rel: + type: string + href: + type: string + errorObject: + type: object + properties: + type: + description: A concise summary of the error used for categorization. + type: string + description: + description: A detailed explanation of the error. + type: string + source: + $ref: '#/components/schemas/errorSource' + required: + - type + - description + - source + errorSource: + title: Error Source + type: object + description: Specifies relevant sources of the error, if any. + properties: + parameter: + type: string + description: The relevant URI query parameter causing the error + field: + type: string + description: The request body field that led to the error + header: + type: string + description: The header field that contributed to the error + reference: + type: string + description: A resource ID or path linked to the error multiChannelMessageChannelEnum: description: The channel of the multi-channel message. type: string @@ -2035,12 +2106,6 @@ components: - SMS - MMS example: RBM - multiChannelMessageDirectionEnum: - type: string - enum: - - INBOUND - - OUTBOUND - example: OUTBOUND multiChannelSenderId: type: string description: The sender ID of the message. This could be an alphanumeric sender ID. @@ -2049,6 +2114,14 @@ components: type: string description: The phone number the message should be sent to in E164 format. example: '+15552223333' + multiChannelDestinations: + uniqueItems: true + type: array + description: The destination phone number(s) of the message, in E164 format. + example: + - '+15554443333' + items: + type: string rbmMessageContentText: title: RBM Text type: object @@ -2090,6 +2163,26 @@ components: maxLength: 1000 required: - fileUrl + mmsMessageContentFile: + title: MMS Media File + type: object + properties: + fileUrl: + type: string + format: uri + description: >- + The URL of a media attachment. + + + For MMS, the API limits file size to 3.5MB. Specific carriers and + channels may have a smaller limit that could cause a large file to + fail, see + [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) + for more details. + example: https://dev.bandwidth.com/images/bandwidth-logo.png + maxLength: 1000 + required: + - fileUrl rbmMessageMedia: title: RBM Media type: object @@ -2198,7 +2291,9 @@ components: text: $ref: '#/components/schemas/messageText' media: - $ref: '#/components/schemas/messageMedia' + type: array + items: + $ref: '#/components/schemas/mmsMessageContentFile' rbmMessageContentRichCard: title: RBM Rich Card oneOf: @@ -2220,7 +2315,7 @@ components: description: Displayed text for user to click maxLength: 25 example: Hello world - rbmActionPostBackData: + rbmActionPostbackData: title: Post Back Data type: string format: byte @@ -2234,11 +2329,11 @@ components: $ref: '#/components/schemas/rbmActionTypeEnum' text: $ref: '#/components/schemas/rbmActionText' - postBackData: - $ref: '#/components/schemas/rbmActionPostBackData' + postbackData: + $ref: '#/components/schemas/rbmActionPostbackData' required: - text - - postBackData + - postbackData - type rbmActionDial: allOf: @@ -2342,14 +2437,6 @@ components: CREATE_CALENDAR_EVENT: '#/components/schemas/multiChannelActionCalendarEvent' OPEN_URL: '#/components/schemas/rbmActionOpenUrl' REQUEST_LOCATION: '#/components/schemas/rbmActionBase' - multiChannelStatusEnum: - type: string - enum: - - QUEUED - - SENDING - - DELIVERED - - FAILED - example: DELIVERED multiChannelChannelListObject: type: object properties: @@ -2396,141 +2483,250 @@ components: required: - to - channelList - multiChannelMessageCallbackData: - type: object - properties: - messageId: - $ref: '#/components/schemas/messageId' - status: - $ref: '#/components/schemas/multiChannelStatusEnum' - direction: - $ref: '#/components/schemas/multiChannelMessageDirectionEnum' - from: - $ref: '#/components/schemas/multiChannelSenderId' - to: - $ref: '#/components/schemas/multiChannelDestination' - applicationId: - $ref: '#/components/schemas/applicationId' - channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' - tag: - $ref: '#/components/schemas/tag' - multiChannelMessageData: + multiChannelMessageResponseData: + description: The data returned in a multichannel message response. type: object properties: messageId: $ref: '#/components/schemas/messageId' - status: - $ref: '#/components/schemas/multiChannelStatusEnum' time: description: The time the message was received by the Bandwidth API. type: string format: date-time example: 2025-01-01T18:20:16.000Z direction: - $ref: '#/components/schemas/multiChannelMessageDirectionEnum' - from: - $ref: '#/components/schemas/multiChannelSenderId' + $ref: '#/components/schemas/messageDirectionEnum' to: - $ref: '#/components/schemas/multiChannelDestination' - applicationId: - $ref: '#/components/schemas/applicationId' - channel: - $ref: '#/components/schemas/multiChannelMessageChannelEnum' + $ref: '#/components/schemas/multiChannelDestinations' + channelList: + type: array + description: >- + A list of message bodies. The messages will be attempted in the + order they are listed. Once a message sends successfully, the others + will be ignored. + items: + allOf: + - $ref: '#/components/schemas/multiChannelChannelListObject' + - type: object + properties: + owner: + type: string + description: >- + The Bandwidth senderId associated with the message. + Identical to 'from'. + required: + - owner + maxItems: 4 tag: $ref: '#/components/schemas/tag' - multiChannelCallbackData: + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + $ref: '#/components/schemas/expiration' + required: + - messageId + - time + - direction + - to + - channelList + multiChannelMessageContent: + description: The structure of the content field of a multichannel message. type: object properties: - time: - description: The time of the callback event. - type: string - format: date-time - example: 2025-01-01T18:20:16.000Z - type: - $ref: '#/components/schemas/multiChannelStatusEnum' - to: - $ref: '#/components/schemas/multiChannelDestination' - description: + text: type: string - example: Incoming message received - message: - $ref: '#/components/schemas/multiChannelMessageCallbackData' - link: + media: + $ref: '#/components/schemas/rbmMessageContentFile' + rbmSuggestionResponse: type: object properties: - rel: - type: string - href: + text: type: string - errorObject: + description: The text associated with the suggestion response. + example: Yes, I would like to proceed + postbackData: + $ref: '#/components/schemas/rbmActionPostbackData' + rbmLocationResponse: type: object properties: - code: + latitude: type: string - message: + format: double + description: The latitude of the client's location. + example: '37.7749' + longitude: type: string - messageCallback: - description: Message Callback Schema + format: double + description: The longitude of the client's location. + example: '-122.4194' + callback: + description: >- + Callbacks are divided into two types based on direction of the related + message: + + - `statusCallback` indicates status of an outbound MT SMS, MMS, or RBM + message. + + - `inboundCallback` indicates an inbound MO message or a multichannel + message client's response to a suggestion or location request. + type: object + oneOf: + - $ref: '#/components/schemas/statusCallback' + - $ref: '#/components/schemas/inboundCallback' + discriminator: + propertyName: type + mapping: + message-sent: '#/components/schemas/statusCallback' + message-delivered: '#/components/schemas/statusCallback' + message-failed: '#/components/schemas/statusCallback' + message-read: '#/components/schemas/statusCallback' + message-received: '#/components/schemas/inboundCallback' + request-location-response: '#/components/schemas/inboundCallback' + suggestion-response: '#/components/schemas/inboundCallback' + statusCallback: type: object + description: >- + Represents a status callback for an outbound MT SMS or MMS or RBM + message. properties: time: type: string format: date-time example: 2024-12-02T20:15:57.278Z + eventTime: + type: string + description: >- + Represents the time at which the message was read, for + `message-read` callbacks. + format: date-time + example: 2024-12-02T20:15:58.278Z type: - $ref: '#/components/schemas/callbackTypeEnum' + $ref: '#/components/schemas/statusCallbackTypeEnum' to: type: string + description: >- + The destination phone number the message was sent to. + + For status callbacks, this the the Bandwidth user's client phone + number. example: '+15552223333' description: type: string description: A detailed description of the event described by the callback. - example: rejected-unallocated-from-number + example: Message delivered to carrier. message: - $ref: '#/components/schemas/messageCallbackMessage' + $ref: '#/components/schemas/statusCallbackMessage' errorCode: type: integer description: Optional error code, applicable only when type is `message-failed`. - nullable: true example: 4405 carrierName: + $ref: '#/components/schemas/carrierName' + required: + - time + - type + - to + - description + - message + inboundCallback: + type: object + description: Represents an inbound callback. + properties: + time: type: string - description: >- - The name of the Authorized Message Provider (AMP) that handled this - message. In the US, this is the carrier that the message was sent - to. - nullable: true - example: AT&T + format: date-time + example: 2024-12-02T20:15:57.278Z + type: + $ref: '#/components/schemas/inboundCallbackTypeEnum' + to: + type: string + description: > + The destination phone number the message was sent to. + + For inbound callbacks, this is the Bandwidth number or alphanumeric + identifier that received the message. + example: '+15552223333' + description: + type: string + description: A detailed description of the event described by the callback. + example: Incoming message received + message: + $ref: '#/components/schemas/inboundCallbackMessage' + carrierName: + $ref: '#/components/schemas/carrierName' required: - time - type - to - description - message - messageCallbackMessage: - description: Message payload schema within a MessageCallback + statusCallbackTypeEnum: + type: string + description: >- + The possible status callbacks when sending an MT SMS or MMS or RBM + message: + + - `message-sending` indicates that Bandwidth is sending the message to + the upstream provider. + + - `message-delivered` indicates that the message was successfully sent. + + - `message-failed` indicates that the message could not be sent to the + intended recipient. + + - `message-read` indicates that the RBM message was read by the + recipient. + enum: + - message-sending + - message-delivered + - message-failed + - message-read + example: message-delivered + inboundCallbackTypeEnum: + type: string + description: >- + The possible inbound callback types originating from MO messages or + multichannel message client responses: + + - `message-received` indicates an MO message from a Bandwidth user's + client to a Bandwidth number. + + - `request-location-response` indicates a response to a location request + sent by the Bandwidth user's client after receiving an RBM message. + + - `suggestion-response` indicates a response to a suggestion sent by the + Bandwidth user's client after receiving an RBM message. + enum: + - message-received + - request-location-response + - suggestion-response + example: message-received + statusCallbackMessage: + description: Message payload schema within a callback type: object properties: id: type: string + description: A unique identifier of the message. example: 1661365814859loidf7mcwd4qacn7 owner: type: string + description: >- + The Bandwidth phone number or alphanumeric identifier associated + with the message. example: '+15553332222' applicationId: - type: string - example: 93de2206-9669-4e07-948d-329f4b722ee2 + $ref: '#/components/schemas/applicationId' time: type: string format: date-time example: 2024-12-02T20:15:57.666Z segmentCount: - type: integer - example: 1 + $ref: '#/components/schemas/segmentCount' direction: $ref: '#/components/schemas/messageDirectionEnum' to: + description: The phone number recipients of the message. uniqueItems: true type: array items: @@ -2539,17 +2735,18 @@ components: - '+15552223333' from: type: string + description: >- + The Bandwidth phone number or alphanumeric identifier the message + was sent from. example: '+15553332222' text: type: string example: Hello world tag: - type: string - example: custom string + $ref: '#/components/schemas/tag' media: type: array - description: Optional media, applicable only for mms - nullable: true + description: Optional media, not applicable for sms items: type: string format: uri @@ -2558,6 +2755,28 @@ components: - https://dev.bandwidth.com/images/github_logo.png priority: $ref: '#/components/schemas/priorityEnum' + channel: + $ref: '#/components/schemas/multiChannelMessageChannelEnum' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + inboundCallbackMessage: + allOf: + - $ref: '#/components/schemas/statusCallbackMessage' + - type: object + properties: + content: + $ref: '#/components/schemas/multiChannelMessageContent' + suggestionResponse: + $ref: '#/components/schemas/rbmSuggestionResponse' + locationResponse: + $ref: '#/components/schemas/rbmLocationResponse' required: - id - owner @@ -2567,7 +2786,6 @@ components: - direction - to - from - - text callbackMethodEnum: type: string nullable: true @@ -5954,6 +6172,12 @@ components: application/json: schema: $ref: '#/components/schemas/messagingRequestError' + messagingMethodNotAllowedError: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' messagingInvalidMediaTypeError: description: Unsupported Media Type content: @@ -5972,6 +6196,120 @@ components: application/json: schema: $ref: '#/components/schemas/messagingRequestError' + multiChannelBadRequestError: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: request-validation + description: >- + The 'channelList[0].from' field must contain exactly one + telephone number + source: + field: channelList[0].from + multiChannelNotAcceptableError: + description: Not Acceptable + multiChannelUnauthorizedError: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: unauthorized + description: Authentication Failed + source: {} + multiChannelForbiddenError: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: forbidden + description: Access Denied + source: {} + multiChannelNotFoundError: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: forbidden + description: Resource not found. + source: {} + multiChannelMethodNotAllowedError: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: method-not-allowed + description: Method 'PUT' not supported for this resource. + source: {} + multiChannelInvalidMediaTypeError: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: unsupported-content-type + description: >- + Content-Type 'application/xml;charset=UTF-8' is not supported. + Please use 'application/json' + source: + header: Content-Type + multiChannelTooManyRequestsError: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: rate-limit-exceeded + description: >- + You have exceeded your rate limit for this endpoint. Please + retry later. + source: {} + multiChannelInternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/multiChannelError' + example: + links: [] + data: null + errors: + - type: internal-server-error + description: Internal server error. No further information available + source: {} createCallResponse: description: Created headers: @@ -6373,6 +6711,8 @@ components: example: description: Cannot process request. type: bad request + noContentResponse: + description: No Content tfvPostBadRequestResponse: description: Bad Request content: @@ -7506,17 +7846,30 @@ components: post: requestBody: required: true - description: > -

This Inbound Message Webhook is an envelope containing a - received (MO) message to your message-enabled Bandwidth telephone - number. The payload type will always indicate "message-received". + description: >- +

This Inbound Message Webhook is an envelope containing either a + received (MO) message to your + + message-enabled Bandwidth telephone number or a multichannel + client's response to a suggestion response + + or location request. + +

The payload type will be one of message-received, + suggestion-response, or + location-request-response. + +

Note that suggestion-response and + location-request-response callback types are + pertinent only for RBM messages sent from the + /messages/multiChannel endpoint.

Please visit Webhooks

content: application/json: schema: - $ref: '#/components/schemas/messageCallback' + $ref: '#/components/schemas/inboundCallback' examples: smsMessageReceivedCallback: $ref: '#/components/examples/smsMessageReceivedCallbackExample' @@ -7525,24 +7878,26 @@ components: responses: '200': description: OK + '202': + description: Accepted statusCallback: '{statusCallbackUrl}': post: requestBody: required: true - description: > + description: >-

This Outbound Message Webhook is an envelope containing status - information regarding a message sent (MT) from your - message-enabled Bandwidth telephone number. The payload type will - be one of "message-sending", "message-delivered", or - "message-failed". + information regarding a message sent (MT) + from your message-enabled Bandwidth telephone number. +

The payload type will be one of message-sending, message-delivered, message-failed or message-read. +

Note that message-read callbacks are pertinent only for RBM messages sent from the /messages/multiChannel endpoint.

Please visit Webhooks

content: application/json: schema: - $ref: '#/components/schemas/messageCallback' + $ref: '#/components/schemas/statusCallback' examples: messageSendingCallback: $ref: '#/components/examples/messageSendingCallbackExample' @@ -7558,19 +7913,8 @@ components: responses: '200': description: OK - multiChannelMessageCallback: - '{multiChannelMessageCallbackUrl}': - post: - requestBody: - required: true - description: Status Callback Payload - content: - application/json: - schema: - $ref: '#/components/schemas/multiChannelCallbackData' - responses: - '204': - description: No Content + '202': + description: Accepted tfVerificationStatus: your_url.com/webhookService: post: @@ -7594,7 +7938,7 @@ components: $ref: '#/components/requestBodies/verificationWebhookRequest' responses: '204': - description: No Content + $ref: '#/components/responses/noContentResponse' '400': $ref: '#/components/responses/tfvBadRequestResponse' '401': diff --git a/docs/Callback.md b/docs/Callback.md new file mode 100644 index 00000000..fcf6b4f1 --- /dev/null +++ b/docs/Callback.md @@ -0,0 +1,84 @@ +# Bandwidth::Callback + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'bandwidth-sdk' + +Bandwidth::Callback.openapi_one_of +# => +# [ +# :'InboundCallback', +# :'StatusCallback' +# ] +``` + +### `openapi_discriminator_name` + +Returns the discriminator's property name. + +#### Example + +```ruby +require 'bandwidth-sdk' + +Bandwidth::Callback.openapi_discriminator_name +# => :'type' +``` + +### `openapi_discriminator_name` + +Returns the discriminator's mapping. + +#### Example + +```ruby +require 'bandwidth-sdk' + +Bandwidth::Callback.openapi_discriminator_mapping +# => +# { +# :'message-delivered' => :'StatusCallback', +# :'message-failed' => :'StatusCallback', +# :'message-read' => :'StatusCallback', +# :'message-received' => :'InboundCallback', +# :'message-sent' => :'StatusCallback', +# :'request-location-response' => :'InboundCallback', +# :'suggestion-response' => :'InboundCallback' +# } +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'bandwidth-sdk' + +Bandwidth::Callback.build(data) +# => # + +Bandwidth::Callback.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `InboundCallback` +- `StatusCallback` +- `nil` (if no type matches) + diff --git a/docs/CreateMultiChannelMessageResponse.md b/docs/CreateMultiChannelMessageResponse.md index b80b4028..4fc395aa 100644 --- a/docs/CreateMultiChannelMessageResponse.md +++ b/docs/CreateMultiChannelMessageResponse.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **links** | [**Array<Link>**](Link.md) | | [optional] | -| **data** | [**MultiChannelMessageData**](MultiChannelMessageData.md) | | [optional] | +| **data** | [**MultiChannelMessageResponseData**](MultiChannelMessageResponseData.md) | | [optional] | | **errors** | [**Array<ErrorObject>**](ErrorObject.md) | | [optional] | ## Example @@ -14,9 +14,9 @@ require 'bandwidth-sdk' instance = Bandwidth::CreateMultiChannelMessageResponse.new( - links: null, + links: [], data: null, - errors: null + errors: [] ) ``` diff --git a/docs/DeferredResult.md b/docs/DeferredResult.md deleted file mode 100644 index 602bcacc..00000000 --- a/docs/DeferredResult.md +++ /dev/null @@ -1,20 +0,0 @@ -# Bandwidth::DeferredResult - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **result** | **Object** | | [optional] | -| **set_or_expired** | **Boolean** | | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::DeferredResult.new( - result: null, - set_or_expired: null -) -``` - diff --git a/docs/ErrorObject.md b/docs/ErrorObject.md index b92d0ff2..577bf0ae 100644 --- a/docs/ErrorObject.md +++ b/docs/ErrorObject.md @@ -4,8 +4,9 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **code** | **String** | | [optional] | -| **message** | **String** | | [optional] | +| **type** | **String** | A concise summary of the error used for categorization. | | +| **description** | **String** | A detailed explanation of the error. | | +| **source** | [**ErrorSource**](ErrorSource.md) | | | ## Example @@ -13,8 +14,9 @@ require 'bandwidth-sdk' instance = Bandwidth::ErrorObject.new( - code: null, - message: null + type: null, + description: null, + source: null ) ``` diff --git a/docs/ErrorSource.md b/docs/ErrorSource.md new file mode 100644 index 00000000..919c96c0 --- /dev/null +++ b/docs/ErrorSource.md @@ -0,0 +1,24 @@ +# Bandwidth::ErrorSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **parameter** | **String** | The relevant URI query parameter causing the error | [optional] | +| **field** | **String** | The request body field that led to the error | [optional] | +| **header** | **String** | The header field that contributed to the error | [optional] | +| **reference** | **String** | A resource ID or path linked to the error | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::ErrorSource.new( + parameter: null, + field: null, + header: null, + reference: null +) +``` + diff --git a/docs/InboundCallback.md b/docs/InboundCallback.md new file mode 100644 index 00000000..a2016c4c --- /dev/null +++ b/docs/InboundCallback.md @@ -0,0 +1,28 @@ +# Bandwidth::InboundCallback + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **time** | **Time** | | | +| **type** | [**InboundCallbackTypeEnum**](InboundCallbackTypeEnum.md) | | | +| **to** | **String** | The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. | | +| **description** | **String** | A detailed description of the event described by the callback. | | +| **message** | [**InboundCallbackMessage**](InboundCallbackMessage.md) | | | +| **carrier_name** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::InboundCallback.new( + time: 2024-12-02T20:15:57.278Z, + type: null, + to: +15552223333, + description: Incoming message received, + message: null, + carrier_name: AT&T +) +``` + diff --git a/docs/InboundCallbackMessage.md b/docs/InboundCallbackMessage.md new file mode 100644 index 00000000..202c34ce --- /dev/null +++ b/docs/InboundCallbackMessage.md @@ -0,0 +1,48 @@ +# Bandwidth::InboundCallbackMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of the message. | | +| **owner** | **String** | The Bandwidth phone number or alphanumeric identifier associated with the message. | | +| **application_id** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | +| **time** | **Time** | | | +| **segment_count** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | | +| **direction** | [**MessageDirectionEnum**](MessageDirectionEnum.md) | | | +| **to** | **Array<String>** | The phone number recipients of the message. | | +| **from** | **String** | The Bandwidth phone number or alphanumeric identifier the message was sent from. | | +| **text** | **String** | | [optional] | +| **tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | +| **media** | **Array<String>** | Optional media, not applicable for sms | [optional] | +| **priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] | +| **channel** | [**MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] | +| **content** | [**MultiChannelMessageContent**](MultiChannelMessageContent.md) | | [optional] | +| **suggestion_response** | [**RbmSuggestionResponse**](RbmSuggestionResponse.md) | | [optional] | +| **location_response** | [**RbmLocationResponse**](RbmLocationResponse.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::InboundCallbackMessage.new( + id: 1661365814859loidf7mcwd4qacn7, + owner: +15553332222, + application_id: 93de2206-9669-4e07-948d-329f4b722ee2, + time: 2024-12-02T20:15:57.666Z, + segment_count: 1, + direction: null, + to: [+15552223333], + from: +15553332222, + text: Hello world, + tag: custom string, + media: [https://dev.bandwidth.com/images/bandwidth-logo.png, https://dev.bandwidth.com/images/github_logo.png], + priority: null, + channel: null, + content: null, + suggestion_response: null, + location_response: null +) +``` + diff --git a/docs/MultiChannelStatusEnum.md b/docs/InboundCallbackTypeEnum.md similarity index 61% rename from docs/MultiChannelStatusEnum.md rename to docs/InboundCallbackTypeEnum.md index 363634b8..84580df9 100644 --- a/docs/MultiChannelStatusEnum.md +++ b/docs/InboundCallbackTypeEnum.md @@ -1,4 +1,4 @@ -# Bandwidth::MultiChannelStatusEnum +# Bandwidth::InboundCallbackTypeEnum ## Properties @@ -10,6 +10,6 @@ ```ruby require 'bandwidth-sdk' -instance = Bandwidth::MultiChannelStatusEnum.new() +instance = Bandwidth::InboundCallbackTypeEnum.new() ``` diff --git a/docs/ListMessageItem.md b/docs/ListMessageItem.md index 1c2b8ea1..f4ddf253 100644 --- a/docs/ListMessageItem.md +++ b/docs/ListMessageItem.md @@ -11,7 +11,7 @@ | **message_status** | [**MessageStatusEnum**](MessageStatusEnum.md) | | [optional] | | **message_direction** | [**ListMessageDirectionEnum**](ListMessageDirectionEnum.md) | | [optional] | | **message_type** | [**MessageTypeEnum**](MessageTypeEnum.md) | | [optional] | -| **segment_count** | **Integer** | The number of segments the message was sent as. | [optional] | +| **segment_count** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | [optional] | | **error_code** | **Integer** | The numeric error code of the message. | [optional] | | **receive_time** | **Time** | The ISO 8601 datetime of the message. | [optional] | | **carrier_name** | **String** | The name of the carrier. Not currently supported for MMS coming soon. | [optional] | diff --git a/docs/Message.md b/docs/Message.md index 849dd626..b1ed7329 100644 --- a/docs/Message.md +++ b/docs/Message.md @@ -6,15 +6,15 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | The id of the message. | [optional] | | **owner** | **String** | The Bandwidth phone number associated with the message. | [optional] | -| **application_id** | **String** | The application ID associated with the message. | [optional] | +| **application_id** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | [optional] | | **time** | **Time** | The datetime stamp of the message in ISO 8601 | [optional] | -| **segment_count** | **Integer** | The number of segments the original message from the user is broken into before sending over to carrier networks. | [optional] | +| **segment_count** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | [optional] | | **direction** | [**MessageDirectionEnum**](MessageDirectionEnum.md) | | [optional] | | **to** | **Array<String>** | The phone number recipients of the message. | [optional] | | **from** | **String** | The phone number the message was sent from. | [optional] | | **media** | **Array<String>** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional] | | **text** | **String** | The contents of the message. | [optional] | -| **tag** | **String** | The custom string set by the user. | [optional] | +| **tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | | **priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] | | **expiration** | **Time** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [optional] | @@ -28,13 +28,13 @@ instance = Bandwidth::Message.new( owner: +15554443333, application_id: 93de2206-9669-4e07-948d-329f4b722ee2, time: 2024-12-02T20:15:57.278Z, - segment_count: 2, + segment_count: 1, direction: null, to: ["+15552223333"], from: +15553332222, media: ["https://dev.bandwidth.com/images/bandwidth-logo.png"], text: Hello world, - tag: custom tag, + tag: custom string, priority: null, expiration: 2021-02-01T11:29:18-05:00 ) diff --git a/docs/MessageCallback.md b/docs/MessageCallback.md deleted file mode 100644 index 1aaa8c1b..00000000 --- a/docs/MessageCallback.md +++ /dev/null @@ -1,30 +0,0 @@ -# Bandwidth::MessageCallback - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **time** | **Time** | | | -| **type** | [**CallbackTypeEnum**](CallbackTypeEnum.md) | | | -| **to** | **String** | | | -| **description** | **String** | A detailed description of the event described by the callback. | | -| **message** | [**MessageCallbackMessage**](MessageCallbackMessage.md) | | | -| **error_code** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] | -| **carrier_name** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::MessageCallback.new( - time: 2024-12-02T20:15:57.278Z, - type: null, - to: +15552223333, - description: rejected-unallocated-from-number, - message: null, - error_code: 4405, - carrier_name: AT&T -) -``` - diff --git a/docs/MessageCallbackMessage.md b/docs/MessageCallbackMessage.md deleted file mode 100644 index 1624f4aa..00000000 --- a/docs/MessageCallbackMessage.md +++ /dev/null @@ -1,40 +0,0 @@ -# Bandwidth::MessageCallbackMessage - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | | | -| **owner** | **String** | | | -| **application_id** | **String** | | | -| **time** | **Time** | | | -| **segment_count** | **Integer** | | | -| **direction** | [**MessageDirectionEnum**](MessageDirectionEnum.md) | | | -| **to** | **Array<String>** | | | -| **from** | **String** | | | -| **text** | **String** | | | -| **tag** | **String** | | [optional] | -| **media** | **Array<String>** | Optional media, applicable only for mms | [optional] | -| **priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::MessageCallbackMessage.new( - id: 1661365814859loidf7mcwd4qacn7, - owner: +15553332222, - application_id: 93de2206-9669-4e07-948d-329f4b722ee2, - time: 2024-12-02T20:15:57.666Z, - segment_count: 1, - direction: null, - to: ["+15552223333"], - from: +15553332222, - text: Hello world, - tag: custom string, - media: ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], - priority: null -) -``` - diff --git a/docs/MessageRequest.md b/docs/MessageRequest.md index 737ddf86..3c348b45 100644 --- a/docs/MessageRequest.md +++ b/docs/MessageRequest.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **application_id** | **String** | The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. | | +| **application_id** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | | **to** | **Array<String>** | The phone number(s) the message should be sent to in E164 format. | | | **from** | **String** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | | | **text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] | diff --git a/docs/MmsMessageContent.md b/docs/MmsMessageContent.md index 01ddd6a2..40bf28ac 100644 --- a/docs/MmsMessageContent.md +++ b/docs/MmsMessageContent.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] | -| **media** | **Array<String>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] | +| **media** | [**Array<MmsMessageContentFile>**](MmsMessageContentFile.md) | | [optional] | ## Example @@ -14,7 +14,7 @@ require 'bandwidth-sdk' instance = Bandwidth::MmsMessageContent.new( text: Hello world, - media: ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"] + media: null ) ``` diff --git a/docs/MmsMessageContentFile.md b/docs/MmsMessageContentFile.md new file mode 100644 index 00000000..09bd4b66 --- /dev/null +++ b/docs/MmsMessageContentFile.md @@ -0,0 +1,18 @@ +# Bandwidth::MmsMessageContentFile + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **file_url** | **String** | The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details. | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::MmsMessageContentFile.new( + file_url: https://dev.bandwidth.com/images/bandwidth-logo.png +) +``` + diff --git a/docs/MultiChannelActionCalendarEvent.md b/docs/MultiChannelActionCalendarEvent.md index f137b099..210f98ca 100644 --- a/docs/MultiChannelActionCalendarEvent.md +++ b/docs/MultiChannelActionCalendarEvent.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **post_back_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | | **title** | **String** | The title of the event. | | | **start_time** | **Time** | The start time of the event. | | | **end_time** | **Time** | The end time of the event. | | @@ -20,7 +20,7 @@ require 'bandwidth-sdk' instance = Bandwidth::MultiChannelActionCalendarEvent.new( type: null, text: Hello world, - post_back_data: U0dWc2JHOGdkMjl5YkdRPQ==, + postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, title: Meeting with John, start_time: 2022-09-14T18:20:16Z, end_time: 2022-09-14T18:20:16Z, diff --git a/docs/MultiChannelCallbackData.md b/docs/MultiChannelCallbackData.md deleted file mode 100644 index 7b6328d8..00000000 --- a/docs/MultiChannelCallbackData.md +++ /dev/null @@ -1,26 +0,0 @@ -# Bandwidth::MultiChannelCallbackData - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **time** | **Time** | The time of the callback event. | [optional] | -| **type** | [**MultiChannelStatusEnum**](MultiChannelStatusEnum.md) | | [optional] | -| **to** | **String** | The phone number the message should be sent to in E164 format. | [optional] | -| **description** | **String** | | [optional] | -| **message** | [**MultiChannelMessageCallbackData**](MultiChannelMessageCallbackData.md) | | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::MultiChannelCallbackData.new( - time: 2025-01-01T18:20:16Z, - type: null, - to: +15552223333, - description: Incoming message received, - message: null -) -``` - diff --git a/docs/MultiChannelError.md b/docs/MultiChannelError.md new file mode 100644 index 00000000..6d2975c1 --- /dev/null +++ b/docs/MultiChannelError.md @@ -0,0 +1,22 @@ +# Bandwidth::MultiChannelError + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **links** | [**Array<Link>**](Link.md) | | [optional] | +| **data** | **Object** | | [optional] | +| **errors** | [**Array<ErrorObject>**](ErrorObject.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::MultiChannelError.new( + links: [], + data: null, + errors: null +) +``` + diff --git a/docs/MultiChannelMessageCallbackData.md b/docs/MultiChannelMessageCallbackData.md deleted file mode 100644 index 3976afa3..00000000 --- a/docs/MultiChannelMessageCallbackData.md +++ /dev/null @@ -1,32 +0,0 @@ -# Bandwidth::MultiChannelMessageCallbackData - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **message_id** | **String** | The ID of the message. | [optional] | -| **status** | [**MultiChannelStatusEnum**](MultiChannelStatusEnum.md) | | [optional] | -| **direction** | [**MultiChannelMessageDirectionEnum**](MultiChannelMessageDirectionEnum.md) | | [optional] | -| **from** | **String** | The sender ID of the message. This could be an alphanumeric sender ID. | [optional] | -| **to** | **String** | The phone number the message should be sent to in E164 format. | [optional] | -| **application_id** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | [optional] | -| **channel** | [**MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] | -| **tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::MultiChannelMessageCallbackData.new( - message_id: 1589228074636lm4k2je7j7jklbn2, - status: null, - direction: null, - from: BandwidthRBM, - to: +15552223333, - application_id: 93de2206-9669-4e07-948d-329f4b722ee2, - channel: null, - tag: custom string -) -``` - diff --git a/docs/MultiChannelMessageContent.md b/docs/MultiChannelMessageContent.md new file mode 100644 index 00000000..546d0f06 --- /dev/null +++ b/docs/MultiChannelMessageContent.md @@ -0,0 +1,20 @@ +# Bandwidth::MultiChannelMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **media** | [**RbmMessageContentFile**](RbmMessageContentFile.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::MultiChannelMessageContent.new( + text: null, + media: null +) +``` + diff --git a/docs/MultiChannelMessageData.md b/docs/MultiChannelMessageData.md deleted file mode 100644 index 44e99016..00000000 --- a/docs/MultiChannelMessageData.md +++ /dev/null @@ -1,34 +0,0 @@ -# Bandwidth::MultiChannelMessageData - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **message_id** | **String** | The ID of the message. | [optional] | -| **status** | [**MultiChannelStatusEnum**](MultiChannelStatusEnum.md) | | [optional] | -| **time** | **Time** | The time the message was received by the Bandwidth API. | [optional] | -| **direction** | [**MultiChannelMessageDirectionEnum**](MultiChannelMessageDirectionEnum.md) | | [optional] | -| **from** | **String** | The sender ID of the message. This could be an alphanumeric sender ID. | [optional] | -| **to** | **String** | The phone number the message should be sent to in E164 format. | [optional] | -| **application_id** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | [optional] | -| **channel** | [**MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] | -| **tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::MultiChannelMessageData.new( - message_id: 1589228074636lm4k2je7j7jklbn2, - status: null, - time: 2025-01-01T18:20:16Z, - direction: null, - from: BandwidthRBM, - to: +15552223333, - application_id: 93de2206-9669-4e07-948d-329f4b722ee2, - channel: null, - tag: custom string -) -``` - diff --git a/docs/MultiChannelMessageDirectionEnum.md b/docs/MultiChannelMessageDirectionEnum.md deleted file mode 100644 index 05855da2..00000000 --- a/docs/MultiChannelMessageDirectionEnum.md +++ /dev/null @@ -1,15 +0,0 @@ -# Bandwidth::MultiChannelMessageDirectionEnum - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::MultiChannelMessageDirectionEnum.new() -``` - diff --git a/docs/MultiChannelMessageResponseData.md b/docs/MultiChannelMessageResponseData.md new file mode 100644 index 00000000..a679ea2d --- /dev/null +++ b/docs/MultiChannelMessageResponseData.md @@ -0,0 +1,32 @@ +# Bandwidth::MultiChannelMessageResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message_id** | **String** | The ID of the message. | | +| **time** | **Time** | The time the message was received by the Bandwidth API. | | +| **direction** | [**MessageDirectionEnum**](MessageDirectionEnum.md) | | | +| **to** | **Array<String>** | The destination phone number(s) of the message, in E164 format. | | +| **channel_list** | [**Array<MultiChannelMessageResponseDataChannelListInner>**](MultiChannelMessageResponseDataChannelListInner.md) | A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. | | +| **tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | +| **priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] | +| **expiration** | **Time** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::MultiChannelMessageResponseData.new( + message_id: 1589228074636lm4k2je7j7jklbn2, + time: 2025-01-01T18:20:16Z, + direction: null, + to: ["+15554443333"], + channel_list: null, + tag: custom string, + priority: null, + expiration: 2021-02-01T11:29:18-05:00 +) +``` + diff --git a/docs/MultiChannelMessageResponseDataChannelListInner.md b/docs/MultiChannelMessageResponseDataChannelListInner.md new file mode 100644 index 00000000..b4400f07 --- /dev/null +++ b/docs/MultiChannelMessageResponseDataChannelListInner.md @@ -0,0 +1,26 @@ +# Bandwidth::MultiChannelMessageResponseDataChannelListInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **String** | The sender ID of the message. This could be an alphanumeric sender ID. | | +| **application_id** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | +| **channel** | [**MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | | +| **content** | [**MultiChannelChannelListObjectContent**](MultiChannelChannelListObjectContent.md) | | | +| **owner** | **String** | The Bandwidth senderId associated with the message. Identical to 'from'. | | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::MultiChannelMessageResponseDataChannelListInner.new( + from: BandwidthRBM, + application_id: 93de2206-9669-4e07-948d-329f4b722ee2, + channel: null, + content: null, + owner: null +) +``` + diff --git a/docs/RbmActionBase.md b/docs/RbmActionBase.md index 9e51afa1..8a357c4f 100644 --- a/docs/RbmActionBase.md +++ b/docs/RbmActionBase.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **post_back_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | ## Example @@ -16,7 +16,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionBase.new( type: null, text: Hello world, - post_back_data: [B@6b103db7 + postback_data: [B@2c6aa46c ) ``` diff --git a/docs/RbmActionDial.md b/docs/RbmActionDial.md index 3ba940c9..f14ab5bf 100644 --- a/docs/RbmActionDial.md +++ b/docs/RbmActionDial.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **post_back_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | | **phone_number** | **String** | The phone number to dial. Must be E164 format. | | ## Example @@ -17,7 +17,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionDial.new( type: null, text: Hello world, - post_back_data: U0dWc2JHOGdkMjl5YkdRPQ==, + postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, phone_number: +15552223333 ) ``` diff --git a/docs/RbmActionOpenUrl.md b/docs/RbmActionOpenUrl.md index d7237526..bf52493e 100644 --- a/docs/RbmActionOpenUrl.md +++ b/docs/RbmActionOpenUrl.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **post_back_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | | **url** | **String** | The URL to open in browser. | | ## Example @@ -17,7 +17,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionOpenUrl.new( type: null, text: Hello world, - post_back_data: U0dWc2JHOGdkMjl5YkdRPQ==, + postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, url: https://dev.bandwidth.com ) ``` diff --git a/docs/RbmActionViewLocation.md b/docs/RbmActionViewLocation.md index 36ab6da9..e6239613 100644 --- a/docs/RbmActionViewLocation.md +++ b/docs/RbmActionViewLocation.md @@ -6,7 +6,7 @@ | ---- | ---- | ----------- | ----- | | **type** | [**RbmActionTypeEnum**](RbmActionTypeEnum.md) | | | | **text** | **String** | Displayed text for user to click | | -| **post_back_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | +| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | | | **latitude** | **Float** | The latitude of the location. | | | **longitude** | **Float** | The longitude of the location. | | | **label** | **String** | The label of the location. | [optional] | @@ -19,7 +19,7 @@ require 'bandwidth-sdk' instance = Bandwidth::RbmActionViewLocation.new( type: null, text: Hello world, - post_back_data: U0dWc2JHOGdkMjl5YkdRPQ==, + postback_data: U0dWc2JHOGdkMjl5YkdRPQ==, latitude: 37.7749, longitude: -122.4194, label: San Francisco diff --git a/docs/RbmLocationResponse.md b/docs/RbmLocationResponse.md new file mode 100644 index 00000000..f5c13b70 --- /dev/null +++ b/docs/RbmLocationResponse.md @@ -0,0 +1,20 @@ +# Bandwidth::RbmLocationResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **latitude** | **Float** | The latitude of the client's location. | [optional] | +| **longitude** | **Float** | The longitude of the client's location. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::RbmLocationResponse.new( + latitude: 37.7749, + longitude: -122.4194 +) +``` + diff --git a/docs/RbmSuggestionResponse.md b/docs/RbmSuggestionResponse.md new file mode 100644 index 00000000..96842d90 --- /dev/null +++ b/docs/RbmSuggestionResponse.md @@ -0,0 +1,20 @@ +# Bandwidth::RbmSuggestionResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | The text associated with the suggestion response. | [optional] | +| **postback_data** | **String** | Base64 payload the customer receives when the reply is clicked. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::RbmSuggestionResponse.new( + text: Yes, I would like to proceed, + postback_data: [B@2c6aa46c +) +``` + diff --git a/docs/StatusCallback.md b/docs/StatusCallback.md new file mode 100644 index 00000000..9de1c748 --- /dev/null +++ b/docs/StatusCallback.md @@ -0,0 +1,32 @@ +# Bandwidth::StatusCallback + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **time** | **Time** | | | +| **event_time** | **Time** | Represents the time at which the message was read, for `message-read` callbacks. | [optional] | +| **type** | [**StatusCallbackTypeEnum**](StatusCallbackTypeEnum.md) | | | +| **to** | **String** | The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. | | +| **description** | **String** | A detailed description of the event described by the callback. | | +| **message** | [**StatusCallbackMessage**](StatusCallbackMessage.md) | | | +| **error_code** | **Integer** | Optional error code, applicable only when type is `message-failed`. | [optional] | +| **carrier_name** | **String** | The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::StatusCallback.new( + time: 2024-12-02T20:15:57.278Z, + event_time: 2024-12-02T20:15:58.278Z, + type: null, + to: +15552223333, + description: Message delivered to carrier., + message: null, + error_code: 4405, + carrier_name: AT&T +) +``` + diff --git a/docs/StatusCallbackMessage.md b/docs/StatusCallbackMessage.md new file mode 100644 index 00000000..f425b51c --- /dev/null +++ b/docs/StatusCallbackMessage.md @@ -0,0 +1,42 @@ +# Bandwidth::StatusCallbackMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A unique identifier of the message. | | +| **owner** | **String** | The Bandwidth phone number or alphanumeric identifier associated with the message. | | +| **application_id** | **String** | The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. | | +| **time** | **Time** | | | +| **segment_count** | **Integer** | The number of segments the user's message is broken into before sending over carrier networks. | | +| **direction** | [**MessageDirectionEnum**](MessageDirectionEnum.md) | | | +| **to** | **Array<String>** | The phone number recipients of the message. | | +| **from** | **String** | The Bandwidth phone number or alphanumeric identifier the message was sent from. | | +| **text** | **String** | | [optional] | +| **tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | +| **media** | **Array<String>** | Optional media, not applicable for sms | [optional] | +| **priority** | [**PriorityEnum**](PriorityEnum.md) | | [optional] | +| **channel** | [**MultiChannelMessageChannelEnum**](MultiChannelMessageChannelEnum.md) | | [optional] | + +## Example + +```ruby +require 'bandwidth-sdk' + +instance = Bandwidth::StatusCallbackMessage.new( + id: 1661365814859loidf7mcwd4qacn7, + owner: +15553332222, + application_id: 93de2206-9669-4e07-948d-329f4b722ee2, + time: 2024-12-02T20:15:57.666Z, + segment_count: 1, + direction: null, + to: ["+15552223333"], + from: +15553332222, + text: Hello world, + tag: custom string, + media: ["https://dev.bandwidth.com/images/bandwidth-logo.png","https://dev.bandwidth.com/images/github_logo.png"], + priority: null, + channel: null +) +``` + diff --git a/docs/CallbackTypeEnum.md b/docs/StatusCallbackTypeEnum.md similarity index 62% rename from docs/CallbackTypeEnum.md rename to docs/StatusCallbackTypeEnum.md index 472c1314..35358345 100644 --- a/docs/CallbackTypeEnum.md +++ b/docs/StatusCallbackTypeEnum.md @@ -1,4 +1,4 @@ -# Bandwidth::CallbackTypeEnum +# Bandwidth::StatusCallbackTypeEnum ## Properties @@ -10,6 +10,6 @@ ```ruby require 'bandwidth-sdk' -instance = Bandwidth::CallbackTypeEnum.new() +instance = Bandwidth::StatusCallbackTypeEnum.new() ``` diff --git a/docs/Tag.md b/docs/Tag.md deleted file mode 100644 index 0c2a8756..00000000 --- a/docs/Tag.md +++ /dev/null @@ -1,20 +0,0 @@ -# Bandwidth::Tag - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **key** | **String** | | [optional] | -| **value** | **String** | | [optional] | - -## Example - -```ruby -require 'bandwidth-sdk' - -instance = Bandwidth::Tag.new( - key: null, - value: null -) -``` - diff --git a/docs/TollFreeVerificationApi.md b/docs/TollFreeVerificationApi.md index e509e9f1..54908a44 100644 --- a/docs/TollFreeVerificationApi.md +++ b/docs/TollFreeVerificationApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | | ------ | ------------ | ----------- | | [**create_webhook_subscription**](TollFreeVerificationApi.md#create_webhook_subscription) | **POST** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions | Create Webhook Subscription | +| [**delete_verification_request**](TollFreeVerificationApi.md#delete_verification_request) | **DELETE** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Delete a Toll-Free Verification Submission | | [**delete_webhook_subscription**](TollFreeVerificationApi.md#delete_webhook_subscription) | **DELETE** /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id} | Delete Webhook Subscription | | [**get_toll_free_verification_status**](TollFreeVerificationApi.md#get_toll_free_verification_status) | **GET** /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification | Get Toll-Free Verification Status | | [**list_toll_free_use_cases**](TollFreeVerificationApi.md#list_toll_free_use_cases) | **GET** /tollFreeVerification/useCases | List Toll-Free Use Cases | @@ -86,6 +87,77 @@ end - **Accept**: application/json +## delete_verification_request + +> delete_verification_request(account_id, phone_number) + +Delete a Toll-Free Verification Submission + +Delete a toll-free verification submission for a toll-free number. + +### 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::TollFreeVerificationApi.new +account_id = '9900000' # String | Your Bandwidth Account ID. +phone_number = '+18885555555' # String | Valid Toll-Free telephone number in E.164 format. + +begin + # Delete a Toll-Free Verification Submission + api_instance.delete_verification_request(account_id, phone_number) +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->delete_verification_request: #{e}" +end +``` + +#### Using the delete_verification_request_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> delete_verification_request_with_http_info(account_id, phone_number) + +```ruby +begin + # Delete a Toll-Free Verification Submission + data, status_code, headers = api_instance.delete_verification_request_with_http_info(account_id, phone_number) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue Bandwidth::ApiError => e + puts "Error when calling TollFreeVerificationApi->delete_verification_request_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | Your Bandwidth Account ID. | | +| **phone_number** | **String** | Valid Toll-Free telephone number in E.164 format. | | + +### Return type + +nil (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## delete_webhook_subscription > delete_webhook_subscription(account_id, id) diff --git a/lib/bandwidth-sdk.rb b/lib/bandwidth-sdk.rb index 74ee0dda..a0f6136c 100644 --- a/lib/bandwidth-sdk.rb +++ b/lib/bandwidth-sdk.rb @@ -33,8 +33,8 @@ require 'bandwidth-sdk/models/call_transcription_metadata' require 'bandwidth-sdk/models/call_transcription_response' require 'bandwidth-sdk/models/call_transcription_track_enum' +require 'bandwidth-sdk/models/callback' require 'bandwidth-sdk/models/callback_method_enum' -require 'bandwidth-sdk/models/callback_type_enum' require 'bandwidth-sdk/models/card_width_enum' require 'bandwidth-sdk/models/code_request' require 'bandwidth-sdk/models/conference' @@ -53,16 +53,19 @@ 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/deferred_result' require 'bandwidth-sdk/models/disconnect_callback' require 'bandwidth-sdk/models/diversion' require 'bandwidth-sdk/models/dtmf_callback' require 'bandwidth-sdk/models/error' require 'bandwidth-sdk/models/error_object' +require 'bandwidth-sdk/models/error_source' require 'bandwidth-sdk/models/failure_webhook' require 'bandwidth-sdk/models/field_error' require 'bandwidth-sdk/models/file_format_enum' require 'bandwidth-sdk/models/gather_callback' +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/link' require 'bandwidth-sdk/models/links_object' @@ -78,8 +81,6 @@ require 'bandwidth-sdk/models/machine_detection_result' require 'bandwidth-sdk/models/media' require 'bandwidth-sdk/models/message' -require 'bandwidth-sdk/models/message_callback' -require 'bandwidth-sdk/models/message_callback_message' require 'bandwidth-sdk/models/message_direction_enum' require 'bandwidth-sdk/models/message_request' require 'bandwidth-sdk/models/message_status_enum' @@ -91,17 +92,17 @@ require 'bandwidth-sdk/models/mfa_request_error' require 'bandwidth-sdk/models/mfa_unauthorized_request_error' require 'bandwidth-sdk/models/mms_message_content' +require 'bandwidth-sdk/models/mms_message_content_file' require 'bandwidth-sdk/models/multi_channel_action' require 'bandwidth-sdk/models/multi_channel_action_calendar_event' -require 'bandwidth-sdk/models/multi_channel_callback_data' require 'bandwidth-sdk/models/multi_channel_channel_list_object' require 'bandwidth-sdk/models/multi_channel_channel_list_object_content' -require 'bandwidth-sdk/models/multi_channel_message_callback_data' +require 'bandwidth-sdk/models/multi_channel_error' require 'bandwidth-sdk/models/multi_channel_message_channel_enum' -require 'bandwidth-sdk/models/multi_channel_message_data' -require 'bandwidth-sdk/models/multi_channel_message_direction_enum' +require 'bandwidth-sdk/models/multi_channel_message_content' require 'bandwidth-sdk/models/multi_channel_message_request' -require 'bandwidth-sdk/models/multi_channel_status_enum' +require 'bandwidth-sdk/models/multi_channel_message_response_data' +require 'bandwidth-sdk/models/multi_channel_message_response_data_channel_list_inner' require 'bandwidth-sdk/models/opt_in_workflow' require 'bandwidth-sdk/models/page_info' require 'bandwidth-sdk/models/priority_enum' @@ -112,6 +113,7 @@ require 'bandwidth-sdk/models/rbm_action_view_location' require 'bandwidth-sdk/models/rbm_card_content' require 'bandwidth-sdk/models/rbm_card_content_media' +require 'bandwidth-sdk/models/rbm_location_response' require 'bandwidth-sdk/models/rbm_media_height_enum' require 'bandwidth-sdk/models/rbm_message_carousel_card' require 'bandwidth-sdk/models/rbm_message_content_file' @@ -119,6 +121,7 @@ require 'bandwidth-sdk/models/rbm_message_content_text' require 'bandwidth-sdk/models/rbm_message_media' require 'bandwidth-sdk/models/rbm_standalone_card' +require 'bandwidth-sdk/models/rbm_suggestion_response' require 'bandwidth-sdk/models/recording_available_callback' require 'bandwidth-sdk/models/recording_complete_callback' require 'bandwidth-sdk/models/recording_state_enum' @@ -128,6 +131,9 @@ require 'bandwidth-sdk/models/redirect_method_enum' require 'bandwidth-sdk/models/sms_message_content' require 'bandwidth-sdk/models/standalone_card_orientation_enum' +require 'bandwidth-sdk/models/status_callback' +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/telephone_number' require 'bandwidth-sdk/models/tfv_basic_authentication' diff --git a/lib/bandwidth-sdk/api/toll_free_verification_api.rb b/lib/bandwidth-sdk/api/toll_free_verification_api.rb index c72a7d8f..5940f24a 100644 --- a/lib/bandwidth-sdk/api/toll_free_verification_api.rb +++ b/lib/bandwidth-sdk/api/toll_free_verification_api.rb @@ -93,6 +93,88 @@ def create_webhook_subscription_with_http_info(account_id, webhook_subscription_ return data, status_code, headers end + # Delete a Toll-Free Verification Submission + # Delete a toll-free verification submission for a toll-free number. + # @param account_id [String] Your Bandwidth Account ID. + # @param phone_number [String] Valid Toll-Free telephone number in E.164 format. + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_verification_request(account_id, phone_number, opts = {}) + delete_verification_request_with_http_info(account_id, phone_number, opts) + nil + end + + # Delete a Toll-Free Verification Submission + # Delete a toll-free verification submission for a toll-free number. + # @param account_id [String] Your Bandwidth Account ID. + # @param phone_number [String] Valid Toll-Free telephone number in E.164 format. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_verification_request_with_http_info(account_id, phone_number, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TollFreeVerificationApi.delete_verification_request ...' + 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 TollFreeVerificationApi.delete_verification_request" + end + # verify the required parameter 'phone_number' is set + if @api_client.config.client_side_validation && phone_number.nil? + fail ArgumentError, "Missing the required parameter 'phone_number' when calling TollFreeVerificationApi.delete_verification_request" + end + if @api_client.config.client_side_validation && phone_number.to_s.length > 12 + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be smaller than or equal to 12.' + end + + if @api_client.config.client_side_validation && phone_number.to_s.length < 12 + fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be great than or equal to 12.' + end + + pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/) + if @api_client.config.client_side_validation && phone_number !~ pattern + fail ArgumentError, "invalid value for 'phone_number' when calling TollFreeVerificationApi.delete_verification_request, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'phoneNumber' + '}', CGI.escape(phone_number.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'] + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Basic'] + + new_options = opts.merge( + :operation => :"TollFreeVerificationApi.delete_verification_request", + :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(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TollFreeVerificationApi#delete_verification_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete Webhook Subscription # Delete a webhook subscription by ID. # @param account_id [String] Your Bandwidth Account ID. diff --git a/lib/bandwidth-sdk/configuration.rb b/lib/bandwidth-sdk/configuration.rb index bb2175f9..a576b582 100644 --- a/lib/bandwidth-sdk/configuration.rb +++ b/lib/bandwidth-sdk/configuration.rb @@ -498,6 +498,12 @@ def operation_server_settings description: "Production", } ], + "TollFreeVerificationApi.delete_verification_request": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], "TollFreeVerificationApi.delete_webhook_subscription": [ { url: "https://api.bandwidth.com/api/v2", diff --git a/lib/bandwidth-sdk/models/callback.rb b/lib/bandwidth-sdk/models/callback.rb new file mode 100644 index 00000000..f1e78463 --- /dev/null +++ b/lib/bandwidth-sdk/models/callback.rb @@ -0,0 +1,60 @@ +=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 + # Callbacks are divided into two types based on direction of the related message: - `statusCallback` indicates status of an outbound MT SMS, MMS, or RBM message. - `inboundCallback` indicates an inbound MO message or a multichannel message client's response to a suggestion or location request. + module Callback + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'InboundCallback', + :'StatusCallback' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'type' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'message-delivered' => :'StatusCallback', + :'message-failed' => :'StatusCallback', + :'message-read' => :'StatusCallback', + :'message-received' => :'InboundCallback', + :'message-sent' => :'StatusCallback', + :'request-location-response' => :'InboundCallback', + :'suggestion-response' => :'InboundCallback' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Bandwidth.const_get(klass).build_from_hash(data) + end + end + end +end diff --git a/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb b/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb index 94b3bc7e..7fea85ab 100644 --- a/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +++ b/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb @@ -39,7 +39,7 @@ def self.acceptable_attributes def self.openapi_types { :'links' => :'Array', - :'data' => :'MultiChannelMessageData', + :'data' => :'MultiChannelMessageResponseData', :'errors' => :'Array' } end diff --git a/lib/bandwidth-sdk/models/error_object.rb b/lib/bandwidth-sdk/models/error_object.rb index 62608d06..b4445297 100644 --- a/lib/bandwidth-sdk/models/error_object.rb +++ b/lib/bandwidth-sdk/models/error_object.rb @@ -15,15 +15,20 @@ module Bandwidth class ErrorObject - attr_accessor :code + # A concise summary of the error used for categorization. + attr_accessor :type - attr_accessor :message + # A detailed explanation of the error. + attr_accessor :description + + attr_accessor :source # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'code' => :'code', - :'message' => :'message' + :'type' => :'type', + :'description' => :'description', + :'source' => :'source' } end @@ -35,8 +40,9 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'code' => :'String', - :'message' => :'String' + :'type' => :'String', + :'description' => :'String', + :'source' => :'ErrorSource' } end @@ -61,12 +67,22 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'code') - self.code = attributes[:'code'] + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + else + self.description = nil end - if attributes.key?(:'message') - self.message = attributes[:'message'] + if attributes.key?(:'source') + self.source = attributes[:'source'] + else + self.source = nil end end @@ -75,6 +91,18 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @source.nil? + invalid_properties.push('invalid value for "source", source cannot be nil.') + end + invalid_properties end @@ -82,6 +110,9 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + return false if @description.nil? + return false if @source.nil? true end @@ -90,8 +121,9 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - code == o.code && - message == o.message + type == o.type && + description == o.description && + source == o.source end # @see the `==` method @@ -103,7 +135,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [code, message].hash + [type, description, source].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/error_source.rb b/lib/bandwidth-sdk/models/error_source.rb new file mode 100644 index 00000000..d54fcd89 --- /dev/null +++ b/lib/bandwidth-sdk/models/error_source.rb @@ -0,0 +1,244 @@ +=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 + # Specifies relevant sources of the error, if any. + class ErrorSource + # The relevant URI query parameter causing the error + attr_accessor :parameter + + # The request body field that led to the error + attr_accessor :field + + # The header field that contributed to the error + attr_accessor :header + + # A resource ID or path linked to the error + attr_accessor :reference + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'parameter' => :'parameter', + :'field' => :'field', + :'header' => :'header', + :'reference' => :'reference' + } + 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 + { + :'parameter' => :'String', + :'field' => :'String', + :'header' => :'String', + :'reference' => :'String' + } + 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::ErrorSource` 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::ErrorSource`. 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?(:'parameter') + self.parameter = attributes[:'parameter'] + end + + if attributes.key?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'header') + self.header = attributes[:'header'] + end + + if attributes.key?(:'reference') + self.reference = attributes[:'reference'] + 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 && + parameter == o.parameter && + field == o.field && + header == o.header && + reference == o.reference + 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 + [parameter, field, header, reference].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/message_callback.rb b/lib/bandwidth-sdk/models/inbound_callback.rb similarity index 91% rename from lib/bandwidth-sdk/models/message_callback.rb rename to lib/bandwidth-sdk/models/inbound_callback.rb index cf728857..94d914a2 100644 --- a/lib/bandwidth-sdk/models/message_callback.rb +++ b/lib/bandwidth-sdk/models/inbound_callback.rb @@ -14,12 +14,13 @@ require 'time' module Bandwidth - # Message Callback Schema - class MessageCallback + # Represents an inbound callback. + class InboundCallback attr_accessor :time attr_accessor :type + # The destination phone number the message was sent to. For inbound callbacks, this is the Bandwidth number or alphanumeric identifier that received the message. attr_accessor :to # A detailed description of the event described by the callback. @@ -27,10 +28,7 @@ class MessageCallback attr_accessor :message - # Optional error code, applicable only when type is `message-failed`. - attr_accessor :error_code - - # The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. + # The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. attr_accessor :carrier_name class EnumAttributeValidator @@ -63,7 +61,6 @@ def self.attribute_map :'to' => :'to', :'description' => :'description', :'message' => :'message', - :'error_code' => :'errorCode', :'carrier_name' => :'carrierName' } end @@ -77,11 +74,10 @@ def self.acceptable_attributes def self.openapi_types { :'time' => :'Time', - :'type' => :'CallbackTypeEnum', + :'type' => :'InboundCallbackTypeEnum', :'to' => :'String', :'description' => :'String', - :'message' => :'MessageCallbackMessage', - :'error_code' => :'Integer', + :'message' => :'InboundCallbackMessage', :'carrier_name' => :'String' } end @@ -89,8 +85,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'error_code', - :'carrier_name' ]) end @@ -98,13 +92,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::MessageCallback` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::InboundCallback` 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::MessageCallback`. 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::InboundCallback`. 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 } @@ -139,10 +133,6 @@ def initialize(attributes = {}) self.message = nil end - if attributes.key?(:'error_code') - self.error_code = attributes[:'error_code'] - end - if attributes.key?(:'carrier_name') self.carrier_name = attributes[:'carrier_name'] end @@ -198,7 +188,6 @@ def ==(o) to == o.to && description == o.description && message == o.message && - error_code == o.error_code && carrier_name == o.carrier_name end @@ -211,7 +200,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [time, type, to, description, message, error_code, carrier_name].hash + [time, type, to, description, message, carrier_name].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/inbound_callback_message.rb b/lib/bandwidth-sdk/models/inbound_callback_message.rb new file mode 100644 index 00000000..933622b4 --- /dev/null +++ b/lib/bandwidth-sdk/models/inbound_callback_message.rb @@ -0,0 +1,454 @@ +=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 InboundCallbackMessage + # A unique identifier of the message. + attr_accessor :id + + # The Bandwidth phone number or alphanumeric identifier associated with the message. + attr_accessor :owner + + # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. + attr_accessor :application_id + + attr_accessor :time + + # The number of segments the user's message is broken into before sending over carrier networks. + attr_accessor :segment_count + + attr_accessor :direction + + # The phone number recipients of the message. + attr_accessor :to + + # The Bandwidth phone number or alphanumeric identifier the message was sent from. + attr_accessor :from + + attr_accessor :text + + # A custom string that will be included in callback events of the message. Max 1024 characters. + attr_accessor :tag + + # Optional media, not applicable for sms + attr_accessor :media + + attr_accessor :priority + + attr_accessor :channel + + attr_accessor :content + + attr_accessor :suggestion_response + + attr_accessor :location_response + + 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 + { + :'id' => :'id', + :'owner' => :'owner', + :'application_id' => :'applicationId', + :'time' => :'time', + :'segment_count' => :'segmentCount', + :'direction' => :'direction', + :'to' => :'to', + :'from' => :'from', + :'text' => :'text', + :'tag' => :'tag', + :'media' => :'media', + :'priority' => :'priority', + :'channel' => :'channel', + :'content' => :'content', + :'suggestion_response' => :'suggestionResponse', + :'location_response' => :'locationResponse' + } + 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 + { + :'id' => :'String', + :'owner' => :'String', + :'application_id' => :'String', + :'time' => :'Time', + :'segment_count' => :'Integer', + :'direction' => :'MessageDirectionEnum', + :'to' => :'Array', + :'from' => :'String', + :'text' => :'String', + :'tag' => :'String', + :'media' => :'Array', + :'priority' => :'PriorityEnum', + :'channel' => :'MultiChannelMessageChannelEnum', + :'content' => :'MultiChannelMessageContent', + :'suggestion_response' => :'RbmSuggestionResponse', + :'location_response' => :'RbmLocationResponse' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'StatusCallbackMessage' + ] + 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::InboundCallbackMessage` 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::InboundCallbackMessage`. 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?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'owner') + self.owner = attributes[:'owner'] + else + self.owner = nil + end + + if attributes.key?(:'application_id') + self.application_id = attributes[:'application_id'] + else + self.application_id = nil + end + + if attributes.key?(:'time') + self.time = attributes[:'time'] + else + self.time = nil + end + + if attributes.key?(:'segment_count') + self.segment_count = attributes[:'segment_count'] + else + self.segment_count = nil + end + + if attributes.key?(:'direction') + self.direction = attributes[:'direction'] + else + self.direction = nil + end + + if attributes.key?(:'to') + if (value = attributes[:'to']).is_a?(Array) + self.to = value + end + else + self.to = nil + end + + if attributes.key?(:'from') + self.from = attributes[:'from'] + else + self.from = nil + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'tag') + self.tag = attributes[:'tag'] + end + + if attributes.key?(:'media') + if (value = attributes[:'media']).is_a?(Array) + self.media = value + end + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'suggestion_response') + self.suggestion_response = attributes[:'suggestion_response'] + end + + if attributes.key?(:'location_response') + self.location_response = attributes[:'location_response'] + 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 @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @owner.nil? + invalid_properties.push('invalid value for "owner", owner cannot be nil.') + end + + if @application_id.nil? + invalid_properties.push('invalid value for "application_id", application_id cannot be nil.') + end + + if @time.nil? + invalid_properties.push('invalid value for "time", time cannot be nil.') + end + + if @segment_count.nil? + invalid_properties.push('invalid value for "segment_count", segment_count cannot be nil.') + end + + if @direction.nil? + invalid_properties.push('invalid value for "direction", direction cannot be nil.') + end + + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + if @from.nil? + invalid_properties.push('invalid value for "from", from 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 @id.nil? + return false if @owner.nil? + return false if @application_id.nil? + return false if @time.nil? + return false if @segment_count.nil? + return false if @direction.nil? + return false if @to.nil? + return false if @from.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + @to = to + 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 && + id == o.id && + owner == o.owner && + application_id == o.application_id && + time == o.time && + segment_count == o.segment_count && + direction == o.direction && + to == o.to && + from == o.from && + text == o.text && + tag == o.tag && + media == o.media && + priority == o.priority && + channel == o.channel && + content == o.content && + suggestion_response == o.suggestion_response && + location_response == o.location_response + 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 + [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel, content, suggestion_response, location_response].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/multi_channel_status_enum.rb b/lib/bandwidth-sdk/models/inbound_callback_type_enum.rb similarity index 60% rename from lib/bandwidth-sdk/models/multi_channel_status_enum.rb rename to lib/bandwidth-sdk/models/inbound_callback_type_enum.rb index 59b26eb3..78721cea 100644 --- a/lib/bandwidth-sdk/models/multi_channel_status_enum.rb +++ b/lib/bandwidth-sdk/models/inbound_callback_type_enum.rb @@ -14,14 +14,13 @@ require 'time' module Bandwidth - class MultiChannelStatusEnum - QUEUED = 'QUEUED'.freeze - SENDING = 'SENDING'.freeze - DELIVERED = 'DELIVERED'.freeze - FAILED = 'FAILED'.freeze + class InboundCallbackTypeEnum + MESSAGE_RECEIVED = 'message-received'.freeze + REQUEST_LOCATION_RESPONSE = 'request-location-response'.freeze + SUGGESTION_RESPONSE = 'suggestion-response'.freeze def self.all_vars - @all_vars ||= [QUEUED, SENDING, DELIVERED, FAILED].freeze + @all_vars ||= [MESSAGE_RECEIVED, REQUEST_LOCATION_RESPONSE, SUGGESTION_RESPONSE].freeze end # Builds the enum from string @@ -35,8 +34,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 MultiChannelStatusEnum.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #MultiChannelStatusEnum" + return value if InboundCallbackTypeEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #InboundCallbackTypeEnum" end end end diff --git a/lib/bandwidth-sdk/models/list_message_item.rb b/lib/bandwidth-sdk/models/list_message_item.rb index 1a71f23b..43209cec 100644 --- a/lib/bandwidth-sdk/models/list_message_item.rb +++ b/lib/bandwidth-sdk/models/list_message_item.rb @@ -33,7 +33,7 @@ class ListMessageItem attr_accessor :message_type - # The number of segments the message was sent as. + # The number of segments the user's message is broken into before sending over carrier networks. attr_accessor :segment_count # The numeric error code of the message. diff --git a/lib/bandwidth-sdk/models/message.rb b/lib/bandwidth-sdk/models/message.rb index d2e5a6eb..288f81ff 100644 --- a/lib/bandwidth-sdk/models/message.rb +++ b/lib/bandwidth-sdk/models/message.rb @@ -21,13 +21,13 @@ class Message # The Bandwidth phone number associated with the message. attr_accessor :owner - # The application ID associated with the message. + # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. attr_accessor :application_id # The datetime stamp of the message in ISO 8601 attr_accessor :time - # The number of segments the original message from the user is broken into before sending over to carrier networks. + # The number of segments the user's message is broken into before sending over carrier networks. attr_accessor :segment_count attr_accessor :direction @@ -44,7 +44,7 @@ class Message # The contents of the message. attr_accessor :text - # The custom string set by the user. + # A custom string that will be included in callback events of the message. Max 1024 characters. attr_accessor :tag attr_accessor :priority diff --git a/lib/bandwidth-sdk/models/message_request.rb b/lib/bandwidth-sdk/models/message_request.rb index 76193911..6fdc3c6b 100644 --- a/lib/bandwidth-sdk/models/message_request.rb +++ b/lib/bandwidth-sdk/models/message_request.rb @@ -15,7 +15,7 @@ module Bandwidth class MessageRequest - # The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. + # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. attr_accessor :application_id # The phone number(s) the message should be sent to in E164 format. diff --git a/lib/bandwidth-sdk/models/mms_message_content.rb b/lib/bandwidth-sdk/models/mms_message_content.rb index 06860636..f66a7c40 100644 --- a/lib/bandwidth-sdk/models/mms_message_content.rb +++ b/lib/bandwidth-sdk/models/mms_message_content.rb @@ -18,7 +18,6 @@ class MmsMessageContent # The contents of the text message. Must be 2048 characters or less. attr_accessor :text - # A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. attr_accessor :media # Attribute mapping from ruby-style variable name to JSON key. @@ -38,7 +37,7 @@ def self.acceptable_attributes def self.openapi_types { :'text' => :'String', - :'media' => :'Array' + :'media' => :'Array' } end diff --git a/lib/bandwidth-sdk/models/multi_channel_message_callback_data.rb b/lib/bandwidth-sdk/models/mms_message_content_file.rb similarity index 66% rename from lib/bandwidth-sdk/models/multi_channel_message_callback_data.rb rename to lib/bandwidth-sdk/models/mms_message_content_file.rb index ed218bab..3b132260 100644 --- a/lib/bandwidth-sdk/models/multi_channel_message_callback_data.rb +++ b/lib/bandwidth-sdk/models/mms_message_content_file.rb @@ -14,61 +14,14 @@ require 'time' module Bandwidth - class MultiChannelMessageCallbackData - # The ID of the message. - attr_accessor :message_id - - attr_accessor :status - - attr_accessor :direction - - # The sender ID of the message. This could be an alphanumeric sender ID. - attr_accessor :from - - # The phone number the message should be sent to in E164 format. - attr_accessor :to - - # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. - attr_accessor :application_id - - attr_accessor :channel - - # A custom string that will be included in callback events of the message. Max 1024 characters. - attr_accessor :tag - - 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 + class MmsMessageContentFile + # The URL of a media attachment. For MMS, the API limits file size to 3.5MB. Specific carriers and channels may have a smaller limit that could cause a large file to fail, see [here](https://support.bandwidth.com/hc/en-us/articles/360014235473-What-are-the-MMS-file-size-limits) for more details. + attr_accessor :file_url # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'message_id' => :'messageId', - :'status' => :'status', - :'direction' => :'direction', - :'from' => :'from', - :'to' => :'to', - :'application_id' => :'applicationId', - :'channel' => :'channel', - :'tag' => :'tag' + :'file_url' => :'fileUrl' } end @@ -80,14 +33,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'message_id' => :'String', - :'status' => :'MultiChannelStatusEnum', - :'direction' => :'MultiChannelMessageDirectionEnum', - :'from' => :'String', - :'to' => :'String', - :'application_id' => :'String', - :'channel' => :'MultiChannelMessageChannelEnum', - :'tag' => :'String' + :'file_url' => :'String' } end @@ -101,47 +47,21 @@ 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::MultiChannelMessageCallbackData` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MmsMessageContentFile` 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::MultiChannelMessageCallbackData`. 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::MmsMessageContentFile`. 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?(:'message_id') - self.message_id = attributes[:'message_id'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'direction') - self.direction = attributes[:'direction'] - end - - if attributes.key?(:'from') - self.from = attributes[:'from'] - end - - if attributes.key?(:'to') - self.to = attributes[:'to'] - end - - if attributes.key?(:'application_id') - self.application_id = attributes[:'application_id'] - end - - if attributes.key?(:'channel') - self.channel = attributes[:'channel'] - end - - if attributes.key?(:'tag') - self.tag = attributes[:'tag'] + if attributes.key?(:'file_url') + self.file_url = attributes[:'file_url'] + else + self.file_url = nil end end @@ -150,6 +70,14 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if @file_url.nil? + invalid_properties.push('invalid value for "file_url", file_url cannot be nil.') + end + + if @file_url.to_s.length > 1000 + invalid_properties.push('invalid value for "file_url", the character length must be smaller than or equal to 1000.') + end + invalid_properties end @@ -157,22 +85,31 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @file_url.nil? + return false if @file_url.to_s.length > 1000 true end + # Custom attribute writer method with validation + # @param [Object] file_url Value to be assigned + def file_url=(file_url) + if file_url.nil? + fail ArgumentError, 'file_url cannot be nil' + end + + if file_url.to_s.length > 1000 + fail ArgumentError, 'invalid value for "file_url", the character length must be smaller than or equal to 1000.' + end + + @file_url = file_url + 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 && - message_id == o.message_id && - status == o.status && - direction == o.direction && - from == o.from && - to == o.to && - application_id == o.application_id && - channel == o.channel && - tag == o.tag + file_url == o.file_url end # @see the `==` method @@ -184,7 +121,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [message_id, status, direction, from, to, application_id, channel, tag].hash + [file_url].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb b/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb index 619000a0..02e9351b 100644 --- a/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +++ b/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb @@ -21,7 +21,7 @@ class MultiChannelActionCalendarEvent attr_accessor :text # Base64 payload the customer receives when the reply is clicked. - attr_accessor :post_back_data + attr_accessor :postback_data # The title of the event. attr_accessor :title @@ -62,7 +62,7 @@ def self.attribute_map { :'type' => :'type', :'text' => :'text', - :'post_back_data' => :'postBackData', + :'postback_data' => :'postbackData', :'title' => :'title', :'start_time' => :'startTime', :'end_time' => :'endTime', @@ -80,7 +80,7 @@ def self.openapi_types { :'type' => :'RbmActionTypeEnum', :'text' => :'String', - :'post_back_data' => :'String', + :'postback_data' => :'String', :'title' => :'String', :'start_time' => :'Time', :'end_time' => :'Time', @@ -128,10 +128,10 @@ def initialize(attributes = {}) self.text = nil end - if attributes.key?(:'post_back_data') - self.post_back_data = attributes[:'post_back_data'] + if attributes.key?(:'postback_data') + self.postback_data = attributes[:'postback_data'] else - self.post_back_data = nil + self.postback_data = nil end if attributes.key?(:'title') @@ -174,12 +174,12 @@ def list_invalid_properties invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.') end - if @post_back_data.nil? - invalid_properties.push('invalid value for "post_back_data", post_back_data cannot be nil.') + if @postback_data.nil? + invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.') end - if @post_back_data.to_s.length > 2048 - invalid_properties.push('invalid value for "post_back_data", the character length must be smaller than or equal to 2048.') + if @postback_data.to_s.length > 2048 + invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.') end if @title.nil? @@ -212,8 +212,8 @@ def valid? return false if @type.nil? return false if @text.nil? return false if @text.to_s.length > 25 - return false if @post_back_data.nil? - return false if @post_back_data.to_s.length > 2048 + return false if @postback_data.nil? + return false if @postback_data.to_s.length > 2048 return false if @title.nil? return false if @title.to_s.length > 100 return false if @start_time.nil? @@ -237,17 +237,17 @@ def text=(text) end # Custom attribute writer method with validation - # @param [Object] post_back_data Value to be assigned - def post_back_data=(post_back_data) - if post_back_data.nil? - fail ArgumentError, 'post_back_data cannot be nil' + # @param [Object] postback_data Value to be assigned + def postback_data=(postback_data) + if postback_data.nil? + fail ArgumentError, 'postback_data cannot be nil' end - if post_back_data.to_s.length > 2048 - fail ArgumentError, 'invalid value for "post_back_data", the character length must be smaller than or equal to 2048.' + if postback_data.to_s.length > 2048 + fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.' end - @post_back_data = post_back_data + @postback_data = postback_data end # Custom attribute writer method with validation @@ -285,7 +285,7 @@ def ==(o) self.class == o.class && type == o.type && text == o.text && - post_back_data == o.post_back_data && + postback_data == o.postback_data && title == o.title && start_time == o.start_time && end_time == o.end_time && @@ -301,7 +301,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, text, post_back_data, title, start_time, end_time, description].hash + [type, text, postback_data, title, start_time, end_time, description].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/multi_channel_error.rb b/lib/bandwidth-sdk/models/multi_channel_error.rb new file mode 100644 index 00000000..051d2a11 --- /dev/null +++ b/lib/bandwidth-sdk/models/multi_channel_error.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 MultiChannelError + 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' => :'Object', + :'errors' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'data', + ]) + 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::MultiChannelError` 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::MultiChannelError`. 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/deferred_result.rb b/lib/bandwidth-sdk/models/multi_channel_message_content.rb similarity index 88% rename from lib/bandwidth-sdk/models/deferred_result.rb rename to lib/bandwidth-sdk/models/multi_channel_message_content.rb index 36c425f7..9a2f4e31 100644 --- a/lib/bandwidth-sdk/models/deferred_result.rb +++ b/lib/bandwidth-sdk/models/multi_channel_message_content.rb @@ -14,16 +14,17 @@ require 'time' module Bandwidth - class DeferredResult - attr_accessor :result + # The structure of the content field of a multichannel message. + class MultiChannelMessageContent + attr_accessor :text - attr_accessor :set_or_expired + attr_accessor :media # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'result' => :'result', - :'set_or_expired' => :'setOrExpired' + :'text' => :'text', + :'media' => :'media' } end @@ -35,8 +36,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'result' => :'Object', - :'set_or_expired' => :'Boolean' + :'text' => :'String', + :'media' => :'RbmMessageContentFile' } end @@ -50,23 +51,23 @@ 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::DeferredResult` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageContent` 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::DeferredResult`. 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::MultiChannelMessageContent`. 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?(:'result') - self.result = attributes[:'result'] + if attributes.key?(:'text') + self.text = attributes[:'text'] end - if attributes.key?(:'set_or_expired') - self.set_or_expired = attributes[:'set_or_expired'] + if attributes.key?(:'media') + self.media = attributes[:'media'] end end @@ -90,8 +91,8 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - result == o.result && - set_or_expired == o.set_or_expired + text == o.text && + media == o.media end # @see the `==` method @@ -103,7 +104,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [result, set_or_expired].hash + [text, media].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/multi_channel_message_direction_enum.rb b/lib/bandwidth-sdk/models/multi_channel_message_direction_enum.rb deleted file mode 100644 index e1c5de1e..00000000 --- a/lib/bandwidth-sdk/models/multi_channel_message_direction_enum.rb +++ /dev/null @@ -1,40 +0,0 @@ -=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 MultiChannelMessageDirectionEnum - INBOUND = 'INBOUND'.freeze - OUTBOUND = 'OUTBOUND'.freeze - - def self.all_vars - @all_vars ||= [INBOUND, OUTBOUND].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 MultiChannelMessageDirectionEnum.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #MultiChannelMessageDirectionEnum" - end - end -end diff --git a/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb b/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb new file mode 100644 index 00000000..d6f2101a --- /dev/null +++ b/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb @@ -0,0 +1,372 @@ +=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 data returned in a multichannel message response. + class MultiChannelMessageResponseData + # The ID of the message. + attr_accessor :message_id + + # The time the message was received by the Bandwidth API. + attr_accessor :time + + attr_accessor :direction + + # The destination phone number(s) of the message, in E164 format. + attr_accessor :to + + # A list of message bodies. The messages will be attempted in the order they are listed. Once a message sends successfully, the others will be ignored. + attr_accessor :channel_list + + # A custom string that will be included in callback events of the message. Max 1024 characters. + attr_accessor :tag + + attr_accessor :priority + + # A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. + attr_accessor :expiration + + 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 + { + :'message_id' => :'messageId', + :'time' => :'time', + :'direction' => :'direction', + :'to' => :'to', + :'channel_list' => :'channelList', + :'tag' => :'tag', + :'priority' => :'priority', + :'expiration' => :'expiration' + } + 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 + { + :'message_id' => :'String', + :'time' => :'Time', + :'direction' => :'MessageDirectionEnum', + :'to' => :'Array', + :'channel_list' => :'Array', + :'tag' => :'String', + :'priority' => :'PriorityEnum', + :'expiration' => :'Time' + } + 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::MultiChannelMessageResponseData` 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::MultiChannelMessageResponseData`. 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?(:'message_id') + self.message_id = attributes[:'message_id'] + else + self.message_id = nil + end + + if attributes.key?(:'time') + self.time = attributes[:'time'] + else + self.time = nil + end + + if attributes.key?(:'direction') + self.direction = attributes[:'direction'] + else + self.direction = nil + end + + if attributes.key?(:'to') + if (value = attributes[:'to']).is_a?(Array) + self.to = value + end + else + self.to = nil + end + + if attributes.key?(:'channel_list') + if (value = attributes[:'channel_list']).is_a?(Array) + self.channel_list = value + end + else + self.channel_list = nil + end + + if attributes.key?(:'tag') + self.tag = attributes[:'tag'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'expiration') + self.expiration = attributes[:'expiration'] + 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 @message_id.nil? + invalid_properties.push('invalid value for "message_id", message_id cannot be nil.') + end + + if @time.nil? + invalid_properties.push('invalid value for "time", time cannot be nil.') + end + + if @direction.nil? + invalid_properties.push('invalid value for "direction", direction cannot be nil.') + end + + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + if @channel_list.nil? + invalid_properties.push('invalid value for "channel_list", channel_list cannot be nil.') + end + + if @channel_list.length > 4 + invalid_properties.push('invalid value for "channel_list", number of items must be less than or equal to 4.') + 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 @message_id.nil? + return false if @time.nil? + return false if @direction.nil? + return false if @to.nil? + return false if @channel_list.nil? + return false if @channel_list.length > 4 + true + end + + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + @to = to + end + + # Custom attribute writer method with validation + # @param [Object] channel_list Value to be assigned + def channel_list=(channel_list) + if channel_list.nil? + fail ArgumentError, 'channel_list cannot be nil' + end + + if channel_list.length > 4 + fail ArgumentError, 'invalid value for "channel_list", number of items must be less than or equal to 4.' + end + + @channel_list = channel_list + 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 && + message_id == o.message_id && + time == o.time && + direction == o.direction && + to == o.to && + channel_list == o.channel_list && + tag == o.tag && + priority == o.priority && + expiration == o.expiration + 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 + [message_id, time, direction, to, channel_list, tag, priority, expiration].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/multi_channel_message_data.rb b/lib/bandwidth-sdk/models/multi_channel_message_response_data_channel_list_inner.rb similarity index 78% rename from lib/bandwidth-sdk/models/multi_channel_message_data.rb rename to lib/bandwidth-sdk/models/multi_channel_message_response_data_channel_list_inner.rb index 379d5f84..743727ce 100644 --- a/lib/bandwidth-sdk/models/multi_channel_message_data.rb +++ b/lib/bandwidth-sdk/models/multi_channel_message_response_data_channel_list_inner.rb @@ -14,30 +14,19 @@ require 'time' module Bandwidth - class MultiChannelMessageData - # The ID of the message. - attr_accessor :message_id - - attr_accessor :status - - # The time the message was received by the Bandwidth API. - attr_accessor :time - - attr_accessor :direction - + class MultiChannelMessageResponseDataChannelListInner # The sender ID of the message. This could be an alphanumeric sender ID. attr_accessor :from - # The phone number the message should be sent to in E164 format. - attr_accessor :to - # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. attr_accessor :application_id attr_accessor :channel - # A custom string that will be included in callback events of the message. Max 1024 characters. - attr_accessor :tag + attr_accessor :content + + # The Bandwidth senderId associated with the message. Identical to 'from'. + attr_accessor :owner class EnumAttributeValidator attr_reader :datatype @@ -64,15 +53,11 @@ def valid?(value) # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'message_id' => :'messageId', - :'status' => :'status', - :'time' => :'time', - :'direction' => :'direction', :'from' => :'from', - :'to' => :'to', :'application_id' => :'applicationId', :'channel' => :'channel', - :'tag' => :'tag' + :'content' => :'content', + :'owner' => :'owner' } end @@ -84,15 +69,11 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'message_id' => :'String', - :'status' => :'MultiChannelStatusEnum', - :'time' => :'Time', - :'direction' => :'MultiChannelMessageDirectionEnum', :'from' => :'String', - :'to' => :'String', :'application_id' => :'String', :'channel' => :'MultiChannelMessageChannelEnum', - :'tag' => :'String' + :'content' => :'MultiChannelChannelListObjectContent', + :'owner' => :'String' } end @@ -102,55 +83,56 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MultiChannelChannelListObject' + ] + 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::MultiChannelMessageData` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelMessageResponseDataChannelListInner` 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::MultiChannelMessageData`. 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::MultiChannelMessageResponseDataChannelListInner`. 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?(:'message_id') - self.message_id = attributes[:'message_id'] - end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'time') - self.time = attributes[:'time'] - end - - if attributes.key?(:'direction') - self.direction = attributes[:'direction'] - end - if attributes.key?(:'from') self.from = attributes[:'from'] - end - - if attributes.key?(:'to') - self.to = attributes[:'to'] + else + self.from = nil end if attributes.key?(:'application_id') self.application_id = attributes[:'application_id'] + else + self.application_id = nil end if attributes.key?(:'channel') self.channel = attributes[:'channel'] + else + self.channel = nil end - if attributes.key?(:'tag') - self.tag = attributes[:'tag'] + if attributes.key?(:'content') + self.content = attributes[:'content'] + else + self.content = nil + end + + if attributes.key?(:'owner') + self.owner = attributes[:'owner'] + else + self.owner = nil end end @@ -159,6 +141,26 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if @from.nil? + invalid_properties.push('invalid value for "from", from cannot be nil.') + end + + if @application_id.nil? + invalid_properties.push('invalid value for "application_id", application_id cannot be nil.') + end + + if @channel.nil? + invalid_properties.push('invalid value for "channel", channel cannot be nil.') + end + + if @content.nil? + invalid_properties.push('invalid value for "content", content cannot be nil.') + end + + if @owner.nil? + invalid_properties.push('invalid value for "owner", owner cannot be nil.') + end + invalid_properties end @@ -166,6 +168,11 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @from.nil? + return false if @application_id.nil? + return false if @channel.nil? + return false if @content.nil? + return false if @owner.nil? true end @@ -174,15 +181,11 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - message_id == o.message_id && - status == o.status && - time == o.time && - direction == o.direction && from == o.from && - to == o.to && application_id == o.application_id && channel == o.channel && - tag == o.tag + content == o.content && + owner == o.owner end # @see the `==` method @@ -194,7 +197,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [message_id, status, time, direction, from, to, application_id, channel, tag].hash + [from, application_id, channel, content, owner].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/rbm_action_base.rb b/lib/bandwidth-sdk/models/rbm_action_base.rb index 43fcbbf9..2fdf7d30 100644 --- a/lib/bandwidth-sdk/models/rbm_action_base.rb +++ b/lib/bandwidth-sdk/models/rbm_action_base.rb @@ -21,7 +21,7 @@ class RbmActionBase attr_accessor :text # Base64 payload the customer receives when the reply is clicked. - attr_accessor :post_back_data + attr_accessor :postback_data class EnumAttributeValidator attr_reader :datatype @@ -50,7 +50,7 @@ def self.attribute_map { :'type' => :'type', :'text' => :'text', - :'post_back_data' => :'postBackData' + :'postback_data' => :'postbackData' } end @@ -64,7 +64,7 @@ def self.openapi_types { :'type' => :'RbmActionTypeEnum', :'text' => :'String', - :'post_back_data' => :'String' + :'postback_data' => :'String' } end @@ -101,10 +101,10 @@ def initialize(attributes = {}) self.text = nil end - if attributes.key?(:'post_back_data') - self.post_back_data = attributes[:'post_back_data'] + if attributes.key?(:'postback_data') + self.postback_data = attributes[:'postback_data'] else - self.post_back_data = nil + self.postback_data = nil end end @@ -125,12 +125,12 @@ def list_invalid_properties invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.') end - if @post_back_data.nil? - invalid_properties.push('invalid value for "post_back_data", post_back_data cannot be nil.') + if @postback_data.nil? + invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.') end - if @post_back_data.to_s.length > 2048 - invalid_properties.push('invalid value for "post_back_data", the character length must be smaller than or equal to 2048.') + if @postback_data.to_s.length > 2048 + invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.') end invalid_properties @@ -143,8 +143,8 @@ def valid? return false if @type.nil? return false if @text.nil? return false if @text.to_s.length > 25 - return false if @post_back_data.nil? - return false if @post_back_data.to_s.length > 2048 + return false if @postback_data.nil? + return false if @postback_data.to_s.length > 2048 true end @@ -163,17 +163,17 @@ def text=(text) end # Custom attribute writer method with validation - # @param [Object] post_back_data Value to be assigned - def post_back_data=(post_back_data) - if post_back_data.nil? - fail ArgumentError, 'post_back_data cannot be nil' + # @param [Object] postback_data Value to be assigned + def postback_data=(postback_data) + if postback_data.nil? + fail ArgumentError, 'postback_data cannot be nil' end - if post_back_data.to_s.length > 2048 - fail ArgumentError, 'invalid value for "post_back_data", the character length must be smaller than or equal to 2048.' + if postback_data.to_s.length > 2048 + fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.' end - @post_back_data = post_back_data + @postback_data = postback_data end # Checks equality by comparing each attribute. @@ -183,7 +183,7 @@ def ==(o) self.class == o.class && type == o.type && text == o.text && - post_back_data == o.post_back_data + postback_data == o.postback_data end # @see the `==` method @@ -195,7 +195,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, text, post_back_data].hash + [type, text, postback_data].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/rbm_action_dial.rb b/lib/bandwidth-sdk/models/rbm_action_dial.rb index 87d019cf..b57f202c 100644 --- a/lib/bandwidth-sdk/models/rbm_action_dial.rb +++ b/lib/bandwidth-sdk/models/rbm_action_dial.rb @@ -21,7 +21,7 @@ class RbmActionDial attr_accessor :text # Base64 payload the customer receives when the reply is clicked. - attr_accessor :post_back_data + attr_accessor :postback_data # The phone number to dial. Must be E164 format. attr_accessor :phone_number @@ -53,7 +53,7 @@ def self.attribute_map { :'type' => :'type', :'text' => :'text', - :'post_back_data' => :'postBackData', + :'postback_data' => :'postbackData', :'phone_number' => :'phoneNumber' } end @@ -68,7 +68,7 @@ def self.openapi_types { :'type' => :'RbmActionTypeEnum', :'text' => :'String', - :'post_back_data' => :'String', + :'postback_data' => :'String', :'phone_number' => :'String' } end @@ -113,10 +113,10 @@ def initialize(attributes = {}) self.text = nil end - if attributes.key?(:'post_back_data') - self.post_back_data = attributes[:'post_back_data'] + if attributes.key?(:'postback_data') + self.postback_data = attributes[:'postback_data'] else - self.post_back_data = nil + self.postback_data = nil end if attributes.key?(:'phone_number') @@ -143,12 +143,12 @@ def list_invalid_properties invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.') end - if @post_back_data.nil? - invalid_properties.push('invalid value for "post_back_data", post_back_data cannot be nil.') + if @postback_data.nil? + invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.') end - if @post_back_data.to_s.length > 2048 - invalid_properties.push('invalid value for "post_back_data", the character length must be smaller than or equal to 2048.') + if @postback_data.to_s.length > 2048 + invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.') end if @phone_number.nil? @@ -165,8 +165,8 @@ def valid? return false if @type.nil? return false if @text.nil? return false if @text.to_s.length > 25 - return false if @post_back_data.nil? - return false if @post_back_data.to_s.length > 2048 + return false if @postback_data.nil? + return false if @postback_data.to_s.length > 2048 return false if @phone_number.nil? true end @@ -186,17 +186,17 @@ def text=(text) end # Custom attribute writer method with validation - # @param [Object] post_back_data Value to be assigned - def post_back_data=(post_back_data) - if post_back_data.nil? - fail ArgumentError, 'post_back_data cannot be nil' + # @param [Object] postback_data Value to be assigned + def postback_data=(postback_data) + if postback_data.nil? + fail ArgumentError, 'postback_data cannot be nil' end - if post_back_data.to_s.length > 2048 - fail ArgumentError, 'invalid value for "post_back_data", the character length must be smaller than or equal to 2048.' + if postback_data.to_s.length > 2048 + fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.' end - @post_back_data = post_back_data + @postback_data = postback_data end # Checks equality by comparing each attribute. @@ -206,7 +206,7 @@ def ==(o) self.class == o.class && type == o.type && text == o.text && - post_back_data == o.post_back_data && + postback_data == o.postback_data && phone_number == o.phone_number end @@ -219,7 +219,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, text, post_back_data, phone_number].hash + [type, text, postback_data, phone_number].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/rbm_action_open_url.rb b/lib/bandwidth-sdk/models/rbm_action_open_url.rb index ab232942..e8e2c5c1 100644 --- a/lib/bandwidth-sdk/models/rbm_action_open_url.rb +++ b/lib/bandwidth-sdk/models/rbm_action_open_url.rb @@ -21,7 +21,7 @@ class RbmActionOpenUrl attr_accessor :text # Base64 payload the customer receives when the reply is clicked. - attr_accessor :post_back_data + attr_accessor :postback_data # The URL to open in browser. attr_accessor :url @@ -53,7 +53,7 @@ def self.attribute_map { :'type' => :'type', :'text' => :'text', - :'post_back_data' => :'postBackData', + :'postback_data' => :'postbackData', :'url' => :'url' } end @@ -68,7 +68,7 @@ def self.openapi_types { :'type' => :'RbmActionTypeEnum', :'text' => :'String', - :'post_back_data' => :'String', + :'postback_data' => :'String', :'url' => :'String' } end @@ -113,10 +113,10 @@ def initialize(attributes = {}) self.text = nil end - if attributes.key?(:'post_back_data') - self.post_back_data = attributes[:'post_back_data'] + if attributes.key?(:'postback_data') + self.postback_data = attributes[:'postback_data'] else - self.post_back_data = nil + self.postback_data = nil end if attributes.key?(:'url') @@ -143,12 +143,12 @@ def list_invalid_properties invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.') end - if @post_back_data.nil? - invalid_properties.push('invalid value for "post_back_data", post_back_data cannot be nil.') + if @postback_data.nil? + invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.') end - if @post_back_data.to_s.length > 2048 - invalid_properties.push('invalid value for "post_back_data", the character length must be smaller than or equal to 2048.') + if @postback_data.to_s.length > 2048 + invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.') end if @url.nil? @@ -169,8 +169,8 @@ def valid? return false if @type.nil? return false if @text.nil? return false if @text.to_s.length > 25 - return false if @post_back_data.nil? - return false if @post_back_data.to_s.length > 2048 + return false if @postback_data.nil? + return false if @postback_data.to_s.length > 2048 return false if @url.nil? return false if @url.to_s.length > 2048 true @@ -191,17 +191,17 @@ def text=(text) end # Custom attribute writer method with validation - # @param [Object] post_back_data Value to be assigned - def post_back_data=(post_back_data) - if post_back_data.nil? - fail ArgumentError, 'post_back_data cannot be nil' + # @param [Object] postback_data Value to be assigned + def postback_data=(postback_data) + if postback_data.nil? + fail ArgumentError, 'postback_data cannot be nil' end - if post_back_data.to_s.length > 2048 - fail ArgumentError, 'invalid value for "post_back_data", the character length must be smaller than or equal to 2048.' + if postback_data.to_s.length > 2048 + fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.' end - @post_back_data = post_back_data + @postback_data = postback_data end # Custom attribute writer method with validation @@ -225,7 +225,7 @@ def ==(o) self.class == o.class && type == o.type && text == o.text && - post_back_data == o.post_back_data && + postback_data == o.postback_data && url == o.url end @@ -238,7 +238,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, text, post_back_data, url].hash + [type, text, postback_data, url].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/rbm_action_view_location.rb b/lib/bandwidth-sdk/models/rbm_action_view_location.rb index 8f2b8127..54acf9fa 100644 --- a/lib/bandwidth-sdk/models/rbm_action_view_location.rb +++ b/lib/bandwidth-sdk/models/rbm_action_view_location.rb @@ -21,7 +21,7 @@ class RbmActionViewLocation attr_accessor :text # Base64 payload the customer receives when the reply is clicked. - attr_accessor :post_back_data + attr_accessor :postback_data # The latitude of the location. attr_accessor :latitude @@ -59,7 +59,7 @@ def self.attribute_map { :'type' => :'type', :'text' => :'text', - :'post_back_data' => :'postBackData', + :'postback_data' => :'postbackData', :'latitude' => :'latitude', :'longitude' => :'longitude', :'label' => :'label' @@ -76,7 +76,7 @@ def self.openapi_types { :'type' => :'RbmActionTypeEnum', :'text' => :'String', - :'post_back_data' => :'String', + :'postback_data' => :'String', :'latitude' => :'Float', :'longitude' => :'Float', :'label' => :'String' @@ -123,10 +123,10 @@ def initialize(attributes = {}) self.text = nil end - if attributes.key?(:'post_back_data') - self.post_back_data = attributes[:'post_back_data'] + if attributes.key?(:'postback_data') + self.postback_data = attributes[:'postback_data'] else - self.post_back_data = nil + self.postback_data = nil end if attributes.key?(:'latitude') @@ -163,12 +163,12 @@ def list_invalid_properties invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 25.') end - if @post_back_data.nil? - invalid_properties.push('invalid value for "post_back_data", post_back_data cannot be nil.') + if @postback_data.nil? + invalid_properties.push('invalid value for "postback_data", postback_data cannot be nil.') end - if @post_back_data.to_s.length > 2048 - invalid_properties.push('invalid value for "post_back_data", the character length must be smaller than or equal to 2048.') + if @postback_data.to_s.length > 2048 + invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.') end if @latitude.nil? @@ -193,8 +193,8 @@ def valid? return false if @type.nil? return false if @text.nil? return false if @text.to_s.length > 25 - return false if @post_back_data.nil? - return false if @post_back_data.to_s.length > 2048 + return false if @postback_data.nil? + return false if @postback_data.to_s.length > 2048 return false if @latitude.nil? return false if @longitude.nil? return false if !@label.nil? && @label.to_s.length > 100 @@ -216,17 +216,17 @@ def text=(text) end # Custom attribute writer method with validation - # @param [Object] post_back_data Value to be assigned - def post_back_data=(post_back_data) - if post_back_data.nil? - fail ArgumentError, 'post_back_data cannot be nil' + # @param [Object] postback_data Value to be assigned + def postback_data=(postback_data) + if postback_data.nil? + fail ArgumentError, 'postback_data cannot be nil' end - if post_back_data.to_s.length > 2048 - fail ArgumentError, 'invalid value for "post_back_data", the character length must be smaller than or equal to 2048.' + if postback_data.to_s.length > 2048 + fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.' end - @post_back_data = post_back_data + @postback_data = postback_data end # Custom attribute writer method with validation @@ -250,7 +250,7 @@ def ==(o) self.class == o.class && type == o.type && text == o.text && - post_back_data == o.post_back_data && + postback_data == o.postback_data && latitude == o.latitude && longitude == o.longitude && label == o.label @@ -265,7 +265,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, text, post_back_data, latitude, longitude, label].hash + [type, text, postback_data, latitude, longitude, label].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/tag.rb b/lib/bandwidth-sdk/models/rbm_location_response.rb similarity index 88% rename from lib/bandwidth-sdk/models/tag.rb rename to lib/bandwidth-sdk/models/rbm_location_response.rb index af4bdf09..0fa253af 100644 --- a/lib/bandwidth-sdk/models/tag.rb +++ b/lib/bandwidth-sdk/models/rbm_location_response.rb @@ -14,16 +14,18 @@ require 'time' module Bandwidth - class Tag - attr_accessor :key + class RbmLocationResponse + # The latitude of the client's location. + attr_accessor :latitude - attr_accessor :value + # The longitude of the client's location. + attr_accessor :longitude # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'key' => :'key', - :'value' => :'value' + :'latitude' => :'latitude', + :'longitude' => :'longitude' } end @@ -35,8 +37,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'key' => :'String', - :'value' => :'String' + :'latitude' => :'Float', + :'longitude' => :'Float' } end @@ -50,23 +52,23 @@ 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::Tag` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmLocationResponse` 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::Tag`. 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::RbmLocationResponse`. 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?(:'key') - self.key = attributes[:'key'] + if attributes.key?(:'latitude') + self.latitude = attributes[:'latitude'] end - if attributes.key?(:'value') - self.value = attributes[:'value'] + if attributes.key?(:'longitude') + self.longitude = attributes[:'longitude'] end end @@ -90,8 +92,8 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - key == o.key && - value == o.value + latitude == o.latitude && + longitude == o.longitude end # @see the `==` method @@ -103,7 +105,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [key, value].hash + [latitude, longitude].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/multi_channel_callback_data.rb b/lib/bandwidth-sdk/models/rbm_suggestion_response.rb similarity index 75% rename from lib/bandwidth-sdk/models/multi_channel_callback_data.rb rename to lib/bandwidth-sdk/models/rbm_suggestion_response.rb index b833e90e..7435e6d1 100644 --- a/lib/bandwidth-sdk/models/multi_channel_callback_data.rb +++ b/lib/bandwidth-sdk/models/rbm_suggestion_response.rb @@ -14,49 +14,18 @@ require 'time' module Bandwidth - class MultiChannelCallbackData - # The time of the callback event. - attr_accessor :time + class RbmSuggestionResponse + # The text associated with the suggestion response. + attr_accessor :text - attr_accessor :type - - # The phone number the message should be sent to in E164 format. - attr_accessor :to - - attr_accessor :description - - attr_accessor :message - - 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 + # Base64 payload the customer receives when the reply is clicked. + attr_accessor :postback_data # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'time' => :'time', - :'type' => :'type', - :'to' => :'to', - :'description' => :'description', - :'message' => :'message' + :'text' => :'text', + :'postback_data' => :'postbackData' } end @@ -68,11 +37,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'time' => :'Time', - :'type' => :'MultiChannelStatusEnum', - :'to' => :'String', - :'description' => :'String', - :'message' => :'MultiChannelMessageCallbackData' + :'text' => :'String', + :'postback_data' => :'String' } end @@ -86,35 +52,23 @@ 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::MultiChannelCallbackData` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::RbmSuggestionResponse` 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::MultiChannelCallbackData`. 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::RbmSuggestionResponse`. 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?(:'time') - self.time = attributes[:'time'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] + if attributes.key?(:'text') + self.text = attributes[:'text'] end - if attributes.key?(:'to') - self.to = attributes[:'to'] - end - - if attributes.key?(:'description') - self.description = attributes[:'description'] - end - - if attributes.key?(:'message') - self.message = attributes[:'message'] + if attributes.key?(:'postback_data') + self.postback_data = attributes[:'postback_data'] end end @@ -123,6 +77,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if !@postback_data.nil? && @postback_data.to_s.length > 2048 + invalid_properties.push('invalid value for "postback_data", the character length must be smaller than or equal to 2048.') + end + invalid_properties end @@ -130,19 +88,31 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@postback_data.nil? && @postback_data.to_s.length > 2048 true end + # Custom attribute writer method with validation + # @param [Object] postback_data Value to be assigned + def postback_data=(postback_data) + if postback_data.nil? + fail ArgumentError, 'postback_data cannot be nil' + end + + if postback_data.to_s.length > 2048 + fail ArgumentError, 'invalid value for "postback_data", the character length must be smaller than or equal to 2048.' + end + + @postback_data = postback_data + 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 && - time == o.time && - type == o.type && - to == o.to && - description == o.description && - message == o.message + text == o.text && + postback_data == o.postback_data end # @see the `==` method @@ -154,7 +124,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [time, type, to, description, message].hash + [text, postback_data].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/status_callback.rb b/lib/bandwidth-sdk/models/status_callback.rb new file mode 100644 index 00000000..78d3905b --- /dev/null +++ b/lib/bandwidth-sdk/models/status_callback.rb @@ -0,0 +1,338 @@ +=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 + # Represents a status callback for an outbound MT SMS or MMS or RBM message. + class StatusCallback + attr_accessor :time + + # Represents the time at which the message was read, for `message-read` callbacks. + attr_accessor :event_time + + attr_accessor :type + + # The destination phone number the message was sent to. For status callbacks, this the the Bandwidth user's client phone number. + attr_accessor :to + + # A detailed description of the event described by the callback. + attr_accessor :description + + attr_accessor :message + + # Optional error code, applicable only when type is `message-failed`. + attr_accessor :error_code + + # The name of the Authorized Message Provider (AMP) that handled this message. In the US, this is the carrier that the message was sent to. This field is present only when this account feature has been enabled. + attr_accessor :carrier_name + + 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 + { + :'time' => :'time', + :'event_time' => :'eventTime', + :'type' => :'type', + :'to' => :'to', + :'description' => :'description', + :'message' => :'message', + :'error_code' => :'errorCode', + :'carrier_name' => :'carrierName' + } + 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 + { + :'time' => :'Time', + :'event_time' => :'Time', + :'type' => :'StatusCallbackTypeEnum', + :'to' => :'String', + :'description' => :'String', + :'message' => :'StatusCallbackMessage', + :'error_code' => :'Integer', + :'carrier_name' => :'String' + } + 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::StatusCallback` 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::StatusCallback`. 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?(:'time') + self.time = attributes[:'time'] + else + self.time = nil + end + + if attributes.key?(:'event_time') + self.event_time = attributes[:'event_time'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + else + self.to = nil + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + else + self.description = nil + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + else + self.message = nil + end + + if attributes.key?(:'error_code') + self.error_code = attributes[:'error_code'] + end + + if attributes.key?(:'carrier_name') + self.carrier_name = attributes[:'carrier_name'] + 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 @time.nil? + invalid_properties.push('invalid value for "time", time cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @message.nil? + invalid_properties.push('invalid value for "message", message 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 @time.nil? + return false if @type.nil? + return false if @to.nil? + return false if @description.nil? + return false if @message.nil? + 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 && + time == o.time && + event_time == o.event_time && + type == o.type && + to == o.to && + description == o.description && + message == o.message && + error_code == o.error_code && + carrier_name == o.carrier_name + 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 + [time, event_time, type, to, description, message, error_code, carrier_name].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/message_callback_message.rb b/lib/bandwidth-sdk/models/status_callback_message.rb similarity index 89% rename from lib/bandwidth-sdk/models/message_callback_message.rb rename to lib/bandwidth-sdk/models/status_callback_message.rb index 9392bb82..2c8b2b8d 100644 --- a/lib/bandwidth-sdk/models/message_callback_message.rb +++ b/lib/bandwidth-sdk/models/status_callback_message.rb @@ -14,33 +14,42 @@ require 'time' module Bandwidth - # Message payload schema within a MessageCallback - class MessageCallbackMessage + # Message payload schema within a callback + class StatusCallbackMessage + # A unique identifier of the message. attr_accessor :id + # The Bandwidth phone number or alphanumeric identifier associated with the message. attr_accessor :owner + # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard. attr_accessor :application_id attr_accessor :time + # The number of segments the user's message is broken into before sending over carrier networks. attr_accessor :segment_count attr_accessor :direction + # The phone number recipients of the message. attr_accessor :to + # The Bandwidth phone number or alphanumeric identifier the message was sent from. attr_accessor :from attr_accessor :text + # A custom string that will be included in callback events of the message. Max 1024 characters. attr_accessor :tag - # Optional media, applicable only for mms + # Optional media, not applicable for sms attr_accessor :media attr_accessor :priority + attr_accessor :channel + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -77,7 +86,8 @@ def self.attribute_map :'text' => :'text', :'tag' => :'tag', :'media' => :'media', - :'priority' => :'priority' + :'priority' => :'priority', + :'channel' => :'channel' } end @@ -100,14 +110,14 @@ def self.openapi_types :'text' => :'String', :'tag' => :'String', :'media' => :'Array', - :'priority' => :'PriorityEnum' + :'priority' => :'PriorityEnum', + :'channel' => :'MultiChannelMessageChannelEnum' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'media', ]) end @@ -115,13 +125,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::MessageCallbackMessage` initialize method' + fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::StatusCallbackMessage` 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::MessageCallbackMessage`. 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::StatusCallbackMessage`. 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 } @@ -178,8 +188,6 @@ def initialize(attributes = {}) if attributes.key?(:'text') self.text = attributes[:'text'] - else - self.text = nil end if attributes.key?(:'tag') @@ -195,6 +203,10 @@ def initialize(attributes = {}) if attributes.key?(:'priority') self.priority = attributes[:'priority'] end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -234,10 +246,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "from", from cannot be nil.') end - if @text.nil? - invalid_properties.push('invalid value for "text", text cannot be nil.') - end - invalid_properties end @@ -253,7 +261,6 @@ def valid? return false if @direction.nil? return false if @to.nil? return false if @from.nil? - return false if @text.nil? true end @@ -283,7 +290,8 @@ def ==(o) text == o.text && tag == o.tag && media == o.media && - priority == o.priority + priority == o.priority && + channel == o.channel end # @see the `==` method @@ -295,7 +303,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority].hash + [id, owner, application_id, time, segment_count, direction, to, from, text, tag, media, priority, channel].hash end # Builds the object from hash diff --git a/lib/bandwidth-sdk/models/callback_type_enum.rb b/lib/bandwidth-sdk/models/status_callback_type_enum.rb similarity index 74% rename from lib/bandwidth-sdk/models/callback_type_enum.rb rename to lib/bandwidth-sdk/models/status_callback_type_enum.rb index fe899996..c2df50fe 100644 --- a/lib/bandwidth-sdk/models/callback_type_enum.rb +++ b/lib/bandwidth-sdk/models/status_callback_type_enum.rb @@ -14,14 +14,14 @@ require 'time' module Bandwidth - class CallbackTypeEnum - RECEIVED = 'message-received'.freeze + class StatusCallbackTypeEnum SENDING = 'message-sending'.freeze DELIVERED = 'message-delivered'.freeze FAILED = 'message-failed'.freeze + READ = 'message-read'.freeze def self.all_vars - @all_vars ||= [RECEIVED, SENDING, DELIVERED, FAILED].freeze + @all_vars ||= [SENDING, DELIVERED, FAILED, READ].freeze end # Builds the enum from string @@ -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 CallbackTypeEnum.all_vars.include?(value) - raise "Invalid ENUM value #{value} for class #CallbackTypeEnum" + return value if StatusCallbackTypeEnum.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #StatusCallbackTypeEnum" end end end diff --git a/spec/smoke/toll_free_verification_api_spec.rb b/spec/smoke/toll_free_verification_api_spec.rb index 84243c5e..46d65899 100644 --- a/spec/smoke/toll_free_verification_api_spec.rb +++ b/spec/smoke/toll_free_verification_api_spec.rb @@ -29,6 +29,13 @@ end end + # Delete a Toll-Free Verification Submission + describe 'delete_verification_request' do + it 'deletes a toll free verification submission' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + # List Toll-Free Use Cases describe 'list_toll_free_use_cases test' do it 'lists toll free use cases' do diff --git a/spec/unit/api/toll_free_verification_api_spec.rb b/spec/unit/api/toll_free_verification_api_spec.rb index 483f2e6a..5fe27845 100644 --- a/spec/unit/api/toll_free_verification_api_spec.rb +++ b/spec/unit/api/toll_free_verification_api_spec.rb @@ -136,6 +136,14 @@ end end + # Delete a Toll-Free Verification Submission + describe 'delete_verification_request' do + it 'deletes a toll free verification submission' do + _data, status_code = @tfv_api_instance.delete_verification_request_with_http_info(BW_ACCOUNT_ID, tf_phone_number) + expect(status_code).to eq(204) + end + end + # List Toll-Free Use Cases describe 'list_toll_free_use_cases test' do it 'lists toll free use cases' do diff --git a/spec/unit/client/api_client_spec.rb b/spec/unit/client/api_client_spec.rb index 676250b9..89842c58 100644 --- a/spec/unit/client/api_client_spec.rb +++ b/spec/unit/client/api_client_spec.rb @@ -268,7 +268,7 @@ expect(api_client_default.convert_to_type({ id: 1 }, 'Object')).to eq({ id: 1 }) expect(api_client_default.convert_to_type([[12, 34], [56]], 'Array>')).to eq([[12, 34], [56]]) expect(api_client_default.convert_to_type({ "id": 'test' }, 'Hash')).to eq({ id: 'test' }) - expect(api_client_default.convert_to_type({ set_or_expired: true }, 'DeferredResult')).to be_instance_of(Bandwidth::DeferredResult) + expect(api_client_default.convert_to_type({ valid: true }, 'VerifyCodeResponse')).to be_instance_of(Bandwidth::VerifyCodeResponse) end end @@ -353,10 +353,10 @@ end it 'returns hash when object can be converted to hash' do - model = Bandwidth::DeferredResult.new({ - set_or_expired: true + model = Bandwidth::VerifyCodeResponse.new({ + valid: true }) - expected = { setOrExpired: true } + expected = { valid: true } expect(api_client_default.object_to_hash(model)).to eq(expected) end end diff --git a/spec/unit/models/deferred_result_spec.rb b/spec/unit/models/deferred_result_spec.rb deleted file mode 100644 index 8a0c2e0b..00000000 --- a/spec/unit/models/deferred_result_spec.rb +++ /dev/null @@ -1,74 +0,0 @@ -# Unit tests for Bandwidth::DeferredResult -describe Bandwidth::DeferredResult do - let(:deferred_result_default) { Bandwidth::DeferredResult.new } - let(:deferred_result_values) { Bandwidth::DeferredResult.new({ - result: { key: 'value' }, - set_or_expired: true - }) } - - describe '#initialize' do - it 'causes an ArgumentError by passing an Array to the initialize method' do - expect { - Bandwidth::DeferredResult.new([]) - }.to raise_error(ArgumentError) - end - - it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do - expect { - Bandwidth::DeferredResult.new({ invalid: true }) - }.to raise_error(ArgumentError) - end - end - - describe '#acceptable_attributes' do - it 'expects acceptable JSON attributes to be those in the attribute map' do - expect(Bandwidth::DeferredResult.acceptable_attributes).to eq(Bandwidth::DeferredResult.attribute_map.values) - end - end - - describe '#openapi_nullable' do - it 'expects nullable attributes to be an empty set' do - expect(Bandwidth::DeferredResult.openapi_nullable).to eq(Set.new([])) - end - end - - describe '#build_from_hash' do - it 'validates instance of DeferredResult created by the build_from_hash method' do - deferred_result_from_hash = Bandwidth::DeferredResult.build_from_hash({ - result: { key: 'value' }, - setOrExpired: true - }) - expect(deferred_result_from_hash).to be_instance_of(Bandwidth::DeferredResult) - expect(deferred_result_from_hash.result).to eq({ key: 'value' }) - expect(deferred_result_from_hash.set_or_expired).to be true - end - end - - describe '#hash' do - it 'returns a hash code according to attributes' do - expect(deferred_result_default.hash).to be_instance_of(Integer) - end - end - - describe '#to_s' do - it 'returns a string representation of the object' do - expect(deferred_result_values.to_s).to eq('{:result=>{:key=>"value"}, :setOrExpired=>true}') - end - end - - describe '#eq? #==' do - it 'returns true/false when comparing objects' do - expect(deferred_result_default.eql?(Bandwidth::DeferredResult.new)).to be true - expect(deferred_result_default.eql?(deferred_result_values)).to be false - end - end - - describe '#to_body #to_hash' do - it 'returns a hash representation of the object' do - expect(deferred_result_values.to_body).to eq({ - result: { key: 'value' }, - setOrExpired: true - }) - end - end -end diff --git a/spec/unit/models/tfv_error_spec.rb b/spec/unit/models/tfv_error_spec.rb new file mode 100644 index 00000000..f6cd7d0b --- /dev/null +++ b/spec/unit/models/tfv_error_spec.rb @@ -0,0 +1,78 @@ +# Unit tests for Bandwidth::TfvError +describe Bandwidth::TfvError do + let(:tfv_error_default) { Bandwidth::TfvError.new } + let(:tfv_error_values) { Bandwidth::TfvError.new({ + type: 'type', + description: 'description', + errors: { key: 'value' } + }) } + + describe '#initialize' do + it 'causes an ArgumentError by passing an Array to the initialize method' do + expect { + Bandwidth::TfvError.new([]) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do + expect { + Bandwidth::TfvError.new({ invalid: true }) + }.to raise_error(ArgumentError) + end + end + + describe '#acceptable_attributes' do + it 'expects acceptable JSON attributes to be those in the attribute map' do + expect(Bandwidth::TfvError.acceptable_attributes).to eq(Bandwidth::TfvError.attribute_map.values) + end + end + + describe 'enum validation' do + it 'works' do + + end + end + + describe '#build_from_hash' do + it 'validates instance of TfvError created by the build_from_hash method' do + tfv_error_from_hash = Bandwidth::TfvError.build_from_hash({ + type: 'type', + description: 'description', + errors: { key: 'value' } + }) + expect(tfv_error_from_hash).to be_instance_of(Bandwidth::TfvError) + expect(tfv_error_from_hash.type).to eq('type') + expect(tfv_error_from_hash.description).to eq('description') + expect(tfv_error_from_hash.errors).to eq({ key: 'value' }) + end + end + + describe '#hash' do + it 'returns a hash code according to attributes' do + expect(tfv_error_default.hash).to be_instance_of(Integer) + end + end + + describe '#to_s' do + it 'returns a string representation of the object' do + expect(tfv_error_values.to_s).to eq('{:type=>"type", :description=>"description", :errors=>{:key=>"value"}}') + end + end + + describe '#eq? #==' do + it 'returns true/false when comparing objects' do + expect(tfv_error_default.eql?(Bandwidth::TfvError.new)).to be true + expect(tfv_error_default.eql?(tfv_error_values)).to be false + end + end + + describe '#to_body #to_hash' do + it 'returns a hash representation of the object' do + expect(tfv_error_values.to_body).to eq({ + type: 'type', + description: 'description', + errors: { key: 'value' } + }) + end + end +end diff --git a/spec/unit/models/verify_code_response_spec.rb b/spec/unit/models/verify_code_response_spec.rb new file mode 100644 index 00000000..43d592fb --- /dev/null +++ b/spec/unit/models/verify_code_response_spec.rb @@ -0,0 +1,70 @@ +# Unit tests for Bandwidth::VerifyCodeResponse +describe Bandwidth::VerifyCodeResponse do + let(:verify_code_response_default) { Bandwidth::VerifyCodeResponse.new } + let(:verify_code_response_values) { Bandwidth::VerifyCodeResponse.new({ + valid: true + }) } + + describe '#initialize' do + it 'causes an ArgumentError by passing an Array to the initialize method' do + expect { + Bandwidth::VerifyCodeResponse.new([]) + }.to raise_error(ArgumentError) + end + + it 'causes an ArgumentError by passing an invalid attribute to the initialize method' do + expect { + Bandwidth::VerifyCodeResponse.new({ invalid: true }) + }.to raise_error(ArgumentError) + end + end + + describe '#acceptable_attributes' do + it 'expects acceptable JSON attributes to be those in the attribute map' do + expect(Bandwidth::VerifyCodeResponse.acceptable_attributes).to eq(Bandwidth::VerifyCodeResponse.attribute_map.values) + end + end + + describe '#openapi_nullable' do + it 'expects nullable attributes to be an empty set' do + expect(Bandwidth::VerifyCodeResponse.openapi_nullable).to eq(Set.new([])) + end + end + + describe '#build_from_hash' do + it 'validates instance of VerifyCodeResponse created by the build_from_hash method' do + verify_code_response_from_hash = Bandwidth::VerifyCodeResponse.build_from_hash({ + valid: true + }) + expect(verify_code_response_from_hash).to be_instance_of(Bandwidth::VerifyCodeResponse) + expect(verify_code_response_from_hash.valid).to be true + end + end + + describe '#hash' do + it 'returns a hash code according to attributes' do + expect(verify_code_response_default.hash).to be_instance_of(Integer) + end + end + + describe '#to_s' do + it 'returns a string representation of the object' do + expect(verify_code_response_values.to_s).to eq('{:valid=>true}') + end + end + + describe '#eq? #==' do + it 'returns true/false when comparing objects' do + expect(verify_code_response_default.eql?(Bandwidth::VerifyCodeResponse.new)).to be true + expect(verify_code_response_default.eql?(verify_code_response_values)).to be false + end + end + + describe '#to_body #to_hash' do + it 'returns a hash representation of the object' do + expect(verify_code_response_values.to_body).to eq({ + valid: true + }) + end + end +end