Skip to content

Commit 0698b32

Browse files
committed
updated request response format for bypassing and server deleting
1 parent 341f7d2 commit 0698b32

4 files changed

Lines changed: 40 additions & 30 deletions

File tree

src/main/java/com/wildbit/java/postmark/client/AccountApiClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.wildbit.java.postmark.client;
22

3+
import com.wildbit.java.postmark.client.data.model.RequestResponse;
34
import com.wildbit.java.postmark.client.data.model.domains.*;
45
import com.wildbit.java.postmark.client.data.model.senders.*;
56
import com.wildbit.java.postmark.client.data.model.server.Server;
@@ -58,8 +59,9 @@ public Servers getServers(Parameters parameters) throws PostmarkException, IOExc
5859
return dataHandler.fromJson(response, Servers.class);
5960
}
6061

61-
public String deleteServer(Integer id) throws PostmarkException, IOException {
62-
return execute(HttpClient.REQUEST_TYPES.DELETE, getEndpointUrl(serversEndpoint + id));
62+
public RequestResponse deleteServer(Integer id) throws PostmarkException, IOException {
63+
String response = execute(HttpClient.REQUEST_TYPES.DELETE, getEndpointUrl(serversEndpoint + id));
64+
return dataHandler.fromJson(response, RequestResponse.class);
6365
}
6466

6567
/*

src/main/java/com/wildbit/java/postmark/client/ApiClient.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.wildbit.java.postmark.client;
22

33
import com.fasterxml.jackson.core.type.TypeReference;
4+
import com.wildbit.java.postmark.client.data.model.RequestResponse;
45
import com.wildbit.java.postmark.client.data.model.bounces.Bounce;
56
import com.wildbit.java.postmark.client.data.model.bounces.BounceDump;
67
import com.wildbit.java.postmark.client.data.model.bounces.Bounces;
78
import com.wildbit.java.postmark.client.data.model.bounces.DeliveryStats;
8-
import com.wildbit.java.postmark.client.data.model.message.BaseMessageResponse;
99
import com.wildbit.java.postmark.client.data.model.message.Message;
1010
import com.wildbit.java.postmark.client.data.model.message.MessageResponse;
1111
import com.wildbit.java.postmark.client.data.model.messages.*;
@@ -41,7 +41,6 @@ public class ApiClient extends BaseApiClient {
4141
private final String outboundMessagesEndpoint = "/messages/outbound/";
4242
private final String inboundMessagesEndpoint = "/messages/inbound/";
4343
private final String outboundStatsEndpoint = "/stats/outbound/";
44-
private final String triggerTagsEndpoint = "/triggers/tags/";
4544
private final String triggerInboundRulesEndpoint = "/triggers/inboundRules/";
4645
private final String sendingEndpoint = "/email/";
4746
private final String webhooksEndpoint = "/webhooks/";
@@ -267,14 +266,14 @@ public InboundMessageDetails getInboundMessageDetails(String id) throws Postmark
267266
return dataHandler.fromJson(response, InboundMessageDetails.class);
268267
}
269268

270-
public String bypassInboundMessage(String id) throws PostmarkException, IOException {
269+
public RequestResponse bypassInboundMessage(String id) throws PostmarkException, IOException {
271270
String response = execute(HttpClient.REQUEST_TYPES.PUT, getEndpointUrl(inboundMessagesEndpoint + id + "/bypass"));
272-
return dataHandler.fromJson(response, BaseMessageResponse.class).getMessage();
271+
return dataHandler.fromJson(response, RequestResponse.class);
273272
}
274273

275-
public String retryFailedInboundMessage( String id) throws PostmarkException, IOException {
274+
public RequestResponse retryFailedInboundMessage(String id) throws PostmarkException, IOException {
276275
String response = execute(HttpClient.REQUEST_TYPES.PUT, getEndpointUrl(inboundMessagesEndpoint + id + "/retry"));
277-
return dataHandler.fromJson(response, BaseMessageResponse.class).getMessage();
276+
return dataHandler.fromJson(response, RequestResponse.class);
278277
}
279278

280279
/*
@@ -430,5 +429,9 @@ public SuppressionStatuses deleteSuppressions(String messageStream, SuppressionE
430429
return dataHandler.fromJson(response, SuppressionStatuses.class);
431430
}
432431

432+
/*
433+
Message stream endpoints
434+
*/
435+
433436

434437
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.wildbit.java.postmark.client.data.model;
2+
3+
public class RequestResponse {
4+
private Integer errorCode;
5+
private String message;
6+
7+
// SETTERS AND GETTERS
8+
9+
public Integer getErrorCode() {
10+
return errorCode;
11+
}
12+
13+
public void setErrorCode(Integer errorCode) {
14+
this.errorCode = errorCode;
15+
}
16+
17+
public String getMessage() {
18+
return message;
19+
}
20+
21+
public void setMessage(String message) {
22+
this.message = message;
23+
}
24+
}
Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,8 @@
11
package com.wildbit.java.postmark.client.data.model.message;
22

3+
import com.wildbit.java.postmark.client.data.model.RequestResponse;
4+
35
/**
46
* HTTP send request response object
57
*/
6-
public class BaseMessageResponse {
7-
private Integer errorCode;
8-
private String message;
9-
10-
// SETTERS AND GETTERS
11-
12-
public Integer getErrorCode() {
13-
return errorCode;
14-
}
15-
16-
public void setErrorCode(Integer errorCode) {
17-
this.errorCode = errorCode;
18-
}
19-
20-
public String getMessage() {
21-
return message;
22-
}
23-
24-
public void setMessage(String message) {
25-
this.message = message;
26-
}
27-
}
8+
public class BaseMessageResponse extends RequestResponse { }

0 commit comments

Comments
 (0)