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

Added support for reply_to_message_id field in Message #194

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This section contains changes that have been committed but not yet released.
### Added

* Added support for overriding the Event ID when updating, for recurring events
* Added support for `reply_to_message_id` field in `Message`

### Changed

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/nylas/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Message extends AccountOwnedModel implements JsonObject {
protected List<NameEmail> cc = Collections.emptyList();
protected List<NameEmail> bcc = Collections.emptyList();
protected List<NameEmail> reply_to = Collections.emptyList();
protected String reply_to_message_id;
protected Long date;
protected Boolean unread;
protected Boolean starred;
Expand Down Expand Up @@ -99,6 +100,10 @@ public Map<String, String> getMetadata() {
return metadata;
}

public String getReplyToMessageId() {
return reply_to_message_id;
}

/**
* Return additional RFC2822 headers, only available in expanded view
*/
Expand All @@ -111,7 +116,7 @@ public String toString() {
return "Message [id=" + getId() + ", account_id=" + getAccountId() + ", thread_id=" + thread_id + ", subject="
+ subject + ", from=" + from + ", to=" + to + ", cc=" + cc + ", bcc=" + bcc + ", reply_to=" + reply_to
+ ", date=" + getDate() + ", unread=" + unread + ", starred=" + starred + ", snippet=" + snippet
+ ", files=" + files + ", events=" + events + ", folder=" + folder
+ ", files=" + files + ", events=" + events + ", folder=" + folder + ", reply_to_message_id=" + reply_to_message_id
+ ", labels=" + labels + ", headers=" + headers + ", metadata=" + metadata + "]";
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/nylas/MessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void testGetters() {
assertEquals(message.getLabels().size(), 1);
assertEquals(message.getMetadata().size(), 1);
assertEquals(message.getHeaders().size(), 1);
assertEquals(message.toString(), "Message [id=null, account_id=null, thread_id=okdvc089, subject=That thing I sent you, from=[NameEmail [name=Peter Potamus, [email protected]]], to=[NameEmail [name=Blue Falcone, [email protected]]], cc=[NameEmail [name=Harvey Birdman, [email protected]]], bcc=[NameEmail [name=Christie, [email protected]]], reply_to=[NameEmail [name=Peter Potamus, [email protected]]], date=2022-11-10T12:28:00Z, unread=true, starred=true, snippet=Did you get that thing..., files=[File [id=null, filename=logo.jpg, size=12334, content_type=image/jpeg, message_ids=[odjashjcv89], content_id=osdivcnm90834e, content_disposition=attachment]], events=[Event [id='null', calendar_id='null', ical_uid='null', master_event_id='null', event_collection_id='null', title='null', description='null', location='null', owner='null', status='null', capacity=null, read_only=null, busy=null, hide_participants=null, original_start_time=null, when=null, conferencing=null, recurrence=null, round_robin_order=[], notifications=[], participants=[], visibility=null, metadata={}, customer_event_id=null]], folder=Folder [id=null, name=null, display_name=null], labels=[Label [id=null, name=null, display_name=null]], headers={header1=value}, metadata={key1=value}]");
assertEquals(message.toString(), "Message [id=null, account_id=null, thread_id=okdvc089, subject=That thing I sent you, from=[NameEmail [name=Peter Potamus, [email protected]]], to=[NameEmail [name=Blue Falcone, [email protected]]], cc=[NameEmail [name=Harvey Birdman, [email protected]]], bcc=[NameEmail [name=Christie, [email protected]]], reply_to=[NameEmail [name=Peter Potamus, [email protected]]], date=2022-11-10T12:28:00Z, unread=true, starred=true, snippet=Did you get that thing..., files=[File [id=null, filename=logo.jpg, size=12334, content_type=image/jpeg, message_ids=[odjashjcv89], content_id=osdivcnm90834e, content_disposition=attachment]], events=[Event [id='null', calendar_id='null', ical_uid='null', master_event_id='null', event_collection_id='null', title='null', description='null', location='null', owner='null', status='null', capacity=null, read_only=null, busy=null, hide_participants=null, original_start_time=null, when=null, conferencing=null, recurrence=null, round_robin_order=[], notifications=[], participants=[], visibility=null, metadata={}, customer_event_id=null]], folder=Folder [id=null, name=null, display_name=null], reply_to_message_id=null, labels=[Label [id=null, name=null, display_name=null]], headers={header1=value}, metadata={key1=value}]");
}


Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/nylas/ThreadTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void testGetters() {
assertEquals(thread.getDraftIds().size(), 1);
assertEquals(thread.getMessages().size(), 1);
assertEquals(thread.getDrafts().size(), 1);
assertEquals(thread.toString(), "Thread [id=solidkvjnopisd903, account_id=null,subject=That thing I sent you, unread=true, starred=true, last_message_timestamp=2022-11-23T16:03:08Z, last_message_received_timestamp=2022-11-23T16:03:15Z, last_message_sent_timestamp=2022-11-23T16:03:04Z, first_message_timestamp=2022-11-23T15:59:48Z, participants=[NameEmail [name=Peter, Potamus, [email protected]]], snippet=this is a preview, version=1, folders=[Folder [id=null, name=null, display_name=null]], labels=[Label [id=null, name=null, display_name=null]], has_attachments=true, message_ids=[sldfkvj893w, losdkvj933], draft_ids=[sdklcvj93], messages=[Message [id=null, account_id=null, thread_id=null, subject=null, from=[], to=[], cc=[], bcc=[], reply_to=[], date=null, unread=null, starred=null, snippet=null, files=[], events=[], folder=null, labels=[], headers={}, metadata={}]], drafts=[Draft [reply_to_message_id=null, version=null, account_id=null, thread_id=null, subject=null, from=[], to=[], cc=[], bcc=[], reply_to=[], date=null, unread=null, starred=null, snippet=null, body=null, files=[], folder=null, labels=[], tracking=null, metadata={}]]]");
assertEquals(thread.toString(), "Thread [id=solidkvjnopisd903, account_id=null,subject=That thing I sent you, unread=true, starred=true, last_message_timestamp=2022-11-23T16:03:08Z, last_message_received_timestamp=2022-11-23T16:03:15Z, last_message_sent_timestamp=2022-11-23T16:03:04Z, first_message_timestamp=2022-11-23T15:59:48Z, participants=[NameEmail [name=Peter, Potamus, [email protected]]], snippet=this is a preview, version=1, folders=[Folder [id=null, name=null, display_name=null]], labels=[Label [id=null, name=null, display_name=null]], has_attachments=true, message_ids=[sldfkvj893w, losdkvj933], draft_ids=[sdklcvj93], messages=[Message [id=null, account_id=null, thread_id=null, subject=null, from=[], to=[], cc=[], bcc=[], reply_to=[], date=null, unread=null, starred=null, snippet=null, files=[], events=[], folder=null, reply_to_message_id=null, labels=[], headers={}, metadata={}]], drafts=[Draft [reply_to_message_id=null, version=null, account_id=null, thread_id=null, subject=null, from=[], to=[], cc=[], bcc=[], reply_to=[], date=null, unread=null, starred=null, snippet=null, body=null, files=[], folder=null, labels=[], tracking=null, metadata={}]]]");
}

@Test
Expand Down
Loading