From 653f3272982c06bc2fe28357a5c8695056ce817f Mon Sep 17 00:00:00 2001 From: renoldthomas-plivo Date: Thu, 10 Oct 2024 20:40:15 +0530 Subject: [PATCH 1/7] fix for get & list all media --- .../java/com/plivo/api/PlivoAPIService.java | 4 +- .../com/plivo/api/models/media/Media.java | 20 ++--- .../plivo/api/models/media/MediaGetter.java | 2 + .../plivo/api/models/media/MediaLister.java | 2 +- .../plivo/api/models/message/MmsMedia.java | 81 ++++++++++++------- .../api/models/message/MmsMediaGetter.java | 10 +-- .../api/models/message/MmsMediaLister.java | 2 +- 7 files changed, 66 insertions(+), 55 deletions(-) diff --git a/src/main/java/com/plivo/api/PlivoAPIService.java b/src/main/java/com/plivo/api/PlivoAPIService.java index 9e20dca4..3f84bd49 100644 --- a/src/main/java/com/plivo/api/PlivoAPIService.java +++ b/src/main/java/com/plivo/api/PlivoAPIService.java @@ -216,10 +216,10 @@ Call> messageList(@Path("authId") String authId, Call messageGet(@Path("authId") String authId, @Path("id") String id); @GET("Account/{authId}/Message/{id}/Media/") - Call> mmsMediaList(@Path("authId") String authId, @Path("id") String id); + Call> mmsMediaList(@Path("authId") String authId, @Path("id") String id, @QueryMap Map mediaListRequest); @GET("Account/{authId}/Message/{id}/Media/{media_id}/") - Call mmsMediaGet(@Path("authId") String authId, @Path("id") String id, @Path("media_id") String media_id); + Call mmsMediaGet(@Path("authId") String authId, @Path("id") String id); @DELETE("Account/{authId}/Message/{id}/Media/") Call mmsMediaDelete(@Path("authId") String authId, @Path("id") String id); diff --git a/src/main/java/com/plivo/api/models/media/Media.java b/src/main/java/com/plivo/api/models/media/Media.java index 3b78b1ef..67f7f08b 100644 --- a/src/main/java/com/plivo/api/models/media/Media.java +++ b/src/main/java/com/plivo/api/models/media/Media.java @@ -1,8 +1,10 @@ package com.plivo.api.models.media; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.plivo.api.exceptions.ResourceNotFoundException; import com.plivo.api.models.base.BaseResource; +@JsonIgnoreProperties(value = {"id"}) public class Media extends BaseResource { private String mediaId; @@ -10,17 +12,13 @@ public class Media extends BaseResource { private String contentType; private int size; private String uploadTime; - private String url; - - private String status; - private int statusCode; + private String mediaUrl; public static MediaUploader creator( String[] fileNames) throws ResourceNotFoundException { return new MediaUploader(fileNames); } - public static MediaGetter getter(String id) { return new MediaGetter(id); } @@ -49,16 +47,8 @@ public String getUploadTime() { return uploadTime; } - public String getUrl() { - return url; - } - - public String getStatus() { - return status; - } - - public int getStatusCode() { - return statusCode; + public String getMediaUrl() { + return mediaUrl; } @Override diff --git a/src/main/java/com/plivo/api/models/media/MediaGetter.java b/src/main/java/com/plivo/api/models/media/MediaGetter.java index 548659b2..495cd36d 100644 --- a/src/main/java/com/plivo/api/models/media/MediaGetter.java +++ b/src/main/java/com/plivo/api/models/media/MediaGetter.java @@ -1,9 +1,11 @@ package com.plivo.api.models.media; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.plivo.api.models.base.Getter; import retrofit2.Call; public class MediaGetter extends Getter { +@JsonIgnoreProperties(value = {"id"}) public MediaGetter(String id) { super(id); } diff --git a/src/main/java/com/plivo/api/models/media/MediaLister.java b/src/main/java/com/plivo/api/models/media/MediaLister.java index cbd75019..600b1c92 100644 --- a/src/main/java/com/plivo/api/models/media/MediaLister.java +++ b/src/main/java/com/plivo/api/models/media/MediaLister.java @@ -2,7 +2,7 @@ import com.plivo.api.models.base.ListResponse; import com.plivo.api.models.base.Lister; -import com.plivo.api.models.media.Media; + import retrofit2.Call; public class MediaLister extends Lister { diff --git a/src/main/java/com/plivo/api/models/message/MmsMedia.java b/src/main/java/com/plivo/api/models/message/MmsMedia.java index b5ce40ca..d986c509 100644 --- a/src/main/java/com/plivo/api/models/message/MmsMedia.java +++ b/src/main/java/com/plivo/api/models/message/MmsMedia.java @@ -1,36 +1,57 @@ package com.plivo.api.models.message; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.plivo.api.models.base.BaseResource; +@JsonIgnoreProperties(value = {"id"}) public class MmsMedia extends BaseResource { - private String content_type; - private String media_id; - private String media_url; - private String message_uuid; - private long size; - - public String getContentType() { - return content_type; - } - - public String getMediaId() { - return media_id; - } - - public String getMediaUrl() { - return media_url; - } - - public String getMessageUuid() { - return message_uuid; - } - - public long getSize() { - return size; - } - - @Override - public String getId() { - return getMediaId(); - } + + private String contentType; + private String fileName; + private String mediaId; + private String mediaUrl; + private int size; + private String messageUuid; + private String uploadTime; + + public static MmsMediaLister getter(String id) { + return new MmsMediaLister(id); + } + + public static MmsMediaLister lister(String id) { + return new MmsMediaLister(id); + } + + public String getContentType() { + return contentType; + } + + public String getFileName() { + return fileName; + } + + public String getMediaId() { + return mediaId; + } + + public String getMediaUrl() { + return mediaUrl; + } + + public int getSize() { + return size; + } + + public String getMessageUuid() { + return messageUuid; + } + + public String getUploadTime() { + return uploadTime; + } + + @Override + public String getId() { + return mediaId; + } } \ No newline at end of file diff --git a/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java b/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java index 86efb075..8960d10d 100644 --- a/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java +++ b/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java @@ -4,15 +4,13 @@ import retrofit2.Call; public class MmsMediaGetter extends Getter { - private String media_id; - public MmsMediaGetter(String id, String media_id) { - super(id); - this.media_id = media_id; - } + public MmsMediaGetter(String id) { + super(id); + } @Override protected Call obtainCall() { - return client().getApiService().mmsMediaGet(client().getAuthId(), id, media_id); + return client().getApiService().mmsMediaGet(client().getAuthId(), id); } } \ No newline at end of file diff --git a/src/main/java/com/plivo/api/models/message/MmsMediaLister.java b/src/main/java/com/plivo/api/models/message/MmsMediaLister.java index cc61ddd9..6cdf3267 100644 --- a/src/main/java/com/plivo/api/models/message/MmsMediaLister.java +++ b/src/main/java/com/plivo/api/models/message/MmsMediaLister.java @@ -14,6 +14,6 @@ public MmsMediaLister(String id) { @Override protected Call> obtainCall() { - return client().getApiService().mmsMediaList(client().getAuthId(), id); + return client().getApiService().mmsMediaList(client().getAuthId(), id, toMap()); } } \ No newline at end of file From 1f17cd8752aaa64b2b0d192598f7fdc7cee53c4b Mon Sep 17 00:00:00 2001 From: renoldthomas-plivo Date: Fri, 11 Oct 2024 18:22:25 +0530 Subject: [PATCH 2/7] Fix for List Media using message_uuid --- .../java/com/plivo/api/PlivoAPIService.java | 4 +- .../com/plivo/api/models/media/Media.java | 1 + .../plivo/api/models/message/MmsMedia.java | 89 +++++++++---------- .../api/models/message/MmsMediaGetter.java | 10 ++- .../api/models/message/MmsMediaLister.java | 2 +- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/main/java/com/plivo/api/PlivoAPIService.java b/src/main/java/com/plivo/api/PlivoAPIService.java index 3f84bd49..69fa15de 100644 --- a/src/main/java/com/plivo/api/PlivoAPIService.java +++ b/src/main/java/com/plivo/api/PlivoAPIService.java @@ -218,8 +218,8 @@ Call> messageList(@Path("authId") String authId, @GET("Account/{authId}/Message/{id}/Media/") Call> mmsMediaList(@Path("authId") String authId, @Path("id") String id, @QueryMap Map mediaListRequest); - @GET("Account/{authId}/Message/{id}/Media/{media_id}/") - Call mmsMediaGet(@Path("authId") String authId, @Path("id") String id); + @GET("Account/{authId}/Message/{id}/Media/{media_id}/") + Call mmsMediaGet(@Path("authId") String authId, @Path("id") String id, @Path("media_id") String media_id); @DELETE("Account/{authId}/Message/{id}/Media/") Call mmsMediaDelete(@Path("authId") String authId, @Path("id") String id); diff --git a/src/main/java/com/plivo/api/models/media/Media.java b/src/main/java/com/plivo/api/models/media/Media.java index 67f7f08b..8ae9a3ec 100644 --- a/src/main/java/com/plivo/api/models/media/Media.java +++ b/src/main/java/com/plivo/api/models/media/Media.java @@ -26,6 +26,7 @@ public static MediaGetter getter(String id) { public static MediaLister lister() { return new MediaLister(); } + public String getMediaId() { return mediaId; diff --git a/src/main/java/com/plivo/api/models/message/MmsMedia.java b/src/main/java/com/plivo/api/models/message/MmsMedia.java index d986c509..5bdd0c5c 100644 --- a/src/main/java/com/plivo/api/models/message/MmsMedia.java +++ b/src/main/java/com/plivo/api/models/message/MmsMedia.java @@ -1,57 +1,54 @@ package com.plivo.api.models.message; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.plivo.api.models.base.BaseResource; @JsonIgnoreProperties(value = {"id"}) +@JsonInclude(JsonInclude.Include.NON_NULL) public class MmsMedia extends BaseResource { - - private String contentType; + private String mediaId; private String fileName; - private String mediaId; + private String contentType; + private long size; + private String uploadTime; private String mediaUrl; - private int size; private String messageUuid; - private String uploadTime; - - public static MmsMediaLister getter(String id) { - return new MmsMediaLister(id); - } - - public static MmsMediaLister lister(String id) { - return new MmsMediaLister(id); - } - - public String getContentType() { - return contentType; - } - - public String getFileName() { - return fileName; - } - - public String getMediaId() { - return mediaId; - } - - public String getMediaUrl() { - return mediaUrl; - } - - public int getSize() { - return size; - } - - public String getMessageUuid() { - return messageUuid; - } - - public String getUploadTime() { - return uploadTime; - } - - @Override - public String getId() { - return mediaId; - } + + public static MmsMediaLister listMedia(String message_uuid) { + return new MmsMediaLister(message_uuid); + } + + public String getContentType() { + return contentType; + } + + public String getMediaId() { + return mediaId; + } + + public String getMediaUrl() { + return mediaUrl; + } + + public String getMessageUuid() { + return messageUuid; + } + + public long getSize() { + return size; + } + + public String getFileName() { + return fileName; + } + + public String getUploadTime() { + return uploadTime; + } + + @Override + public String getId() { + return getMediaId(); + } } \ No newline at end of file diff --git a/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java b/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java index 8960d10d..86efb075 100644 --- a/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java +++ b/src/main/java/com/plivo/api/models/message/MmsMediaGetter.java @@ -4,13 +4,15 @@ import retrofit2.Call; public class MmsMediaGetter extends Getter { + private String media_id; - public MmsMediaGetter(String id) { - super(id); - } + public MmsMediaGetter(String id, String media_id) { + super(id); + this.media_id = media_id; + } @Override protected Call obtainCall() { - return client().getApiService().mmsMediaGet(client().getAuthId(), id); + return client().getApiService().mmsMediaGet(client().getAuthId(), id, media_id); } } \ No newline at end of file diff --git a/src/main/java/com/plivo/api/models/message/MmsMediaLister.java b/src/main/java/com/plivo/api/models/message/MmsMediaLister.java index 6cdf3267..70064dc4 100644 --- a/src/main/java/com/plivo/api/models/message/MmsMediaLister.java +++ b/src/main/java/com/plivo/api/models/message/MmsMediaLister.java @@ -1,11 +1,11 @@ package com.plivo.api.models.message; import com.plivo.api.models.base.ListResponse; - import com.plivo.api.models.base.Lister; import retrofit2.Call; public class MmsMediaLister extends Lister { + private String id; public MmsMediaLister(String id) { From a7636e269140affaa6c7a7c907805656a5d50f21 Mon Sep 17 00:00:00 2001 From: renoldthomas-plivo Date: Fri, 11 Oct 2024 18:39:39 +0530 Subject: [PATCH 3/7] Fix for removing additional fields in MMS API response --- src/main/java/com/plivo/api/models/media/Media.java | 2 ++ src/main/java/com/plivo/api/models/media/MediaResponse.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/plivo/api/models/media/Media.java b/src/main/java/com/plivo/api/models/media/Media.java index 8ae9a3ec..1ab2a23d 100644 --- a/src/main/java/com/plivo/api/models/media/Media.java +++ b/src/main/java/com/plivo/api/models/media/Media.java @@ -1,10 +1,12 @@ package com.plivo.api.models.media; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.plivo.api.exceptions.ResourceNotFoundException; import com.plivo.api.models.base.BaseResource; @JsonIgnoreProperties(value = {"id"}) +@JsonInclude(JsonInclude.Include.NON_NULL) public class Media extends BaseResource { private String mediaId; diff --git a/src/main/java/com/plivo/api/models/media/MediaResponse.java b/src/main/java/com/plivo/api/models/media/MediaResponse.java index d0d1af60..12f12c7a 100644 --- a/src/main/java/com/plivo/api/models/media/MediaResponse.java +++ b/src/main/java/com/plivo/api/models/media/MediaResponse.java @@ -1,13 +1,15 @@ package com.plivo.api.models.media; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.plivo.api.models.base.BaseResponse; import java.util.List; +//@JsonIgnoreProperties(value = {"status_code","status"}) public class MediaResponse extends BaseResponse { private List objects; - + @JsonIgnoreProperties(value = {"status_code","status"}) public List getObjects() { return objects; } From b965dff38d4cba0852067e601e2022a68bb285f4 Mon Sep 17 00:00:00 2001 From: renoldthomas-plivo Date: Mon, 14 Oct 2024 13:08:09 +0530 Subject: [PATCH 4/7] reverted tech debt change - to prevent customer impact and intimiation --- src/main/java/com/plivo/api/models/media/Media.java | 2 +- src/main/java/com/plivo/api/models/media/MediaGetter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/plivo/api/models/media/Media.java b/src/main/java/com/plivo/api/models/media/Media.java index 1ab2a23d..47607f8b 100644 --- a/src/main/java/com/plivo/api/models/media/Media.java +++ b/src/main/java/com/plivo/api/models/media/Media.java @@ -5,7 +5,7 @@ import com.plivo.api.exceptions.ResourceNotFoundException; import com.plivo.api.models.base.BaseResource; -@JsonIgnoreProperties(value = {"id"}) +// @JsonIgnoreProperties(value = {"id"}) @JsonInclude(JsonInclude.Include.NON_NULL) public class Media extends BaseResource { diff --git a/src/main/java/com/plivo/api/models/media/MediaGetter.java b/src/main/java/com/plivo/api/models/media/MediaGetter.java index 495cd36d..3d7cb841 100644 --- a/src/main/java/com/plivo/api/models/media/MediaGetter.java +++ b/src/main/java/com/plivo/api/models/media/MediaGetter.java @@ -5,7 +5,7 @@ import retrofit2.Call; public class MediaGetter extends Getter { -@JsonIgnoreProperties(value = {"id"}) +// @JsonIgnoreProperties(value = {"id"}) public MediaGetter(String id) { super(id); } From 82074db446a7b556773359fcbd47838db481aa5a Mon Sep 17 00:00:00 2001 From: renoldthomas-plivo Date: Mon, 14 Oct 2024 13:20:32 +0530 Subject: [PATCH 5/7] Updated SDK Version to 5.45.2 - MMS API Fixes --- CHANGELOG.md | 5 +++++ README.md | 6 +++--- pom.properties | 2 +- pom.xml | 2 +- src/main/resources/com/plivo/api/version.txt | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83efe1ae..12fa4620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Change Log +## [5.45.2](https://github.com/plivo/plivo-java/tree/v5.45.2) (2024-10-14) +**Feature - Dtmf param in Create, Get and List Session** +- Fix MMS API parameters returning NULL and match response with Public APIs +- Change in Code Snippet for List Media using Message UUID + ## [5.45.1](https://github.com/plivo/plivo-java/tree/v5.45.1) (2024-10-10) **Feature - Dtmf param in Create, Get and List Session** - Support for the `dtmf` parameter in voice verify session request diff --git a/README.md b/README.md index 74976adc..590fe5ff 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ 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.45.1/plivo-java-5.45.1.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.45.2/plivo-java-5.45.2.jar). If you are using Maven, use the following XML to include the Plivo SDK as a dependency. @@ -19,13 +19,13 @@ If you are using Maven, use the following XML to include the Plivo SDK as a depe com.plivo plivo-java - 5.45.1 + 5.45.2 ``` If you are using Gradle, use the following line in your dependencies. ``` -compile 'com.plivo:plivo-java:5.45.1' +compile 'com.plivo:plivo-java:5.45.2' ``` ### To Install Beta release diff --git a/pom.properties b/pom.properties index 2795cc05..495fdcbe 100644 --- a/pom.properties +++ b/pom.properties @@ -1,6 +1,6 @@ # Written manually. -version=5.45.1 +version=5.45.2 groupId=com.plivo artifactId=plivo-java diff --git a/pom.xml b/pom.xml index deb56acc..a17b448d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.plivo plivo-java - 5.45.1 + 5.45.2 plivo-java A Java SDK to make voice calls & send SMS using Plivo and to generate Plivo XML diff --git a/src/main/resources/com/plivo/api/version.txt b/src/main/resources/com/plivo/api/version.txt index 8f04f20f..8c727092 100644 --- a/src/main/resources/com/plivo/api/version.txt +++ b/src/main/resources/com/plivo/api/version.txt @@ -1 +1 @@ -5.45.1 +5.45.2 From 8b17f4527efab9707008145e0d446b05030a2b0e Mon Sep 17 00:00:00 2001 From: renoldthomas-plivo Date: Tue, 15 Oct 2024 16:11:13 +0530 Subject: [PATCH 6/7] Updated Change Log --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12fa4620..57138533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log ## [5.45.2](https://github.com/plivo/plivo-java/tree/v5.45.2) (2024-10-14) -**Feature - Dtmf param in Create, Get and List Session** +**Feature - Fix all null returning params in MMS API Responses** - Fix MMS API parameters returning NULL and match response with Public APIs - Change in Code Snippet for List Media using Message UUID From ba5123f96d2b6ec64a7bb2ed5c17489f92bedcf3 Mon Sep 17 00:00:00 2001 From: renoldthomas-plivo Date: Thu, 17 Oct 2024 13:20:04 +0530 Subject: [PATCH 7/7] removed unused references + retained url field --- src/main/java/com/plivo/api/models/media/Media.java | 10 ++++++---- .../java/com/plivo/api/models/media/MediaGetter.java | 2 -- .../java/com/plivo/api/models/media/MediaResponse.java | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/plivo/api/models/media/Media.java b/src/main/java/com/plivo/api/models/media/Media.java index 47607f8b..504172d4 100644 --- a/src/main/java/com/plivo/api/models/media/Media.java +++ b/src/main/java/com/plivo/api/models/media/Media.java @@ -1,12 +1,9 @@ package com.plivo.api.models.media; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; import com.plivo.api.exceptions.ResourceNotFoundException; import com.plivo.api.models.base.BaseResource; -// @JsonIgnoreProperties(value = {"id"}) -@JsonInclude(JsonInclude.Include.NON_NULL) + public class Media extends BaseResource { private String mediaId; @@ -15,6 +12,7 @@ public class Media extends BaseResource { private int size; private String uploadTime; private String mediaUrl; + private String url; public static MediaUploader creator( String[] fileNames) throws ResourceNotFoundException { @@ -54,6 +52,10 @@ public String getMediaUrl() { return mediaUrl; } + public String getUrl() { + return url; + } + @Override public String getId() { return mediaId; diff --git a/src/main/java/com/plivo/api/models/media/MediaGetter.java b/src/main/java/com/plivo/api/models/media/MediaGetter.java index 3d7cb841..548659b2 100644 --- a/src/main/java/com/plivo/api/models/media/MediaGetter.java +++ b/src/main/java/com/plivo/api/models/media/MediaGetter.java @@ -1,11 +1,9 @@ package com.plivo.api.models.media; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.plivo.api.models.base.Getter; import retrofit2.Call; public class MediaGetter extends Getter { -// @JsonIgnoreProperties(value = {"id"}) public MediaGetter(String id) { super(id); } diff --git a/src/main/java/com/plivo/api/models/media/MediaResponse.java b/src/main/java/com/plivo/api/models/media/MediaResponse.java index 12f12c7a..602da97d 100644 --- a/src/main/java/com/plivo/api/models/media/MediaResponse.java +++ b/src/main/java/com/plivo/api/models/media/MediaResponse.java @@ -5,11 +5,10 @@ import java.util.List; -//@JsonIgnoreProperties(value = {"status_code","status"}) + public class MediaResponse extends BaseResponse { private List objects; - @JsonIgnoreProperties(value = {"status_code","status"}) public List getObjects() { return objects; }