Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add method for calling the outbound message details endpoint with que… #19

Merged
merged 1 commit into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/com/wildbit/java/postmark/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public OutboundMessageDetails getMessageDetails(String id) throws PostmarkExcept
return dataHandler.fromJson(response, OutboundMessageDetails.class);
}

public OutboundMessageDetails getMessageDetails(String id, Parameters parameters) throws PostmarkException, IOException {
String response = execute(HttpClient.REQUEST_TYPES.GET, getEndpointUrl(outboundMessagesEndpoint + id + "/details" + parameters));
return dataHandler.fromJson(response, OutboundMessageDetails.class);
}

public OutboundMessageDump getMessageDump(String id) throws PostmarkException, IOException {
String response = execute(HttpClient.REQUEST_TYPES.GET, getEndpointUrl(outboundMessagesEndpoint + id + "/dump"));
return dataHandler.fromJson(response, OutboundMessageDump.class);
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/integration/MessagesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ void messageById() throws PostmarkException, IOException {
assertNotNull(message.getReceivedAt());
}

@Test
void messageByIdWithParameters() throws PostmarkException, IOException {
OutboundMessages messages = client.getMessages(Parameters.init().build("count", 1).build("offset", 0));
String messageId = messages.getMessages().get(0).getMessageId();
Parameters parameters = new Parameters()
.build("includeMessageContent", "Full");
OutboundMessageDetails message = client.getMessageDetails(messageId, parameters);

assertNotNull(message.getReceivedAt());
}

@Test
void messageByIdDump() throws PostmarkException, IOException {
OutboundMessages messages = client.getMessages(Parameters.init().build("count", 1).build("offset", 0));
Expand Down