Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Messente API Library

- Messente API version: 2.0.0
- Java artifact version: 4.1.0
- Java artifact version: 4.2.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.

Expand All @@ -12,7 +12,7 @@ Install Messente API library via Maven, Gradle, Ivy or manual build.
### Gradle

```groovy
compile "com.messente.api:messente-api:4.1.0"
compile "com.messente.api:messente-api:4.2.0"
```

### Maven
Expand All @@ -21,15 +21,15 @@ compile "com.messente.api:messente-api:4.1.0"
<dependency>
<groupId>com.messente.api</groupId>
<artifactId>messente-api</artifactId>
<version>4.1.0</version>
<version>4.2.0</version>
<type>pom</type>
</dependency>
```

### Ivy

```xml
<dependency org='com.messente.api' name='messente-api' rev='4.1.0'>
<dependency org='com.messente.api' name='messente-api' rev='4.2.0'>
<artifact name='messente-api' ext='pom' ></artifact>
</dependency>
```
Expand All @@ -44,7 +44,7 @@ mvn clean package

Install

- `target/messente-api-4.1.0.jar`
- `target/messente-api-4.2.0.jar`
- `target/lib/*.jar`

## Features
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'

group = 'com.messente.api'
version = '4.1.0'
version = '4.2.0'

ext {
jakarta_annotation_version = "1.3.5"
Expand Down Expand Up @@ -109,6 +109,8 @@ sourceSets {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}

javadoc {
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
organization := "com.messente.api",
name := "messente-api",
version := "4.1.0",
version := "4.2.0",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>messente-api</artifactId>
<packaging>jar</packaging>
<name>messente-api</name>
<version>4.1.0</version>
<version>4.2.0</version>
<url>https://github.com/messente/messente-api-java</url>
<description>Java library for Messente API</description>
<scm>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/messente/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private void init() {
json = new JSON();

// Set default User-Agent.
setUserAgent("OpenAPI-Generator/4.1.0/java");
setUserAgent("OpenAPI-Generator/4.2.0/java");

authentications = new HashMap<String, Authentication>();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/messente/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.0";
public static final String VERSION = "4.2.0";

private static ApiClient defaultApiClient = new ApiClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,50 @@ public void setMessages(List<BulkOmniMessageCreateSuccessResponseMessagesInner>
this.messages = messages;
}

/**
* 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<String, Object> 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 BulkOmniMessageCreateSuccessResponse instance itself
*/
public BulkOmniMessageCreateSuccessResponse putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> 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
Expand All @@ -98,19 +142,21 @@ public boolean equals(Object o) {
return false;
}
BulkOmniMessageCreateSuccessResponse bulkOmniMessageCreateSuccessResponse = (BulkOmniMessageCreateSuccessResponse) o;
return Objects.equals(this.messages, bulkOmniMessageCreateSuccessResponse.messages);
return Objects.equals(this.messages, bulkOmniMessageCreateSuccessResponse.messages)&&
Objects.equals(this.additionalProperties, bulkOmniMessageCreateSuccessResponse.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(messages);
return Objects.hash(messages, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BulkOmniMessageCreateSuccessResponse {\n");
sb.append(" messages: ").append(toIndentedString(messages)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!BulkOmniMessageCreateSuccessResponse.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BulkOmniMessageCreateSuccessResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}

// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : BulkOmniMessageCreateSuccessResponse.openapiRequiredFields) {
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
Expand Down Expand Up @@ -195,14 +233,57 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
@Override
public void write(JsonWriter out, BulkOmniMessageCreateSuccessResponse value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> 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 BulkOmniMessageCreateSuccessResponse read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
BulkOmniMessageCreateSuccessResponse instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry<String, JsonElement> 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("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();
Expand Down
103 changes: 92 additions & 11 deletions src/main/java/com/messente/api/BulkOmnimessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,50 @@ public void setMessages(List<Omnimessage> messages) {
this.messages = messages;
}

/**
* 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<String, Object> 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 BulkOmnimessage instance itself
*/
public BulkOmnimessage putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map<String, Object> 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
Expand All @@ -98,19 +142,21 @@ public boolean equals(Object o) {
return false;
}
BulkOmnimessage bulkOmnimessage = (BulkOmnimessage) o;
return Objects.equals(this.messages, bulkOmnimessage.messages);
return Objects.equals(this.messages, bulkOmnimessage.messages)&&
Objects.equals(this.additionalProperties, bulkOmnimessage.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(messages);
return Objects.hash(messages, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BulkOmnimessage {\n");
sb.append(" messages: ").append(toIndentedString(messages)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!BulkOmnimessage.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BulkOmnimessage` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}
}

// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : BulkOmnimessage.openapiRequiredFields) {
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
Expand Down Expand Up @@ -195,14 +233,57 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
@Override
public void write(JsonWriter out, BulkOmnimessage value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additional properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry<String, Object> 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 BulkOmnimessage read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
BulkOmnimessage instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry<String, JsonElement> 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("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();
Expand Down
Loading