From dc73f7181508940cb4d3b6387494ba9c30a4bf8e Mon Sep 17 00:00:00 2001 From: Mostafa Rashed <17770919+mrashed-dev@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:30:51 +0400 Subject: [PATCH] Added support for `reply_to_message_id` field in `Message` (#194) # Description This PR adds the missing `reply_to_message_id` field for Messages. # License I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner. --- CHANGELOG.md | 1 + src/main/java/com/nylas/Message.java | 7 ++++++- src/test/java/com/nylas/MessageTest.java | 2 +- src/test/java/com/nylas/ThreadTest.java | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b0abcd1..b59c0b09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/main/java/com/nylas/Message.java b/src/main/java/com/nylas/Message.java index 9c620817..36d6523b 100644 --- a/src/main/java/com/nylas/Message.java +++ b/src/main/java/com/nylas/Message.java @@ -12,6 +12,7 @@ public class Message extends AccountOwnedModel implements JsonObject { protected List cc = Collections.emptyList(); protected List bcc = Collections.emptyList(); protected List reply_to = Collections.emptyList(); + protected String reply_to_message_id; protected Long date; protected Boolean unread; protected Boolean starred; @@ -99,6 +100,10 @@ public Map getMetadata() { return metadata; } + public String getReplyToMessageId() { + return reply_to_message_id; + } + /** * Return additional RFC2822 headers, only available in expanded view */ @@ -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 + "]"; } diff --git a/src/test/java/com/nylas/MessageTest.java b/src/test/java/com/nylas/MessageTest.java index 4368a36c..410ffb6a 100644 --- a/src/test/java/com/nylas/MessageTest.java +++ b/src/test/java/com/nylas/MessageTest.java @@ -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=potamus.peter@sebbebandsebben.com]], to=[NameEmail [name=Blue Falcone, email=falcone.blue@sebbebandsebben.com]], cc=[NameEmail [name=Harvey Birdman, email=harvey.birdman@sebbebandsebben.com]], bcc=[NameEmail [name=Christie, email=christie@sebbebandsebben.com]], reply_to=[NameEmail [name=Peter Potamus, email=potamus.peter@sebbebandsebben.com]], 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=potamus.peter@sebbebandsebben.com]], to=[NameEmail [name=Blue Falcone, email=falcone.blue@sebbebandsebben.com]], cc=[NameEmail [name=Harvey Birdman, email=harvey.birdman@sebbebandsebben.com]], bcc=[NameEmail [name=Christie, email=christie@sebbebandsebben.com]], reply_to=[NameEmail [name=Peter Potamus, email=potamus.peter@sebbebandsebben.com]], 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}]"); } diff --git a/src/test/java/com/nylas/ThreadTest.java b/src/test/java/com/nylas/ThreadTest.java index 759b4acc..4a3cdf08 100644 --- a/src/test/java/com/nylas/ThreadTest.java +++ b/src/test/java/com/nylas/ThreadTest.java @@ -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=ppotamus@gmail.com]], 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=ppotamus@gmail.com]], 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