From 4411540cdc313ba957ff592424bdb38a65d4a86a Mon Sep 17 00:00:00 2001 From: Norbert Bartels Date: Fri, 15 Jan 2021 23:40:15 +0100 Subject: [PATCH] Issue #1117 - deprecated messenger components removed --- .../types/webhook/ChangeValueFactory.java | 1 - .../types/webhook/PageConversation.java | 56 ------------------- .../types/webhook/messaging/MessageItem.java | 13 ----- .../restfb/types/WebhookMessagingTest.java | 6 -- .../java/com/restfb/types/WebhookTest.java | 11 ---- .../json/webhooks/page-conversations-25.json | 18 ------ 6 files changed, 105 deletions(-) delete mode 100644 src/main/lombok/com/restfb/types/webhook/PageConversation.java delete mode 100644 src/test/resources/json/webhooks/page-conversations-25.json diff --git a/src/main/lombok/com/restfb/types/webhook/ChangeValueFactory.java b/src/main/lombok/com/restfb/types/webhook/ChangeValueFactory.java index 4b9d3c17f..d9fc985b8 100644 --- a/src/main/lombok/com/restfb/types/webhook/ChangeValueFactory.java +++ b/src/main/lombok/com/restfb/types/webhook/ChangeValueFactory.java @@ -163,7 +163,6 @@ enum ChangeValueEnumeration { RATINGS_REACTION_ADD(RatingsReactionValue.class), // RATINGS_REACTION_REMOVE(RatingsReactionValue.class), // RATINGS_REACTION_EDIT(RatingsReactionValue.class), // - CONVERSATIONS(PageConversation.class), // LEADGEN(PageLeadgen.class), // // Instagram STORY_INSIGHTS(InstagramStoryInsightsValue.class), // diff --git a/src/main/lombok/com/restfb/types/webhook/PageConversation.java b/src/main/lombok/com/restfb/types/webhook/PageConversation.java deleted file mode 100644 index 123ee4b10..000000000 --- a/src/main/lombok/com/restfb/types/webhook/PageConversation.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2010-2021 Mark Allen, Norbert Bartels. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.restfb.types.webhook; - -import com.restfb.Facebook; -import com.restfb.annotation.GraphAPI; - -import lombok.Getter; -import lombok.Setter; - -/** - * Change value of the page conversation. - * - * Hint for Graph API 3.3: The conversations field is deprecated. Use the existing Messenger Webhooks - * messages field instead. - * @deprecated for 3.3+ directly and for all other versions on December 31, 2019. Use the Messenger Webhook instead - */ -@Deprecated -@GraphAPI(until = "3.2") -public class PageConversation extends ChangeValue { - - @Getter - @Setter - @Facebook("page_id") - private String pageId; - - @Getter - @Setter - @Facebook("thread_id") - private String threadId; - - @Getter - @Setter - @Facebook("thread_key") - private String threadKey; - -} diff --git a/src/main/lombok/com/restfb/types/webhook/messaging/MessageItem.java b/src/main/lombok/com/restfb/types/webhook/messaging/MessageItem.java index a12cdd950..9774440ae 100644 --- a/src/main/lombok/com/restfb/types/webhook/messaging/MessageItem.java +++ b/src/main/lombok/com/restfb/types/webhook/messaging/MessageItem.java @@ -46,19 +46,6 @@ public class MessageItem implements InnerMessagingItem { @Facebook private String mid; - /** - * Message sequence number - * - * @deprecated https://messengerblog.com/platform-updates/introducing-messenger-platform-v1-3-and-new-ways-to-drive-the-conversation/ - * "Developers who previously relied on using seq ID for deduping can use mid instead, and those who were - * using it for ordering purposes can use timestamp instead." - */ - @Deprecated - @Getter - @Setter - @Facebook - private Long seq; - /** * Text of message */ diff --git a/src/test/java/com/restfb/types/WebhookMessagingTest.java b/src/test/java/com/restfb/types/WebhookMessagingTest.java index ba51464f2..a16ca66fe 100644 --- a/src/test/java/com/restfb/types/WebhookMessagingTest.java +++ b/src/test/java/com/restfb/types/WebhookMessagingTest.java @@ -113,7 +113,6 @@ void messagingMessageMediaAttachment() { assertNotNull(item); assertEquals("mid.1458696618141:b4ef9d19ec21086067", item.getMid()); assertNull(item.getText()); - assertEquals(51L, item.getSeq().longValue()); assertFalse(item.hasQuickReply()); assertFalse(item.hasNlp()); assertTrue(item.hasAttachment()); @@ -151,7 +150,6 @@ void messagingMessageLocationAttachment() { assertNotNull(item); assertEquals("mid.1458696618141:b4ef9d19ec21086067", item.getMid()); assertNull(item.getText()); - assertEquals(51L, item.getSeq().longValue()); assertFalse(item.hasQuickReply()); assertFalse(item.hasNlp()); assertTrue(item.hasAttachment()); @@ -190,7 +188,6 @@ void messagingMessageLegacyFallbackAttachment() { assertNotNull(item); assertEquals("mid.1458696618141:b4ef9d19ec21086067", item.getMid()); assertNull(item.getText()); - assertEquals(51L, item.getSeq().longValue()); assertFalse(item.hasQuickReply()); assertFalse(item.hasNlp()); assertTrue(item.hasAttachment()); @@ -222,7 +219,6 @@ void messagingMessageBasic() { assertNotNull(item); assertEquals("mid.1457764197618:41d102a3e1ae206a38", item.getMid()); assertEquals("hello, world!", item.getText()); - assertEquals(73L, item.getSeq().longValue()); assertTrue(item.getAttachments().isEmpty()); } @@ -388,7 +384,6 @@ void messagingMessageBasicIsEcho() { assertEquals("hello, world!", item.getText()); assertEquals("1517776481860111", item.getAppId()); assertEquals("DEVELOPER_DEFINED_METADATA_STRING", item.getMetadata()); - assertEquals(73L, item.getSeq().longValue()); assertTrue(item.getAttachments().isEmpty()); } @@ -411,7 +406,6 @@ void standbyMessageBasicIsEcho() { assertEquals("hello, world!", item.getText()); assertEquals("1517776481860111", item.getAppId()); assertEquals("DEVELOPER_DEFINED_METADATA_STRING", item.getMetadata()); - assertEquals(73L, item.getSeq().longValue()); assertTrue(item.getAttachments().isEmpty()); } diff --git a/src/test/java/com/restfb/types/WebhookTest.java b/src/test/java/com/restfb/types/WebhookTest.java index c75e6ef50..f939288d6 100644 --- a/src/test/java/com/restfb/types/WebhookTest.java +++ b/src/test/java/com/restfb/types/WebhookTest.java @@ -1166,17 +1166,6 @@ public void ratingsReactionValue(RatingsReactionValue convertChangeValue) { assertTrue(listenerTriggered.get()); } - @Test - void pageConversations() { - WebhookObject webhookObject = openJson("page-conversations-25"); - Change change = webhookObject.getEntryList().get(0).getChanges().get(0); - assertEquals(FIELD_CONVERSATIONS, change.getField(), "change field"); - assertEquals(change.getValue().getClass(), PageConversation.class, "change value class"); - PageConversation value = (PageConversation) change.getValue(); - assertEquals("1234567890321", value.getPageId(), "change page id"); - assertEquals("t_id.171899099639713", value.getThreadId(), "change thread id"); - } - @Test void feedEventAdd() { WebhookObject webhookObject = openJson("feed-event-add"); diff --git a/src/test/resources/json/webhooks/page-conversations-25.json b/src/test/resources/json/webhooks/page-conversations-25.json deleted file mode 100644 index 110456eea..000000000 --- a/src/test/resources/json/webhooks/page-conversations-25.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "object": "page", - "entry": [ - { - "id": "1234567890321", - "time": 1448551514, - "changes": [ - { - "field": "conversations", - "value": { - "page_id": 1234567890321, - "thread_id": "t_id.171899099639713" - } - } - ] - } - ] -} \ No newline at end of file