Skip to content

Commit de7e0db

Browse files
Merge pull request #18 from messente/travis
Release version 4.2.0
2 parents 99e16ff + 408a4b6 commit de7e0db

52 files changed

Lines changed: 4244 additions & 516 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Messente API Library
22

33
- Messente API version: 2.0.0
4-
- Java artifact version: 4.1.0
4+
- Java artifact version: 4.2.0
55

66
[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.
77

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

1414
```groovy
15-
compile "com.messente.api:messente-api:4.1.0"
15+
compile "com.messente.api:messente-api:4.2.0"
1616
```
1717

1818
### Maven
@@ -21,15 +21,15 @@ compile "com.messente.api:messente-api:4.1.0"
2121
<dependency>
2222
<groupId>com.messente.api</groupId>
2323
<artifactId>messente-api</artifactId>
24-
<version>4.1.0</version>
24+
<version>4.2.0</version>
2525
<type>pom</type>
2626
</dependency>
2727
```
2828

2929
### Ivy
3030

3131
```xml
32-
<dependency org='com.messente.api' name='messente-api' rev='4.1.0'>
32+
<dependency org='com.messente.api' name='messente-api' rev='4.2.0'>
3333
<artifact name='messente-api' ext='pom' ></artifact>
3434
</dependency>
3535
```
@@ -44,7 +44,7 @@ mvn clean package
4444

4545
Install
4646

47-
- `target/messente-api-4.1.0.jar`
47+
- `target/messente-api-4.2.0.jar`
4848
- `target/lib/*.jar`
4949

5050
## Features

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ apply plugin: 'java'
2222
apply plugin: 'com.diffplug.spotless'
2323

2424
group = 'com.messente.api'
25-
version = '4.1.0'
25+
version = '4.2.0'
2626

2727
ext {
2828
jakarta_annotation_version = "1.3.5"
@@ -109,6 +109,8 @@ sourceSets {
109109
java {
110110
sourceCompatibility = JavaVersion.VERSION_1_8
111111
targetCompatibility = JavaVersion.VERSION_1_8
112+
withJavadocJar()
113+
withSourcesJar()
112114
}
113115

114116
javadoc {

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "com.messente.api",
44
name := "messente-api",
5-
version := "4.1.0",
5+
version := "4.2.0",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>messente-api</artifactId>
66
<packaging>jar</packaging>
77
<name>messente-api</name>
8-
<version>4.1.0</version>
8+
<version>4.2.0</version>
99
<url>https://github.com/messente/messente-api-java</url>
1010
<description>Java library for Messente API</description>
1111
<scm>

src/main/java/com/messente/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void init() {
141141
json = new JSON();
142142

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

146146
authentications = new HashMap<String, Authentication>();
147147
}

src/main/java/com/messente/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
1717
public class Configuration {
18-
public static final String VERSION = "4.1.0";
18+
public static final String VERSION = "4.2.0";
1919

2020
private static ApiClient defaultApiClient = new ApiClient();
2121

src/main/java/com/messente/api/BulkOmniMessageCreateSuccessResponse.java

Lines changed: 92 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,50 @@ public void setMessages(List<BulkOmniMessageCreateSuccessResponseMessagesInner>
8787
this.messages = messages;
8888
}
8989

90+
/**
91+
* A container for additional, undeclared properties.
92+
* This is a holder for any undeclared properties as specified with
93+
* the 'additionalProperties' keyword in the OAS document.
94+
*/
95+
private Map<String, Object> additionalProperties;
96+
97+
/**
98+
* Set the additional (undeclared) property with the specified name and value.
99+
* If the property does not already exist, create it otherwise replace it.
100+
*
101+
* @param key name of the property
102+
* @param value value of the property
103+
* @return the BulkOmniMessageCreateSuccessResponse instance itself
104+
*/
105+
public BulkOmniMessageCreateSuccessResponse putAdditionalProperty(String key, Object value) {
106+
if (this.additionalProperties == null) {
107+
this.additionalProperties = new HashMap<String, Object>();
108+
}
109+
this.additionalProperties.put(key, value);
110+
return this;
111+
}
112+
113+
/**
114+
* Return the additional (undeclared) property.
115+
*
116+
* @return a map of objects
117+
*/
118+
public Map<String, Object> getAdditionalProperties() {
119+
return additionalProperties;
120+
}
121+
122+
/**
123+
* Return the additional (undeclared) property with the specified name.
124+
*
125+
* @param key name of the property
126+
* @return an object
127+
*/
128+
public Object getAdditionalProperty(String key) {
129+
if (this.additionalProperties == null) {
130+
return null;
131+
}
132+
return this.additionalProperties.get(key);
133+
}
90134

91135

92136
@Override
@@ -98,19 +142,21 @@ public boolean equals(Object o) {
98142
return false;
99143
}
100144
BulkOmniMessageCreateSuccessResponse bulkOmniMessageCreateSuccessResponse = (BulkOmniMessageCreateSuccessResponse) o;
101-
return Objects.equals(this.messages, bulkOmniMessageCreateSuccessResponse.messages);
145+
return Objects.equals(this.messages, bulkOmniMessageCreateSuccessResponse.messages)&&
146+
Objects.equals(this.additionalProperties, bulkOmniMessageCreateSuccessResponse.additionalProperties);
102147
}
103148

104149
@Override
105150
public int hashCode() {
106-
return Objects.hash(messages);
151+
return Objects.hash(messages, additionalProperties);
107152
}
108153

109154
@Override
110155
public String toString() {
111156
StringBuilder sb = new StringBuilder();
112157
sb.append("class BulkOmniMessageCreateSuccessResponse {\n");
113158
sb.append(" messages: ").append(toIndentedString(messages)).append("\n");
159+
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
114160
sb.append("}");
115161
return sb.toString();
116162
}
@@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
153199
}
154200
}
155201

156-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
157-
// check to see if the JSON string contains additional fields
158-
for (Map.Entry<String, JsonElement> entry : entries) {
159-
if (!BulkOmniMessageCreateSuccessResponse.openapiFields.contains(entry.getKey())) {
160-
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()));
161-
}
162-
}
163-
164202
// check to make sure all required properties/fields are present in the JSON string
165203
for (String requiredField : BulkOmniMessageCreateSuccessResponse.openapiRequiredFields) {
166204
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
@@ -195,14 +233,57 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
195233
@Override
196234
public void write(JsonWriter out, BulkOmniMessageCreateSuccessResponse value) throws IOException {
197235
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
236+
obj.remove("additionalProperties");
237+
// serialize additional properties
238+
if (value.getAdditionalProperties() != null) {
239+
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
240+
if (entry.getValue() instanceof String)
241+
obj.addProperty(entry.getKey(), (String) entry.getValue());
242+
else if (entry.getValue() instanceof Number)
243+
obj.addProperty(entry.getKey(), (Number) entry.getValue());
244+
else if (entry.getValue() instanceof Boolean)
245+
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
246+
else if (entry.getValue() instanceof Character)
247+
obj.addProperty(entry.getKey(), (Character) entry.getValue());
248+
else {
249+
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
250+
if (jsonElement.isJsonArray()) {
251+
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
252+
} else {
253+
obj.add(entry.getKey(), jsonElement.getAsJsonObject());
254+
}
255+
}
256+
}
257+
}
198258
elementAdapter.write(out, obj);
199259
}
200260

201261
@Override
202262
public BulkOmniMessageCreateSuccessResponse read(JsonReader in) throws IOException {
203263
JsonElement jsonElement = elementAdapter.read(in);
204264
validateJsonElement(jsonElement);
205-
return thisAdapter.fromJsonTree(jsonElement);
265+
JsonObject jsonObj = jsonElement.getAsJsonObject();
266+
// store additional fields in the deserialized instance
267+
BulkOmniMessageCreateSuccessResponse instance = thisAdapter.fromJsonTree(jsonObj);
268+
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
269+
if (!openapiFields.contains(entry.getKey())) {
270+
if (entry.getValue().isJsonPrimitive()) { // primitive type
271+
if (entry.getValue().getAsJsonPrimitive().isString())
272+
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
273+
else if (entry.getValue().getAsJsonPrimitive().isNumber())
274+
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
275+
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
276+
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
277+
else
278+
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
279+
} else if (entry.getValue().isJsonArray()) {
280+
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
281+
} else { // JSON object
282+
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
283+
}
284+
}
285+
}
286+
return instance;
206287
}
207288

208289
}.nullSafe();

src/main/java/com/messente/api/BulkOmnimessage.java

Lines changed: 92 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,50 @@ public void setMessages(List<Omnimessage> messages) {
8787
this.messages = messages;
8888
}
8989

90+
/**
91+
* A container for additional, undeclared properties.
92+
* This is a holder for any undeclared properties as specified with
93+
* the 'additionalProperties' keyword in the OAS document.
94+
*/
95+
private Map<String, Object> additionalProperties;
96+
97+
/**
98+
* Set the additional (undeclared) property with the specified name and value.
99+
* If the property does not already exist, create it otherwise replace it.
100+
*
101+
* @param key name of the property
102+
* @param value value of the property
103+
* @return the BulkOmnimessage instance itself
104+
*/
105+
public BulkOmnimessage putAdditionalProperty(String key, Object value) {
106+
if (this.additionalProperties == null) {
107+
this.additionalProperties = new HashMap<String, Object>();
108+
}
109+
this.additionalProperties.put(key, value);
110+
return this;
111+
}
112+
113+
/**
114+
* Return the additional (undeclared) property.
115+
*
116+
* @return a map of objects
117+
*/
118+
public Map<String, Object> getAdditionalProperties() {
119+
return additionalProperties;
120+
}
121+
122+
/**
123+
* Return the additional (undeclared) property with the specified name.
124+
*
125+
* @param key name of the property
126+
* @return an object
127+
*/
128+
public Object getAdditionalProperty(String key) {
129+
if (this.additionalProperties == null) {
130+
return null;
131+
}
132+
return this.additionalProperties.get(key);
133+
}
90134

91135

92136
@Override
@@ -98,19 +142,21 @@ public boolean equals(Object o) {
98142
return false;
99143
}
100144
BulkOmnimessage bulkOmnimessage = (BulkOmnimessage) o;
101-
return Objects.equals(this.messages, bulkOmnimessage.messages);
145+
return Objects.equals(this.messages, bulkOmnimessage.messages)&&
146+
Objects.equals(this.additionalProperties, bulkOmnimessage.additionalProperties);
102147
}
103148

104149
@Override
105150
public int hashCode() {
106-
return Objects.hash(messages);
151+
return Objects.hash(messages, additionalProperties);
107152
}
108153

109154
@Override
110155
public String toString() {
111156
StringBuilder sb = new StringBuilder();
112157
sb.append("class BulkOmnimessage {\n");
113158
sb.append(" messages: ").append(toIndentedString(messages)).append("\n");
159+
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
114160
sb.append("}");
115161
return sb.toString();
116162
}
@@ -153,14 +199,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
153199
}
154200
}
155201

156-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
157-
// check to see if the JSON string contains additional fields
158-
for (Map.Entry<String, JsonElement> entry : entries) {
159-
if (!BulkOmnimessage.openapiFields.contains(entry.getKey())) {
160-
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()));
161-
}
162-
}
163-
164202
// check to make sure all required properties/fields are present in the JSON string
165203
for (String requiredField : BulkOmnimessage.openapiRequiredFields) {
166204
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
@@ -195,14 +233,57 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
195233
@Override
196234
public void write(JsonWriter out, BulkOmnimessage value) throws IOException {
197235
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
236+
obj.remove("additionalProperties");
237+
// serialize additional properties
238+
if (value.getAdditionalProperties() != null) {
239+
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
240+
if (entry.getValue() instanceof String)
241+
obj.addProperty(entry.getKey(), (String) entry.getValue());
242+
else if (entry.getValue() instanceof Number)
243+
obj.addProperty(entry.getKey(), (Number) entry.getValue());
244+
else if (entry.getValue() instanceof Boolean)
245+
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
246+
else if (entry.getValue() instanceof Character)
247+
obj.addProperty(entry.getKey(), (Character) entry.getValue());
248+
else {
249+
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
250+
if (jsonElement.isJsonArray()) {
251+
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
252+
} else {
253+
obj.add(entry.getKey(), jsonElement.getAsJsonObject());
254+
}
255+
}
256+
}
257+
}
198258
elementAdapter.write(out, obj);
199259
}
200260

201261
@Override
202262
public BulkOmnimessage read(JsonReader in) throws IOException {
203263
JsonElement jsonElement = elementAdapter.read(in);
204264
validateJsonElement(jsonElement);
205-
return thisAdapter.fromJsonTree(jsonElement);
265+
JsonObject jsonObj = jsonElement.getAsJsonObject();
266+
// store additional fields in the deserialized instance
267+
BulkOmnimessage instance = thisAdapter.fromJsonTree(jsonObj);
268+
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
269+
if (!openapiFields.contains(entry.getKey())) {
270+
if (entry.getValue().isJsonPrimitive()) { // primitive type
271+
if (entry.getValue().getAsJsonPrimitive().isString())
272+
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
273+
else if (entry.getValue().getAsJsonPrimitive().isNumber())
274+
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
275+
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
276+
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
277+
else
278+
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
279+
} else if (entry.getValue().isJsonArray()) {
280+
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
281+
} else { // JSON object
282+
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
283+
}
284+
}
285+
}
286+
return instance;
206287
}
207288

208289
}.nullSafe();

0 commit comments

Comments
 (0)