diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 04aab50..e068305 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -51,6 +51,7 @@ docs/OmniMessageCreateSuccessResponse.md docs/Omnimessage.md docs/OmnimessageApi.md docs/OmnimessageMessagesInner.md +docs/PriceInfo.md docs/Priority.md docs/SMS.md docs/StatisticsApi.md @@ -139,6 +140,7 @@ src/main/java/com/messente/api/OmniMessageCreateSuccessResponse.java src/main/java/com/messente/api/Omnimessage.java src/main/java/com/messente/api/OmnimessageApi.java src/main/java/com/messente/api/OmnimessageMessagesInner.java +src/main/java/com/messente/api/PriceInfo.java src/main/java/com/messente/api/Priority.java src/main/java/com/messente/api/SMS.java src/main/java/com/messente/api/StatisticsApi.java diff --git a/README.md b/README.md index cff7282..47f000c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Messente API Library - Messente API version: 2.0.0 -- Java artifact version: 4.0.0 +- Java artifact version: 4.1.0 [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. @@ -12,7 +12,7 @@ Install Messente API library via Maven, Gradle, Ivy or manual build. ### Gradle ```groovy -compile "com.messente.api:messente-api:4.0.0" +compile "com.messente.api:messente-api:4.1.0" ``` ### Maven @@ -21,7 +21,7 @@ compile "com.messente.api:messente-api:4.0.0" com.messente.api messente-api - 4.0.0 + 4.1.0 pom ``` @@ -29,7 +29,7 @@ compile "com.messente.api:messente-api:4.0.0" ### Ivy ```xml - + ``` @@ -44,7 +44,7 @@ mvn clean package Install -- `target/messente-api-4.0.0.jar` +- `target/messente-api-4.1.0.jar` - `target/lib/*.jar` ## Features diff --git a/api/openapi.yaml b/api/openapi.yaml index afea7e9..5945126 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -2459,13 +2459,23 @@ components: description: A container for successful delivery report response example: statuses: - - err: 0 + - price_info: + parts_count: 6 + total_price: total_price + part_price: part_price + err: 0 + sender: sender channel: sms message_id: message_id error: error status: ACK timestamp: 2000-01-23T04:56:07.000+00:00 - - err: 0 + - price_info: + parts_count: 6 + total_price: total_price + part_price: part_price + err: 0 + sender: sender channel: sms message_id: message_id error: error @@ -2495,7 +2505,12 @@ components: DeliveryResult: description: A delivery report example: + price_info: + parts_count: 6 + total_price: total_price + part_price: part_price err: 0 + sender: sender channel: sms message_id: message_id error: error @@ -2521,6 +2536,33 @@ components: description: When this status was received by Omnichannel API format: date-time type: string + price_info: + $ref: '#/components/schemas/PriceInfo' + sender: + description: the sender of the message + type: string + type: object + PriceInfo: + description: Contains price information for the message. This value is *null* + if the message is still being processed + example: + parts_count: 6 + total_price: total_price + part_price: part_price + properties: + part_price: + description: price per message part - relevant mostly for SMS + type: string + parts_count: + description: the number of parts the message consists of + type: integer + total_price: + description: total price for the message + type: string + required: + - part_price + - parts_count + - total_price type: object Status: description: |- diff --git a/build.gradle b/build.gradle index 37679e9..12dd7d4 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'com.messente.api' -version = '4.0.0' +version = '4.1.0' ext { jakarta_annotation_version = "1.3.5" @@ -113,6 +113,7 @@ java { javadoc { options.tags = [ "http.response.details:a:Http Response Details" ] + options.addStringOption('Xdoclint:none', '-quiet') } // Use spotless plugin to automatically format code, remove unused import, etc diff --git a/build.sbt b/build.sbt index 9bef085..4b106f7 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.messente.api", name := "messente-api", - version := "4.0.0", + version := "4.1.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/docs/DeliveryResult.md b/docs/DeliveryResult.md index 0cf5536..24e3161 100644 --- a/docs/DeliveryResult.md +++ b/docs/DeliveryResult.md @@ -14,6 +14,8 @@ A delivery report |**error** | **String** | Human-readable description of what went wrong, *null* in case of success or if the message has not been processed yet | [optional] | |**err** | **ErrorCodeOmnichannelMachine** | | [optional] | |**timestamp** | **OffsetDateTime** | When this status was received by Omnichannel API | [optional] | +|**priceInfo** | [**PriceInfo**](PriceInfo.md) | | [optional] | +|**sender** | **String** | the sender of the message | [optional] | diff --git a/docs/PriceInfo.md b/docs/PriceInfo.md new file mode 100644 index 0000000..b7f3d0e --- /dev/null +++ b/docs/PriceInfo.md @@ -0,0 +1,16 @@ + + +# PriceInfo + +Contains price information for the message. This value is *null* if the message is still being processed + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**partPrice** | **String** | price per message part - relevant mostly for SMS | | +|**partsCount** | **Integer** | the number of parts the message consists of | | +|**totalPrice** | **String** | total price for the message | | + + + diff --git a/pom.xml b/pom.xml index b72be28..2405522 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ messente-api jar messente-api - 4.0.0 + 4.1.0 https://github.com/messente/messente-api-java Java library for Messente API diff --git a/src/main/java/com/messente/ApiClient.java b/src/main/java/com/messente/ApiClient.java index 442f4ff..da545aa 100644 --- a/src/main/java/com/messente/ApiClient.java +++ b/src/main/java/com/messente/ApiClient.java @@ -141,7 +141,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/4.0.0/java"); + setUserAgent("OpenAPI-Generator/4.1.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/com/messente/Configuration.java b/src/main/java/com/messente/Configuration.java index c8ecfc7..d18188f 100644 --- a/src/main/java/com/messente/Configuration.java +++ b/src/main/java/com/messente/Configuration.java @@ -15,7 +15,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0") public class Configuration { - public static final String VERSION = "4.0.0"; + public static final String VERSION = "4.1.0"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/com/messente/JSON.java b/src/main/java/com/messente/JSON.java index febf209..0c3b072 100644 --- a/src/main/java/com/messente/JSON.java +++ b/src/main/java/com/messente/JSON.java @@ -131,6 +131,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.messente.api.OmniMessageCreateSuccessResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.messente.api.Omnimessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.messente.api.OmnimessageMessagesInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.messente.api.PriceInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.messente.api.SMS.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.messente.api.StatisticsReport.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.messente.api.StatisticsReportSettings.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/messente/api/DeliveryResult.java b/src/main/java/com/messente/api/DeliveryResult.java index 05f8c5b..fa4b732 100644 --- a/src/main/java/com/messente/api/DeliveryResult.java +++ b/src/main/java/com/messente/api/DeliveryResult.java @@ -21,6 +21,7 @@ import com.google.gson.stream.JsonWriter; import com.messente.api.Channel; import com.messente.api.ErrorCodeOmnichannelMachine; +import com.messente.api.PriceInfo; import com.messente.api.Status; import java.io.IOException; import java.time.OffsetDateTime; @@ -81,6 +82,14 @@ public class DeliveryResult { @SerializedName(SERIALIZED_NAME_TIMESTAMP) private OffsetDateTime timestamp; + public static final String SERIALIZED_NAME_PRICE_INFO = "price_info"; + @SerializedName(SERIALIZED_NAME_PRICE_INFO) + private PriceInfo priceInfo; + + public static final String SERIALIZED_NAME_SENDER = "sender"; + @SerializedName(SERIALIZED_NAME_SENDER) + private String sender; + public DeliveryResult() { } @@ -198,6 +207,44 @@ public void setTimestamp(OffsetDateTime timestamp) { } + public DeliveryResult priceInfo(PriceInfo priceInfo) { + this.priceInfo = priceInfo; + return this; + } + + /** + * Get priceInfo + * @return priceInfo + **/ + @javax.annotation.Nullable + public PriceInfo getPriceInfo() { + return priceInfo; + } + + public void setPriceInfo(PriceInfo priceInfo) { + this.priceInfo = priceInfo; + } + + + public DeliveryResult sender(String sender) { + this.sender = sender; + return this; + } + + /** + * the sender of the message + * @return sender + **/ + @javax.annotation.Nullable + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + @Override public boolean equals(Object o) { @@ -213,7 +260,9 @@ public boolean equals(Object o) { Objects.equals(this.messageId, deliveryResult.messageId) && Objects.equals(this.error, deliveryResult.error) && Objects.equals(this.err, deliveryResult.err) && - Objects.equals(this.timestamp, deliveryResult.timestamp); + Objects.equals(this.timestamp, deliveryResult.timestamp) && + Objects.equals(this.priceInfo, deliveryResult.priceInfo) && + Objects.equals(this.sender, deliveryResult.sender); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -222,7 +271,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(status, channel, messageId, error, err, timestamp); + return Objects.hash(status, channel, messageId, error, err, timestamp, priceInfo, sender); } private static int hashCodeNullable(JsonNullable a) { @@ -242,6 +291,8 @@ public String toString() { sb.append(" error: ").append(toIndentedString(error)).append("\n"); sb.append(" err: ").append(toIndentedString(err)).append("\n"); sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" priceInfo: ").append(toIndentedString(priceInfo)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); sb.append("}"); return sb.toString(); } @@ -270,6 +321,8 @@ private String toIndentedString(Object o) { openapiFields.add("error"); openapiFields.add("err"); openapiFields.add("timestamp"); + openapiFields.add("price_info"); + openapiFields.add("sender"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -314,6 +367,13 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("err") != null && !jsonObj.get("err").isJsonNull()) { ErrorCodeOmnichannelMachine.validateJsonElement(jsonObj.get("err")); } + // validate the optional field `price_info` + if (jsonObj.get("price_info") != null && !jsonObj.get("price_info").isJsonNull()) { + PriceInfo.validateJsonElement(jsonObj.get("price_info")); + } + if ((jsonObj.get("sender") != null && !jsonObj.get("sender").isJsonNull()) && !jsonObj.get("sender").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sender` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sender").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/messente/api/PriceInfo.java b/src/main/java/com/messente/api/PriceInfo.java new file mode 100644 index 0000000..7781112 --- /dev/null +++ b/src/main/java/com/messente/api/PriceInfo.java @@ -0,0 +1,271 @@ +/* + * Messente API + * [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + * + * The version of the OpenAPI document: 2.0.0 + * Contact: messente@messente.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.messente.api; + +import java.util.Objects; +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.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.messente.JSON; + +/** + * Contains price information for the message. This value is *null* if the message is still being processed + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0") +public class PriceInfo { + public static final String SERIALIZED_NAME_PART_PRICE = "part_price"; + @SerializedName(SERIALIZED_NAME_PART_PRICE) + private String partPrice; + + public static final String SERIALIZED_NAME_PARTS_COUNT = "parts_count"; + @SerializedName(SERIALIZED_NAME_PARTS_COUNT) + private Integer partsCount; + + public static final String SERIALIZED_NAME_TOTAL_PRICE = "total_price"; + @SerializedName(SERIALIZED_NAME_TOTAL_PRICE) + private String totalPrice; + + public PriceInfo() { + } + + public PriceInfo partPrice(String partPrice) { + this.partPrice = partPrice; + return this; + } + + /** + * price per message part - relevant mostly for SMS + * @return partPrice + **/ + @javax.annotation.Nonnull + public String getPartPrice() { + return partPrice; + } + + public void setPartPrice(String partPrice) { + this.partPrice = partPrice; + } + + + public PriceInfo partsCount(Integer partsCount) { + this.partsCount = partsCount; + return this; + } + + /** + * the number of parts the message consists of + * @return partsCount + **/ + @javax.annotation.Nonnull + public Integer getPartsCount() { + return partsCount; + } + + public void setPartsCount(Integer partsCount) { + this.partsCount = partsCount; + } + + + public PriceInfo totalPrice(String totalPrice) { + this.totalPrice = totalPrice; + return this; + } + + /** + * total price for the message + * @return totalPrice + **/ + @javax.annotation.Nonnull + public String getTotalPrice() { + return totalPrice; + } + + public void setTotalPrice(String totalPrice) { + this.totalPrice = totalPrice; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PriceInfo priceInfo = (PriceInfo) o; + return Objects.equals(this.partPrice, priceInfo.partPrice) && + Objects.equals(this.partsCount, priceInfo.partsCount) && + Objects.equals(this.totalPrice, priceInfo.totalPrice); + } + + @Override + public int hashCode() { + return Objects.hash(partPrice, partsCount, totalPrice); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PriceInfo {\n"); + sb.append(" partPrice: ").append(toIndentedString(partPrice)).append("\n"); + sb.append(" partsCount: ").append(toIndentedString(partsCount)).append("\n"); + sb.append(" totalPrice: ").append(toIndentedString(totalPrice)).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(); + openapiFields.add("part_price"); + openapiFields.add("parts_count"); + openapiFields.add("total_price"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("part_price"); + openapiRequiredFields.add("parts_count"); + openapiRequiredFields.add("total_price"); + } + + /** + * 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 PriceInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PriceInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PriceInfo is not found in the empty JSON string", PriceInfo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PriceInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PriceInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PriceInfo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("part_price").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `part_price` to be a primitive type in the JSON string but got `%s`", jsonObj.get("part_price").toString())); + } + if (!jsonObj.get("total_price").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `total_price` to be a primitive type in the JSON string but got `%s`", jsonObj.get("total_price").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PriceInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PriceInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PriceInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PriceInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PriceInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PriceInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of PriceInfo + * @throws IOException if the JSON string is invalid with respect to PriceInfo + */ + public static PriceInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PriceInfo.class); + } + + /** + * Convert an instance of PriceInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +