diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0da4f8c5..8844f807 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -92,6 +92,7 @@ docs/LinksObject.md docs/ListEndpointsResponse.md docs/ListMessageDirectionEnum.md docs/ListMessageItem.md +docs/LocationResponse.md docs/LookupErrorResponse.md docs/LookupErrorSchema.md docs/LookupErrorSchemaMeta.md @@ -149,7 +150,6 @@ docs/RbmActionTypeEnum.md docs/RbmActionViewLocation.md docs/RbmCardContent.md docs/RbmCardContentMedia.md -docs/RbmLocationResponse.md docs/RbmMediaHeightEnum.md docs/RbmMessageCarouselCard.md docs/RbmMessageContentFile.md @@ -158,7 +158,6 @@ docs/RbmMessageContentText.md docs/RbmMessageMedia.md docs/RbmOpenUrlEnum.md docs/RbmStandaloneCard.md -docs/RbmSuggestionResponse.md docs/RbmWebViewEnum.md docs/RecordingAvailableCallback.md docs/RecordingCompleteCallback.md @@ -177,6 +176,7 @@ docs/StatusCallback.md docs/StatusCallbackMessage.md docs/StatusCallbackTypeEnum.md docs/StirShaken.md +docs/SuggestionResponse.md docs/SyncLookupRequest.md docs/TelephoneNumber.md docs/TfvBasicAuthentication.md @@ -342,6 +342,7 @@ src/main/java/com/bandwidth/sdk/model/LinksObject.java src/main/java/com/bandwidth/sdk/model/ListEndpointsResponse.java src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java src/main/java/com/bandwidth/sdk/model/ListMessageItem.java +src/main/java/com/bandwidth/sdk/model/LocationResponse.java src/main/java/com/bandwidth/sdk/model/LookupErrorResponse.java src/main/java/com/bandwidth/sdk/model/LookupErrorSchema.java src/main/java/com/bandwidth/sdk/model/LookupErrorSchemaMeta.java @@ -393,7 +394,6 @@ src/main/java/com/bandwidth/sdk/model/RbmActionTypeEnum.java src/main/java/com/bandwidth/sdk/model/RbmActionViewLocation.java src/main/java/com/bandwidth/sdk/model/RbmCardContent.java src/main/java/com/bandwidth/sdk/model/RbmCardContentMedia.java -src/main/java/com/bandwidth/sdk/model/RbmLocationResponse.java src/main/java/com/bandwidth/sdk/model/RbmMediaHeightEnum.java src/main/java/com/bandwidth/sdk/model/RbmMessageCarouselCard.java src/main/java/com/bandwidth/sdk/model/RbmMessageContentFile.java @@ -402,7 +402,6 @@ src/main/java/com/bandwidth/sdk/model/RbmMessageContentText.java src/main/java/com/bandwidth/sdk/model/RbmMessageMedia.java src/main/java/com/bandwidth/sdk/model/RbmOpenUrlEnum.java src/main/java/com/bandwidth/sdk/model/RbmStandaloneCard.java -src/main/java/com/bandwidth/sdk/model/RbmSuggestionResponse.java src/main/java/com/bandwidth/sdk/model/RbmWebViewEnum.java src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java @@ -419,6 +418,7 @@ src/main/java/com/bandwidth/sdk/model/StatusCallback.java src/main/java/com/bandwidth/sdk/model/StatusCallbackMessage.java src/main/java/com/bandwidth/sdk/model/StatusCallbackTypeEnum.java src/main/java/com/bandwidth/sdk/model/StirShaken.java +src/main/java/com/bandwidth/sdk/model/SuggestionResponse.java src/main/java/com/bandwidth/sdk/model/SyncLookupRequest.java src/main/java/com/bandwidth/sdk/model/TelephoneNumber.java src/main/java/com/bandwidth/sdk/model/TfvBasicAuthentication.java diff --git a/README.md b/README.md index 0f80d7dc..b590172a 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,7 @@ Class | Method | HTTP request | Description - [ListEndpointsResponse](docs/ListEndpointsResponse.md) - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) - [ListMessageItem](docs/ListMessageItem.md) + - [LocationResponse](docs/LocationResponse.md) - [LookupErrorResponse](docs/LookupErrorResponse.md) - [LookupErrorSchema](docs/LookupErrorSchema.md) - [LookupErrorSchemaMeta](docs/LookupErrorSchemaMeta.md) @@ -326,7 +327,6 @@ Class | Method | HTTP request | Description - [RbmActionViewLocation](docs/RbmActionViewLocation.md) - [RbmCardContent](docs/RbmCardContent.md) - [RbmCardContentMedia](docs/RbmCardContentMedia.md) - - [RbmLocationResponse](docs/RbmLocationResponse.md) - [RbmMediaHeightEnum](docs/RbmMediaHeightEnum.md) - [RbmMessageCarouselCard](docs/RbmMessageCarouselCard.md) - [RbmMessageContentFile](docs/RbmMessageContentFile.md) @@ -335,7 +335,6 @@ Class | Method | HTTP request | Description - [RbmMessageMedia](docs/RbmMessageMedia.md) - [RbmOpenUrlEnum](docs/RbmOpenUrlEnum.md) - [RbmStandaloneCard](docs/RbmStandaloneCard.md) - - [RbmSuggestionResponse](docs/RbmSuggestionResponse.md) - [RbmWebViewEnum](docs/RbmWebViewEnum.md) - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) - [RecordingCompleteCallback](docs/RecordingCompleteCallback.md) @@ -352,6 +351,7 @@ Class | Method | HTTP request | Description - [StatusCallbackMessage](docs/StatusCallbackMessage.md) - [StatusCallbackTypeEnum](docs/StatusCallbackTypeEnum.md) - [StirShaken](docs/StirShaken.md) + - [SuggestionResponse](docs/SuggestionResponse.md) - [SyncLookupRequest](docs/SyncLookupRequest.md) - [TelephoneNumber](docs/TelephoneNumber.md) - [TfvBasicAuthentication](docs/TfvBasicAuthentication.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index e2120313..af7ca965 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -6480,8 +6480,8 @@ components:

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. +

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

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

Please visit Webhooks

required: true responses: @@ -7199,7 +7199,7 @@ components: tag: "{\"myTag\": \"myTagValue\"}" updateEndpointBxmlRequestExample: summary: Update Endpoint BXML Request Example - value: + value: endpointDisconnectedEventExample: summary: Endpoint Disconnected Event value: @@ -10627,7 +10627,7 @@ components: media: $ref: "#/components/schemas/rbmMessageContentFile" type: object - rbmSuggestionResponse: + suggestionResponse: properties: text: description: The text associated with the suggestion response. @@ -10641,8 +10641,13 @@ components: maxLength: 2048 title: Post Back Data type: string + pairedMessageId: + description: Corresponding parent message ID (MT). + example: 1752697342534u24xerqdukke523x + nullable: true + type: string type: object - rbmLocationResponse: + locationResponse: properties: latitude: description: The latitude of the client's location. @@ -10668,7 +10673,7 @@ components: message-failed: "#/components/schemas/statusCallback" message-read: "#/components/schemas/statusCallback" message-received: "#/components/schemas/inboundCallback" - request-location-response: "#/components/schemas/inboundCallback" + requested-location-response: "#/components/schemas/inboundCallback" suggestion-response: "#/components/schemas/inboundCallback" propertyName: type oneOf: @@ -10774,11 +10779,11 @@ components: 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. + - `requested-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 + - requested-location-response - suggestion-response example: message-received type: string @@ -10862,9 +10867,9 @@ components: content: $ref: "#/components/schemas/multiChannelMessageContent" suggestionResponse: - $ref: "#/components/schemas/rbmSuggestionResponse" + $ref: "#/components/schemas/suggestionResponse" locationResponse: - $ref: "#/components/schemas/rbmLocationResponse" + $ref: "#/components/schemas/locationResponse" type: object required: - applicationId diff --git a/bandwidth.yml b/bandwidth.yml index 5e2bc9b3..92f7b763 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -2880,7 +2880,7 @@ components: type: string media: $ref: '#/components/schemas/rbmMessageContentFile' - rbmSuggestionResponse: + suggestionResponse: type: object properties: text: @@ -2889,7 +2889,12 @@ components: example: Yes, I would like to proceed postbackData: $ref: '#/components/schemas/rbmActionPostbackData' - rbmLocationResponse: + pairedMessageId: + type: string + nullable: true + description: Corresponding parent message ID (MT). + example: 1752697342534u24xerqdukke523x + locationResponse: type: object properties: latitude: @@ -2925,7 +2930,7 @@ components: message-failed: '#/components/schemas/statusCallback' message-read: '#/components/schemas/statusCallback' message-received: '#/components/schemas/inboundCallback' - request-location-response: '#/components/schemas/inboundCallback' + requested-location-response: '#/components/schemas/inboundCallback' suggestion-response: '#/components/schemas/inboundCallback' statusCallback: type: object @@ -3035,14 +3040,15 @@ components: - `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. + - `requested-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 + - requested-location-response - suggestion-response example: message-received statusCallbackMessage: @@ -3118,9 +3124,9 @@ components: content: $ref: '#/components/schemas/multiChannelMessageContent' suggestionResponse: - $ref: '#/components/schemas/rbmSuggestionResponse' + $ref: '#/components/schemas/suggestionResponse' locationResponse: - $ref: '#/components/schemas/rbmLocationResponse' + $ref: '#/components/schemas/locationResponse' required: - id - owner @@ -9154,7 +9160,7 @@ components: tag: '{"myTag": "myTagValue"}' updateEndpointBxmlRequestExample: summary: Update Endpoint BXML Request Example - value: + value: endpointDisconnectedEventExample: summary: Endpoint Disconnected Event value: @@ -9678,10 +9684,10 @@ components:

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

Note that suggestion-response and - location-request-response callback types are + requested-location-response callback types are pertinent only for RBM messages sent from the /messages/multiChannel endpoint. diff --git a/docs/InboundCallbackMessage.md b/docs/InboundCallbackMessage.md index 2e3fd3d2..a5e7140e 100644 --- a/docs/InboundCallbackMessage.md +++ b/docs/InboundCallbackMessage.md @@ -21,8 +21,8 @@ |**priority** | **PriorityEnum** | | [optional] | |**channel** | **MultiChannelMessageChannelEnum** | | [optional] | |**content** | [**MultiChannelMessageContent**](MultiChannelMessageContent.md) | | [optional] | -|**suggestionResponse** | [**RbmSuggestionResponse**](RbmSuggestionResponse.md) | | [optional] | -|**locationResponse** | [**RbmLocationResponse**](RbmLocationResponse.md) | | [optional] | +|**suggestionResponse** | [**SuggestionResponse**](SuggestionResponse.md) | | [optional] | +|**locationResponse** | [**LocationResponse**](LocationResponse.md) | | [optional] | diff --git a/docs/InboundCallbackTypeEnum.md b/docs/InboundCallbackTypeEnum.md index d2577d84..9b34f428 100644 --- a/docs/InboundCallbackTypeEnum.md +++ b/docs/InboundCallbackTypeEnum.md @@ -7,7 +7,7 @@ * `MESSAGE_RECEIVED` (value: `"message-received"`) -* `REQUEST_LOCATION_RESPONSE` (value: `"request-location-response"`) +* `REQUESTED_LOCATION_RESPONSE` (value: `"requested-location-response"`) * `SUGGESTION_RESPONSE` (value: `"suggestion-response"`) diff --git a/docs/LocationResponse.md b/docs/LocationResponse.md new file mode 100644 index 00000000..f6bec63e --- /dev/null +++ b/docs/LocationResponse.md @@ -0,0 +1,14 @@ + + +# LocationResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**latitude** | **Double** | The latitude of the client's location. | [optional] | +|**longitude** | **Double** | The longitude of the client's location. | [optional] | + + + diff --git a/docs/SuggestionResponse.md b/docs/SuggestionResponse.md new file mode 100644 index 00000000..4a1fa1a9 --- /dev/null +++ b/docs/SuggestionResponse.md @@ -0,0 +1,15 @@ + + +# SuggestionResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**text** | **String** | The text associated with the suggestion response. | [optional] | +|**postbackData** | **byte[]** | Base64 payload the customer receives when the reply is clicked. | [optional] | +|**pairedMessageId** | **String** | Corresponding parent message ID (MT). | [optional] | + + + diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index f2a30beb..b6c003a3 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -71,7 +71,7 @@ public Class getClassForElement(Json classByDiscriminatorValue.put("message-received", com.bandwidth.sdk.model.InboundCallback.class); classByDiscriminatorValue.put("message-sending", com.bandwidth.sdk.model.StatusCallback.class); classByDiscriminatorValue.put("message-sent", com.bandwidth.sdk.model.StatusCallback.class); - classByDiscriminatorValue.put("request-location-response", com.bandwidth.sdk.model.InboundCallback.class); + classByDiscriminatorValue.put("requested-location-response", com.bandwidth.sdk.model.InboundCallback.class); classByDiscriminatorValue.put("suggestion-response", com.bandwidth.sdk.model.InboundCallback.class); classByDiscriminatorValue.put("callback", com.bandwidth.sdk.model.Callback.class); return getClassByDiscriminator(classByDiscriminatorValue, @@ -216,6 +216,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LinksObject.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ListEndpointsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ListMessageItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LocationResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupErrorResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupErrorSchema.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupErrorSchemaMeta.CustomTypeAdapterFactory()); @@ -260,14 +261,12 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmActionViewLocation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmCardContent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmCardContentMedia.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmLocationResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageCarouselCard.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageContentFile.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageContentRichCard.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageContentText.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmMessageMedia.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmStandaloneCard.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmSuggestionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingAvailableCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingCompleteCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingTranscriptionMetadata.CustomTypeAdapterFactory()); @@ -279,6 +278,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StatusCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StatusCallbackMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StirShaken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.SuggestionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.SyncLookupRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TelephoneNumber.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TfvBasicAuthentication.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/bandwidth/sdk/model/Callback.java b/src/main/java/com/bandwidth/sdk/model/Callback.java index 9db016fd..0b570822 100644 --- a/src/main/java/com/bandwidth/sdk/model/Callback.java +++ b/src/main/java/com/bandwidth/sdk/model/Callback.java @@ -140,7 +140,7 @@ public Callback read(JsonReader in) throws IOException { deserialized = adapterStatusCallback.fromJsonTree(jsonObject); newCallback.setActualInstance(deserialized); return newCallback; - case "request-location-response": + case "requested-location-response": deserialized = adapterInboundCallback.fromJsonTree(jsonObject); newCallback.setActualInstance(deserialized); return newCallback; @@ -149,7 +149,7 @@ public Callback read(JsonReader in) throws IOException { newCallback.setActualInstance(deserialized); return newCallback; default: - log.log(Level.WARNING, String.format(Locale.ROOT, "Failed to lookup discriminator value `%s` for Callback. Possible values: message-delivered message-failed message-read message-received message-sending message-sent request-location-response suggestion-response", jsonObject.get("type").getAsString())); + log.log(Level.WARNING, String.format(Locale.ROOT, "Failed to lookup discriminator value `%s` for Callback. Possible values: message-delivered message-failed message-read message-received message-sending message-sent requested-location-response suggestion-response", jsonObject.get("type").getAsString())); } } diff --git a/src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java index 412d1602..5a3c0a49 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundCallbackMessage.java @@ -15,12 +15,12 @@ import java.util.Objects; import java.util.Locale; +import com.bandwidth.sdk.model.LocationResponse; import com.bandwidth.sdk.model.MessageDirectionEnum; import com.bandwidth.sdk.model.MultiChannelMessageChannelEnum; import com.bandwidth.sdk.model.MultiChannelMessageContent; import com.bandwidth.sdk.model.PriorityEnum; -import com.bandwidth.sdk.model.RbmLocationResponse; -import com.bandwidth.sdk.model.RbmSuggestionResponse; +import com.bandwidth.sdk.model.SuggestionResponse; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -137,12 +137,12 @@ public class InboundCallbackMessage { public static final String SERIALIZED_NAME_SUGGESTION_RESPONSE = "suggestionResponse"; @SerializedName(SERIALIZED_NAME_SUGGESTION_RESPONSE) @javax.annotation.Nullable - private RbmSuggestionResponse suggestionResponse; + private SuggestionResponse suggestionResponse; public static final String SERIALIZED_NAME_LOCATION_RESPONSE = "locationResponse"; @SerializedName(SERIALIZED_NAME_LOCATION_RESPONSE) @javax.annotation.Nullable - private RbmLocationResponse locationResponse; + private LocationResponse locationResponse; public InboundCallbackMessage() { } @@ -429,7 +429,7 @@ public void setContent(@javax.annotation.Nullable MultiChannelMessageContent con } - public InboundCallbackMessage suggestionResponse(@javax.annotation.Nullable RbmSuggestionResponse suggestionResponse) { + public InboundCallbackMessage suggestionResponse(@javax.annotation.Nullable SuggestionResponse suggestionResponse) { this.suggestionResponse = suggestionResponse; return this; } @@ -439,16 +439,16 @@ public InboundCallbackMessage suggestionResponse(@javax.annotation.Nullable RbmS * @return suggestionResponse */ @javax.annotation.Nullable - public RbmSuggestionResponse getSuggestionResponse() { + public SuggestionResponse getSuggestionResponse() { return suggestionResponse; } - public void setSuggestionResponse(@javax.annotation.Nullable RbmSuggestionResponse suggestionResponse) { + public void setSuggestionResponse(@javax.annotation.Nullable SuggestionResponse suggestionResponse) { this.suggestionResponse = suggestionResponse; } - public InboundCallbackMessage locationResponse(@javax.annotation.Nullable RbmLocationResponse locationResponse) { + public InboundCallbackMessage locationResponse(@javax.annotation.Nullable LocationResponse locationResponse) { this.locationResponse = locationResponse; return this; } @@ -458,11 +458,11 @@ public InboundCallbackMessage locationResponse(@javax.annotation.Nullable RbmLoc * @return locationResponse */ @javax.annotation.Nullable - public RbmLocationResponse getLocationResponse() { + public LocationResponse getLocationResponse() { return locationResponse; } - public void setLocationResponse(@javax.annotation.Nullable RbmLocationResponse locationResponse) { + public void setLocationResponse(@javax.annotation.Nullable LocationResponse locationResponse) { this.locationResponse = locationResponse; } @@ -657,11 +657,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } // validate the optional field `suggestionResponse` if (jsonObj.get("suggestionResponse") != null && !jsonObj.get("suggestionResponse").isJsonNull()) { - RbmSuggestionResponse.validateJsonElement(jsonObj.get("suggestionResponse")); + SuggestionResponse.validateJsonElement(jsonObj.get("suggestionResponse")); } // validate the optional field `locationResponse` if (jsonObj.get("locationResponse") != null && !jsonObj.get("locationResponse").isJsonNull()) { - RbmLocationResponse.validateJsonElement(jsonObj.get("locationResponse")); + LocationResponse.validateJsonElement(jsonObj.get("locationResponse")); } } diff --git a/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java index 2c09896b..630bc0ae 100644 --- a/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java +++ b/src/main/java/com/bandwidth/sdk/model/InboundCallbackTypeEnum.java @@ -26,14 +26,14 @@ import com.google.gson.stream.JsonWriter; /** - * 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. + * 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. - `requested-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. */ @JsonAdapter(InboundCallbackTypeEnum.Adapter.class) public enum InboundCallbackTypeEnum { MESSAGE_RECEIVED("message-received"), - REQUEST_LOCATION_RESPONSE("request-location-response"), + REQUESTED_LOCATION_RESPONSE("requested-location-response"), SUGGESTION_RESPONSE("suggestion-response"); diff --git a/src/main/java/com/bandwidth/sdk/model/LocationResponse.java b/src/main/java/com/bandwidth/sdk/model/LocationResponse.java new file mode 100644 index 00000000..84bb5ceb --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/LocationResponse.java @@ -0,0 +1,317 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * LocationResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class LocationResponse { + public static final String SERIALIZED_NAME_LATITUDE = "latitude"; + @SerializedName(SERIALIZED_NAME_LATITUDE) + @javax.annotation.Nullable + private Double latitude; + + public static final String SERIALIZED_NAME_LONGITUDE = "longitude"; + @SerializedName(SERIALIZED_NAME_LONGITUDE) + @javax.annotation.Nullable + private Double longitude; + + public LocationResponse() { + } + + public LocationResponse latitude(@javax.annotation.Nullable Double latitude) { + this.latitude = latitude; + return this; + } + + /** + * The latitude of the client's location. + * @return latitude + */ + @javax.annotation.Nullable + public Double getLatitude() { + return latitude; + } + + public void setLatitude(@javax.annotation.Nullable Double latitude) { + this.latitude = latitude; + } + + + public LocationResponse longitude(@javax.annotation.Nullable Double longitude) { + this.longitude = longitude; + return this; + } + + /** + * The longitude of the client's location. + * @return longitude + */ + @javax.annotation.Nullable + public Double getLongitude() { + return longitude; + } + + public void setLongitude(@javax.annotation.Nullable Double longitude) { + this.longitude = longitude; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the LocationResponse instance itself + */ + public LocationResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LocationResponse locationResponse = (LocationResponse) o; + return Objects.equals(this.latitude, locationResponse.latitude) && + Objects.equals(this.longitude, locationResponse.longitude)&& + Objects.equals(this.additionalProperties, locationResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(latitude, longitude, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LocationResponse {\n"); + sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); + sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("latitude", "longitude")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LocationResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LocationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in LocationResponse is not found in the empty JSON string", LocationResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("latitude") != null && !jsonObj.get("latitude").isJsonNull()) && !jsonObj.get("latitude").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `latitude` to be a primitive type in the JSON string but got `%s`", jsonObj.get("latitude").toString())); + } + if ((jsonObj.get("longitude") != null && !jsonObj.get("longitude").isJsonNull()) && !jsonObj.get("longitude").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `longitude` to be a primitive type in the JSON string but got `%s`", jsonObj.get("longitude").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LocationResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LocationResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LocationResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LocationResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public LocationResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + LocationResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LocationResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of LocationResponse + * @throws IOException if the JSON string is invalid with respect to LocationResponse + */ + public static LocationResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LocationResponse.class); + } + + /** + * Convert an instance of LocationResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/SuggestionResponse.java b/src/main/java/com/bandwidth/sdk/model/SuggestionResponse.java new file mode 100644 index 00000000..c83f7619 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/SuggestionResponse.java @@ -0,0 +1,355 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * SuggestionResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class SuggestionResponse { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_POSTBACK_DATA = "postbackData"; + @SerializedName(SERIALIZED_NAME_POSTBACK_DATA) + @javax.annotation.Nullable + private byte[] postbackData; + + public static final String SERIALIZED_NAME_PAIRED_MESSAGE_ID = "pairedMessageId"; + @SerializedName(SERIALIZED_NAME_PAIRED_MESSAGE_ID) + @javax.annotation.Nullable + private String pairedMessageId; + + public SuggestionResponse() { + } + + public SuggestionResponse text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * The text associated with the suggestion response. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public SuggestionResponse postbackData(@javax.annotation.Nullable byte[] postbackData) { + this.postbackData = postbackData; + return this; + } + + /** + * Base64 payload the customer receives when the reply is clicked. + * @return postbackData + */ + @javax.annotation.Nullable + public byte[] getPostbackData() { + return postbackData; + } + + public void setPostbackData(@javax.annotation.Nullable byte[] postbackData) { + this.postbackData = postbackData; + } + + + public SuggestionResponse pairedMessageId(@javax.annotation.Nullable String pairedMessageId) { + this.pairedMessageId = pairedMessageId; + return this; + } + + /** + * Corresponding parent message ID (MT). + * @return pairedMessageId + */ + @javax.annotation.Nullable + public String getPairedMessageId() { + return pairedMessageId; + } + + public void setPairedMessageId(@javax.annotation.Nullable String pairedMessageId) { + this.pairedMessageId = pairedMessageId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SuggestionResponse instance itself + */ + public SuggestionResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SuggestionResponse suggestionResponse = (SuggestionResponse) o; + return Objects.equals(this.text, suggestionResponse.text) && + Arrays.equals(this.postbackData, suggestionResponse.postbackData) && + Objects.equals(this.pairedMessageId, suggestionResponse.pairedMessageId)&& + Objects.equals(this.additionalProperties, suggestionResponse.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(text, Arrays.hashCode(postbackData), pairedMessageId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SuggestionResponse {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" postbackData: ").append(toIndentedString(postbackData)).append("\n"); + sb.append(" pairedMessageId: ").append(toIndentedString(pairedMessageId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("text", "postbackData", "pairedMessageId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SuggestionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SuggestionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in SuggestionResponse is not found in the empty JSON string", SuggestionResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("pairedMessageId") != null && !jsonObj.get("pairedMessageId").isJsonNull()) && !jsonObj.get("pairedMessageId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `pairedMessageId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pairedMessageId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SuggestionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SuggestionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SuggestionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SuggestionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SuggestionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SuggestionResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SuggestionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SuggestionResponse + * @throws IOException if the JSON string is invalid with respect to SuggestionResponse + */ + public static SuggestionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SuggestionResponse.class); + } + + /** + * Convert an instance of SuggestionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +