Skip to content

Commit f35c162

Browse files
author
ddlatham
authored
add Drafts.setSendEndpoint (#21)
1 parent 2396fa2 commit f35c162

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/com/nylas/Drafts.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
public class Drafts extends RestfulDAO<Draft> {
1515

16+
private String sendEndpoint = "send";
17+
1618
Drafts(NylasClient client, String accessToken) {
1719
super(client, Draft.class, "drafts", accessToken);
1820
}
@@ -105,10 +107,6 @@ public Message send(Draft draft) throws IOException, RequestFailedException {
105107
return client.executeRequestWithAuth(authUser, url, HttpMethod.POST, jsonBody, resultType);
106108
}
107109

108-
private HttpUrl.Builder getSendUrl() {
109-
return client.newUrlBuilder().addPathSegment("send");
110-
}
111-
112110
/**
113111
* Sends the given mime message with Content-Type: message/rfc822
114112
* @return a Message representing the sent message
@@ -118,6 +116,14 @@ public Message sendRawMime(String mimeMessage) throws IOException, RequestFailed
118116
RequestBody requestBody = RequestBody.create(MediaType.get("message/rfc822"), mimeMessage);
119117
return client.executeRequestWithAuth(authUser, url, HttpMethod.POST, requestBody, Message.class);
120118
}
119+
120+
public void setSendEndpoint(String sendEndpoint) {
121+
this.sendEndpoint = sendEndpoint;
122+
}
123+
124+
private HttpUrl.Builder getSendUrl() {
125+
return client.newUrlBuilder().addPathSegment(sendEndpoint);
126+
}
121127

122128
}
123129

0 commit comments

Comments
 (0)