Skip to content

Commit

Permalink
versionChange
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-plivo committed May 31, 2024
2 parents c2cbf2e + 9c4c75c commit aef936a
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 31 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Change Log

## [5.42.0](https://github.com/plivo/plivo-java/tree/v5.42.0) (2024-05-09)
## [5.43.0](https://github.com/plivo/plivo-java/tree/v5.43.0) (2024-05-31)
**Feature - Number Masking Feature Added**
- Number Masking APIs added to create, update, delete and list sessions

## [5.42.0](https://github.com/plivo/plivo-java/tree/v5.42.0) (2024-05-20)
**Feature - Adding support for location whatsapp messages**
- Added new param `location` to [send message API](https://www.plivo.com/docs/sms/api/message#send-a-message) to support location `whatsapp` messages
- Added new param `location` in templates to support location based templated messages

## [5.41.0](https://github.com/plivo/plivo-java/tree/v5.41.0) (2024-05-07)
**Feature - Adding support for interactive whatsapp messages**
- Added new param `interactive` to [send message API](https://www.plivo.com/docs/sms/api/message#send-a-message) to support interactive `whatsapp` messages
Expand Down
369 changes: 366 additions & 3 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Written manually.

version=5.42.0
version=5.43.0
groupId=com.plivo
artifactId=plivo-java

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.plivo</groupId>
<artifactId>plivo-java</artifactId>
<version>5.42.0</version>
<version>5.43.0</version>
<name>plivo-java</name>
<description>A Java SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML</description>
<licenses>
Expand Down
43 changes: 43 additions & 0 deletions src/main/java/com/plivo/api/models/message/Location.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.plivo.api.models.message;

public class Location {
private String latitude;
private String longitude;
private String name;
private String address;

public Location() {
}

public String getLatitude() {
return latitude;
}

public void setLatitude(String latitude) {
this.latitude = latitude;
}

public String getLongitude() {
return longitude;
}

public void setLongitude(String longitude) {
this.longitude = longitude;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}
}
58 changes: 34 additions & 24 deletions src/main/java/com/plivo/api/models/message/MessageCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class MessageCreator extends Creator < MessageCreateResponse > {
private Template template;
@JsonProperty("interactive")
private Interactive interactive;
@JsonProperty("location")
private Location location;

/**
* @param source The phone number that will be shown as the sender ID.
Expand Down Expand Up @@ -261,12 +263,6 @@ public MessageCreator dlt_template_category(final String dlt_template_category)
* @param template_json_string This is the template passed as a json string in the whatsapp message request.
*/
public MessageCreator template_json_string(final String template_json_string) {
if (this.type == null) {
this.type = MessageType.WHATSAPP;
} else {
if (this.type.equals(MessageType.SMS) || (this.type.equals(MessageType.MMS)))
throw new IllegalArgumentException("type parameter should be whatsapp");
}
if (Utils.allNotNull(this.template)) {
throw new IllegalArgumentException("template parameter is already set");
}
Expand All @@ -291,12 +287,6 @@ public MessageCreator template_json_string(final String template_json_string) {
* @param temp This is the template passed as a template object in the whatsapp message request.
*/
public MessageCreator template(final Template temp) {
if (this.type == null) {
this.type = MessageType.WHATSAPP;
} else {
if (this.type.equals(MessageType.SMS) || (this.type.equals(MessageType.MMS)))
throw new IllegalArgumentException("type parameter should be whatsapp");
}
if (Utils.allNotNull(this.template)) {
throw new IllegalArgumentException("template parameter is already set");
}
Expand All @@ -316,12 +306,6 @@ public MessageCreator template(final Template temp) {
* @param intractv This is the interactive messages passed as a interactive object in the whatsapp message request.
*/
public MessageCreator interactive(final Interactive intractv) {
if (this.type == null) {
this.type = MessageType.WHATSAPP;
} else {
if (type.equals(MessageType.SMS) || (type.equals(MessageType.MMS)))
throw new IllegalArgumentException("type parameter should be whatsapp");
}
if (Utils.allNotNull(this.interactive)) {
throw new IllegalArgumentException("interacitve parameter is already set");
}
Expand All @@ -334,12 +318,6 @@ public MessageCreator interactive(final Interactive intractv) {
* @param interactive_json_string This is the interactive message passed as a json string in the whatsapp message request.
*/
public MessageCreator interactive_json_string(final String interactive_json_string) {
if (this.type == null) {
this.type = MessageType.WHATSAPP;
} else {
if (this.type.equals(MessageType.SMS) || (this.type.equals(MessageType.MMS)))
throw new IllegalArgumentException("type parameter should be whatsapp");
}
if (Utils.allNotNull(this.interactive)) {
throw new IllegalArgumentException("interactive parameter is already set");
}
Expand All @@ -354,6 +332,38 @@ public MessageCreator interactive_json_string(final String interactive_json_stri
return this;
}

/**
* @param location_json_string This is the location passed as a json string in the whatsapp message request.
*/
public MessageCreator location_json_string(final String location_json_string) {
if (Utils.allNotNull(this.location)) {
throw new IllegalArgumentException("location parameter is already set");
}
try {
ObjectMapper objectMapper = new ObjectMapper();
Location loc = objectMapper.readValue(location_json_string, Location.class);
this.location = loc;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException("failed to read location");
}
return this;
}

/**
* @param loc This is the location passed as a location object in the whatsapp message request.
*/
public MessageCreator location(final Location loc) {
if (Utils.allNotNull(this.location)) {
throw new IllegalArgumentException("location parameter is already set");
}
this.location = loc;

return this;
}



@Override
protected Call < MessageCreateResponse > obtainCall() {
return client().getApiService().messageSend(client().getAuthId(), this);
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/plivo/api/models/message/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Parameter {
private String payload;
private Currency currency;
private DateTime date_time;
private Location location;

public Parameter() {
}
Expand Down Expand Up @@ -62,4 +63,12 @@ public void setDate_time(DateTime date_time) {
this.date_time = date_time;
}

public Location getLocation() {
return location;
}

public void setLocation(Location location) {
this.location = location;
}

}
2 changes: 1 addition & 1 deletion src/main/resources/com/plivo/api/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.41.0
5.43.0

0 comments on commit aef936a

Please sign in to comment.