Skip to content

Commit

Permalink
Merge branch 'master' into SMS-6439
Browse files Browse the repository at this point in the history
  • Loading branch information
rajneeshkatkam-plivo committed Nov 9, 2023
2 parents 126dcae + 0ec00c0 commit 029c5ea
Show file tree
Hide file tree
Showing 22 changed files with 608 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Change Log
## [5.35.0](https://github.com/plivo/plivo-java/tree/v5.35.0) (2023-11-03)
## [5.36.0](https://github.com/plivo/plivo-java/tree/v5.36.0) (2023-11-09)
**Feature - registration_status field**
- Added new param `registration_status` in LIST Campaign APIs


## [5.35.0](https://github.com/plivo/plivo-java/tree/v5.35.0) (2023-11-08)
**Verify Service**
-Added Support for Verify Service Public API'S
-Create Session API(POST): To create a verify session (2FA). Allowed params recipient, method, channel, callback_url, app_uuid
-Get Session API(GET): To retrieve a particular session
-List Sessions : To retrieve all the sessions
-Validate Session : To validate OTP for a particular session
## [5.34.0](https://github.com/plivo/plivo-java/tree/v5.34.0) (2023-11-03)
**Feature - TollFree Verification API Support**
- API support for Create, Update, Get, Delete and List Tollfree Verification.
Expand All @@ -27,6 +34,7 @@
- Added new params `template`, `template_json_string` and new message_type `whatsapp` to [send message API](https://www.plivo.com/docs/sms/api/message#send-a-message)
- Added new `message_states` (`read`), `message_type`(`whatsapp`), `conversation_id`, `conversation_origin`, `conversation_expiry_timestamp` in [list all messages API](https://www.plivo.com/docs/sms/api/message#list-all-messages) and [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message) response


## [5.30.0](https://github.com/plivo/plivo-java/tree/v5.30.0) (2023-08-25)
**Feature - Added New Param 'carrier_fees', 'carrier_fees_rate', 'destination_network' in Get Message and List Message APIs**
- Added new params on message get and list response
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ The Plivo Java SDK makes it simpler to integrate communications into your Java a

### To Install Stable release

You can use this SDK by adding it as a dependency in your dependency management tool. Alternatively, you can use the [JAR file](https://search.maven.org/remotecontent?filepath=com/plivo/plivo-java/5.35.0/plivo-java-5.35.0.jar).
You can use this SDK by adding it as a dependency in your dependency management tool. Alternatively, you can use the [JAR file](https://search.maven.org/remotecontent?filepath=com/plivo/plivo-java/5.36.0/plivo-java-5.36.0.jar).

If you are using Maven, use the following XML to include the Plivo SDK as a dependency.

```xml
<dependency>
<groupId>com.plivo</groupId>
<artifactId>plivo-java</artifactId>
<version>5.35.0</version>
<version>5.36.0</version>
</dependency>
```

If you are using Gradle, use the following line in your dependencies.
```
compile 'com.plivo:plivo-java:5.35.0'
compile 'com.plivo:plivo-java:5.36.0'
```

### To Install Beta release
Expand Down
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.35.0
version=5.36.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.35.0</version>
<version>5.36.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
18 changes: 18 additions & 0 deletions src/main/java/com/plivo/api/PlivoAPIService.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
import com.plivo.api.models.profile.*;
import com.plivo.api.models.token.TokenCreateResponse;
import com.plivo.api.models.token.TokenCreator;
import com.plivo.api.models.verify_session.SessionCreateResponse;
import com.plivo.api.models.verify_session.SessionCreator;
import com.plivo.api.models.verify_session.ValidateSession;
import com.plivo.api.models.verify_session.VerifySession;
import com.plivo.api.models.verify_session.VerifySessionList;
import com.plivo.api.models.tollfree_verification.*;
import com.plivo.api.models.verify.*;
import okhttp3.RequestBody;
Expand Down Expand Up @@ -741,6 +746,19 @@ Call<ResponseBody> callStreamDeleteSpecific(@Path("authId") String authId, @Path
Call<CallStreamGetSpecificResponse> callStreamGetSpecific(@Path("authId") String authId, @Path("callId") String callId,
@Path("streamId") String streamId);

@POST("Account/{authId}/Verify/Session/")
Call<SessionCreateResponse> sessionSend(@Path("authId") String authId,
@Body SessionCreator sessionCreator);

@POST("Account/{authId}/Verify/Session/{id}/")
Call<SessionCreateResponse> validateSession(@Path("authId") String authId, @Path("id") String id,
@Body ValidateSession validateSession);
@GET("Account/{authId}/Verify/Session/{id}/")
Call<VerifySession> sessionGet(@Path("authId") String authId, @Path("id") String id);

@GET("Account/{authId}/Verify/Session/")
Call<ListResponse<VerifySessionList>> sessionList(@Path("authId") String authId,
@QueryMap Map<String, Object> sessionListRequest);
//Verify
@POST("Account/{authId}/VerifiedCallerId/")
Call<InitiateVerifyResponse> initiateVerify(@Path("authId") String authId, @Body InitiateVerify initiateVerify);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/plivo/api/models/base/ListResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ListResponse<T> extends BaseResponse {
private List<T> brands;
private List<T> profiles;
private List<T> campaigns;
private List<T> sessions;

/**
* @return The pagination-related metadata for this list response.
Expand All @@ -42,4 +43,7 @@ public List<T> getProfiles() {
public List<T> getCampaigns() {
return campaigns;
}
public List<T> getSessions() {
return sessions;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.plivo.api.models.verify_session;

public class AttemptCharge {
private String attemptUuid;
private String channel;
private String charge;

public AttemptCharge( String attemptUuid, String channel, String charge) {
this.attemptUuid = attemptUuid;
this.channel = channel;
this.charge = charge;
}

public AttemptCharge(){}

public String getAttemptUuid(){
return attemptUuid;
}
public String getChannel(){
return channel;
}
public String getCharge(){
return charge;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.plivo.api.models.verify_session;

public class AttemptDetail {
private String channel;
private String attemptUuid;
private String status;
private String time;

public AttemptDetail(String channel, String attemptUuid, String status, String time) {
this.channel = channel;
this.attemptUuid = attemptUuid;
this.status = status;
this.time = time;
}

public AttemptDetail(){}

public String getChannel(){
return channel;
}
public String getAttemptUuid(){
return attemptUuid;
}
public String getStatus(){
return status;
}
public String getTime(){
return time;
}
}
26 changes: 26 additions & 0 deletions src/main/java/com/plivo/api/models/verify_session/Charges.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.plivo.api.models.verify_session;

import java.util.List;

public class Charges {
private String totalCharge;
private String validationCharge;
private List<AttemptCharge> attemptCharges;

public Charges(String totalCharge, String validationCharge, List<AttemptCharge> attemptCharges) {
this.totalCharge = totalCharge;
this.validationCharge = validationCharge;
this.attemptCharges = attemptCharges;
}

public Charges(){}
public String getTotalCharge(){
return totalCharge;
}
public String getValidationCharge(){
return validationCharge;
}
public List<AttemptCharge> getAttemptCharges(){
return attemptCharges;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.plivo.api.models.verify_session;

import com.plivo.api.models.base.BaseResponse;

import java.util.List;

public class SessionCreateResponse extends BaseResponse {
String sessionUuid;

public String getSessionUuid() {
return sessionUuid;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.plivo.api.models.verify_session;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.plivo.api.models.base.Creator;
import com.plivo.api.util.Utils;
import retrofit2.Call;

import java.net.URL;

public class SessionCreator extends Creator < SessionCreateResponse > {
@JsonProperty("app_uuid")
private String appUUID;
@JsonProperty("recipient")
private String recipient;
@JsonProperty("channel")
private String channel;
@JsonProperty("url")
private String url;
private String method = "POST";

SessionCreator(String appUUID,String recipient, String channel, String url, String method) {
if (!Utils.allNotNull(recipient)) {
throw new IllegalArgumentException("recipient should not be null");
}
this.appUUID = appUUID;
this.recipient = recipient;
this.channel = channel;
this.url = url;
this.method = method;
}

public String appUUID() {
return this.appUUID;
}
public String recipient() {
return this.recipient;
}
public String channel() {
return this.channel;
}
public String url() {
return this.url;
}
public String method() {
return this.method;
}

@Override
protected Call<SessionCreateResponse> obtainCall() {
return client().getApiService().sessionSend(client().getAuthId(), this);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.plivo.api.models.verify_session;

import com.plivo.api.models.base.Getter;
import com.plivo.api.models.message.Message;
import retrofit2.Call;

public class SessionGetter extends Getter<VerifySession> {
public SessionGetter(String id) {
super(id);
}

@Override
protected Call<VerifySession> obtainCall() {
return client().getApiService().sessionGet(client().getAuthId(), id);
}
}
100 changes: 100 additions & 0 deletions src/main/java/com/plivo/api/models/verify_session/SessionLister.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.plivo.api.models.verify_session;

import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.base.ListResponse;
import com.plivo.api.util.PropertyFilter;
import retrofit2.Call;
import retrofit2.Response;

import com.plivo.api.models.base.Lister;

import java.io.IOException;
import java.lang.reflect.Field;
import java.util.Date;

public class SessionLister extends Lister<VerifySessionList> {
private String subaccount = null;
private PropertyFilter<Date> sessionTime = null;
private String status = null;
private String country = null;
private String alias = null;
private String appUuid = null;
private String recipient = null;
public String subaccount() {
return this.subaccount;
}
public String status() {
return this.status;
}
public String country() {
return this.country;
}
public String alias() {
return this.alias;
}
public String appUuid() {
return this.appUuid;
}
public String recipient() {
return this.recipient;
}
public PropertyFilter<Date> sessionTime() {
return this.sessionTime;
}
public SessionLister subaccount(final String subaccount) {
this.subaccount = subaccount;
return this;
}
public SessionLister status(final String status) {
this.status = status;
return this;
}
public SessionLister country(final String country) {
this.country = country;
return this;
}
public SessionLister alias(final String alias) {
this.alias = alias;
return this;
}
public SessionLister appUuid(final String appUuid) {
this.appUuid = appUuid;
return this;
}
public SessionLister recipient(final String recipient) {
this.recipient = recipient;
return this;
}
public SessionLister sessionTime(final PropertyFilter<Date> sessionTime) {
this.sessionTime = sessionTime;
return this;
}
@Override
/**
* Actually list instances of the resource.
*/
public ListResponse<VerifySessionList> list() throws IOException, PlivoRestException {
validate();
Response<ListResponse<VerifySessionList>> response = obtainCall().execute();
handleResponse(response);

try
{
Field meta = response.body().getClass().getDeclaredField("meta");
meta.setAccessible(true);
meta.set(response.body(), new SessionMeta(response.body().getMeta()));
}
catch(Exception e)
{
e.printStackTrace();
}

return response.body();
}

@Override
protected Call<ListResponse<VerifySessionList>> obtainCall() {
return client().getApiService().sessionList(client().getAuthId(), toMap());
}

}
Loading

0 comments on commit 029c5ea

Please sign in to comment.