diff --git a/config/checkstyle/checkstyle-suppressions.xml b/config/checkstyle/checkstyle-suppressions.xml new file mode 100644 index 0000000..883bbd2 --- /dev/null +++ b/config/checkstyle/checkstyle-suppressions.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..83adbc8 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 14b7871..0b8c8fa 100644 --- a/pom.xml +++ b/pom.xml @@ -124,15 +124,38 @@ - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0 - - - + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0 + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.3.1 + + config/checkstyle/checkstyle.xml + config/checkstyle/checkstyle-suppressions.xml + checkstyle.suppressions.file + + + + lint-check + validate + + UTF-8 + true + true + false + + + check + + + + + diff --git a/src/main/java/co/novu/api/blueprints/BlueprintsHandler.java b/src/main/java/co/novu/api/blueprints/BlueprintsHandler.java index 42cfc30..8c607d5 100644 --- a/src/main/java/co/novu/api/blueprints/BlueprintsHandler.java +++ b/src/main/java/co/novu/api/blueprints/BlueprintsHandler.java @@ -8,15 +8,15 @@ import java.io.IOException; -public class BlueprintsHandler { +public final class BlueprintsHandler { private final RestHandler restHandler; private final BlueprintsApi blueprintsApi; - public BlueprintsHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.blueprintsApi = restHandler.buildRetrofit().create(BlueprintsApi.class); + public BlueprintsHandler(final RestHandler handler) { + this.restHandler = handler; + this.blueprintsApi = handler.buildRetrofit().create(BlueprintsApi.class); } public BlueprintsByCategoryResponse getBlueprintsByCategory() throws IOException, NovuNetworkException { @@ -24,8 +24,8 @@ public BlueprintsByCategoryResponse getBlueprintsByCategory() throws IOException return restHandler.extractResponse(response); } - public Blueprint getBlueprint(String templateId) throws IOException, NovuNetworkException { + public Blueprint getBlueprint(final String templateId) throws IOException, NovuNetworkException { Response response = blueprintsApi.getBlueprint(templateId).execute(); return restHandler.extractResponse(response); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Blueprint.java b/src/main/java/co/novu/api/blueprints/pojos/Blueprint.java index f46c430..febdca3 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Blueprint.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Blueprint.java @@ -40,4 +40,4 @@ public class Blueprint { @SerializedName("__v") private Long version; private NotificationGroup notificationGroup; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Content.java b/src/main/java/co/novu/api/blueprints/pojos/Content.java index e60bca3..a8ab2dd 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Content.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Content.java @@ -7,4 +7,4 @@ public class Content { private String type; private String content; private Styles styles; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Filters.java b/src/main/java/co/novu/api/blueprints/pojos/Filters.java index 3379a52..75c6d72 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Filters.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Filters.java @@ -10,4 +10,4 @@ public class Filters { private List children; @SerializedName("_id") private String id; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/General.java b/src/main/java/co/novu/api/blueprints/pojos/General.java index 71a7e17..06a7614 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/General.java +++ b/src/main/java/co/novu/api/blueprints/pojos/General.java @@ -8,4 +8,4 @@ public class General { private String name; private List blueprints; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Metadata.java b/src/main/java/co/novu/api/blueprints/pojos/Metadata.java index 47ce612..f98540e 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Metadata.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Metadata.java @@ -5,4 +5,4 @@ @Data public class Metadata { private Timed timed; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Popular.java b/src/main/java/co/novu/api/blueprints/pojos/Popular.java index c5648d6..53e2c2b 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Popular.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Popular.java @@ -8,4 +8,4 @@ public class Popular { private String name; private List blueprints; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Styles.java b/src/main/java/co/novu/api/blueprints/pojos/Styles.java index 88d6971..52929af 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Styles.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Styles.java @@ -5,4 +5,4 @@ @Data public class Styles { private String textAlign; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Template.java b/src/main/java/co/novu/api/blueprints/pojos/Template.java index e03e7dd..342ef5d 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Template.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Template.java @@ -29,4 +29,4 @@ public class Template { private String updatedAt; @SerializedName("__v") private Long version; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Timed.java b/src/main/java/co/novu/api/blueprints/pojos/Timed.java index ee4a3c0..a7da6ce 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Timed.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Timed.java @@ -8,4 +8,4 @@ public class Timed { private List weekDays; private List monthDays; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/pojos/Variables.java b/src/main/java/co/novu/api/blueprints/pojos/Variables.java index 48b087c..e61f531 100644 --- a/src/main/java/co/novu/api/blueprints/pojos/Variables.java +++ b/src/main/java/co/novu/api/blueprints/pojos/Variables.java @@ -8,4 +8,4 @@ public class Variables { private String type; private Boolean required; private String id; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/responses/BlueprintsByCategoryResponse.java b/src/main/java/co/novu/api/blueprints/responses/BlueprintsByCategoryResponse.java index f698b89..374f451 100644 --- a/src/main/java/co/novu/api/blueprints/responses/BlueprintsByCategoryResponse.java +++ b/src/main/java/co/novu/api/blueprints/responses/BlueprintsByCategoryResponse.java @@ -5,4 +5,4 @@ @Data public class BlueprintsByCategoryResponse { private BlueprintsResponseData data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/blueprints/responses/BlueprintsResponseData.java b/src/main/java/co/novu/api/blueprints/responses/BlueprintsResponseData.java index f71ba13..d541542 100644 --- a/src/main/java/co/novu/api/blueprints/responses/BlueprintsResponseData.java +++ b/src/main/java/co/novu/api/blueprints/responses/BlueprintsResponseData.java @@ -1,4 +1,5 @@ package co.novu.api.blueprints.responses; + import co.novu.api.blueprints.pojos.General; import co.novu.api.blueprints.pojos.Popular; import lombok.Data; @@ -9,4 +10,4 @@ public class BlueprintsResponseData { private List general; private Popular popular; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/changes/ChangeHandler.java b/src/main/java/co/novu/api/changes/ChangeHandler.java index f12f75a..790f57b 100644 --- a/src/main/java/co/novu/api/changes/ChangeHandler.java +++ b/src/main/java/co/novu/api/changes/ChangeHandler.java @@ -15,24 +15,25 @@ import java.util.Map; @RequiredArgsConstructor -public class ChangeHandler { +public final class ChangeHandler { private final RestHandler restHandler; private final ChangeApi changeApi; - private static final String ENDPOINT = "changes"; - - public ChangeHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.changeApi = restHandler.buildRetrofit().create(ChangeApi.class); + public ChangeHandler(final RestHandler handler) { + this.restHandler = handler; + this.changeApi = handler.buildRetrofit().create(ChangeApi.class); } - - public GetChangesResponse getChanges(GetChangesRequest request) throws IOException, NovuNetworkException { + public GetChangesResponse getChanges(final GetChangesRequest request) throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (request.getPage() != null) params.put("page", request.getPage()); - if (request.getLimit() != null) params.put("limit", request.getLimit()); + if (request.getPage() != null) { + params.put("page", request.getPage()); + } + if (request.getLimit() != null) { + params.put("limit", request.getLimit()); + } params.put("promoted", request.getPromoted()); Response response = changeApi.getChanges(params).execute(); return restHandler.extractResponse(response); @@ -43,15 +44,14 @@ public ChangeCountResponse getChangesCount() throws IOException, NovuNetworkExce return restHandler.extractResponse(response); } - public ApplyChangesResponse applyChanges(ApplyChangesRequest request) throws IOException, NovuNetworkException { + public ApplyChangesResponse applyChanges(final ApplyChangesRequest request) + throws IOException, NovuNetworkException { Response response = changeApi.applyChanges(request).execute(); return restHandler.extractResponse(response); } - public ApplyChangesResponse applyChange(String changeId) throws IOException, NovuNetworkException { + public ApplyChangesResponse applyChange(final String changeId) throws IOException, NovuNetworkException { Response response = changeApi.applyChange(changeId).execute(); return restHandler.extractResponse(response); } - - } diff --git a/src/main/java/co/novu/api/common/Filters.java b/src/main/java/co/novu/api/common/Filters.java index 837b3be..2c81d17 100644 --- a/src/main/java/co/novu/api/common/Filters.java +++ b/src/main/java/co/novu/api/common/Filters.java @@ -11,4 +11,4 @@ public class Filters { private String type; private String value; private List children; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/Metadata.java b/src/main/java/co/novu/api/common/Metadata.java index 1342680..0bca3e5 100644 --- a/src/main/java/co/novu/api/common/Metadata.java +++ b/src/main/java/co/novu/api/common/Metadata.java @@ -12,4 +12,4 @@ public class Metadata { private String backoffUnit; private Long backoffAmount; private Boolean updateMode; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/NotificationGroup.java b/src/main/java/co/novu/api/common/NotificationGroup.java index 64e8e00..97cea95 100644 --- a/src/main/java/co/novu/api/common/NotificationGroup.java +++ b/src/main/java/co/novu/api/common/NotificationGroup.java @@ -6,7 +6,7 @@ @Data public class NotificationGroup { - @SerializedName("_id") + @SerializedName("_id") private String id; private String name; @SerializedName("_organizationId") @@ -19,4 +19,4 @@ public class NotificationGroup { private String updatedAt; @SerializedName("__v") private String version; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/PreferenceSettings.java b/src/main/java/co/novu/api/common/PreferenceSettings.java index 5696d6a..0f5e104 100644 --- a/src/main/java/co/novu/api/common/PreferenceSettings.java +++ b/src/main/java/co/novu/api/common/PreferenceSettings.java @@ -11,4 +11,4 @@ public class PreferenceSettings { private Boolean inApp; private Boolean chat; private Boolean push; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/ReplyCallback.java b/src/main/java/co/novu/api/common/ReplyCallback.java index f814a57..0abe057 100644 --- a/src/main/java/co/novu/api/common/ReplyCallback.java +++ b/src/main/java/co/novu/api/common/ReplyCallback.java @@ -5,4 +5,4 @@ @Data public class ReplyCallback { private Boolean active; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/Step.java b/src/main/java/co/novu/api/common/Step.java index 56a8914..cd1c41b 100644 --- a/src/main/java/co/novu/api/common/Step.java +++ b/src/main/java/co/novu/api/common/Step.java @@ -3,8 +3,6 @@ import com.google.gson.annotations.SerializedName; import lombok.Data; -import java.util.List; - @Data public class Step { @SerializedName("_id") @@ -21,4 +19,4 @@ public class Step { private String parentId; private Object filters; private Object metadata; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/SubscriberRequest.java b/src/main/java/co/novu/api/common/SubscriberRequest.java index 713ccc8..b56f4d6 100644 --- a/src/main/java/co/novu/api/common/SubscriberRequest.java +++ b/src/main/java/co/novu/api/common/SubscriberRequest.java @@ -13,4 +13,4 @@ public class SubscriberRequest implements IRequest { private String avatar; private String locale; private Object data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/Template.java b/src/main/java/co/novu/api/common/Template.java index 0f3fcde..b362565 100644 --- a/src/main/java/co/novu/api/common/Template.java +++ b/src/main/java/co/novu/api/common/Template.java @@ -12,4 +12,4 @@ public class Template { private String name; private Boolean critical; private List triggers; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/common/Trigger.java b/src/main/java/co/novu/api/common/Trigger.java index 8fad97e..d278766 100644 --- a/src/main/java/co/novu/api/common/Trigger.java +++ b/src/main/java/co/novu/api/common/Trigger.java @@ -15,4 +15,4 @@ public class Trigger { private List variables; private List subscriberVariables; private List reservedVariables; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/EnvironmentApi.java b/src/main/java/co/novu/api/environments/EnvironmentApi.java index 769aee5..66bd92d 100644 --- a/src/main/java/co/novu/api/environments/EnvironmentApi.java +++ b/src/main/java/co/novu/api/environments/EnvironmentApi.java @@ -14,23 +14,24 @@ public interface EnvironmentApi { - String ENDPOINT = "environments"; - - @GET(ENDPOINT + "/me") - Call getCurrentEnvironment(); - - @POST(ENDPOINT) - Call createEnvironment(@Body CreateEnvironmentRequest request); - - @GET(ENDPOINT) - Call getEnvironments(); - - @PUT(ENDPOINT + "/{environmentId}") - Call updateEnvironmentById(@Path("environmentId") String environmentId, @Body UpdateEnvironmentRequest request); - - @GET(ENDPOINT + "/api-keys") - Call getApiKeys(); - - @POST(ENDPOINT + "/api-keys/regenerate") - Call regenerateApiKeys(); + String ENDPOINT = "environments"; + + @GET(ENDPOINT + "/me") + Call getCurrentEnvironment(); + + @POST(ENDPOINT) + Call createEnvironment(@Body CreateEnvironmentRequest request); + + @GET(ENDPOINT) + Call getEnvironments(); + + @PUT(ENDPOINT + "/{environmentId}") + Call updateEnvironmentById(@Path("environmentId") String environmentId, + @Body UpdateEnvironmentRequest request); + + @GET(ENDPOINT + "/api-keys") + Call getApiKeys(); + + @POST(ENDPOINT + "/api-keys/regenerate") + Call regenerateApiKeys(); } diff --git a/src/main/java/co/novu/api/environments/EnvironmentHandler.java b/src/main/java/co/novu/api/environments/EnvironmentHandler.java index 14be473..f9aa95a 100644 --- a/src/main/java/co/novu/api/environments/EnvironmentHandler.java +++ b/src/main/java/co/novu/api/environments/EnvironmentHandler.java @@ -11,44 +11,48 @@ import co.novu.common.rest.RestHandler; import retrofit2.Response; -public class EnvironmentHandler { +public final class EnvironmentHandler { private final RestHandler restHandler; private final EnvironmentApi environmentApi; - - public EnvironmentHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.environmentApi = restHandler.buildRetrofit().create(EnvironmentApi.class); + + public EnvironmentHandler(final RestHandler handler) { + this.restHandler = handler; + this.environmentApi = handler.buildRetrofit().create(EnvironmentApi.class); } public SingleEnvironmentResponse getCurrentEnvironment() throws IOException, NovuNetworkException { - Response response = environmentApi.getCurrentEnvironment().execute(); + Response response = environmentApi.getCurrentEnvironment().execute(); return restHandler.extractResponse(response); } - public SingleEnvironmentResponse createEnvironment(CreateEnvironmentRequest request) throws IOException, NovuNetworkException { - Response response = environmentApi.createEnvironment(request).execute(); + public SingleEnvironmentResponse createEnvironment(final CreateEnvironmentRequest request) + throws IOException, NovuNetworkException { + Response response = environmentApi.createEnvironment(request).execute(); return restHandler.extractResponse(response); } public BulkEnvironmentResponse getEnvironments() throws IOException, NovuNetworkException { - Response response = environmentApi.getEnvironments().execute(); + Response response = environmentApi.getEnvironments().execute(); return restHandler.extractResponse(response); } - public SingleEnvironmentResponse updateEnvironmentById(String environmentId, UpdateEnvironmentRequest request) throws IOException, NovuNetworkException { - Response response = environmentApi.updateEnvironmentById(environmentId, request).execute(); + public SingleEnvironmentResponse updateEnvironmentById(final String environmentId, + final UpdateEnvironmentRequest request) + throws IOException, NovuNetworkException { + Response response = + environmentApi.updateEnvironmentById(environmentId, request).execute(); return restHandler.extractResponse(response); } public ApiKeyResponse getApiKeys() throws IOException, NovuNetworkException { - Response response = environmentApi.getApiKeys().execute(); + Response response = environmentApi.getApiKeys().execute(); return restHandler.extractResponse(response); } public ApiKeyResponse regenerateApiKeys() throws IOException, NovuNetworkException { - Response response = environmentApi.regenerateApiKeys().execute(); + Response response = environmentApi.regenerateApiKeys().execute(); return restHandler.extractResponse(response); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/pojos/ApiKey.java b/src/main/java/co/novu/api/environments/pojos/ApiKey.java index 9572769..2fa65d0 100644 --- a/src/main/java/co/novu/api/environments/pojos/ApiKey.java +++ b/src/main/java/co/novu/api/environments/pojos/ApiKey.java @@ -9,4 +9,4 @@ public class ApiKey { private String key; @SerializedName("_userId") private String userId; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/pojos/Dns.java b/src/main/java/co/novu/api/environments/pojos/Dns.java index 6030ad9..72e96e2 100644 --- a/src/main/java/co/novu/api/environments/pojos/Dns.java +++ b/src/main/java/co/novu/api/environments/pojos/Dns.java @@ -5,4 +5,4 @@ @Data public class Dns { private String inboundParseDomain; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/pojos/Widget.java b/src/main/java/co/novu/api/environments/pojos/Widget.java index 5426f36..ada08a1 100644 --- a/src/main/java/co/novu/api/environments/pojos/Widget.java +++ b/src/main/java/co/novu/api/environments/pojos/Widget.java @@ -5,4 +5,4 @@ @Data public class Widget { private Boolean notificationCenterEncryption; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/requests/CreateEnvironmentRequest.java b/src/main/java/co/novu/api/environments/requests/CreateEnvironmentRequest.java index 385aefd..0078e2f 100644 --- a/src/main/java/co/novu/api/environments/requests/CreateEnvironmentRequest.java +++ b/src/main/java/co/novu/api/environments/requests/CreateEnvironmentRequest.java @@ -7,4 +7,4 @@ public class CreateEnvironmentRequest implements IRequest { private String name; private String parentId; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/requests/UpdateEnvironmentRequest.java b/src/main/java/co/novu/api/environments/requests/UpdateEnvironmentRequest.java index aa298f3..518bd73 100644 --- a/src/main/java/co/novu/api/environments/requests/UpdateEnvironmentRequest.java +++ b/src/main/java/co/novu/api/environments/requests/UpdateEnvironmentRequest.java @@ -10,4 +10,4 @@ public class UpdateEnvironmentRequest implements IRequest { private String identifier; private String parentId; private Dns dns; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/responses/ApiKeyResponse.java b/src/main/java/co/novu/api/environments/responses/ApiKeyResponse.java index c2a9a32..a8e2c26 100644 --- a/src/main/java/co/novu/api/environments/responses/ApiKeyResponse.java +++ b/src/main/java/co/novu/api/environments/responses/ApiKeyResponse.java @@ -8,4 +8,4 @@ @Data public class ApiKeyResponse { private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/responses/BulkEnvironmentResponse.java b/src/main/java/co/novu/api/environments/responses/BulkEnvironmentResponse.java index 17e961f..1e90441 100644 --- a/src/main/java/co/novu/api/environments/responses/BulkEnvironmentResponse.java +++ b/src/main/java/co/novu/api/environments/responses/BulkEnvironmentResponse.java @@ -7,4 +7,4 @@ @Data public class BulkEnvironmentResponse { private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/responses/EnvironmentResponse.java b/src/main/java/co/novu/api/environments/responses/EnvironmentResponse.java index 6a196b1..13a47bf 100644 --- a/src/main/java/co/novu/api/environments/responses/EnvironmentResponse.java +++ b/src/main/java/co/novu/api/environments/responses/EnvironmentResponse.java @@ -21,4 +21,4 @@ public class EnvironmentResponse { private String updatedAt; @SerializedName("_parentId") private String parentId; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/environments/responses/SingleEnvironmentResponse.java b/src/main/java/co/novu/api/environments/responses/SingleEnvironmentResponse.java index 0c7516c..b01b5b3 100644 --- a/src/main/java/co/novu/api/environments/responses/SingleEnvironmentResponse.java +++ b/src/main/java/co/novu/api/environments/responses/SingleEnvironmentResponse.java @@ -5,4 +5,4 @@ @Data public class SingleEnvironmentResponse { private EnvironmentResponse data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/events/EventsHandler.java b/src/main/java/co/novu/api/events/EventsHandler.java index 340ed1b..35fc885 100644 --- a/src/main/java/co/novu/api/events/EventsHandler.java +++ b/src/main/java/co/novu/api/events/EventsHandler.java @@ -13,33 +13,37 @@ import java.io.IOException; @RequiredArgsConstructor -public class EventsHandler { +public final class EventsHandler { private final RestHandler restHandler; private final EventsApi eventsApi; - public EventsHandler(RestHandler restHandler){ - this.restHandler = restHandler; - this.eventsApi = restHandler.buildRetrofit().create(EventsApi.class); + public EventsHandler(final RestHandler handler) { + this.restHandler = handler; + this.eventsApi = handler.buildRetrofit().create(EventsApi.class); } - public TriggerEventResponse triggerEvent(TriggerEventRequest request) throws IOException, NovuNetworkException { + public TriggerEventResponse triggerEvent(final TriggerEventRequest request) + throws IOException, NovuNetworkException { Response response = eventsApi.triggerEvent(request).execute(); return restHandler.extractResponse(response); } - public BulkTriggerEventResponse bulkTriggerEvent(BulkTriggerEventRequest request) throws IOException, NovuNetworkException { + public BulkTriggerEventResponse bulkTriggerEvent(final BulkTriggerEventRequest request) + throws IOException, NovuNetworkException { Response response = eventsApi.bulkTriggerEvent(request).execute(); return restHandler.extractResponse(response); } - public TriggerEventResponse broadcastEvent(TriggerEventRequest request) throws IOException, NovuNetworkException { + public TriggerEventResponse broadcastEvent(final TriggerEventRequest request) + throws IOException, NovuNetworkException { Response response = eventsApi.broadcastEvent(request).execute(); return restHandler.extractResponse(response); } - public CancelEventResponse cancelTriggeredEvent(String transactionId) throws IOException, NovuNetworkException { + public CancelEventResponse cancelTriggeredEvent(final String transactionId) + throws IOException, NovuNetworkException { Response response = eventsApi.cancelTriggeredEvent(transactionId).execute(); return restHandler.extractResponse(response); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/events/requests/TriggerEventRequest.java b/src/main/java/co/novu/api/events/requests/TriggerEventRequest.java index 96fdb73..8e83755 100644 --- a/src/main/java/co/novu/api/events/requests/TriggerEventRequest.java +++ b/src/main/java/co/novu/api/events/requests/TriggerEventRequest.java @@ -1,7 +1,5 @@ package co.novu.api.events.requests; -import co.novu.api.common.SubscriberRequest; -import co.novu.api.tenants.pojos.Tenant; import co.novu.common.contracts.IRequest; import lombok.Data; @@ -12,7 +10,8 @@ public class TriggerEventRequest implements IRequest { private String name; /** - * Possible types this field accepts are; {@link SubscriberRequest}, list of {@link SubscriberRequest}, {@link Topic} or list of {@link Topic} + * Possible types this field accepts are; {@link SubscriberRequest}, list of {@link SubscriberRequest}, + * {@link Topic} or list of {@link Topic}. * *

For example: * @@ -30,7 +29,7 @@ public class TriggerEventRequest implements IRequest { private String transactionId; /** - * Possible types this field accepts are; String or {@link Map} + * Possible types this field accepts are; String or {@link Map}. * *

For example: * @@ -49,7 +48,7 @@ public class TriggerEventRequest implements IRequest { private Object actor; /** - * Possible types this field accepts are; String or {@link Tenant} + * Possible types this field accepts are; String or {@link Tenant}. * *

For example: * @@ -61,4 +60,4 @@ public class TriggerEventRequest implements IRequest { * */ private Object tenant; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/events/responses/TriggerEventResponse.java b/src/main/java/co/novu/api/events/responses/TriggerEventResponse.java index c4d7450..56d4230 100644 --- a/src/main/java/co/novu/api/events/responses/TriggerEventResponse.java +++ b/src/main/java/co/novu/api/events/responses/TriggerEventResponse.java @@ -8,4 +8,4 @@ public class TriggerEventResponse { private TriggerEventResponseData data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsApi.java b/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsApi.java index 0bf225d..807fefe 100644 --- a/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsApi.java +++ b/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsApi.java @@ -8,10 +8,9 @@ import retrofit2.http.QueryMap; public interface ExecutiveDetailsApi { - - String ENDPOINT = "execution-details"; - - @GET(ENDPOINT) - Call getExecutionDetails(@QueryMap Map params); + String ENDPOINT = "execution-details"; + + @GET(ENDPOINT) + Call getExecutionDetails(@QueryMap Map params); } diff --git a/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsHandler.java b/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsHandler.java index 0be5b5b..4489eb3 100644 --- a/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsHandler.java +++ b/src/main/java/co/novu/api/executivedetails/ExecutiveDetailsHandler.java @@ -9,24 +9,23 @@ import co.novu.common.rest.RestHandler; import retrofit2.Response; - -public class ExecutiveDetailsHandler { +public final class ExecutiveDetailsHandler { private final RestHandler restHandler; private final ExecutiveDetailsApi executiveDetailsApi; - public ExecutiveDetailsHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.executiveDetailsApi = restHandler.buildRetrofit().create(ExecutiveDetailsApi.class); + public ExecutiveDetailsHandler(final RestHandler handler) { + this.restHandler = handler; + this.executiveDetailsApi = handler.buildRetrofit().create(ExecutiveDetailsApi.class); } - - public ExecutiveDetailsResponse getExecutionDetails(String notificationId, String subscriberId) throws IOException, NovuNetworkException { - Map params = new HashMap<>(); + + public ExecutiveDetailsResponse getExecutionDetails(final String notificationId, final String subscriberId) + throws IOException, NovuNetworkException { + Map params = new HashMap<>(); params.put("notificationId", notificationId); params.put("subscriberId", subscriberId); - Response response = executiveDetailsApi.getExecutionDetails(params).execute(); - return restHandler.extractResponse(response); + Response response = executiveDetailsApi.getExecutionDetails(params).execute(); + return restHandler.extractResponse(response); } - -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/executivedetails/pojos/ExecutiveDetails.java b/src/main/java/co/novu/api/executivedetails/pojos/ExecutiveDetails.java index 6dba575..a154ead 100644 --- a/src/main/java/co/novu/api/executivedetails/pojos/ExecutiveDetails.java +++ b/src/main/java/co/novu/api/executivedetails/pojos/ExecutiveDetails.java @@ -6,21 +6,21 @@ @Data public class ExecutiveDetails { - @SerializedName("_id") + @SerializedName("_id") private String id; - @SerializedName("_jobId") + @SerializedName("_jobId") private String jobId; - @SerializedName("_organizationId") + @SerializedName("_organizationId") private String organizationId; - @SerializedName("_environmentId") + @SerializedName("_environmentId") private String environmentId; - @SerializedName("_notificationId") + @SerializedName("_notificationId") private String notificationId; - @SerializedName("_subscriberId") + @SerializedName("_subscriberId") private String subscriberId; - @SerializedName("_notificationTemplateId") + @SerializedName("_notificationTemplateId") private String notificationTemplateId; - @SerializedName("_messageId") + @SerializedName("_messageId") private String messageId; private String transactionId; private String providerId; @@ -31,4 +31,4 @@ public class ExecutiveDetails { private String source; private String createdAt; private String updatedAt; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/executivedetails/responses/ExecutiveDetailsResponse.java b/src/main/java/co/novu/api/executivedetails/responses/ExecutiveDetailsResponse.java index 94dce94..bd4ec67 100644 --- a/src/main/java/co/novu/api/executivedetails/responses/ExecutiveDetailsResponse.java +++ b/src/main/java/co/novu/api/executivedetails/responses/ExecutiveDetailsResponse.java @@ -8,4 +8,4 @@ @Data public class ExecutiveDetailsResponse { private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/feeds/FeedsApi.java b/src/main/java/co/novu/api/feeds/FeedsApi.java index 3875287..dae521e 100644 --- a/src/main/java/co/novu/api/feeds/FeedsApi.java +++ b/src/main/java/co/novu/api/feeds/FeedsApi.java @@ -12,14 +12,14 @@ public interface FeedsApi { - String ENDPOINT = "feeds"; - - @POST(ENDPOINT) - Call createFeed(@Body FeedRequest request); - - @GET(ENDPOINT) - Call getFeeds(); - - @DELETE(ENDPOINT + "/{feedId}") - Call deleteFeed(@Path("feedId") String feedId); + String ENDPOINT = "feeds"; + + @POST(ENDPOINT) + Call createFeed(@Body FeedRequest request); + + @GET(ENDPOINT) + Call getFeeds(); + + @DELETE(ENDPOINT + "/{feedId}") + Call deleteFeed(@Path("feedId") String feedId); } diff --git a/src/main/java/co/novu/api/feeds/FeedsHandler.java b/src/main/java/co/novu/api/feeds/FeedsHandler.java index 99bc859..1b76988 100644 --- a/src/main/java/co/novu/api/feeds/FeedsHandler.java +++ b/src/main/java/co/novu/api/feeds/FeedsHandler.java @@ -9,31 +9,29 @@ import co.novu.common.rest.RestHandler; import retrofit2.Response; -public class FeedsHandler { +public final class FeedsHandler { private final RestHandler restHandler; - + private final FeedsApi feedsApi; - - public FeedsHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.feedsApi = restHandler.buildRetrofit().create(FeedsApi.class); + + public FeedsHandler(final RestHandler handler) { + this.restHandler = handler; + this.feedsApi = handler.buildRetrofit().create(FeedsApi.class); } - public FeedResponse createFeed(FeedRequest request) throws IOException, NovuNetworkException { - Response response = feedsApi.createFeed(request).execute(); + public FeedResponse createFeed(final FeedRequest request) throws IOException, NovuNetworkException { + Response response = feedsApi.createFeed(request).execute(); return restHandler.extractResponse(response); } public BulkFeedsResponse getFeeds() throws IOException, NovuNetworkException { - Response response = feedsApi.getFeeds().execute(); - return restHandler.extractResponse(response); + Response response = feedsApi.getFeeds().execute(); + return restHandler.extractResponse(response); } - - public BulkFeedsResponse deleteFeed(String feedId) throws IOException, NovuNetworkException { - Response response = feedsApi.deleteFeed(feedId).execute(); - return restHandler.extractResponse(response); + public BulkFeedsResponse deleteFeed(final String feedId) throws IOException, NovuNetworkException { + Response response = feedsApi.deleteFeed(feedId).execute(); + return restHandler.extractResponse(response); } - } diff --git a/src/main/java/co/novu/api/feeds/response/FeedResponseData.java b/src/main/java/co/novu/api/feeds/response/FeedResponseData.java index bd05055..a2fb6e4 100644 --- a/src/main/java/co/novu/api/feeds/response/FeedResponseData.java +++ b/src/main/java/co/novu/api/feeds/response/FeedResponseData.java @@ -6,7 +6,7 @@ @Data public class FeedResponseData { - @SerializedName("_id") + @SerializedName("_id") private String id; private String name; private String identifier; diff --git a/src/main/java/co/novu/api/inboundparse/InboundParseApi.java b/src/main/java/co/novu/api/inboundparse/InboundParseApi.java index bb96df0..01ae547 100644 --- a/src/main/java/co/novu/api/inboundparse/InboundParseApi.java +++ b/src/main/java/co/novu/api/inboundparse/InboundParseApi.java @@ -5,10 +5,10 @@ import retrofit2.http.GET; public interface InboundParseApi { - - String ENDPOINT = "inbound-parse"; - - @GET(ENDPOINT + "/mx/status") - Call validateMxRecordSetupForInboundParse(); + + String ENDPOINT = "inbound-parse"; + + @GET(ENDPOINT + "/mx/status") + Call validateMxRecordSetupForInboundParse(); } diff --git a/src/main/java/co/novu/api/inboundparse/InboundParseHandler.java b/src/main/java/co/novu/api/inboundparse/InboundParseHandler.java index 0c68e05..a4224ee 100644 --- a/src/main/java/co/novu/api/inboundparse/InboundParseHandler.java +++ b/src/main/java/co/novu/api/inboundparse/InboundParseHandler.java @@ -7,19 +7,19 @@ import co.novu.common.rest.RestHandler; import retrofit2.Response; -public class InboundParseHandler { +public final class InboundParseHandler { private final RestHandler restHandler; private final InboundParseApi inboundParseApi; - public InboundParseHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.inboundParseApi = restHandler.buildRetrofit().create(InboundParseApi.class); - } + public InboundParseHandler(final RestHandler handler) { + this.restHandler = handler; + this.inboundParseApi = handler.buildRetrofit().create(InboundParseApi.class); + } - public ValidateMxRecordResponse validateMxRecordSetupForInboundParse() throws IOException, NovuNetworkException { - Response response = inboundParseApi.validateMxRecordSetupForInboundParse().execute(); + public ValidateMxRecordResponse validateMxRecordSetupForInboundParse() throws IOException, NovuNetworkException { + Response response = inboundParseApi.validateMxRecordSetupForInboundParse().execute(); return restHandler.extractResponse(response); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponse.java b/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponse.java index d4335d1..153d3a6 100644 --- a/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponse.java +++ b/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponse.java @@ -6,4 +6,4 @@ public class ValidateMxRecordResponse { private ValidateMxRecordResponseData data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponseData.java b/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponseData.java index d7cf14c..daaaabf 100644 --- a/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponseData.java +++ b/src/main/java/co/novu/api/inboundparse/responses/ValidateMxRecordResponseData.java @@ -6,4 +6,4 @@ public class ValidateMxRecordResponseData { private Boolean mxRecordConfigured; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/integrations/IntegrationsApi.java b/src/main/java/co/novu/api/integrations/IntegrationsApi.java index b793e32..c5147d2 100644 --- a/src/main/java/co/novu/api/integrations/IntegrationsApi.java +++ b/src/main/java/co/novu/api/integrations/IntegrationsApi.java @@ -15,25 +15,26 @@ public interface IntegrationsApi { String ENDPOINT = "integrations"; - + @GET(ENDPOINT + "/get-integrations") - public Call getIntegrations(); + Call getIntegrations(); @POST(ENDPOINT + "/create-integrations") - public Call createIntegration(@Body IntegrationRequest request); + Call createIntegration(@Body IntegrationRequest request); @GET(ENDPOINT + "/active") - public Call getActiveIntegrations(); + Call getActiveIntegrations(); @GET(ENDPOINT + "/webhook/provider/{providerId}/status") - public Call getProviderWebhookStatus(@Path("providerId") String providerId); + Call getProviderWebhookStatus(@Path("providerId") String providerId); @PUT(ENDPOINT + "/{integrationId}") - public Call updateIntegration(@Path("integrationId") String integrationId, @Body IntegrationRequest request); + Call updateIntegration(@Path("integrationId") String integrationId, + @Body IntegrationRequest request); @DELETE(ENDPOINT + "/{integrationId}") - public Call deleteIntegration(@Path("integrationId") String integrationId); + Call deleteIntegration(@Path("integrationId") String integrationId); @PUT(ENDPOINT + "/{integrationId}/set-primary") - public Call setIntegrationAsPrimary(@Path("integrationId") String integrationId); -} \ No newline at end of file + Call setIntegrationAsPrimary(@Path("integrationId") String integrationId); +} diff --git a/src/main/java/co/novu/api/integrations/IntegrationsHandler.java b/src/main/java/co/novu/api/integrations/IntegrationsHandler.java index a6ea6e4..d413572 100644 --- a/src/main/java/co/novu/api/integrations/IntegrationsHandler.java +++ b/src/main/java/co/novu/api/integrations/IntegrationsHandler.java @@ -11,22 +11,23 @@ import lombok.RequiredArgsConstructor; @RequiredArgsConstructor -public class IntegrationsHandler { +public final class IntegrationsHandler { private final RestHandler restHandler; private final IntegrationsApi integrationsApi; - public IntegrationsHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.integrationsApi = restHandler.buildRetrofit().create(IntegrationsApi.class); + public IntegrationsHandler(final RestHandler handler) { + this.restHandler = handler; + this.integrationsApi = handler.buildRetrofit().create(IntegrationsApi.class); } public BulkIntegrationResponse getIntegrations() throws NovuNetworkException, IOException { return restHandler.extractResponse(this.integrationsApi.getIntegrations().execute()); } - - public SingleIntegrationResponse createIntegration(IntegrationRequest request) throws NovuNetworkException, IOException { + + public SingleIntegrationResponse createIntegration(final IntegrationRequest request) + throws NovuNetworkException, IOException { return restHandler.extractResponse(this.integrationsApi.createIntegration(request).execute()); } @@ -34,19 +35,23 @@ public BulkIntegrationResponse getActiveIntegrations() throws NovuNetworkExcepti return restHandler.extractResponse(this.integrationsApi.getActiveIntegrations().execute()); } - public ProviderWebhookStatusResponse getProviderWebhookStatus(String providerId) throws NovuNetworkException, IOException { + public ProviderWebhookStatusResponse getProviderWebhookStatus(final String providerId) + throws NovuNetworkException, IOException { return restHandler.extractResponse(this.integrationsApi.getProviderWebhookStatus(providerId).execute()); } - public SingleIntegrationResponse updateIntegration(String integrationId, IntegrationRequest request) throws NovuNetworkException, IOException { + public SingleIntegrationResponse updateIntegration(final String integrationId, final IntegrationRequest request) + throws NovuNetworkException, IOException { return restHandler.extractResponse(this.integrationsApi.updateIntegration(integrationId, request).execute()); } - public BulkIntegrationResponse deleteIntegration(String integrationId) throws NovuNetworkException, IOException { + public BulkIntegrationResponse deleteIntegration(final String integrationId) + throws NovuNetworkException, IOException { return restHandler.extractResponse(this.integrationsApi.deleteIntegration(integrationId).execute()); } - public SingleIntegrationResponse setIntegrationAsPrimary(String integrationId) throws NovuNetworkException, IOException { + public SingleIntegrationResponse setIntegrationAsPrimary(final String integrationId) + throws NovuNetworkException, IOException { return restHandler.extractResponse(this.integrationsApi.setIntegrationAsPrimary(integrationId).execute()); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/integrations/pojo/Credentials.java b/src/main/java/co/novu/api/integrations/pojo/Credentials.java index 2fc3ebb..9be31aa 100644 --- a/src/main/java/co/novu/api/integrations/pojo/Credentials.java +++ b/src/main/java/co/novu/api/integrations/pojo/Credentials.java @@ -26,4 +26,4 @@ public class Credentials { private Object tlsOptions; private String baseUrl; private String webhookUrl; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/integrations/pojo/Integration.java b/src/main/java/co/novu/api/integrations/pojo/Integration.java index 148d9a7..804d1fc 100644 --- a/src/main/java/co/novu/api/integrations/pojo/Integration.java +++ b/src/main/java/co/novu/api/integrations/pojo/Integration.java @@ -24,4 +24,4 @@ public class Integration { private String identifier; private String name; private Boolean primary; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/integrations/requests/IntegrationRequest.java b/src/main/java/co/novu/api/integrations/requests/IntegrationRequest.java index 675acb2..264025a 100644 --- a/src/main/java/co/novu/api/integrations/requests/IntegrationRequest.java +++ b/src/main/java/co/novu/api/integrations/requests/IntegrationRequest.java @@ -11,4 +11,4 @@ public class IntegrationRequest implements IRequest { private Credentials credentials; private Boolean active; private Boolean check; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/integrations/responses/BulkIntegrationResponse.java b/src/main/java/co/novu/api/integrations/responses/BulkIntegrationResponse.java index d951346..a6ab5c3 100644 --- a/src/main/java/co/novu/api/integrations/responses/BulkIntegrationResponse.java +++ b/src/main/java/co/novu/api/integrations/responses/BulkIntegrationResponse.java @@ -8,4 +8,4 @@ @Data public class BulkIntegrationResponse { private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/integrations/responses/ProviderWebhookStatusResponse.java b/src/main/java/co/novu/api/integrations/responses/ProviderWebhookStatusResponse.java index 82445fc..4b917c0 100644 --- a/src/main/java/co/novu/api/integrations/responses/ProviderWebhookStatusResponse.java +++ b/src/main/java/co/novu/api/integrations/responses/ProviderWebhookStatusResponse.java @@ -5,4 +5,4 @@ @Data public class ProviderWebhookStatusResponse { private Boolean data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/integrations/responses/SingleIntegrationResponse.java b/src/main/java/co/novu/api/integrations/responses/SingleIntegrationResponse.java index 33514eb..47e4cc5 100644 --- a/src/main/java/co/novu/api/integrations/responses/SingleIntegrationResponse.java +++ b/src/main/java/co/novu/api/integrations/responses/SingleIntegrationResponse.java @@ -6,4 +6,4 @@ @Data public class SingleIntegrationResponse { private Integration data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/layouts/LayoutApi.java b/src/main/java/co/novu/api/layouts/LayoutApi.java index 90bb77a..b382308 100644 --- a/src/main/java/co/novu/api/layouts/LayoutApi.java +++ b/src/main/java/co/novu/api/layouts/LayoutApi.java @@ -2,10 +2,8 @@ import co.novu.api.layouts.requests.LayoutRequest; import co.novu.api.layouts.responses.CreateLayoutResponse; -import co.novu.api.layouts.responses.DeleteLayoutResponse; import co.novu.api.layouts.responses.FilterLayoutResponse; import co.novu.api.layouts.responses.GetLayoutResponse; -import co.novu.api.layouts.responses.SetDefaultLayoutResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; diff --git a/src/main/java/co/novu/api/layouts/LayoutHandler.java b/src/main/java/co/novu/api/layouts/LayoutHandler.java index c77d6ae..61b66a0 100644 --- a/src/main/java/co/novu/api/layouts/LayoutHandler.java +++ b/src/main/java/co/novu/api/layouts/LayoutHandler.java @@ -15,51 +15,59 @@ import java.util.HashMap; import java.util.Map; -public class LayoutHandler { +public final class LayoutHandler { private final RestHandler restHandler; - private static final String ENDPOINT = "layouts"; - private final LayoutApi layoutApi; - public LayoutHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.layoutApi = restHandler.buildRetrofit().create(LayoutApi.class); + public LayoutHandler(final RestHandler handler) { + this.restHandler = handler; + this.layoutApi = handler.buildRetrofit().create(LayoutApi.class); } - public CreateLayoutResponse createLayout(LayoutRequest request) throws IOException, NovuNetworkException { + public CreateLayoutResponse createLayout(final LayoutRequest request) throws IOException, NovuNetworkException { Response response = layoutApi.createLayout(request).execute(); return restHandler.extractResponse(response); } - public FilterLayoutResponse filterLayouts(FilterLayoutRequest request) throws IOException, NovuNetworkException { + public FilterLayoutResponse filterLayouts(final FilterLayoutRequest request) + throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (request.getPage() != null) params.put("page", request.getPage()); - if (request.getPageSize() != null) params.put("pageSize", request.getPageSize()); - if (request.getSortBy() != null) params.put("sortBy", request.getSortBy()); - if (request.getOrderBy() != null) params.put("orderBy", request.getOrderBy()); + if (request.getPage() != null) { + params.put("page", request.getPage()); + } + if (request.getPageSize() != null) { + params.put("pageSize", request.getPageSize()); + } + if (request.getSortBy() != null) { + params.put("sortBy", request.getSortBy()); + } + if (request.getOrderBy() != null) { + params.put("orderBy", request.getOrderBy()); + } Response response = layoutApi.filterLayouts(params).execute(); return restHandler.extractResponse(response); } - public GetLayoutResponse getLayout(String layoutId) throws IOException, NovuNetworkException { + public GetLayoutResponse getLayout(final String layoutId) throws IOException, NovuNetworkException { Response response = layoutApi.getLayout(layoutId).execute(); return restHandler.extractResponse(response); } - public DeleteLayoutResponse deleteLayout(String layoutId) throws IOException, NovuNetworkException { + public DeleteLayoutResponse deleteLayout(final String layoutId) throws IOException, NovuNetworkException { Response response = layoutApi.deleteLayout(layoutId).execute(); return restHandler.extractResponse(response, new DeleteLayoutResponse()); } - public GetLayoutResponse updateLayout(String layoutId, LayoutRequest request) throws IOException, NovuNetworkException { + public GetLayoutResponse updateLayout(final String layoutId, final LayoutRequest request) + throws IOException, NovuNetworkException { Response response = layoutApi.updateLayout(layoutId, request).execute(); return restHandler.extractResponse(response); } - public SetDefaultLayoutResponse setDefaultLayout(String layoutId) throws IOException, NovuNetworkException { + public SetDefaultLayoutResponse setDefaultLayout(final String layoutId) throws IOException, NovuNetworkException { Response response = layoutApi.setDefaultLayout(layoutId).execute(); return restHandler.extractResponse(response, new SetDefaultLayoutResponse()); } diff --git a/src/main/java/co/novu/api/layouts/responses/DeleteLayoutResponse.java b/src/main/java/co/novu/api/layouts/responses/DeleteLayoutResponse.java index 00f0b80..de76aa7 100644 --- a/src/main/java/co/novu/api/layouts/responses/DeleteLayoutResponse.java +++ b/src/main/java/co/novu/api/layouts/responses/DeleteLayoutResponse.java @@ -7,4 +7,4 @@ public class DeleteLayoutResponse { private Boolean acknowledged = true; private String status = "Done"; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/layouts/responses/SetDefaultLayoutResponse.java b/src/main/java/co/novu/api/layouts/responses/SetDefaultLayoutResponse.java index b646977..bb4ab96 100644 --- a/src/main/java/co/novu/api/layouts/responses/SetDefaultLayoutResponse.java +++ b/src/main/java/co/novu/api/layouts/responses/SetDefaultLayoutResponse.java @@ -7,4 +7,4 @@ public class SetDefaultLayoutResponse { private Boolean acknowledged = true; private String status = "Done"; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/messages/MessageApi.java b/src/main/java/co/novu/api/messages/MessageApi.java index cee5bfb..a1c7db8 100644 --- a/src/main/java/co/novu/api/messages/MessageApi.java +++ b/src/main/java/co/novu/api/messages/MessageApi.java @@ -12,11 +12,11 @@ public interface MessageApi { - String ENDPOINT = "messages"; - - @GET(ENDPOINT) - Call getMessages(@QueryMap Map options); - - @DELETE(ENDPOINT + "/{messageId}") - Call deleteMessage(@Path("messageId") String messageId); + String ENDPOINT = "messages"; + + @GET(ENDPOINT) + Call getMessages(@QueryMap Map options); + + @DELETE(ENDPOINT + "/{messageId}") + Call deleteMessage(@Path("messageId") String messageId); } diff --git a/src/main/java/co/novu/api/messages/MessageHandler.java b/src/main/java/co/novu/api/messages/MessageHandler.java index 0ccdce5..72cfb00 100644 --- a/src/main/java/co/novu/api/messages/MessageHandler.java +++ b/src/main/java/co/novu/api/messages/MessageHandler.java @@ -11,31 +11,41 @@ import co.novu.common.rest.RestHandler; import retrofit2.Response; -public class MessageHandler { +public final class MessageHandler { private final RestHandler restHandler; private final MessageApi messageApi; - public MessageHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.messageApi = restHandler.buildRetrofit().create(MessageApi.class); + public MessageHandler(final RestHandler handler) { + this.restHandler = handler; + this.messageApi = handler.buildRetrofit().create(MessageApi.class); } - public MessageResponse getMessages(MessageRequest request) throws NovuNetworkException, IOException { + public MessageResponse getMessages(final MessageRequest request) throws NovuNetworkException, IOException { Map params = new HashMap<>(); - if (request.getChannel() != null) params.put("channel", request.getChannel()); - if (request.getSubscriberId() != null) params.put("subscriberId", request.getSubscriberId()); - if (request.getTransactionId() != null) params.put("transactionId", request.getTransactionId()); - if (request.getPage() != null) params.put("page", request.getPage()); - if (request.getLimit() != null) params.put("limit", request.getLimit()); + if (request.getChannel() != null) { + params.put("channel", request.getChannel()); + } + if (request.getSubscriberId() != null) { + params.put("subscriberId", request.getSubscriberId()); + } + if (request.getTransactionId() != null) { + params.put("transactionId", request.getTransactionId()); + } + if (request.getPage() != null) { + params.put("page", request.getPage()); + } + if (request.getLimit() != null) { + params.put("limit", request.getLimit()); + } Response response = messageApi.getMessages(params).execute(); return restHandler.extractResponse(response); } - public DeleteMessageResponse deleteMessage(String messageId) throws IOException, NovuNetworkException { - Response response = messageApi.deleteMessage(messageId).execute(); + public DeleteMessageResponse deleteMessage(final String messageId) throws IOException, NovuNetworkException { + Response response = messageApi.deleteMessage(messageId).execute(); return restHandler.extractResponse(response); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/messages/pojos/Message.java b/src/main/java/co/novu/api/messages/pojos/Message.java index a7c1fc0..f9b15a3 100644 --- a/src/main/java/co/novu/api/messages/pojos/Message.java +++ b/src/main/java/co/novu/api/messages/pojos/Message.java @@ -1,8 +1,6 @@ package co.novu.api.messages.pojos; import java.util.List; - - import co.novu.api.common.Template; import co.novu.api.notifications.pojos.Job; import co.novu.api.notifications.pojos.Subscriber; @@ -11,11 +9,11 @@ @Data public class Message { - @SerializedName("_id") + @SerializedName("_id") private String id; - @SerializedName("_environmentId") + @SerializedName("_environmentId") private String environmentId; - @SerializedName("_organizationId") + @SerializedName("_organizationId") private String organizationId; private String transactionId; private String createdAt; @@ -23,4 +21,4 @@ public class Message { private Subscriber subscriber; private Template template; private List jobs; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/messages/requests/MessageRequest.java b/src/main/java/co/novu/api/messages/requests/MessageRequest.java index 0fc307c..68a56de 100644 --- a/src/main/java/co/novu/api/messages/requests/MessageRequest.java +++ b/src/main/java/co/novu/api/messages/requests/MessageRequest.java @@ -12,4 +12,4 @@ public class MessageRequest implements IRequest { private List transactionId; private Integer page; private Integer limit; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/messages/responses/DeleteMessageResponse.java b/src/main/java/co/novu/api/messages/responses/DeleteMessageResponse.java index a7054c3..d88611b 100644 --- a/src/main/java/co/novu/api/messages/responses/DeleteMessageResponse.java +++ b/src/main/java/co/novu/api/messages/responses/DeleteMessageResponse.java @@ -6,4 +6,4 @@ public class DeleteMessageResponse { private Boolean acknowledged; private String status; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/messages/responses/MessageResponse.java b/src/main/java/co/novu/api/messages/responses/MessageResponse.java index 8c4ee19..7046ec2 100644 --- a/src/main/java/co/novu/api/messages/responses/MessageResponse.java +++ b/src/main/java/co/novu/api/messages/responses/MessageResponse.java @@ -11,4 +11,4 @@ public class MessageResponse { private Long totalCount; private Long pageSize; private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/NotificationApi.java b/src/main/java/co/novu/api/notifications/NotificationApi.java index e733c08..fb6d529 100644 --- a/src/main/java/co/novu/api/notifications/NotificationApi.java +++ b/src/main/java/co/novu/api/notifications/NotificationApi.java @@ -28,6 +28,6 @@ public interface NotificationApi { @GET(ENDPOINT + "/graph/stats") Call getNotificationGraphStats(); - @GET(ENDPOINT +"/{notificationId}") + @GET(ENDPOINT + "/{notificationId}") Call getNotification(@Path("notificationId") String notificationId); } diff --git a/src/main/java/co/novu/api/notifications/NotificationHandler.java b/src/main/java/co/novu/api/notifications/NotificationHandler.java index 5af0014..f8ecb5a 100644 --- a/src/main/java/co/novu/api/notifications/NotificationHandler.java +++ b/src/main/java/co/novu/api/notifications/NotificationHandler.java @@ -1,41 +1,50 @@ package co.novu.api.notifications; -import co.novu.api.layouts.LayoutApi; -import co.novu.api.layouts.responses.CreateLayoutResponse; import co.novu.api.notifications.requests.NotificationRequest; import co.novu.api.notifications.responses.NotificationGraphStatsResponse; import co.novu.api.notifications.responses.NotificationResponse; import co.novu.api.notifications.responses.NotificationStatsResponse; import co.novu.api.notifications.responses.NotificationsResponse; -import co.novu.common.base.NovuConfig; import co.novu.common.rest.NovuNetworkException; import co.novu.common.rest.RestHandler; import lombok.RequiredArgsConstructor; -import retrofit2.Response; import java.io.IOException; import java.util.HashMap; import java.util.Map; @RequiredArgsConstructor -public class NotificationHandler { +public final class NotificationHandler { private final RestHandler restHandler; private final NotificationApi notificationApi; - public NotificationHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.notificationApi = restHandler.buildRetrofit().create(NotificationApi.class); + public NotificationHandler(final RestHandler handler) { + this.restHandler = handler; + this.notificationApi = handler.buildRetrofit().create(NotificationApi.class); } - public NotificationsResponse getNotifications(NotificationRequest request) throws IOException, NovuNetworkException { + public NotificationsResponse getNotifications(final NotificationRequest request) + throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (request.getChannels() != null) params.put("channels", request.getChannels()); - if (request.getTemplates() != null)params.put("templates", request.getTemplates()); - if (request.getEmails() != null)params.put("emails", request.getEmails()); - if (request.getSearch() != null)params.put("search", request.getSearch()); - if (request.getPage() != null) params.put("page", request.getPage()); - if (request.getTransactionId() != null) params.put("transactionId", request.getTransactionId()); + if (request.getChannels() != null) { + params.put("channels", request.getChannels()); + } + if (request.getTemplates() != null) { + params.put("templates", request.getTemplates()); + } + if (request.getEmails() != null) { + params.put("emails", request.getEmails()); + } + if (request.getSearch() != null) { + params.put("search", request.getSearch()); + } + if (request.getPage() != null) { + params.put("page", request.getPage()); + } + if (request.getTransactionId() != null) { + params.put("transactionId", request.getTransactionId()); + } return restHandler.extractResponse(notificationApi.getNotifications(params).execute()); } @@ -47,7 +56,7 @@ public NotificationGraphStatsResponse getNotificationGraphStats() throws IOExcep return restHandler.extractResponse(notificationApi.getNotificationGraphStats().execute()); } - public NotificationResponse getNotification(String notificationId) throws IOException, NovuNetworkException { + public NotificationResponse getNotification(final String notificationId) throws IOException, NovuNetworkException { return restHandler.extractResponse(notificationApi.getNotification(notificationId).execute()); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/Children.java b/src/main/java/co/novu/api/notifications/pojos/Children.java index be1e031..df074c8 100644 --- a/src/main/java/co/novu/api/notifications/pojos/Children.java +++ b/src/main/java/co/novu/api/notifications/pojos/Children.java @@ -8,4 +8,4 @@ public class Children { private String value; private String operator; private String on; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/ExecutionDetails.java b/src/main/java/co/novu/api/notifications/pojos/ExecutionDetails.java index 4b4f3b6..0301405 100644 --- a/src/main/java/co/novu/api/notifications/pojos/ExecutionDetails.java +++ b/src/main/java/co/novu/api/notifications/pojos/ExecutionDetails.java @@ -6,21 +6,21 @@ @Data public class ExecutionDetails { - @SerializedName("_id") + @SerializedName("_id") private String id; - @SerializedName("_jobId") + @SerializedName("_jobId") private String jobId; - @SerializedName("_organizationId") + @SerializedName("_organizationId") private String organizationId; - @SerializedName("_environmentId") + @SerializedName("_environmentId") private String environmentId; - @SerializedName("_notificationId") + @SerializedName("_notificationId") private String notificationId; - @SerializedName("_subscriberId") + @SerializedName("_subscriberId") private String subscriberId; - @SerializedName("_notificationTemplateId") + @SerializedName("_notificationTemplateId") private String notificationTemplateId; - @SerializedName("_messageId") + @SerializedName("_messageId") private String messageId; private String transactionId; private Object providerId; @@ -31,4 +31,4 @@ public class ExecutionDetails { private String source; private String createdAt; private String updatedAt; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/Job.java b/src/main/java/co/novu/api/notifications/pojos/Job.java index e504d91..31d76d9 100644 --- a/src/main/java/co/novu/api/notifications/pojos/Job.java +++ b/src/main/java/co/novu/api/notifications/pojos/Job.java @@ -21,4 +21,4 @@ public class Job { private String providerId; private Step step; private List executionDetails; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/Notification.java b/src/main/java/co/novu/api/notifications/pojos/Notification.java index f0a3275..59ee4c5 100644 --- a/src/main/java/co/novu/api/notifications/pojos/Notification.java +++ b/src/main/java/co/novu/api/notifications/pojos/Notification.java @@ -27,4 +27,4 @@ public class Notification { private Template template; private Subscriber subscriber; private List jobs; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/NotificationGraphStats.java b/src/main/java/co/novu/api/notifications/pojos/NotificationGraphStats.java index 230b291..f7bd774 100644 --- a/src/main/java/co/novu/api/notifications/pojos/NotificationGraphStats.java +++ b/src/main/java/co/novu/api/notifications/pojos/NotificationGraphStats.java @@ -12,4 +12,4 @@ public class NotificationGraphStats { private Long count; private List templates; private List channels; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/NotificationStats.java b/src/main/java/co/novu/api/notifications/pojos/NotificationStats.java index 4c0dc3f..e8f3e44 100644 --- a/src/main/java/co/novu/api/notifications/pojos/NotificationStats.java +++ b/src/main/java/co/novu/api/notifications/pojos/NotificationStats.java @@ -7,4 +7,4 @@ public class NotificationStats { private Long weeklySent; private Long monthlySent; private Long yearlySent; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/Subscriber.java b/src/main/java/co/novu/api/notifications/pojos/Subscriber.java index 5082a87..9fa57ee 100644 --- a/src/main/java/co/novu/api/notifications/pojos/Subscriber.java +++ b/src/main/java/co/novu/api/notifications/pojos/Subscriber.java @@ -11,4 +11,4 @@ public class Subscriber { private String email; private String phone; private String avatar; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/pojos/Variables.java b/src/main/java/co/novu/api/notifications/pojos/Variables.java index 7b3883b..736e605 100644 --- a/src/main/java/co/novu/api/notifications/pojos/Variables.java +++ b/src/main/java/co/novu/api/notifications/pojos/Variables.java @@ -8,4 +8,4 @@ public class Variables { private String name; @SerializedName("_id") private String id; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/requests/NotificationRequest.java b/src/main/java/co/novu/api/notifications/requests/NotificationRequest.java index 5d50909..3f3a2dd 100644 --- a/src/main/java/co/novu/api/notifications/requests/NotificationRequest.java +++ b/src/main/java/co/novu/api/notifications/requests/NotificationRequest.java @@ -13,4 +13,4 @@ public class NotificationRequest implements IRequest { private String search; private Integer page; private String transactionId; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/responses/NotificationGraphStatsResponse.java b/src/main/java/co/novu/api/notifications/responses/NotificationGraphStatsResponse.java index 17e9419..7028e52 100644 --- a/src/main/java/co/novu/api/notifications/responses/NotificationGraphStatsResponse.java +++ b/src/main/java/co/novu/api/notifications/responses/NotificationGraphStatsResponse.java @@ -8,4 +8,4 @@ @Data public class NotificationGraphStatsResponse { private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/responses/NotificationResponse.java b/src/main/java/co/novu/api/notifications/responses/NotificationResponse.java index 27884ec..52d6ee2 100644 --- a/src/main/java/co/novu/api/notifications/responses/NotificationResponse.java +++ b/src/main/java/co/novu/api/notifications/responses/NotificationResponse.java @@ -6,4 +6,4 @@ @Data public class NotificationResponse { private Notification data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/responses/NotificationStatsResponse.java b/src/main/java/co/novu/api/notifications/responses/NotificationStatsResponse.java index ed726b1..4d11c1b 100644 --- a/src/main/java/co/novu/api/notifications/responses/NotificationStatsResponse.java +++ b/src/main/java/co/novu/api/notifications/responses/NotificationStatsResponse.java @@ -6,4 +6,4 @@ @Data public class NotificationStatsResponse { private NotificationStats data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/notifications/responses/NotificationsResponse.java b/src/main/java/co/novu/api/notifications/responses/NotificationsResponse.java index 767563a..4afd330 100644 --- a/src/main/java/co/novu/api/notifications/responses/NotificationsResponse.java +++ b/src/main/java/co/novu/api/notifications/responses/NotificationsResponse.java @@ -11,4 +11,4 @@ public class NotificationsResponse { private Long totalCount; private Long pageSize; private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/organizations/OrganizationApi.java b/src/main/java/co/novu/api/organizations/OrganizationApi.java index bc4654d..11965f8 100644 --- a/src/main/java/co/novu/api/organizations/OrganizationApi.java +++ b/src/main/java/co/novu/api/organizations/OrganizationApi.java @@ -19,8 +19,6 @@ import retrofit2.http.Path; import retrofit2.http.PATCH; - - public interface OrganizationApi { String ENDPOINT = "organizations"; @@ -41,7 +39,7 @@ public interface OrganizationApi { Call removeMemberWithId(@Path("memberId") String memberId); @PUT(ENDPOINT + "/members/{memberId}/roles") - Call updateMemberRole(@Path("memberId") String memberId , @Body UpdateMemberRoleRequest request); + Call updateMemberRole(@Path("memberId") String memberId, @Body UpdateMemberRoleRequest request); @GET(ENDPOINT + "/members") Call fetchMembersOfOrganization(); diff --git a/src/main/java/co/novu/api/organizations/OrganizationHandler.java b/src/main/java/co/novu/api/organizations/OrganizationHandler.java index bdf3787..062e4bd 100644 --- a/src/main/java/co/novu/api/organizations/OrganizationHandler.java +++ b/src/main/java/co/novu/api/organizations/OrganizationHandler.java @@ -18,19 +18,20 @@ import java.io.IOException; @RequiredArgsConstructor -public class OrganizationHandler { +public final class OrganizationHandler { private final RestHandler restHandler; private final OrganizationApi organizationApi; - public OrganizationHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.organizationApi = restHandler.buildRetrofit().create(OrganizationApi.class); + public OrganizationHandler(final RestHandler handler) { + this.restHandler = handler; + this.organizationApi = handler.buildRetrofit().create(OrganizationApi.class); } - public OrganizationResponse createOrganization(CreateOrganizationRequest request) throws IOException, NovuNetworkException { + public OrganizationResponse createOrganization(final CreateOrganizationRequest request) + throws IOException, NovuNetworkException { Response response = organizationApi.createOrganization(request).execute(); return restHandler.extractResponse(response); } @@ -40,23 +41,25 @@ public FetchOrganizationResponse fetchAllOrganizations() throws IOException, Nov return restHandler.extractResponse(response); } - public UpdateOrganizationNameResponse updateOrganizationName(UpdateOrganizationNameRequest request) throws IOException, NovuNetworkException { + public UpdateOrganizationNameResponse updateOrganizationName(final UpdateOrganizationNameRequest request) + throws IOException, NovuNetworkException { Response response = organizationApi.updateOrganizationName(request).execute(); return restHandler.extractResponse(response); } - public OrganizationResponse fetchCurrentOrganization() throws IOException, NovuNetworkException{ + public OrganizationResponse fetchCurrentOrganization() throws IOException, NovuNetworkException { Response response = organizationApi.fetchCurrentOrganization().execute(); return restHandler.extractResponse(response); } - public MemberResponse removeMemberWithId(String memberId) throws IOException, NovuNetworkException { + public MemberResponse removeMemberWithId(final String memberId) throws IOException, NovuNetworkException { Response response = organizationApi.removeMemberWithId(memberId).execute(); return restHandler.extractResponse(response); } - public MemberResponse updateMemberRole(String memberId, UpdateMemberRoleRequest request) throws IOException, NovuNetworkException { - Response response = organizationApi.updateMemberRole(memberId,request).execute(); + public MemberResponse updateMemberRole(final String memberId, final UpdateMemberRoleRequest request) + throws IOException, NovuNetworkException { + Response response = organizationApi.updateMemberRole(memberId, request).execute(); return restHandler.extractResponse(response); } @@ -65,10 +68,9 @@ public FetchMembersResponse fetchMembersOfOrganization() throws IOException, Nov return restHandler.extractResponse(response); } - public UpdateOrganizationBrandResponse updateOrganizationBrand(UpdateOrganizationBrandRequest request) throws IOException, NovuNetworkException { + public UpdateOrganizationBrandResponse updateOrganizationBrand(final UpdateOrganizationBrandRequest request) + throws IOException, NovuNetworkException { Response response = organizationApi.updateOrganizationBrand(request).execute(); return restHandler.extractResponse(response); } - - } diff --git a/src/main/java/co/novu/api/organizations/pojos/Branding.java b/src/main/java/co/novu/api/organizations/pojos/Branding.java index 378b575..b19d3b4 100644 --- a/src/main/java/co/novu/api/organizations/pojos/Branding.java +++ b/src/main/java/co/novu/api/organizations/pojos/Branding.java @@ -10,4 +10,4 @@ public class Branding { private String fontColor; private String contentBackground; private String fontFamily; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/SubscribersApi.java b/src/main/java/co/novu/api/subscribers/SubscribersApi.java index 2dfdd55..983c4b4 100644 --- a/src/main/java/co/novu/api/subscribers/SubscribersApi.java +++ b/src/main/java/co/novu/api/subscribers/SubscribersApi.java @@ -32,6 +32,7 @@ import java.util.Map; public interface SubscribersApi { + String ENDPOINT = "subscribers"; @GET(ENDPOINT) @@ -47,38 +48,50 @@ public interface SubscribersApi { Call getSubscriber(@Path("subscriberId") String subscriberId); @PUT(ENDPOINT + "/{subscriberId}") - Call updateSubscriber(@Body UpdateSubscriberRequest request, @Path("subscriberId") String subscriberId); + Call updateSubscriber(@Body UpdateSubscriberRequest request, + @Path("subscriberId") String subscriberId); @DELETE(ENDPOINT + "/{subscriberId}") Call deleteSubscriber(@Path("subscriberId") String subscriberId); @PUT(ENDPOINT + "/{subscriberId}/credentials") - Call updateSubscriberCredentials(@Body UpdateSubscriberCredentialsRequest request, @Path("subscriberId") String subscriberId); + Call updateSubscriberCredentials(@Body UpdateSubscriberCredentialsRequest request, + @Path("subscriberId") String subscriberId); @DELETE(ENDPOINT + "/{subscriberId}/credentials/{providerId}") - Call deleteSubscriberCredentials(@Path("subscriberId") String subscriberId, @Path("providerId") String providerId); + Call deleteSubscriberCredentials(@Path("subscriberId") String subscriberId, + @Path("providerId") String providerId); @PATCH(ENDPOINT + "/{subscriberId}/online-status") - Call updateSubscriberOnlineStatus(@Body UpdateSubscriberOnlineStatusRequest request, @Path("subscriberId") String subscriberId); + Call updateSubscriberOnlineStatus(@Body UpdateSubscriberOnlineStatusRequest request, + @Path("subscriberId") String subscriberId); @GET(ENDPOINT + "/{subscriberId}/preferences") Call getSubscriberPreferences(@Path("subscriberId") String subscriberId); @PATCH(ENDPOINT + "/{subscriberId}/preferences/{templateId}") - Call updateSubscriberPreferences(@Body UpdateSubscriberPreferenceRequest request, @Path("subscriberId") String subscriberId, @Path("templateId") String templateId); + Call updateSubscriberPreferences(@Body UpdateSubscriberPreferenceRequest request, + @Path("subscriberId") String subscriberId, + @Path("templateId") String templateId); @GET(ENDPOINT + "/{subscriberId}/notifications/feed") Call getSubscriberNotificationsFeed(@Path("subscriberId") String subscriberId); @GET(ENDPOINT + "/{subscriberId}/notifications/unseen") - Call getSubscriberUnseenNotificationsCount(@Path("subscriberId") String subscriberId); + Call getSubscriberUnseenNotificationsCount( + @Path("subscriberId") String subscriberId); @POST(ENDPOINT + "/{subscriberId}/messages/markAs") - Call markSubscriberMessageFeedAs(@Body MarkSubscriberFeedAsRequest request, @Path("subscriberId") String subscriberId); + Call markSubscriberMessageFeedAs(@Body MarkSubscriberFeedAsRequest request, + @Path("subscriberId") String subscriberId); @POST(ENDPOINT + "/{subscriberId}/messages/mark-all") - Call markAllSubscriberMessagesFeedAs(@Body MarkAllMessagesRequest request, @Path("subscriberId") String subscriberId); + Call markAllSubscriberMessagesFeedAs(@Body MarkAllMessagesRequest request, + @Path("subscriberId") String subscriberId); @POST(ENDPOINT + "/{subscriberId}/messages/{messageId}/actions/{type}") - Call markMessageActionAsSeen(@Body MarkMessageActionAsSeenRequest request, @Path("subscriberId") String subscriberId, @Path("messageId") String messageId, @Path("type") String type); + Call markMessageActionAsSeen(@Body MarkMessageActionAsSeenRequest request, + @Path("subscriberId") String subscriberId, + @Path("messageId") String messageId, + @Path("type") String type); } diff --git a/src/main/java/co/novu/api/subscribers/SubscribersHandler.java b/src/main/java/co/novu/api/subscribers/SubscribersHandler.java index c9c5bd2..04b8e44 100644 --- a/src/main/java/co/novu/api/subscribers/SubscribersHandler.java +++ b/src/main/java/co/novu/api/subscribers/SubscribersHandler.java @@ -1,6 +1,5 @@ package co.novu.api.subscribers; -import co.novu.api.layouts.LayoutApi; import co.novu.api.subscribers.requests.BulkSubscriberRequest; import co.novu.api.subscribers.requests.MarkAllMessagesRequest; import co.novu.api.subscribers.requests.MarkMessageActionAsSeenRequest; @@ -20,7 +19,6 @@ import co.novu.api.subscribers.responses.SubscriberDeleteResponse; import co.novu.api.subscribers.responses.SubscriberPreferenceResponse; import co.novu.api.subscribers.responses.UnseenNotificationsCountResponse; -import co.novu.common.base.NovuConfig; import co.novu.common.rest.NovuNetworkException; import co.novu.common.rest.RestHandler; import lombok.RequiredArgsConstructor; @@ -31,83 +29,123 @@ import java.util.Map; @RequiredArgsConstructor -public class SubscribersHandler { +public final class SubscribersHandler { private final RestHandler restHandler; private final SubscribersApi subscribersApi; - public SubscribersHandler(RestHandler restHandler){ - this.restHandler = restHandler; - this.subscribersApi = restHandler.buildRetrofit().create(SubscribersApi.class); + public SubscribersHandler(final RestHandler handler) { + this.restHandler = handler; + this.subscribersApi = handler.buildRetrofit().create(SubscribersApi.class); } - public BulkSubscriberResponse getSubscribers(Integer page, Integer limit) throws IOException, NovuNetworkException { + public BulkSubscriberResponse getSubscribers(final Integer page, final Integer limit) + throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (page != null) params.put("page", page); - if (limit != null) params.put("limit", limit); + if (page != null) { + params.put("page", page); + } + if (limit != null) { + params.put("limit", limit); + } Response bulkSubscriberResponse = subscribersApi.getSubscribers(params).execute(); return restHandler.extractResponse(bulkSubscriberResponse); } - public CreateSubscriberResponse createSubscriber(SubscriberRequest request) throws IOException, NovuNetworkException { + public CreateSubscriberResponse createSubscriber(final SubscriberRequest request) + throws IOException, NovuNetworkException { return restHandler.extractResponse(subscribersApi.createSubscriber(request).execute()); } - public CreateBulkSubscriberResponse createSubscriberBulk(BulkSubscriberRequest request) throws IOException, NovuNetworkException { + public CreateBulkSubscriberResponse createSubscriberBulk(final BulkSubscriberRequest request) + throws IOException, NovuNetworkException { return restHandler.extractResponse(subscribersApi.createBulkSubscriber(request).execute()); } - public SingleSubscriberResponse getSubscriber(String subscriberId) throws IOException, NovuNetworkException { + public SingleSubscriberResponse getSubscriber(final String subscriberId) throws IOException, NovuNetworkException { return restHandler.extractResponse(subscribersApi.getSubscriber(subscriberId).execute()); } - public SingleSubscriberResponse updateSubscriber(UpdateSubscriberRequest request, String subscriberId) throws IOException, NovuNetworkException { + public SingleSubscriberResponse updateSubscriber(final UpdateSubscriberRequest request, final String subscriberId) + throws IOException, NovuNetworkException { return restHandler.extractResponse(subscribersApi.updateSubscriber(request, subscriberId).execute()); } - public SubscriberDeleteResponse deleteSubscriber(String subscriberId) throws IOException, NovuNetworkException { + public SubscriberDeleteResponse deleteSubscriber(final String subscriberId) + throws IOException, NovuNetworkException { return restHandler.extractResponse(subscribersApi.deleteSubscriber(subscriberId).execute()); } - public SingleSubscriberResponse updateSubscriberCredentials(UpdateSubscriberCredentialsRequest request, String subscriberId) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.updateSubscriberCredentials(request, subscriberId).execute()); + public SingleSubscriberResponse updateSubscriberCredentials(final UpdateSubscriberCredentialsRequest request, + final String subscriberId) + throws IOException, NovuNetworkException { + Response response = + subscribersApi.updateSubscriberCredentials(request, subscriberId).execute(); + return restHandler.extractResponse(response); } - public DeleteCredentialsResponse deleteSubscriberCredentials(String subscriberId, String providerId) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.deleteSubscriberCredentials(subscriberId, providerId).execute(), new DeleteCredentialsResponse()); + public DeleteCredentialsResponse deleteSubscriberCredentials(final String subscriberId, final String providerId) + throws IOException, NovuNetworkException { + Response response = subscribersApi.deleteSubscriberCredentials(subscriberId, providerId).execute(); + return restHandler.extractResponse(response, new DeleteCredentialsResponse()); } - public SingleSubscriberResponse updateSubscriberOnlineStatus(UpdateSubscriberOnlineStatusRequest request, String subscriberId) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.updateSubscriberOnlineStatus(request, subscriberId).execute()); + public SingleSubscriberResponse updateSubscriberOnlineStatus(final UpdateSubscriberOnlineStatusRequest request, + final String subscriberId) + throws IOException, NovuNetworkException { + Response response = + subscribersApi.updateSubscriberOnlineStatus(request, subscriberId).execute(); + return restHandler.extractResponse(response); } - public SubscriberPreferenceResponse getSubscriberPreferences(String subscriberId) throws IOException, NovuNetworkException { + public SubscriberPreferenceResponse getSubscriberPreferences(final String subscriberId) + throws IOException, NovuNetworkException { return restHandler.extractResponse(subscribersApi.getSubscriberPreferences(subscriberId).execute()); } - public SingleSubscriberPrefResponse updateSubscriberPreferences(UpdateSubscriberPreferenceRequest request, String subscriberId, String templateId) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.updateSubscriberPreferences(request, subscriberId, templateId).execute()); + public SingleSubscriberPrefResponse updateSubscriberPreferences(final UpdateSubscriberPreferenceRequest request, + final String subscriberId, + final String templateId) + throws IOException, NovuNetworkException { + Response response = + subscribersApi.updateSubscriberPreferences(request, subscriberId, templateId).execute(); + return restHandler.extractResponse(response); } - public SubscriberNotificationResponse getSubscriberNotificationsFeed(String subscriberId) throws IOException, NovuNetworkException { + public SubscriberNotificationResponse getSubscriberNotificationsFeed(final String subscriberId) + throws IOException, NovuNetworkException { return restHandler.extractResponse(subscribersApi.getSubscriberNotificationsFeed(subscriberId).execute()); } - public UnseenNotificationsCountResponse getSubscriberUnseenNotificationsCount(String subscriberId) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.getSubscriberUnseenNotificationsCount(subscriberId).execute()); + public UnseenNotificationsCountResponse getSubscriberUnseenNotificationsCount(final String subscriberId) + throws IOException, NovuNetworkException { + Response response = + subscribersApi.getSubscriberUnseenNotificationsCount(subscriberId).execute(); + return restHandler.extractResponse(response); } - public SubscriberNotificationResponse markSubscriberMessageFeedAs(MarkSubscriberFeedAsRequest request, String subscriberId) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.markSubscriberMessageFeedAs(request, subscriberId).execute()); + public SubscriberNotificationResponse markSubscriberMessageFeedAs(final MarkSubscriberFeedAsRequest request, + final String subscriberId) + throws IOException, NovuNetworkException { + Response response = + subscribersApi.markSubscriberMessageFeedAs(request, subscriberId).execute(); + return restHandler.extractResponse(response); } - public Long markAllSubscriberMessagesFeedAs(MarkAllMessagesRequest request, String subscriberId) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.markAllSubscriberMessagesFeedAs(request, subscriberId).execute()); + public Long markAllSubscriberMessagesFeedAs(final MarkAllMessagesRequest request, final String subscriberId) + throws IOException, NovuNetworkException { + Response response = subscribersApi.markAllSubscriberMessagesFeedAs(request, subscriberId).execute(); + return restHandler.extractResponse(response); } - public SubscriberNotificationResponse markMessageActionAsSeen(MarkMessageActionAsSeenRequest request, String subscriberId, String messageId, String type) throws IOException, NovuNetworkException { - return restHandler.extractResponse(subscribersApi.markMessageActionAsSeen(request, subscriberId, messageId, type).execute()); + public SubscriberNotificationResponse markMessageActionAsSeen(final MarkMessageActionAsSeenRequest request, + final String subscriberId, final String messageId, + final String type) + throws IOException, NovuNetworkException { + Response response = + subscribersApi.markMessageActionAsSeen(request, subscriberId, messageId, type).execute(); + return restHandler.extractResponse(response); } } diff --git a/src/main/java/co/novu/api/subscribers/pojos/Channel.java b/src/main/java/co/novu/api/subscribers/pojos/Channel.java index c6ccc12..483b47a 100644 --- a/src/main/java/co/novu/api/subscribers/pojos/Channel.java +++ b/src/main/java/co/novu/api/subscribers/pojos/Channel.java @@ -9,4 +9,4 @@ public class Channel { private String providerId; @SerializedName("_integrationId") private String integrationId; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/pojos/ChannelCredentials.java b/src/main/java/co/novu/api/subscribers/pojos/ChannelCredentials.java index 476e197..04181cc 100644 --- a/src/main/java/co/novu/api/subscribers/pojos/ChannelCredentials.java +++ b/src/main/java/co/novu/api/subscribers/pojos/ChannelCredentials.java @@ -9,4 +9,4 @@ public class ChannelCredentials { private String webhookUrl; private String channel; private List deviceTokens; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/pojos/Mark.java b/src/main/java/co/novu/api/subscribers/pojos/Mark.java index aa04885..141fbff 100644 --- a/src/main/java/co/novu/api/subscribers/pojos/Mark.java +++ b/src/main/java/co/novu/api/subscribers/pojos/Mark.java @@ -6,4 +6,4 @@ public class Mark { private Boolean read; private Boolean seen; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/pojos/Preference.java b/src/main/java/co/novu/api/subscribers/pojos/Preference.java index 101530f..a832bfb 100644 --- a/src/main/java/co/novu/api/subscribers/pojos/Preference.java +++ b/src/main/java/co/novu/api/subscribers/pojos/Preference.java @@ -7,4 +7,4 @@ public class Preference { private Boolean enabled; private Object channels; private Object overrides; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/pojos/PreferenceChannel.java b/src/main/java/co/novu/api/subscribers/pojos/PreferenceChannel.java index e0d8b95..e9bddc5 100644 --- a/src/main/java/co/novu/api/subscribers/pojos/PreferenceChannel.java +++ b/src/main/java/co/novu/api/subscribers/pojos/PreferenceChannel.java @@ -6,4 +6,4 @@ public class PreferenceChannel { private Boolean enabled; private String type; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/pojos/SubscriberNotification.java b/src/main/java/co/novu/api/subscribers/pojos/SubscriberNotification.java index a04b477..d6aa6f9 100644 --- a/src/main/java/co/novu/api/subscribers/pojos/SubscriberNotification.java +++ b/src/main/java/co/novu/api/subscribers/pojos/SubscriberNotification.java @@ -46,4 +46,4 @@ public class SubscriberNotification { private String errorText; private Object overrides; private Object subject; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/pojos/SubscriberPreference.java b/src/main/java/co/novu/api/subscribers/pojos/SubscriberPreference.java index 97da0ea..c21496b 100644 --- a/src/main/java/co/novu/api/subscribers/pojos/SubscriberPreference.java +++ b/src/main/java/co/novu/api/subscribers/pojos/SubscriberPreference.java @@ -7,4 +7,4 @@ public class SubscriberPreference { private Template template; private Preference preference; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/BulkSubscriberRequest.java b/src/main/java/co/novu/api/subscribers/requests/BulkSubscriberRequest.java index f42247d..5c41faf 100644 --- a/src/main/java/co/novu/api/subscribers/requests/BulkSubscriberRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/BulkSubscriberRequest.java @@ -9,4 +9,4 @@ @Data public class BulkSubscriberRequest implements IRequest { private List subscribers; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/MarkAllMessagesRequest.java b/src/main/java/co/novu/api/subscribers/requests/MarkAllMessagesRequest.java index 51a93f8..6776cb8 100644 --- a/src/main/java/co/novu/api/subscribers/requests/MarkAllMessagesRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/MarkAllMessagesRequest.java @@ -7,4 +7,4 @@ public class MarkAllMessagesRequest implements IRequest { private String feedIdentifier; private String markAs; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/MarkMessageActionAsSeenRequest.java b/src/main/java/co/novu/api/subscribers/requests/MarkMessageActionAsSeenRequest.java index 4329d63..ab0256a 100644 --- a/src/main/java/co/novu/api/subscribers/requests/MarkMessageActionAsSeenRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/MarkMessageActionAsSeenRequest.java @@ -7,4 +7,4 @@ public class MarkMessageActionAsSeenRequest implements IRequest { private String status; private Object payload; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/MarkSubscriberFeedAsRequest.java b/src/main/java/co/novu/api/subscribers/requests/MarkSubscriberFeedAsRequest.java index 833d95e..1398cc7 100644 --- a/src/main/java/co/novu/api/subscribers/requests/MarkSubscriberFeedAsRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/MarkSubscriberFeedAsRequest.java @@ -8,4 +8,4 @@ public class MarkSubscriberFeedAsRequest implements IRequest { private Object messageId; private Mark mark; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberCredentialsRequest.java b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberCredentialsRequest.java index 149e3cb..df57193 100644 --- a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberCredentialsRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberCredentialsRequest.java @@ -8,4 +8,4 @@ public class UpdateSubscriberCredentialsRequest implements IRequest { private String providerId; private ChannelCredentials credentials; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberOnlineStatusRequest.java b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberOnlineStatusRequest.java index ecbf996..d6b1ec7 100644 --- a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberOnlineStatusRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberOnlineStatusRequest.java @@ -6,4 +6,4 @@ @Data public class UpdateSubscriberOnlineStatusRequest implements IRequest { private Boolean isOnline; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberPreferenceRequest.java b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberPreferenceRequest.java index a9d5c55..cc214ac 100644 --- a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberPreferenceRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberPreferenceRequest.java @@ -8,4 +8,4 @@ public class UpdateSubscriberPreferenceRequest implements IRequest { private PreferenceChannel channel; private Boolean enabled; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberRequest.java b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberRequest.java index ffb97e1..23ce075 100644 --- a/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberRequest.java +++ b/src/main/java/co/novu/api/subscribers/requests/UpdateSubscriberRequest.java @@ -12,4 +12,4 @@ public class UpdateSubscriberRequest implements IRequest { private String avatar; private String locale; private Object data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/BulkSubscriberResponse.java b/src/main/java/co/novu/api/subscribers/responses/BulkSubscriberResponse.java index 13579cb..1d3dd83 100644 --- a/src/main/java/co/novu/api/subscribers/responses/BulkSubscriberResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/BulkSubscriberResponse.java @@ -10,4 +10,4 @@ public class BulkSubscriberResponse { private Long totalCount; private Long pageSize; private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/CreateBulkSubscriberResponse.java b/src/main/java/co/novu/api/subscribers/responses/CreateBulkSubscriberResponse.java index 4599bb9..8ad8855 100644 --- a/src/main/java/co/novu/api/subscribers/responses/CreateBulkSubscriberResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/CreateBulkSubscriberResponse.java @@ -15,4 +15,4 @@ public static class Failed { private String message; private String subscriberId; } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/CreateSubscriberResponse.java b/src/main/java/co/novu/api/subscribers/responses/CreateSubscriberResponse.java index a4c84af..6ada400 100644 --- a/src/main/java/co/novu/api/subscribers/responses/CreateSubscriberResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/CreateSubscriberResponse.java @@ -5,4 +5,4 @@ @Data public class CreateSubscriberResponse { private SubscriberResponse data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/DeleteCredentialsResponse.java b/src/main/java/co/novu/api/subscribers/responses/DeleteCredentialsResponse.java index ae9a358..7f4ed6a 100644 --- a/src/main/java/co/novu/api/subscribers/responses/DeleteCredentialsResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/DeleteCredentialsResponse.java @@ -7,4 +7,4 @@ public class DeleteCredentialsResponse { private Boolean acknowledged = true; private String status = "Done"; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/DeleteResponse.java b/src/main/java/co/novu/api/subscribers/responses/DeleteResponse.java index bf33c29..7812196 100644 --- a/src/main/java/co/novu/api/subscribers/responses/DeleteResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/DeleteResponse.java @@ -6,4 +6,4 @@ public class DeleteResponse { private Boolean acknowledged; private String status; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberPrefResponse.java b/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberPrefResponse.java index 4caf978..ae3a02b 100644 --- a/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberPrefResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberPrefResponse.java @@ -6,4 +6,4 @@ @Data public class SingleSubscriberPrefResponse { private SubscriberPreference data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberResponse.java b/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberResponse.java index d7b896f..5552d14 100644 --- a/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/SingleSubscriberResponse.java @@ -5,4 +5,4 @@ @Data public class SingleSubscriberResponse { private SubscriberResponse data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/SubscriberDeleteResponse.java b/src/main/java/co/novu/api/subscribers/responses/SubscriberDeleteResponse.java index 68971dd..1476e11 100644 --- a/src/main/java/co/novu/api/subscribers/responses/SubscriberDeleteResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/SubscriberDeleteResponse.java @@ -5,4 +5,4 @@ @Data public class SubscriberDeleteResponse { private DeleteResponse data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/SubscriberNotificationResponse.java b/src/main/java/co/novu/api/subscribers/responses/SubscriberNotificationResponse.java index 34445c5..b734570 100644 --- a/src/main/java/co/novu/api/subscribers/responses/SubscriberNotificationResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/SubscriberNotificationResponse.java @@ -11,4 +11,4 @@ public class SubscriberNotificationResponse { private Long totalCount; private Long pageSize; private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/SubscriberPreferenceResponse.java b/src/main/java/co/novu/api/subscribers/responses/SubscriberPreferenceResponse.java index b385442..bb582bc 100644 --- a/src/main/java/co/novu/api/subscribers/responses/SubscriberPreferenceResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/SubscriberPreferenceResponse.java @@ -8,4 +8,4 @@ @Data public class SubscriberPreferenceResponse { private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/SubscriberResponse.java b/src/main/java/co/novu/api/subscribers/responses/SubscriberResponse.java index 3f34999..f2c16ff 100644 --- a/src/main/java/co/novu/api/subscribers/responses/SubscriberResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/SubscriberResponse.java @@ -29,4 +29,4 @@ public class SubscriberResponse { private Long v; private Object locale; private List channels; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/subscribers/responses/UnseenNotificationsCountResponse.java b/src/main/java/co/novu/api/subscribers/responses/UnseenNotificationsCountResponse.java index 0112a13..cf2b717 100644 --- a/src/main/java/co/novu/api/subscribers/responses/UnseenNotificationsCountResponse.java +++ b/src/main/java/co/novu/api/subscribers/responses/UnseenNotificationsCountResponse.java @@ -5,4 +5,4 @@ @Data public class UnseenNotificationsCountResponse { private Long data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/tenants/TenantsApi.java b/src/main/java/co/novu/api/tenants/TenantsApi.java index 3fa10b5..1775a5e 100644 --- a/src/main/java/co/novu/api/tenants/TenantsApi.java +++ b/src/main/java/co/novu/api/tenants/TenantsApi.java @@ -30,7 +30,7 @@ public interface TenantsApi { @PATCH(ENDPOINT + "/{tenantId}") Call updateTenant(@Body TenantRequest request, @Path("tenantId") String tenantId); - @DELETE(ENDPOINT+ "/{tenantId}") + @DELETE(ENDPOINT + "/{tenantId}") Call deleteTenant(@Path("tenantId") String tenantId); } diff --git a/src/main/java/co/novu/api/tenants/TenantsHandler.java b/src/main/java/co/novu/api/tenants/TenantsHandler.java index 8b2850e..ea1f0e3 100644 --- a/src/main/java/co/novu/api/tenants/TenantsHandler.java +++ b/src/main/java/co/novu/api/tenants/TenantsHandler.java @@ -13,42 +13,46 @@ import co.novu.common.rest.RestHandler; import retrofit2.Response; -public class TenantsHandler { +public final class TenantsHandler { private final RestHandler restHandler; private final TenantsApi tenantsApi; - public TenantsHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.tenantsApi = restHandler.buildRetrofit().create(TenantsApi.class); + public TenantsHandler(final RestHandler handler) { + this.restHandler = handler; + this.tenantsApi = handler.buildRetrofit().create(TenantsApi.class); } - public BulkTenantResponse getTenants(GetTenantRequest request) throws IOException, NovuNetworkException { + public BulkTenantResponse getTenants(final GetTenantRequest request) throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (request.getPage() != null) params.put("page", request.getPage()); - if (request.getLimit() != null) params.put("limit", request.getLimit()); + if (request.getPage() != null) { + params.put("page", request.getPage()); + } + if (request.getLimit() != null) { + params.put("limit", request.getLimit()); + } Response response = tenantsApi.getTenants(params).execute(); return restHandler.extractResponse(response); } - public TenantResponse createTenant(TenantRequest request) throws IOException, NovuNetworkException { + public TenantResponse createTenant(final TenantRequest request) throws IOException, NovuNetworkException { Response response = tenantsApi.createTenant(request).execute(); return restHandler.extractResponse(response); } - public TenantResponse getTenant(String tenantId) throws IOException, NovuNetworkException { + public TenantResponse getTenant(final String tenantId) throws IOException, NovuNetworkException { Response response = tenantsApi.getTenant(tenantId).execute(); return restHandler.extractResponse(response); } - public TenantResponse updateTenant(TenantRequest request, String tenantId) throws IOException, NovuNetworkException { + public TenantResponse updateTenant(final TenantRequest request, final String tenantId) + throws IOException, NovuNetworkException { Response response = tenantsApi.updateTenant(request, tenantId).execute(); return restHandler.extractResponse(response); } - public DeleteTenantResponse deleteTenant(String tenantId) throws IOException, NovuNetworkException { + public DeleteTenantResponse deleteTenant(final String tenantId) throws IOException, NovuNetworkException { Response response = tenantsApi.deleteTenant(tenantId).execute(); return restHandler.extractResponse(response, new DeleteTenantResponse()); } - } diff --git a/src/main/java/co/novu/api/tenants/pojos/Tenant.java b/src/main/java/co/novu/api/tenants/pojos/Tenant.java index d068bdc..2a31fbd 100644 --- a/src/main/java/co/novu/api/tenants/pojos/Tenant.java +++ b/src/main/java/co/novu/api/tenants/pojos/Tenant.java @@ -14,4 +14,4 @@ public class Tenant { private String identifier; private String name; private String updatedAt; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/tenants/requests/GetTenantRequest.java b/src/main/java/co/novu/api/tenants/requests/GetTenantRequest.java index 2b83ad7..5d76394 100644 --- a/src/main/java/co/novu/api/tenants/requests/GetTenantRequest.java +++ b/src/main/java/co/novu/api/tenants/requests/GetTenantRequest.java @@ -7,4 +7,4 @@ public class GetTenantRequest implements IRequest { private Integer page; private Integer limit; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/tenants/requests/TenantRequest.java b/src/main/java/co/novu/api/tenants/requests/TenantRequest.java index 16c33d2..a1f03e8 100644 --- a/src/main/java/co/novu/api/tenants/requests/TenantRequest.java +++ b/src/main/java/co/novu/api/tenants/requests/TenantRequest.java @@ -8,4 +8,4 @@ public class TenantRequest implements IRequest { private String identifier; private String name; private Object data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/tenants/responses/BulkTenantResponse.java b/src/main/java/co/novu/api/tenants/responses/BulkTenantResponse.java index 3c37386..80e2994 100644 --- a/src/main/java/co/novu/api/tenants/responses/BulkTenantResponse.java +++ b/src/main/java/co/novu/api/tenants/responses/BulkTenantResponse.java @@ -11,4 +11,4 @@ public class BulkTenantResponse { private Integer page; private Integer pageSize; private Boolean hasMore; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/tenants/responses/DeleteTenantResponse.java b/src/main/java/co/novu/api/tenants/responses/DeleteTenantResponse.java index 8ec4fb7..a6f0bd5 100644 --- a/src/main/java/co/novu/api/tenants/responses/DeleteTenantResponse.java +++ b/src/main/java/co/novu/api/tenants/responses/DeleteTenantResponse.java @@ -7,4 +7,4 @@ public class DeleteTenantResponse { private Boolean acknowledged = true; private String status = "Done"; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/tenants/responses/TenantResponse.java b/src/main/java/co/novu/api/tenants/responses/TenantResponse.java index 67af082..f66459d 100644 --- a/src/main/java/co/novu/api/tenants/responses/TenantResponse.java +++ b/src/main/java/co/novu/api/tenants/responses/TenantResponse.java @@ -6,4 +6,4 @@ @Data public class TenantResponse { private Tenant data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/topics/TopicApi.java b/src/main/java/co/novu/api/topics/TopicApi.java index 0acd11a..ae9f3d0 100644 --- a/src/main/java/co/novu/api/topics/TopicApi.java +++ b/src/main/java/co/novu/api/topics/TopicApi.java @@ -4,10 +4,8 @@ import co.novu.api.topics.requests.SubscriberAdditionRequest; import co.novu.api.topics.requests.TopicRequest; import co.novu.api.topics.responses.CheckTopicSubscriberResponse; -import co.novu.api.topics.responses.DeleteTopicResponse; import co.novu.api.topics.responses.FilterTopicsResponse; import co.novu.api.topics.responses.SubscriberAdditionResponse; -import co.novu.api.topics.responses.SubscriberRemovalResponse; import co.novu.api.topics.responses.TopicResponse; import retrofit2.Call; import retrofit2.http.Body; @@ -31,13 +29,16 @@ public interface TopicApi { Call filterTopics(@QueryMap Map options); @POST(ENDPOINT + "/{topicKey}/subscribers") - Call addSubscriberToTopic(@Path("topicKey") String topicKey, @Body SubscriberAdditionRequest subscriberAdditionRequest); + Call addSubscriberToTopic(@Path("topicKey") String topicKey, + @Body SubscriberAdditionRequest subscriberAdditionRequest); @GET(ENDPOINT + "/{topicKey}/subscribers/{externalSubscriberId}") - Call checkTopicSubscriber(@Path("topicKey") String topicKey, @Path("externalSubscriberId") String externalSubscriberId); + Call checkTopicSubscriber(@Path("topicKey") String topicKey, + @Path("externalSubscriberId") String externalSubscriberId); @POST(ENDPOINT + "/{topicKey}/subscribers/removal") - Call removeSubscriberFromTopic(@Path("topicKey") String topicKey, @Body SubscriberAdditionRequest subscriberAdditionRequest); + Call removeSubscriberFromTopic(@Path("topicKey") String topicKey, + @Body SubscriberAdditionRequest subscriberAdditionRequest); @DELETE(ENDPOINT + "/{topicKey}") Call deleteTopic(@Path("topicKey") String topicKey); diff --git a/src/main/java/co/novu/api/topics/TopicHandler.java b/src/main/java/co/novu/api/topics/TopicHandler.java index c74c4c5..cc5e4eb 100644 --- a/src/main/java/co/novu/api/topics/TopicHandler.java +++ b/src/main/java/co/novu/api/topics/TopicHandler.java @@ -18,57 +18,71 @@ import java.util.Map; import retrofit2.Response; -public class TopicHandler { +public final class TopicHandler { private final RestHandler restHandler; private final TopicApi topicApi; - public TopicHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.topicApi = restHandler.buildRetrofit().create(TopicApi.class); + public TopicHandler(final RestHandler handler) { + this.restHandler = handler; + this.topicApi = handler.buildRetrofit().create(TopicApi.class); } - public TopicResponse createTopic(TopicRequest request) throws IOException, NovuNetworkException { + public TopicResponse createTopic(final TopicRequest request) throws IOException, NovuNetworkException { Response response = topicApi.createTopic(request).execute(); return restHandler.extractResponse(response); } - public FilterTopicsResponse filterTopics(FilterTopicsRequest request) throws IOException, NovuNetworkException { + public FilterTopicsResponse filterTopics(final FilterTopicsRequest request) + throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (request.getPage() != null) params.put("page", request.getPage()); - if (request.getPageSize() != null) params.put("pageSize", request.getPageSize()); - if (request.getKey() != null) params.put("key", request.getKey()); + if (request.getPage() != null) { + params.put("page", request.getPage()); + } + if (request.getPageSize() != null) { + params.put("pageSize", request.getPageSize()); + } + if (request.getKey() != null) { + params.put("key", request.getKey()); + } Response response = topicApi.filterTopics(params).execute(); return restHandler.extractResponse(response); } - public SubscriberAdditionResponse addSubscriberToTopic(SubscriberAdditionRequest request, String topicKey) throws IOException, NovuNetworkException { + public SubscriberAdditionResponse addSubscriberToTopic(final SubscriberAdditionRequest request, + final String topicKey) + throws IOException, NovuNetworkException { Response response = topicApi.addSubscriberToTopic(topicKey, request).execute(); return restHandler.extractResponse(response); } - public CheckTopicSubscriberResponse checkTopicSubscriber(String topicKey, String externalSubscriberId) throws IOException, NovuNetworkException { - Response response = topicApi.checkTopicSubscriber(topicKey, externalSubscriberId).execute(); + public CheckTopicSubscriberResponse checkTopicSubscriber(final String topicKey, final String externalSubscriberId) + throws IOException, NovuNetworkException { + Response response = + topicApi.checkTopicSubscriber(topicKey, externalSubscriberId).execute(); return restHandler.extractResponse(response); } - public SubscriberRemovalResponse removeSubscriberFromTopic(SubscriberAdditionRequest request, String topicKey) throws IOException, NovuNetworkException { + public SubscriberRemovalResponse removeSubscriberFromTopic(final SubscriberAdditionRequest request, + final String topicKey) + throws IOException, NovuNetworkException { Response response = topicApi.removeSubscriberFromTopic(topicKey, request).execute(); return restHandler.extractResponse(response, new SubscriberRemovalResponse()); } - public DeleteTopicResponse deleteTopic(String topicKey) throws IOException, NovuNetworkException { + public DeleteTopicResponse deleteTopic(final String topicKey) throws IOException, NovuNetworkException { Response response = topicApi.deleteTopic(topicKey).execute(); return restHandler.extractResponse(response, new DeleteTopicResponse()); } - public TopicResponse getTopic(String topicKey) throws IOException, NovuNetworkException { + public TopicResponse getTopic(final String topicKey) throws IOException, NovuNetworkException { Response response = topicApi.getTopic(topicKey).execute(); return restHandler.extractResponse(response); } - public TopicResponse renameTopic(RenameTopicRequest request, String topicKey) throws IOException, NovuNetworkException { + public TopicResponse renameTopic(final RenameTopicRequest request, final String topicKey) + throws IOException, NovuNetworkException { Response response = topicApi.renameTopic(topicKey, request).execute(); return restHandler.extractResponse(response); } -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/topics/responses/CheckTopicSubscriberResponse.java b/src/main/java/co/novu/api/topics/responses/CheckTopicSubscriberResponse.java index ddf35bd..35ac993 100644 --- a/src/main/java/co/novu/api/topics/responses/CheckTopicSubscriberResponse.java +++ b/src/main/java/co/novu/api/topics/responses/CheckTopicSubscriberResponse.java @@ -19,4 +19,4 @@ public class CheckTopicSubscriberResponse { private String topicKey; private String externalSubscriberId; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/topics/responses/DeleteTopicResponse.java b/src/main/java/co/novu/api/topics/responses/DeleteTopicResponse.java index 3c717a2..cf4928d 100644 --- a/src/main/java/co/novu/api/topics/responses/DeleteTopicResponse.java +++ b/src/main/java/co/novu/api/topics/responses/DeleteTopicResponse.java @@ -7,4 +7,4 @@ public class DeleteTopicResponse { private Boolean acknowledged = true; private String status = "Done"; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/topics/responses/Failed.java b/src/main/java/co/novu/api/topics/responses/Failed.java index 0bea5d0..688e19b 100644 --- a/src/main/java/co/novu/api/topics/responses/Failed.java +++ b/src/main/java/co/novu/api/topics/responses/Failed.java @@ -7,5 +7,4 @@ @Data public class Failed { private List notFound; - } diff --git a/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponse.java b/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponse.java index dddc7ce..de3bb10 100644 --- a/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponse.java +++ b/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponse.java @@ -6,4 +6,3 @@ public class SubscriberAdditionResponse { private SubscriberAdditionResponseData data; } - diff --git a/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponseData.java b/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponseData.java index defeaac..2711d11 100644 --- a/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponseData.java +++ b/src/main/java/co/novu/api/topics/responses/SubscriberAdditionResponseData.java @@ -8,4 +8,3 @@ public class SubscriberAdditionResponseData { private List succeeded; private Failed failed; } - diff --git a/src/main/java/co/novu/api/topics/responses/SubscriberRemovalResponse.java b/src/main/java/co/novu/api/topics/responses/SubscriberRemovalResponse.java index 4e26258..b661a3a 100644 --- a/src/main/java/co/novu/api/topics/responses/SubscriberRemovalResponse.java +++ b/src/main/java/co/novu/api/topics/responses/SubscriberRemovalResponse.java @@ -7,4 +7,4 @@ public class SubscriberRemovalResponse { private Boolean acknowledged = true; private String status = "Done"; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/topics/responses/TopicResponse.java b/src/main/java/co/novu/api/topics/responses/TopicResponse.java index ba9486e..05f11a2 100644 --- a/src/main/java/co/novu/api/topics/responses/TopicResponse.java +++ b/src/main/java/co/novu/api/topics/responses/TopicResponse.java @@ -5,5 +5,4 @@ @Data public class TopicResponse { private TopicResponseData data; - } diff --git a/src/main/java/co/novu/api/workflowgroups/WorkflowGroupApi.java b/src/main/java/co/novu/api/workflowgroups/WorkflowGroupApi.java index 40131b6..3c55307 100644 --- a/src/main/java/co/novu/api/workflowgroups/WorkflowGroupApi.java +++ b/src/main/java/co/novu/api/workflowgroups/WorkflowGroupApi.java @@ -17,17 +17,17 @@ public interface WorkflowGroupApi { String ENDPOINT = "notification-groups"; @POST(ENDPOINT) - public Call createWorkflowGroup(@Body WorkflowGroupRequest request); + Call createWorkflowGroup(@Body WorkflowGroupRequest request); @GET(ENDPOINT) - public Call getWorkflowGroups(); + Call getWorkflowGroups(); @GET(ENDPOINT + "/{id}") - public Call getWorkflowGroup(@Path("id") String id); + Call getWorkflowGroup(@Path("id") String id); @PUT(ENDPOINT + "/{id}") - public Call updateWorkflowGroup(@Path("id") String id, @Body WorkflowGroupRequest request); + Call updateWorkflowGroup(@Path("id") String id, @Body WorkflowGroupRequest request); @DELETE(ENDPOINT + "/{id}") - public Call deleteWorkflowGroup(@Path("id") String id); + Call deleteWorkflowGroup(@Path("id") String id); } diff --git a/src/main/java/co/novu/api/workflowgroups/WorkflowGroupHandler.java b/src/main/java/co/novu/api/workflowgroups/WorkflowGroupHandler.java index 1d165dc..5de56c3 100644 --- a/src/main/java/co/novu/api/workflowgroups/WorkflowGroupHandler.java +++ b/src/main/java/co/novu/api/workflowgroups/WorkflowGroupHandler.java @@ -11,19 +11,20 @@ import lombok.RequiredArgsConstructor; @RequiredArgsConstructor -public class WorkflowGroupHandler { +public final class WorkflowGroupHandler { private final RestHandler restHandler; private final WorkflowGroupApi workflowGroupApi; - public WorkflowGroupHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.workflowGroupApi = restHandler.buildRetrofit().create(WorkflowGroupApi.class); + public WorkflowGroupHandler(final RestHandler handler) { + this.restHandler = handler; + this.workflowGroupApi = handler.buildRetrofit().create(WorkflowGroupApi.class); } - public WorkflowGroupResponse createWorkflowGroup(WorkflowGroupRequest request) throws NovuNetworkException, IOException { + public WorkflowGroupResponse createWorkflowGroup(final WorkflowGroupRequest request) + throws NovuNetworkException, IOException { return restHandler.extractResponse(this.workflowGroupApi.createWorkflowGroup(request).execute()); } @@ -31,15 +32,16 @@ public GetWorkflowGroupsResponse getWorkflowGroups() throws NovuNetworkException return restHandler.extractResponse(this.workflowGroupApi.getWorkflowGroups().execute()); } - public WorkflowGroupResponse getWorkflowGroup(String id) throws NovuNetworkException, IOException { + public WorkflowGroupResponse getWorkflowGroup(final String id) throws NovuNetworkException, IOException { return restHandler.extractResponse(this.workflowGroupApi.getWorkflowGroup(id).execute()); } - public WorkflowGroupResponse updateWorkflowGroup(String id, WorkflowGroupRequest request) throws NovuNetworkException, IOException { + public WorkflowGroupResponse updateWorkflowGroup(final String id, final WorkflowGroupRequest request) + throws NovuNetworkException, IOException { return restHandler.extractResponse(this.workflowGroupApi.updateWorkflowGroup(id, request).execute()); } - public DeleteWorkflowGroup deleteWorkflowGroup(String id) throws NovuNetworkException, IOException { + public DeleteWorkflowGroup deleteWorkflowGroup(final String id) throws NovuNetworkException, IOException { return restHandler.extractResponse(this.workflowGroupApi.deleteWorkflowGroup(id).execute()); } } diff --git a/src/main/java/co/novu/api/workflowgroups/responses/WorkflowGroupResponseData.java b/src/main/java/co/novu/api/workflowgroups/responses/WorkflowGroupResponseData.java index 4abe3ca..1c8051d 100644 --- a/src/main/java/co/novu/api/workflowgroups/responses/WorkflowGroupResponseData.java +++ b/src/main/java/co/novu/api/workflowgroups/responses/WorkflowGroupResponseData.java @@ -1,12 +1,17 @@ package co.novu.api.workflowgroups.responses; +import com.google.gson.annotations.SerializedName; import lombok.Data; @Data public class WorkflowGroupResponseData { - private String _id; + @SerializedName("_id") + private String id; private String name; - private String _environmentId; - private String _organizationId; - private String _parentId; + @SerializedName("_environmentId") + private String environmentId; + @SerializedName("_organizationId") + private String organizationId; + @SerializedName("_parentId") + private String parentId; } diff --git a/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideApi.java b/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideApi.java index 01d915c..97d5c00 100644 --- a/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideApi.java +++ b/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideApi.java @@ -27,7 +27,8 @@ public interface WorkflowOverrideApi { Call getWorkflowOverrides(@QueryMap Map params); @GET(ENDPOINT + "/workflows/{workflowId}/tenants/{tenantId}") - Call getWorkflowOverride(@Path("workflowId") String workflowId, @Path("tenantId") String tenantId); + Call getWorkflowOverride(@Path("workflowId") String workflowId, + @Path("tenantId") String tenantId); @GET(ENDPOINT + "/{overrideId}") @@ -35,12 +36,14 @@ public interface WorkflowOverrideApi { @PUT(ENDPOINT + "/{overrideId}") - Call updateWorkflowOverrideById(@Path("overrideId") String OverrideId, @Body UpdateWorkflowOverrideRequest request); + Call updateWorkflowOverrideById(@Path("overrideId") String overrideId, + @Body UpdateWorkflowOverrideRequest request); @PUT(ENDPOINT + "/workflows/{workflowId}/tenants/{tenantId}") - Call updateWorkflowOverride(@Path("workflowId") String workflowId, @Path("tenantId") String tenantId, - @Body UpdateWorkflowOverrideRequest request); + Call updateWorkflowOverride(@Path("workflowId") String workflowId, + @Path("tenantId") String tenantId, + @Body UpdateWorkflowOverrideRequest request); @DELETE(ENDPOINT + "/{overrideId}") Call deleteWorkflowOverride(@Path("overrideId") String overrideId); diff --git a/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideHandler.java b/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideHandler.java index 95df046..7847e68 100644 --- a/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideHandler.java +++ b/src/main/java/co/novu/api/workflowoverrides/WorkflowOverrideHandler.java @@ -14,54 +14,70 @@ import java.util.HashMap; import java.util.Map; -public class WorkflowOverrideHandler { +public final class WorkflowOverrideHandler { private final RestHandler restHandler; private final WorkflowOverrideApi workflowOverrideApi; - public WorkflowOverrideHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.workflowOverrideApi = restHandler.buildRetrofit().create(WorkflowOverrideApi.class); + public WorkflowOverrideHandler(final RestHandler handler) { + this.restHandler = handler; + this.workflowOverrideApi = handler.buildRetrofit().create(WorkflowOverrideApi.class); } - public WorkflowOverrideResponse createWorkflowOverride(CreateWorkflowOverrideRequest request) throws IOException, NovuNetworkException { + public WorkflowOverrideResponse createWorkflowOverride(final CreateWorkflowOverrideRequest request) + throws IOException, NovuNetworkException { Response response = workflowOverrideApi.createWorkflowOverride(request).execute(); return restHandler.extractResponse(response); } - public BulkWorkflowOverridesResponse getWorkflowOverrides(GetWorkflowOverrideRequest request) throws IOException, NovuNetworkException { + public BulkWorkflowOverridesResponse getWorkflowOverrides(final GetWorkflowOverrideRequest request) + throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (request.getPage() != null) params.put("page", request.getPage()); - if (request.getLimit() != null) params.put("limit", request.getLimit()); + if (request.getPage() != null) { + params.put("page", request.getPage()); + } + if (request.getLimit() != null) { + params.put("limit", request.getLimit()); + } Response response = workflowOverrideApi.getWorkflowOverrides(params).execute(); return restHandler.extractResponse(response); } - public WorkflowOverrideResponse getWorkflowOverride(String workflowId, String tenantId) throws IOException, NovuNetworkException { - Response response = workflowOverrideApi.getWorkflowOverride(workflowId, tenantId).execute(); + public WorkflowOverrideResponse getWorkflowOverride(final String workflowId, final String tenantId) + throws IOException, NovuNetworkException { + Response response = + workflowOverrideApi.getWorkflowOverride(workflowId, tenantId).execute(); return restHandler.extractResponse(response); } - public WorkflowOverrideResponse getWorkflowOverrideById(String overrideId) throws IOException, NovuNetworkException { - Response response = workflowOverrideApi.getWorkflowOverrideById(overrideId).execute(); + public WorkflowOverrideResponse getWorkflowOverrideById(final String overrideId) + throws IOException, NovuNetworkException { + Response response = + workflowOverrideApi.getWorkflowOverrideById(overrideId).execute(); return restHandler.extractResponse(response); } - public WorkflowOverrideResponse updateWorkflowOverrideById(String overrideId, UpdateWorkflowOverrideRequest request) throws IOException, - NovuNetworkException { - Response response = workflowOverrideApi.updateWorkflowOverrideById(overrideId, request).execute(); + public WorkflowOverrideResponse updateWorkflowOverrideById(final String overrideId, + final UpdateWorkflowOverrideRequest request) + throws IOException, NovuNetworkException { + Response response = + workflowOverrideApi.updateWorkflowOverrideById(overrideId, request).execute(); return restHandler.extractResponse(response); } - public WorkflowOverrideResponse updateWorkflowOverride(String workflowId, String tenantId, UpdateWorkflowOverrideRequest request) + public WorkflowOverrideResponse updateWorkflowOverride(final String workflowId, final String tenantId, + final UpdateWorkflowOverrideRequest request) throws IOException, NovuNetworkException { - Response response = workflowOverrideApi.updateWorkflowOverride(workflowId, tenantId, request).execute(); + Response response = + workflowOverrideApi.updateWorkflowOverride(workflowId, tenantId, request).execute(); return restHandler.extractResponse(response); } - public DeleteWorkflowOverrideResponse deleteWorkflowOverride(String overrideId) throws IOException, NovuNetworkException { - Response response = workflowOverrideApi.deleteWorkflowOverride(overrideId).execute(); + public DeleteWorkflowOverrideResponse deleteWorkflowOverride(final String overrideId) + throws IOException, NovuNetworkException { + Response response = + workflowOverrideApi.deleteWorkflowOverride(overrideId).execute(); return restHandler.extractResponse(response); } } diff --git a/src/main/java/co/novu/api/workflows/WorkflowApi.java b/src/main/java/co/novu/api/workflows/WorkflowApi.java index 58fa323..562f76e 100644 --- a/src/main/java/co/novu/api/workflows/WorkflowApi.java +++ b/src/main/java/co/novu/api/workflows/WorkflowApi.java @@ -18,25 +18,27 @@ import retrofit2.http.QueryMap; public interface WorkflowApi { - - String ENDPOINT = "workflows"; - - @GET(ENDPOINT) - Call getWorkflows(@QueryMap Map params); - - @POST(ENDPOINT) - Call createWorkflow(@Body WorkflowRequest request); - - @PUT(ENDPOINT + "/{workflowId}") - Call updateWorkflow(@Path("workflowId") String workflowId, @Body UpdateWorkflowRequest request); - - @DELETE(ENDPOINT + "/{workflowId}") - Call deleteWorkflow(@Path("workflowId") String workflowId); - - @GET(ENDPOINT + "/{workflowId}") - Call getWorkflow(@Path("workflowId") String workflowId); - - @PUT(ENDPOINT + "/{workflowId}/status") - Call updateWorkflowStatus(@Path("workflowId") String workflowId , @Body UpdateWorkflowStatusRequest request); + + String ENDPOINT = "workflows"; + + @GET(ENDPOINT) + Call getWorkflows(@QueryMap Map params); + + @POST(ENDPOINT) + Call createWorkflow(@Body WorkflowRequest request); + + @PUT(ENDPOINT + "/{workflowId}") + Call updateWorkflow(@Path("workflowId") String workflowId, + @Body UpdateWorkflowRequest request); + + @DELETE(ENDPOINT + "/{workflowId}") + Call deleteWorkflow(@Path("workflowId") String workflowId); + + @GET(ENDPOINT + "/{workflowId}") + Call getWorkflow(@Path("workflowId") String workflowId); + + @PUT(ENDPOINT + "/{workflowId}/status") + Call updateWorkflowStatus(@Path("workflowId") String workflowId, + @Body UpdateWorkflowStatusRequest request); } diff --git a/src/main/java/co/novu/api/workflows/WorkflowHandler.java b/src/main/java/co/novu/api/workflows/WorkflowHandler.java index 6b3c03c..a1b07a1 100644 --- a/src/main/java/co/novu/api/workflows/WorkflowHandler.java +++ b/src/main/java/co/novu/api/workflows/WorkflowHandler.java @@ -14,48 +14,56 @@ import co.novu.common.rest.RestHandler; import retrofit2.Response; -public class WorkflowHandler { +public final class WorkflowHandler { private final RestHandler restHandler; - + private final WorkflowApi workflowApi; - public WorkflowHandler(RestHandler restHandler) { - this.restHandler = restHandler; - this.workflowApi = restHandler.buildRetrofit().create(WorkflowApi.class); - } + public WorkflowHandler(final RestHandler handler) { + this.restHandler = handler; + this.workflowApi = handler.buildRetrofit().create(WorkflowApi.class); + } - public BulkWorkflowResponse getWorkflows(Integer page, Integer limit) throws IOException, NovuNetworkException { + public BulkWorkflowResponse getWorkflows(final Integer page, final Integer limit) + throws IOException, NovuNetworkException { Map params = new HashMap<>(); - if (page != null) params.put("page", page); - if (limit != null) params.put("limit", limit); + if (page != null) { + params.put("page", page); + } + if (limit != null) { + params.put("limit", limit); + } Response response = workflowApi.getWorkflows(params).execute(); return restHandler.extractResponse(response); } - public SingleWorkflowResponse createWorkflow(WorkflowRequest request) throws IOException, NovuNetworkException { - Response response = workflowApi.createWorkflow(request).execute(); + public SingleWorkflowResponse createWorkflow(final WorkflowRequest request) + throws IOException, NovuNetworkException { + Response response = workflowApi.createWorkflow(request).execute(); return restHandler.extractResponse(response); } - public SingleWorkflowResponse updateWorkflow(String workflowId, UpdateWorkflowRequest request) throws IOException, NovuNetworkException { - Response response = workflowApi.updateWorkflow(workflowId , request).execute(); + public SingleWorkflowResponse updateWorkflow(final String workflowId, final UpdateWorkflowRequest request) + throws IOException, NovuNetworkException { + Response response = workflowApi.updateWorkflow(workflowId, request).execute(); return restHandler.extractResponse(response); } - public DeleteWorkflowResponse deleteWorkflow(String workflowId) throws IOException, NovuNetworkException { - Response response = workflowApi.deleteWorkflow(workflowId).execute(); + public DeleteWorkflowResponse deleteWorkflow(final String workflowId) throws IOException, NovuNetworkException { + Response response = workflowApi.deleteWorkflow(workflowId).execute(); return restHandler.extractResponse(response); } - public SingleWorkflowResponse getWorkflow(String workflowId) throws IOException, NovuNetworkException { - Response response = workflowApi.getWorkflow(workflowId).execute(); + public SingleWorkflowResponse getWorkflow(final String workflowId) throws IOException, NovuNetworkException { + Response response = workflowApi.getWorkflow(workflowId).execute(); return restHandler.extractResponse(response); } - public SingleWorkflowResponse updateWorkflowStatus(String workflowId, UpdateWorkflowStatusRequest request) throws IOException, NovuNetworkException { - Response response = workflowApi.updateWorkflowStatus(workflowId , request).execute(); + public SingleWorkflowResponse updateWorkflowStatus(final String workflowId, + final UpdateWorkflowStatusRequest request) + throws IOException, NovuNetworkException { + Response response = workflowApi.updateWorkflowStatus(workflowId, request).execute(); return restHandler.extractResponse(response); } - -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/pojos/Channels.java b/src/main/java/co/novu/api/workflows/pojos/Channels.java index c07f3ed..472c86a 100644 --- a/src/main/java/co/novu/api/workflows/pojos/Channels.java +++ b/src/main/java/co/novu/api/workflows/pojos/Channels.java @@ -8,4 +8,4 @@ public class Channels { private Sms sms; private Chat chat; private Push push; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/pojos/WorkflowIntegrationStatus.java b/src/main/java/co/novu/api/workflows/pojos/WorkflowIntegrationStatus.java index d99dbfc..a2eeead 100644 --- a/src/main/java/co/novu/api/workflows/pojos/WorkflowIntegrationStatus.java +++ b/src/main/java/co/novu/api/workflows/pojos/WorkflowIntegrationStatus.java @@ -6,4 +6,4 @@ public class WorkflowIntegrationStatus { private Boolean hasActiveIntegrations; private Channels channels; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/requests/BaseWorkflowRequest.java b/src/main/java/co/novu/api/workflows/requests/BaseWorkflowRequest.java index bd74bee..0506389 100644 --- a/src/main/java/co/novu/api/workflows/requests/BaseWorkflowRequest.java +++ b/src/main/java/co/novu/api/workflows/requests/BaseWorkflowRequest.java @@ -20,4 +20,4 @@ public class BaseWorkflowRequest implements IRequest { private List tags; private List steps; private String notificationGroupId; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowRequest.java b/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowRequest.java index acdfbad..7dfd531 100644 --- a/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowRequest.java +++ b/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowRequest.java @@ -6,4 +6,4 @@ @Data public class UpdateWorkflowRequest extends BaseWorkflowRequest implements IRequest { private String identifier; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowStatusRequest.java b/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowStatusRequest.java index 5e168f4..6300713 100644 --- a/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowStatusRequest.java +++ b/src/main/java/co/novu/api/workflows/requests/UpdateWorkflowStatusRequest.java @@ -6,4 +6,4 @@ @Data public class UpdateWorkflowStatusRequest implements IRequest { private Boolean active; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/requests/WorkflowRequest.java b/src/main/java/co/novu/api/workflows/requests/WorkflowRequest.java index 1209cd4..39651ba 100644 --- a/src/main/java/co/novu/api/workflows/requests/WorkflowRequest.java +++ b/src/main/java/co/novu/api/workflows/requests/WorkflowRequest.java @@ -5,4 +5,4 @@ @Data public class WorkflowRequest extends BaseWorkflowRequest implements IRequest { -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/responses/BulkWorkflowResponse.java b/src/main/java/co/novu/api/workflows/responses/BulkWorkflowResponse.java index cb0cb9c..208772e 100644 --- a/src/main/java/co/novu/api/workflows/responses/BulkWorkflowResponse.java +++ b/src/main/java/co/novu/api/workflows/responses/BulkWorkflowResponse.java @@ -10,4 +10,4 @@ public class BulkWorkflowResponse { private Long totalCount; private Long pageSize; private List data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/responses/DeleteWorkflowResponse.java b/src/main/java/co/novu/api/workflows/responses/DeleteWorkflowResponse.java index 42921af..77fd308 100644 --- a/src/main/java/co/novu/api/workflows/responses/DeleteWorkflowResponse.java +++ b/src/main/java/co/novu/api/workflows/responses/DeleteWorkflowResponse.java @@ -5,4 +5,4 @@ @Data public class DeleteWorkflowResponse { private Boolean data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/responses/SingleWorkflowResponse.java b/src/main/java/co/novu/api/workflows/responses/SingleWorkflowResponse.java index 49c8010..485a773 100644 --- a/src/main/java/co/novu/api/workflows/responses/SingleWorkflowResponse.java +++ b/src/main/java/co/novu/api/workflows/responses/SingleWorkflowResponse.java @@ -5,4 +5,4 @@ @Data public class SingleWorkflowResponse { private WorkflowResponse data; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/api/workflows/responses/WorkflowResponse.java b/src/main/java/co/novu/api/workflows/responses/WorkflowResponse.java index 160d0e5..99a0fab 100644 --- a/src/main/java/co/novu/api/workflows/responses/WorkflowResponse.java +++ b/src/main/java/co/novu/api/workflows/responses/WorkflowResponse.java @@ -13,7 +13,7 @@ @Data public class WorkflowResponse { - @SerializedName("_id") + @SerializedName("_id") private String id; private String description; private Boolean active; @@ -37,4 +37,4 @@ public class WorkflowResponse { private NotificationGroup notificationGroup; private Boolean isBlueprint; private WorkflowIntegrationStatus workflowIntegrationStatus; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/common/base/Novu.java b/src/main/java/co/novu/common/base/Novu.java index 8d59e62..ac602cf 100644 --- a/src/main/java/co/novu/common/base/Novu.java +++ b/src/main/java/co/novu/common/base/Novu.java @@ -127,7 +127,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j -public class Novu { +public final class Novu { private final NovuConfig novuConfig; @@ -168,13 +168,13 @@ public class Novu { private final WorkflowOverrideHandler workflowOverrideHandler; - public Novu(String apiKey) { + public Novu(final String apiKey) { this(new NovuConfig(apiKey)); } - public Novu(NovuConfig novuConfig) { - RestHandler restHandler = new RestHandler(novuConfig); - this.novuConfig = novuConfig; + public Novu(final NovuConfig config) { + RestHandler restHandler = new RestHandler(config); + this.novuConfig = config; this.eventsHandler = new EventsHandler(restHandler); this.notificationHandler = new NotificationHandler(restHandler); this.subscribersHandler = new SubscribersHandler(restHandler); @@ -195,7 +195,8 @@ public Novu(NovuConfig novuConfig) { this.workflowOverrideHandler = new WorkflowOverrideHandler(restHandler); } - public TriggerEventResponse triggerEvent(TriggerEventRequest request) throws IOException, NovuNetworkException { + public TriggerEventResponse triggerEvent(final TriggerEventRequest request) + throws IOException, NovuNetworkException { try { return eventsHandler.triggerEvent(request); } catch (Exception e) { @@ -204,7 +205,8 @@ public TriggerEventResponse triggerEvent(TriggerEventRequest request) throws IOE } } - public BulkTriggerEventResponse bulkTriggerEvent(BulkTriggerEventRequest request) throws IOException, NovuNetworkException { + public BulkTriggerEventResponse bulkTriggerEvent(final BulkTriggerEventRequest request) + throws IOException, NovuNetworkException { try { return eventsHandler.bulkTriggerEvent(request); } catch (Exception e) { @@ -213,7 +215,8 @@ public BulkTriggerEventResponse bulkTriggerEvent(BulkTriggerEventRequest request } } - public TriggerEventResponse broadcastEvent(TriggerEventRequest request) throws IOException, NovuNetworkException { + public TriggerEventResponse broadcastEvent(final TriggerEventRequest request) + throws IOException, NovuNetworkException { try { return eventsHandler.broadcastEvent(request); } catch (Exception e) { @@ -222,7 +225,8 @@ public TriggerEventResponse broadcastEvent(TriggerEventRequest request) throws I } } - public CancelEventResponse cancelTriggeredEvent(String transactionId) throws IOException, NovuNetworkException { + public CancelEventResponse cancelTriggeredEvent(final String transactionId) + throws IOException, NovuNetworkException { try { return eventsHandler.cancelTriggeredEvent(transactionId); } catch (Exception e) { @@ -231,7 +235,8 @@ public CancelEventResponse cancelTriggeredEvent(String transactionId) throws IOE } } - public NotificationsResponse getNotifications(NotificationRequest request) throws IOException, NovuNetworkException { + public NotificationsResponse getNotifications(final NotificationRequest request) + throws IOException, NovuNetworkException { try { return notificationHandler.getNotifications(request); } catch (Exception e) { @@ -240,7 +245,8 @@ public NotificationsResponse getNotifications(NotificationRequest request) throw } } - public NotificationStatsResponse getNotificationsStats() throws IOException, NovuNetworkException { + public NotificationStatsResponse getNotificationsStats() + throws IOException, NovuNetworkException { try { return notificationHandler.getNotificationsStats(); } catch (Exception e) { @@ -249,7 +255,8 @@ public NotificationStatsResponse getNotificationsStats() throws IOException, Nov } } - public NotificationGraphStatsResponse getNotificationGraphStats() throws IOException, NovuNetworkException { + public NotificationGraphStatsResponse getNotificationGraphStats() + throws IOException, NovuNetworkException { try { return notificationHandler.getNotificationGraphStats(); } catch (Exception e) { @@ -258,7 +265,8 @@ public NotificationGraphStatsResponse getNotificationGraphStats() throws IOExcep } } - public NotificationResponse getNotification(String notificationId) throws IOException, NovuNetworkException { + public NotificationResponse getNotification(final String notificationId) + throws IOException, NovuNetworkException { try { return notificationHandler.getNotification(notificationId); } catch (Exception e) { @@ -267,7 +275,8 @@ public NotificationResponse getNotification(String notificationId) throws IOExce } } - public BulkSubscriberResponse getSubscribers(Integer page, Integer limit) throws IOException, NovuNetworkException { + public BulkSubscriberResponse getSubscribers(final Integer page, final Integer limit) + throws IOException, NovuNetworkException { try { return subscribersHandler.getSubscribers(page, limit); } catch (Exception e) { @@ -276,7 +285,8 @@ public BulkSubscriberResponse getSubscribers(Integer page, Integer limit) throws } } - public CreateSubscriberResponse createSubscriber(SubscriberRequest request) throws IOException, NovuNetworkException { + public CreateSubscriberResponse createSubscriber(final SubscriberRequest request) + throws IOException, NovuNetworkException { try { return subscribersHandler.createSubscriber(request); } catch (Exception e) { @@ -285,7 +295,8 @@ public CreateSubscriberResponse createSubscriber(SubscriberRequest request) thro } } - public CreateBulkSubscriberResponse createSubscriberBulk(BulkSubscriberRequest request) throws IOException, NovuNetworkException { + public CreateBulkSubscriberResponse createSubscriberBulk(final BulkSubscriberRequest request) + throws IOException, NovuNetworkException { try { return subscribersHandler.createSubscriberBulk(request); } catch (Exception e) { @@ -294,7 +305,8 @@ public CreateBulkSubscriberResponse createSubscriberBulk(BulkSubscriberRequest r } } - public SingleSubscriberResponse getSubscriber(String subscriberId) throws IOException, NovuNetworkException { + public SingleSubscriberResponse getSubscriber(final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.getSubscriber(subscriberId); } catch (Exception e) { @@ -303,7 +315,8 @@ public SingleSubscriberResponse getSubscriber(String subscriberId) throws IOExce } } - public SingleSubscriberResponse updateSubscriber(UpdateSubscriberRequest request, String subscriberId) throws IOException, NovuNetworkException { + public SingleSubscriberResponse updateSubscriber(final UpdateSubscriberRequest request, final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.updateSubscriber(request, subscriberId); } catch (Exception e) { @@ -312,7 +325,8 @@ public SingleSubscriberResponse updateSubscriber(UpdateSubscriberRequest request } } - public SubscriberDeleteResponse deleteSubscriber(String subscriberId) throws IOException, NovuNetworkException { + public SubscriberDeleteResponse deleteSubscriber(final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.deleteSubscriber(subscriberId); } catch (Exception e) { @@ -321,7 +335,9 @@ public SubscriberDeleteResponse deleteSubscriber(String subscriberId) throws IOE } } - public SingleSubscriberResponse updateSubscriberCredentials(UpdateSubscriberCredentialsRequest request, String subscriberId) throws IOException, NovuNetworkException { + public SingleSubscriberResponse updateSubscriberCredentials(final UpdateSubscriberCredentialsRequest request, + final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.updateSubscriberCredentials(request, subscriberId); } catch (Exception e) { @@ -330,7 +346,8 @@ public SingleSubscriberResponse updateSubscriberCredentials(UpdateSubscriberCred } } - public DeleteCredentialsResponse deleteSubscriberCredentials(String subscriberId, String providerId) throws IOException, NovuNetworkException { + public DeleteCredentialsResponse deleteSubscriberCredentials(final String subscriberId, final String providerId) + throws IOException, NovuNetworkException { try { return subscribersHandler.deleteSubscriberCredentials(subscriberId, providerId); } catch (Exception e) { @@ -339,7 +356,9 @@ public DeleteCredentialsResponse deleteSubscriberCredentials(String subscriberId } } - public SingleSubscriberResponse updateSubscriberOnlineStatus(UpdateSubscriberOnlineStatusRequest request, String subscriberId) throws IOException, NovuNetworkException { + public SingleSubscriberResponse updateSubscriberOnlineStatus(final UpdateSubscriberOnlineStatusRequest request, + final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.updateSubscriberOnlineStatus(request, subscriberId); } catch (Exception e) { @@ -348,7 +367,8 @@ public SingleSubscriberResponse updateSubscriberOnlineStatus(UpdateSubscriberOnl } } - public SubscriberPreferenceResponse getSubscriberPreferences(String subscriberId) throws IOException, NovuNetworkException { + public SubscriberPreferenceResponse getSubscriberPreferences(final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.getSubscriberPreferences(subscriberId); } catch (Exception e) { @@ -357,7 +377,9 @@ public SubscriberPreferenceResponse getSubscriberPreferences(String subscriberId } } - public SingleSubscriberPrefResponse updateSubscriberPreferences(UpdateSubscriberPreferenceRequest request, String subscriberId, String templateId) throws IOException, NovuNetworkException { + public SingleSubscriberPrefResponse updateSubscriberPreferences(final UpdateSubscriberPreferenceRequest request, + final String subscriberId, final String templateId) + throws IOException, NovuNetworkException { try { return subscribersHandler.updateSubscriberPreferences(request, subscriberId, templateId); } catch (Exception e) { @@ -366,7 +388,8 @@ public SingleSubscriberPrefResponse updateSubscriberPreferences(UpdateSubscriber } } - public SubscriberNotificationResponse getSubscriberNotificationsFeed(String subscriberId) throws IOException, NovuNetworkException { + public SubscriberNotificationResponse getSubscriberNotificationsFeed(final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.getSubscriberNotificationsFeed(subscriberId); } catch (Exception e) { @@ -375,7 +398,8 @@ public SubscriberNotificationResponse getSubscriberNotificationsFeed(String subs } } - public UnseenNotificationsCountResponse getSubscriberUnseenNotificationsCount(String subscriberId) throws IOException, NovuNetworkException { + public UnseenNotificationsCountResponse getSubscriberUnseenNotificationsCount(final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.getSubscriberUnseenNotificationsCount(subscriberId); } catch (Exception e) { @@ -384,7 +408,9 @@ public UnseenNotificationsCountResponse getSubscriberUnseenNotificationsCount(St } } - public SubscriberNotificationResponse markSubscriberMessageFeedAs(MarkSubscriberFeedAsRequest request, String subscriberId) throws IOException, NovuNetworkException { + public SubscriberNotificationResponse markSubscriberMessageFeedAs(final MarkSubscriberFeedAsRequest request, + final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.markSubscriberMessageFeedAs(request, subscriberId); } catch (Exception e) { @@ -393,7 +419,8 @@ public SubscriberNotificationResponse markSubscriberMessageFeedAs(MarkSubscriber } } - public Long markAllSubscriberMessagesFeedAs(MarkAllMessagesRequest request, String subscriberId) throws IOException, NovuNetworkException { + public Long markAllSubscriberMessagesFeedAs(final MarkAllMessagesRequest request, final String subscriberId) + throws IOException, NovuNetworkException { try { return subscribersHandler.markAllSubscriberMessagesFeedAs(request, subscriberId); } catch (Exception e) { @@ -402,7 +429,10 @@ public Long markAllSubscriberMessagesFeedAs(MarkAllMessagesRequest request, Stri } } - public SubscriberNotificationResponse markMessageActionAsSeen(MarkMessageActionAsSeenRequest request, String subscriberId, String messageId, String type) throws IOException, NovuNetworkException { + public SubscriberNotificationResponse markMessageActionAsSeen(final MarkMessageActionAsSeenRequest request, + final String subscriberId, final String messageId, + final String type) + throws IOException, NovuNetworkException { try { return subscribersHandler.markMessageActionAsSeen(request, subscriberId, messageId, type); } catch (Exception e) { @@ -411,7 +441,7 @@ public SubscriberNotificationResponse markMessageActionAsSeen(MarkMessageActionA } } - public TopicResponse createTopic(TopicRequest request) throws IOException, NovuNetworkException { + public TopicResponse createTopic(final TopicRequest request) throws IOException, NovuNetworkException { try { return topicHandler.createTopic(request); } catch (Exception e) { @@ -420,7 +450,8 @@ public TopicResponse createTopic(TopicRequest request) throws IOException, NovuN } } - public FilterTopicsResponse filterTopics(FilterTopicsRequest request) throws IOException, NovuNetworkException { + public FilterTopicsResponse filterTopics(final FilterTopicsRequest request) + throws IOException, NovuNetworkException { try { return topicHandler.filterTopics(request); } catch (Exception e) { @@ -429,7 +460,9 @@ public FilterTopicsResponse filterTopics(FilterTopicsRequest request) throws IOE } } - public SubscriberAdditionResponse addSubscriberToTopic(SubscriberAdditionRequest request, String topicKey) throws IOException, NovuNetworkException { + public SubscriberAdditionResponse addSubscriberToTopic(final SubscriberAdditionRequest request, + final String topicKey) + throws IOException, NovuNetworkException { try { return topicHandler.addSubscriberToTopic(request, topicKey); } catch (Exception e) { @@ -438,7 +471,8 @@ public SubscriberAdditionResponse addSubscriberToTopic(SubscriberAdditionRequest } } - public CheckTopicSubscriberResponse checkTopicSubscriber(String topicKey, String externalSubscriberId) throws IOException, NovuNetworkException { + public CheckTopicSubscriberResponse checkTopicSubscriber(final String topicKey, final String externalSubscriberId) + throws IOException, NovuNetworkException { try { return topicHandler.checkTopicSubscriber(topicKey, externalSubscriberId); } catch (Exception e) { @@ -447,7 +481,9 @@ public CheckTopicSubscriberResponse checkTopicSubscriber(String topicKey, String } } - public SubscriberRemovalResponse removeSubscriberFromTopic(SubscriberAdditionRequest request, String topicKey) throws IOException, NovuNetworkException { + public SubscriberRemovalResponse removeSubscriberFromTopic(final SubscriberAdditionRequest request, + final String topicKey) + throws IOException, NovuNetworkException { try { return topicHandler.removeSubscriberFromTopic(request, topicKey); } catch (Exception e) { @@ -456,7 +492,7 @@ public SubscriberRemovalResponse removeSubscriberFromTopic(SubscriberAdditionReq } } - public DeleteTopicResponse deleteTopic(String topicKey) throws IOException, NovuNetworkException { + public DeleteTopicResponse deleteTopic(final String topicKey) throws IOException, NovuNetworkException { try { return topicHandler.deleteTopic(topicKey); } catch (Exception e) { @@ -465,7 +501,7 @@ public DeleteTopicResponse deleteTopic(String topicKey) throws IOException, Novu } } - public TopicResponse getTopic(String topicKey) throws IOException, NovuNetworkException { + public TopicResponse getTopic(final String topicKey) throws IOException, NovuNetworkException { try { return topicHandler.getTopic(topicKey); } catch (Exception e) { @@ -474,7 +510,8 @@ public TopicResponse getTopic(String topicKey) throws IOException, NovuNetworkEx } } - public TopicResponse renameTopic(RenameTopicRequest request, String topicKey) throws IOException, NovuNetworkException { + public TopicResponse renameTopic(final RenameTopicRequest request, final String topicKey) + throws IOException, NovuNetworkException { try { return topicHandler.renameTopic(request, topicKey); } catch (Exception e) { @@ -492,7 +529,8 @@ public BulkIntegrationResponse getIntegrations() throws IOException, NovuNetwork } } - public SingleIntegrationResponse createIntegration(IntegrationRequest request) throws IOException, NovuNetworkException { + public SingleIntegrationResponse createIntegration(final IntegrationRequest request) + throws IOException, NovuNetworkException { try { return integrationsHandler.createIntegration(request); } catch (Exception e) { @@ -510,7 +548,8 @@ public BulkIntegrationResponse getActiveIntegrations() throws IOException, NovuN } } - public ProviderWebhookStatusResponse getProviderWebhookStatus(String providerId) throws IOException, NovuNetworkException { + public ProviderWebhookStatusResponse getProviderWebhookStatus(final String providerId) + throws IOException, NovuNetworkException { try { return integrationsHandler.getProviderWebhookStatus(providerId); } catch (Exception e) { @@ -519,7 +558,8 @@ public ProviderWebhookStatusResponse getProviderWebhookStatus(String providerId) } } - public SingleIntegrationResponse updateIntegration(String integrationId, IntegrationRequest request) throws IOException, NovuNetworkException { + public SingleIntegrationResponse updateIntegration(final String integrationId, final IntegrationRequest request) + throws IOException, NovuNetworkException { try { return integrationsHandler.updateIntegration(integrationId, request); } catch (Exception e) { @@ -528,7 +568,8 @@ public SingleIntegrationResponse updateIntegration(String integrationId, Integra } } - public BulkIntegrationResponse deleteIntegration(String integrationId) throws IOException, NovuNetworkException { + public BulkIntegrationResponse deleteIntegration(final String integrationId) + throws IOException, NovuNetworkException { try { return integrationsHandler.deleteIntegration(integrationId); } catch (Exception e) { @@ -537,7 +578,8 @@ public BulkIntegrationResponse deleteIntegration(String integrationId) throws IO } } - public SingleIntegrationResponse setIntegrationAsPrimary(String integrationId) throws IOException, NovuNetworkException { + public SingleIntegrationResponse setIntegrationAsPrimary(final String integrationId) + throws IOException, NovuNetworkException { try { return integrationsHandler.setIntegrationAsPrimary(integrationId); } catch (Exception e) { @@ -546,7 +588,7 @@ public SingleIntegrationResponse setIntegrationAsPrimary(String integrationId) t } } - public CreateLayoutResponse createLayout(LayoutRequest request) throws IOException, NovuNetworkException { + public CreateLayoutResponse createLayout(final LayoutRequest request) throws IOException, NovuNetworkException { try { return layoutHandler.createLayout(request); } catch (Exception e) { @@ -555,7 +597,8 @@ public CreateLayoutResponse createLayout(LayoutRequest request) throws IOExcepti } } - public FilterLayoutResponse filterLayout(FilterLayoutRequest request) throws IOException, NovuNetworkException { + public FilterLayoutResponse filterLayout(final FilterLayoutRequest request) + throws IOException, NovuNetworkException { try { return layoutHandler.filterLayouts(request); } catch (Exception e) { @@ -564,7 +607,7 @@ public FilterLayoutResponse filterLayout(FilterLayoutRequest request) throws IOE } } - public GetLayoutResponse getLayout(String layoutId) throws IOException, NovuNetworkException { + public GetLayoutResponse getLayout(final String layoutId) throws IOException, NovuNetworkException { try { return layoutHandler.getLayout(layoutId); } catch (Exception e) { @@ -573,7 +616,7 @@ public GetLayoutResponse getLayout(String layoutId) throws IOException, NovuNetw } } - public DeleteLayoutResponse deleteLayout(String layoutId) throws IOException, NovuNetworkException { + public DeleteLayoutResponse deleteLayout(final String layoutId) throws IOException, NovuNetworkException { try { return layoutHandler.deleteLayout(layoutId); } catch (Exception e) { @@ -582,7 +625,8 @@ public DeleteLayoutResponse deleteLayout(String layoutId) throws IOException, No } } - public GetLayoutResponse updateIntegration(String layoutId, LayoutRequest request) throws IOException, NovuNetworkException { + public GetLayoutResponse updateIntegration(final String layoutId, final LayoutRequest request) + throws IOException, NovuNetworkException { try { return layoutHandler.updateLayout(layoutId, request); } catch (Exception e) { @@ -591,7 +635,7 @@ public GetLayoutResponse updateIntegration(String layoutId, LayoutRequest reques } } - public SetDefaultLayoutResponse setDefaultLayout(String layoutId) throws IOException, NovuNetworkException { + public SetDefaultLayoutResponse setDefaultLayout(final String layoutId) throws IOException, NovuNetworkException { try { return layoutHandler.setDefaultLayout(layoutId); } catch (Exception e) { @@ -600,7 +644,8 @@ public SetDefaultLayoutResponse setDefaultLayout(String layoutId) throws IOExcep } } - public BulkWorkflowResponse getWorkflows(Integer page, Integer limit) throws IOException, NovuNetworkException { + public BulkWorkflowResponse getWorkflows(final Integer page, final Integer limit) + throws IOException, NovuNetworkException { try { return workflowHandler.getWorkflows(page, limit); } catch (Exception e) { @@ -609,7 +654,8 @@ public BulkWorkflowResponse getWorkflows(Integer page, Integer limit) throws IOE } } - public SingleWorkflowResponse createWorkflow(WorkflowRequest request) throws IOException, NovuNetworkException { + public SingleWorkflowResponse createWorkflow(final WorkflowRequest request) + throws IOException, NovuNetworkException { try { return workflowHandler.createWorkflow(request); } catch (Exception e) { @@ -618,7 +664,8 @@ public SingleWorkflowResponse createWorkflow(WorkflowRequest request) throws IOE } } - public SingleWorkflowResponse updateWorkflow(String workflowId, UpdateWorkflowRequest request) throws IOException, NovuNetworkException { + public SingleWorkflowResponse updateWorkflow(final String workflowId, final UpdateWorkflowRequest request) + throws IOException, NovuNetworkException { try { return workflowHandler.updateWorkflow(workflowId, request); } catch (Exception e) { @@ -627,7 +674,7 @@ public SingleWorkflowResponse updateWorkflow(String workflowId, UpdateWorkflowRe } } - public DeleteWorkflowResponse deleteWorkflow(String workflowId) throws IOException, NovuNetworkException { + public DeleteWorkflowResponse deleteWorkflow(final String workflowId) throws IOException, NovuNetworkException { try { return workflowHandler.deleteWorkflow(workflowId); } catch (Exception e) { @@ -636,7 +683,7 @@ public DeleteWorkflowResponse deleteWorkflow(String workflowId) throws IOExcepti } } - public SingleWorkflowResponse getWorkflow(String workflowId) throws IOException, NovuNetworkException { + public SingleWorkflowResponse getWorkflow(final String workflowId) throws IOException, NovuNetworkException { try { return workflowHandler.getWorkflow(workflowId); } catch (Exception e) { @@ -645,7 +692,9 @@ public SingleWorkflowResponse getWorkflow(String workflowId) throws IOException, } } - public SingleWorkflowResponse updateWorkflowStatus(String workflowId, UpdateWorkflowStatusRequest request) throws IOException, NovuNetworkException { + public SingleWorkflowResponse updateWorkflowStatus(final String workflowId, + final UpdateWorkflowStatusRequest request) + throws IOException, NovuNetworkException { try { return workflowHandler.updateWorkflowStatus(workflowId, request); } catch (Exception e) { @@ -654,7 +703,8 @@ public SingleWorkflowResponse updateWorkflowStatus(String workflowId, UpdateWork } } - public WorkflowGroupResponse createWorkflowGroup(WorkflowGroupRequest request) throws IOException, NovuNetworkException { + public WorkflowGroupResponse createWorkflowGroup(final WorkflowGroupRequest request) + throws IOException, NovuNetworkException { try { return workflowGroupHandler.createWorkflowGroup(request); } catch (Exception e) { @@ -672,7 +722,7 @@ public GetWorkflowGroupsResponse getWorkflowGroups() throws IOException, NovuNet } } - public WorkflowGroupResponse getWorkflowGroup(String id) throws IOException, NovuNetworkException { + public WorkflowGroupResponse getWorkflowGroup(final String id) throws IOException, NovuNetworkException { try { return workflowGroupHandler.getWorkflowGroup(id); } catch (Exception e) { @@ -681,16 +731,17 @@ public WorkflowGroupResponse getWorkflowGroup(String id) throws IOException, Nov } } - public WorkflowGroupResponse updateWorkflowGroup(String id, WorkflowGroupRequest request) throws IOException, NovuNetworkException { + public WorkflowGroupResponse updateWorkflowGroup(final String id, final WorkflowGroupRequest request) + throws IOException, NovuNetworkException { try { - return workflowGroupHandler.updateWorkflowGroup(id,request); + return workflowGroupHandler.updateWorkflowGroup(id, request); } catch (Exception e) { logException("Error updating workflow group", e); throw e; } } - public DeleteWorkflowGroup deleteWorkflowGroup(String id) throws IOException, NovuNetworkException { + public DeleteWorkflowGroup deleteWorkflowGroup(final String id) throws IOException, NovuNetworkException { try { return workflowGroupHandler.deleteWorkflowGroup(id); } catch (Exception e) { @@ -699,7 +750,7 @@ public DeleteWorkflowGroup deleteWorkflowGroup(String id) throws IOException, No } } - public GetChangesResponse getChanges(GetChangesRequest request) throws IOException, NovuNetworkException { + public GetChangesResponse getChanges(final GetChangesRequest request) throws IOException, NovuNetworkException { try { return changeHandler.getChanges(request); } catch (Exception e) { @@ -717,7 +768,8 @@ public ChangeCountResponse getChangesCount() throws IOException, NovuNetworkExce } } - public ApplyChangesResponse applyChanges(ApplyChangesRequest request) throws IOException, NovuNetworkException { + public ApplyChangesResponse applyChanges(final ApplyChangesRequest request) + throws IOException, NovuNetworkException { try { return changeHandler.applyChanges(request); } catch (Exception e) { @@ -726,7 +778,7 @@ public ApplyChangesResponse applyChanges(ApplyChangesRequest request) throws IOE } } - public ApplyChangesResponse applyChange(String changeId) throws IOException, NovuNetworkException { + public ApplyChangesResponse applyChange(final String changeId) throws IOException, NovuNetworkException { try { return changeHandler.applyChange(changeId); } catch (Exception e) { @@ -744,7 +796,8 @@ public SingleEnvironmentResponse getCurrentEnvironment() throws IOException, Nov } } - public SingleEnvironmentResponse createEnvironment(CreateEnvironmentRequest request) throws IOException, NovuNetworkException { + public SingleEnvironmentResponse createEnvironment(final CreateEnvironmentRequest request) + throws IOException, NovuNetworkException { try { return environmentHandler.createEnvironment(request); } catch (Exception e) { @@ -762,7 +815,9 @@ public BulkEnvironmentResponse getEnvironments() throws IOException, NovuNetwork } } - public SingleEnvironmentResponse updateEnvironmentById(String environmentId, UpdateEnvironmentRequest request) throws IOException, NovuNetworkException { + public SingleEnvironmentResponse updateEnvironmentById(final String environmentId, + final UpdateEnvironmentRequest request) + throws IOException, NovuNetworkException { try { return environmentHandler.updateEnvironmentById(environmentId, request); } catch (Exception e) { @@ -798,7 +853,7 @@ public ValidateMxRecordResponse validateMxRecordSetupForInboundParse() throws IO } } - public FeedResponse createFeed(FeedRequest request) throws IOException, NovuNetworkException { + public FeedResponse createFeed(final FeedRequest request) throws IOException, NovuNetworkException { try { return feedsHandler.createFeed(request); } catch (Exception e) { @@ -816,7 +871,7 @@ public BulkFeedsResponse getFeeds() throws IOException, NovuNetworkException { } } - public BulkFeedsResponse deleteFeed(String feedId) throws IOException, NovuNetworkException { + public BulkFeedsResponse deleteFeed(final String feedId) throws IOException, NovuNetworkException { try { return feedsHandler.deleteFeed(feedId); } catch (Exception e) { @@ -825,7 +880,7 @@ public BulkFeedsResponse deleteFeed(String feedId) throws IOException, NovuNetwo } } - public MessageResponse getMessages(MessageRequest request) throws IOException, NovuNetworkException { + public MessageResponse getMessages(final MessageRequest request) throws IOException, NovuNetworkException { try { return messageHandler.getMessages(request); } catch (Exception e) { @@ -834,7 +889,7 @@ public MessageResponse getMessages(MessageRequest request) throws IOException, N } } - public DeleteMessageResponse deleteMessage(String messageId) throws IOException, NovuNetworkException { + public DeleteMessageResponse deleteMessage(final String messageId) throws IOException, NovuNetworkException { try { return messageHandler.deleteMessage(messageId); } catch (Exception e) { @@ -843,7 +898,8 @@ public DeleteMessageResponse deleteMessage(String messageId) throws IOException, } } - public ExecutiveDetailsResponse getExecutionDetails(String notificationId, String subscriberId) throws IOException, NovuNetworkException { + public ExecutiveDetailsResponse getExecutionDetails(final String notificationId, final String subscriberId) + throws IOException, NovuNetworkException { try { return executiveDetailsHandler.getExecutionDetails(notificationId, subscriberId); } catch (Exception e) { @@ -861,7 +917,7 @@ public BlueprintsByCategoryResponse getBlueprintsByCategory() throws IOException } } - public Blueprint getBlueprint(String templateId) throws IOException, NovuNetworkException { + public Blueprint getBlueprint(final String templateId) throws IOException, NovuNetworkException { try { return blueprintsHandler.getBlueprint(templateId); } catch (Exception e) { @@ -870,7 +926,7 @@ public Blueprint getBlueprint(String templateId) throws IOException, NovuNetwork } } - public BulkTenantResponse getTenants(GetTenantRequest request) throws IOException, NovuNetworkException { + public BulkTenantResponse getTenants(final GetTenantRequest request) throws IOException, NovuNetworkException { try { return tenantsHandler.getTenants(request); } catch (Exception e) { @@ -879,7 +935,7 @@ public BulkTenantResponse getTenants(GetTenantRequest request) throws IOExceptio } } - public TenantResponse createTenant(TenantRequest request) throws IOException, NovuNetworkException { + public TenantResponse createTenant(final TenantRequest request) throws IOException, NovuNetworkException { try { return tenantsHandler.createTenant(request); } catch (Exception e) { @@ -888,7 +944,7 @@ public TenantResponse createTenant(TenantRequest request) throws IOException, No } } - public TenantResponse getTenant(String identifier) throws IOException, NovuNetworkException { + public TenantResponse getTenant(final String identifier) throws IOException, NovuNetworkException { try { return tenantsHandler.getTenant(identifier); } catch (Exception e) { @@ -897,7 +953,8 @@ public TenantResponse getTenant(String identifier) throws IOException, NovuNetwo } } - public TenantResponse updateTenant(TenantRequest request, String identifier) throws IOException, NovuNetworkException { + public TenantResponse updateTenant(final TenantRequest request, final String identifier) + throws IOException, NovuNetworkException { try { return tenantsHandler.updateTenant(request, identifier); } catch (Exception e) { @@ -906,7 +963,7 @@ public TenantResponse updateTenant(TenantRequest request, String identifier) thr } } - public DeleteTenantResponse deleteTenant(String identifier) throws IOException, NovuNetworkException { + public DeleteTenantResponse deleteTenant(final String identifier) throws IOException, NovuNetworkException { try { return tenantsHandler.deleteTenant(identifier); } catch (Exception e) { @@ -915,7 +972,8 @@ public DeleteTenantResponse deleteTenant(String identifier) throws IOException, } } - public OrganizationResponse createOrganization(CreateOrganizationRequest request) throws IOException, NovuNetworkException { + public OrganizationResponse createOrganization(final CreateOrganizationRequest request) + throws IOException, NovuNetworkException { try { return organizationHandler.createOrganization(request); } catch (Exception e) { @@ -933,7 +991,8 @@ public FetchOrganizationResponse fetchAllOrganizations() throws IOException, Nov } } - public UpdateOrganizationNameResponse updateOrganizationName(UpdateOrganizationNameRequest request) throws IOException, NovuNetworkException { + public UpdateOrganizationNameResponse updateOrganizationName(final UpdateOrganizationNameRequest request) + throws IOException, NovuNetworkException { try { return organizationHandler.updateOrganizationName(request); } catch (Exception e) { @@ -951,7 +1010,7 @@ public OrganizationResponse fetchCurrentOrganization() throws IOException, NovuN } } - public MemberResponse removeMemberWithId(String memberId) throws IOException, NovuNetworkException { + public MemberResponse removeMemberWithId(final String memberId) throws IOException, NovuNetworkException { try { return organizationHandler.removeMemberWithId(memberId); } catch (Exception e) { @@ -960,7 +1019,8 @@ public MemberResponse removeMemberWithId(String memberId) throws IOException, No } } - public MemberResponse updateMemberRole(String memberId, UpdateMemberRoleRequest request) throws IOException, NovuNetworkException { + public MemberResponse updateMemberRole(final String memberId, final UpdateMemberRoleRequest request) + throws IOException, NovuNetworkException { try { return organizationHandler.updateMemberRole(memberId, request); } catch (Exception e) { @@ -969,7 +1029,7 @@ public MemberResponse updateMemberRole(String memberId, UpdateMemberRoleRequest } } - public FetchMembersResponse fetchMembersOfOrganization()throws IOException, NovuNetworkException { + public FetchMembersResponse fetchMembersOfOrganization() throws IOException, NovuNetworkException { try { return organizationHandler.fetchMembersOfOrganization(); } catch (Exception e) { @@ -978,7 +1038,8 @@ public FetchMembersResponse fetchMembersOfOrganization()throws IOException, Novu } } - public UpdateOrganizationBrandResponse updateOrganizationBrand(UpdateOrganizationBrandRequest request)throws IOException, NovuNetworkException { + public UpdateOrganizationBrandResponse updateOrganizationBrand(final UpdateOrganizationBrandRequest request) + throws IOException, NovuNetworkException { try { return organizationHandler.updateOrganizationBrand(request); } catch (Exception e) { @@ -987,7 +1048,8 @@ public UpdateOrganizationBrandResponse updateOrganizationBrand(UpdateOrganizatio } } - public WorkflowOverrideResponse createWorkflowOverride(CreateWorkflowOverrideRequest request) throws IOException, NovuNetworkException { + public WorkflowOverrideResponse createWorkflowOverride(final CreateWorkflowOverrideRequest request) + throws IOException, NovuNetworkException { try { return workflowOverrideHandler.createWorkflowOverride(request); } catch (Exception e) { @@ -996,7 +1058,8 @@ public WorkflowOverrideResponse createWorkflowOverride(CreateWorkflowOverrideReq } } - public BulkWorkflowOverridesResponse getWorkflowOverrides(GetWorkflowOverrideRequest request) throws IOException, NovuNetworkException { + public BulkWorkflowOverridesResponse getWorkflowOverrides(final GetWorkflowOverrideRequest request) + throws IOException, NovuNetworkException { try { return workflowOverrideHandler.getWorkflowOverrides(request); } catch (Exception e) { @@ -1005,7 +1068,8 @@ public BulkWorkflowOverridesResponse getWorkflowOverrides(GetWorkflowOverrideReq } } - public WorkflowOverrideResponse getWorkflowOverride(String workflowId, String tenantId) throws IOException, NovuNetworkException { + public WorkflowOverrideResponse getWorkflowOverride(final String workflowId, final String tenantId) + throws IOException, NovuNetworkException { try { return workflowOverrideHandler.getWorkflowOverride(workflowId, tenantId); } catch (Exception e) { @@ -1014,7 +1078,8 @@ public WorkflowOverrideResponse getWorkflowOverride(String workflowId, String te } } - public WorkflowOverrideResponse getWorkflowOverrideById(String overrideId) throws IOException, NovuNetworkException { + public WorkflowOverrideResponse getWorkflowOverrideById(final String overrideId) + throws IOException, NovuNetworkException { try { return workflowOverrideHandler.getWorkflowOverrideById(overrideId); } catch (Exception e) { @@ -1023,7 +1088,9 @@ public WorkflowOverrideResponse getWorkflowOverrideById(String overrideId) throw } } - public WorkflowOverrideResponse updateWorkflowOverrideById(String overrideId, UpdateWorkflowOverrideRequest request) throws IOException, NovuNetworkException { + public WorkflowOverrideResponse updateWorkflowOverrideById(final String overrideId, + final UpdateWorkflowOverrideRequest request) + throws IOException, NovuNetworkException { try { return workflowOverrideHandler.updateWorkflowOverrideById(overrideId, request); } catch (Exception e) { @@ -1032,7 +1099,9 @@ public WorkflowOverrideResponse updateWorkflowOverrideById(String overrideId, Up } } - public WorkflowOverrideResponse updateWorkflowOverride(String workflowId, String tenantId, UpdateWorkflowOverrideRequest request) throws IOException, NovuNetworkException { + public WorkflowOverrideResponse updateWorkflowOverride(final String workflowId, final String tenantId, + final UpdateWorkflowOverrideRequest request) + throws IOException, NovuNetworkException { try { return workflowOverrideHandler.updateWorkflowOverride(workflowId, tenantId, request); } catch (Exception e) { @@ -1041,7 +1110,8 @@ public WorkflowOverrideResponse updateWorkflowOverride(String workflowId, String } } - public DeleteWorkflowOverrideResponse deleteWorkflowOverride(String overrideId) throws IOException, NovuNetworkException { + public DeleteWorkflowOverrideResponse deleteWorkflowOverride(final String overrideId) + throws IOException, NovuNetworkException { try { return workflowOverrideHandler.deleteWorkflowOverride(overrideId); } catch (Exception e) { @@ -1050,7 +1120,7 @@ public DeleteWorkflowOverrideResponse deleteWorkflowOverride(String overrideId) } } - private void logException(String message, Exception e) { + private void logException(final String message, final Exception e) { if (!novuConfig.isEnableLogging()) { return; } diff --git a/src/main/java/co/novu/common/base/NovuConfig.java b/src/main/java/co/novu/common/base/NovuConfig.java index 2fc4240..1a7f4f9 100644 --- a/src/main/java/co/novu/common/base/NovuConfig.java +++ b/src/main/java/co/novu/common/base/NovuConfig.java @@ -1,15 +1,13 @@ package co.novu.common.base; -import lombok.Getter; -import lombok.Setter; +import lombok.Data; import okhttp3.logging.HttpLoggingInterceptor; -@Getter -@Setter +@Data public class NovuConfig { - - public NovuConfig(String apiKey) { - this.apiKey = apiKey; + + public NovuConfig(final String novuApiKey) { + this.apiKey = novuApiKey; } private String apiKey; @@ -19,4 +17,4 @@ public NovuConfig(String apiKey) { private boolean enableLogging = true; private HttpLoggingInterceptor.Level apiLogLevel = HttpLoggingInterceptor.Level.BASIC; -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/common/contracts/IRequest.java b/src/main/java/co/novu/common/contracts/IRequest.java index 6852f94..6407b9d 100644 --- a/src/main/java/co/novu/common/contracts/IRequest.java +++ b/src/main/java/co/novu/common/contracts/IRequest.java @@ -1,4 +1,4 @@ package co.novu.common.contracts; public interface IRequest { -} \ No newline at end of file +} diff --git a/src/main/java/co/novu/common/rest/NovuNetworkException.java b/src/main/java/co/novu/common/rest/NovuNetworkException.java index 348f4a1..be67f47 100644 --- a/src/main/java/co/novu/common/rest/NovuNetworkException.java +++ b/src/main/java/co/novu/common/rest/NovuNetworkException.java @@ -2,7 +2,7 @@ public class NovuNetworkException extends Exception { - public NovuNetworkException(String message) { + public NovuNetworkException(final String message) { super(message); } } diff --git a/src/main/java/co/novu/common/rest/RestHandler.java b/src/main/java/co/novu/common/rest/RestHandler.java index 8843c97..d934b09 100644 --- a/src/main/java/co/novu/common/rest/RestHandler.java +++ b/src/main/java/co/novu/common/rest/RestHandler.java @@ -22,7 +22,7 @@ @RequiredArgsConstructor @Slf4j -public class RestHandler { +public final class RestHandler { private final NovuConfig novuConfig; @@ -58,19 +58,21 @@ public Retrofit buildRetrofit() { return retrofit; } - public T extractResponse(Response response) throws NovuNetworkException, IOException { + public T extractResponse(final Response response) throws NovuNetworkException, IOException { if (response.isSuccessful()) { return response.body(); } else { - throw new NovuNetworkException(response.errorBody() != null ? response.errorBody().string() : "Error connecting to Novu API"); + throw new NovuNetworkException(response.errorBody() != null ? response.errorBody().string() + : "Error connecting to Novu API"); } } - public R extractResponse(Response response, R body) throws NovuNetworkException, IOException { + public R extractResponse(final Response response, final R body) throws NovuNetworkException, IOException { if (response.isSuccessful()) { return body; } else { - throw new NovuNetworkException(response.errorBody() != null ? response.errorBody().string() : "Error connecting to Novu API"); + throw new NovuNetworkException(response.errorBody() != null ? response.errorBody().string() + : "Error connecting to Novu API"); } } @@ -90,4 +92,4 @@ private String loadSdkVersionFromPom() { } return ""; } -} \ No newline at end of file +} diff --git a/src/test/java/co/novu/api/workflowgroups/WorkflowGroupHandlerTest.java b/src/test/java/co/novu/api/workflowgroups/WorkflowGroupHandlerTest.java index 60e50e8..dc4e05f 100644 --- a/src/test/java/co/novu/api/workflowgroups/WorkflowGroupHandlerTest.java +++ b/src/test/java/co/novu/api/workflowgroups/WorkflowGroupHandlerTest.java @@ -38,11 +38,11 @@ public void test_createWorkflowGroup() throws InterruptedException, NovuNetworkE WorkflowGroupResponse workflowGroupResponse = new WorkflowGroupResponse(); WorkflowGroupResponseData data = new WorkflowGroupResponseData(); - data.set_id("id"); + data.setId("id"); data.setName("name"); - data.set_organizationId("organizationId"); - data.set_environmentId("environmentId"); - data.set_parentId("parentId"); + data.setOrganizationId("organizationId"); + data.setEnvironmentId("environmentId"); + data.setParentId("parentId"); workflowGroupResponse.setData(data); Gson gson = new Gson(); @@ -75,17 +75,17 @@ public void test_getWorkflowGroup() throws NovuNetworkException, IOException, In WorkflowGroupResponse workflowGroupResponse = new WorkflowGroupResponse(); WorkflowGroupResponseData data = new WorkflowGroupResponseData(); - data.set_id("id"); + data.setId("id"); data.setName("name"); - data.set_organizationId("organizationId"); - data.set_environmentId("environmentId"); - data.set_parentId("parentId"); + data.setOrganizationId("organizationId"); + data.setEnvironmentId("environmentId"); + data.setParentId("parentId"); workflowGroupResponse.setData(data); Gson gson = new Gson(); mockWebServer.enqueue(new MockResponse().setResponseCode(200).setBody(gson.toJson(workflowGroupResponse))); - WorkflowGroupResponse response = workflowGroupHandler.getWorkflowGroup(data.get_id()); + WorkflowGroupResponse response = workflowGroupHandler.getWorkflowGroup(data.getId()); RecordedRequest request = mockWebServer.takeRequest(); assertEquals("/notification-groups/id", request.getPath()); @@ -100,17 +100,17 @@ public void test_updateWorkflowGroup() throws NovuNetworkException, IOException, WorkflowGroupResponse workflowGroupResponse = new WorkflowGroupResponse(); WorkflowGroupResponseData data = new WorkflowGroupResponseData(); - data.set_id("id"); + data.setId("id"); data.setName("name"); - data.set_organizationId("organizationId"); - data.set_environmentId("environmentId"); - data.set_parentId("parentId"); + data.setOrganizationId("organizationId"); + data.setEnvironmentId("environmentId"); + data.setParentId("parentId"); workflowGroupResponse.setData(data); Gson gson = new Gson(); mockWebServer.enqueue(new MockResponse().setResponseCode(200).setBody(gson.toJson(workflowGroupResponse))); - WorkflowGroupResponse response = workflowGroupHandler.updateWorkflowGroup(data.get_id(), workflowGroupRequest); + WorkflowGroupResponse response = workflowGroupHandler.updateWorkflowGroup(data.getId(), workflowGroupRequest); RecordedRequest request = mockWebServer.takeRequest(); assertEquals("/notification-groups/id", request.getPath());