Skip to content

Commit 8f0126a

Browse files
authored
Support webhook redelivery #755 (#765)
* Support webhook redelivery #755 * follow checkstyle rules
1 parent a043c96 commit 8f0126a

File tree

19 files changed

+233
-0
lines changed

19 files changed

+233
-0
lines changed

line-bot-model/src/main/java/com/linecorp/bot/model/event/AccountLinkEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,14 @@ public static class AccountLinkEventBuilder {
7474
* </dl>
7575
*/
7676
EventMode mode;
77+
78+
/**
79+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
80+
*/
81+
String webhookEventId;
82+
83+
/**
84+
* Get delivery context.
85+
*/
86+
DeliveryContext deliveryContext;
7787
}

line-bot-model/src/main/java/com/linecorp/bot/model/event/BeaconEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,14 @@ public static class BeaconEventBuilder {
7373
* </dl>
7474
*/
7575
EventMode mode;
76+
77+
/**
78+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
79+
*/
80+
String webhookEventId;
81+
82+
/**
83+
* Get delivery context.
84+
*/
85+
DeliveryContext deliveryContext;
7686
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2022 LINE Corporation
3+
*
4+
* LINE Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
package com.linecorp.bot.model.event;
18+
19+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
20+
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
21+
22+
import lombok.Builder;
23+
import lombok.Value;
24+
25+
@Value
26+
@Builder(toBuilder = true)
27+
@JsonDeserialize(builder = DeliveryContext.DeliveryContextBuilder.class)
28+
public class DeliveryContext {
29+
@JsonPOJOBuilder(withPrefix = "")
30+
public static class DeliveryContextBuilder {
31+
// Providing builder instead of public constructor. Class body is filled by lombok.
32+
}
33+
34+
/**
35+
* Whether the webhook event is a redelivered one or not. The values of other properties such as
36+
* webhookEventId and timestamp remain the same for redelivered webhook events.
37+
*/
38+
Boolean isRedelivery;
39+
}

line-bot-model/src/main/java/com/linecorp/bot/model/event/Event.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,14 @@ public interface Event {
6767
* </dl>
6868
*/
6969
EventMode getMode();
70+
71+
/**
72+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
73+
*/
74+
String getWebhookEventId();
75+
76+
/**
77+
* Get delivery context.
78+
*/
79+
DeliveryContext getDeliveryContext();
7080
}

line-bot-model/src/main/java/com/linecorp/bot/model/event/FollowEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,14 @@ public static class FollowEventBuilder {
6767
* </dl>
6868
*/
6969
EventMode mode;
70+
71+
/**
72+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
73+
*/
74+
String webhookEventId;
75+
76+
/**
77+
* Get delivery context.
78+
*/
79+
DeliveryContext deliveryContext;
7080
}

line-bot-model/src/main/java/com/linecorp/bot/model/event/JoinEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,14 @@ public static class JoinEventBuilder {
6767
* </dl>
6868
*/
6969
EventMode mode;
70+
71+
/**
72+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
73+
*/
74+
String webhookEventId;
75+
76+
/**
77+
* Get delivery context.
78+
*/
79+
DeliveryContext deliveryContext;
7080
}

line-bot-model/src/main/java/com/linecorp/bot/model/event/LeaveEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,14 @@ public static class LeaveEventBuilder {
6262
* </dl>
6363
*/
6464
EventMode mode;
65+
66+
/**
67+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
68+
*/
69+
String webhookEventId;
70+
71+
/**
72+
* Get delivery context.
73+
*/
74+
DeliveryContext deliveryContext;
6575
}

line-bot-model/src/main/java/com/linecorp/bot/model/event/MemberJoinedEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ public static class MemberJoinedEventBuilder {
7474
*/
7575
EventMode mode;
7676

77+
/**
78+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
79+
*/
80+
String webhookEventId;
81+
82+
/**
83+
* Get delivery context.
84+
*/
85+
DeliveryContext deliveryContext;
86+
7787
@Value
7888
@Builder(toBuilder = true)
7989
@JsonDeserialize(builder = JoinedMembers.JoinedMembersBuilder.class)

line-bot-model/src/main/java/com/linecorp/bot/model/event/MemberLeftEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ public static class MemberLeftEventBuilder {
6666
*/
6767
EventMode mode;
6868

69+
/**
70+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
71+
*/
72+
String webhookEventId;
73+
74+
/**
75+
* Get delivery context.
76+
*/
77+
DeliveryContext deliveryContext;
78+
6979
@Value
7080
@Builder(toBuilder = true)
7181
@JsonDeserialize(builder = LeftMembers.LeftMembersBuilder.class)

line-bot-model/src/main/java/com/linecorp/bot/model/event/MessageEvent.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,14 @@ public static class MessageEventBuilder<T extends MessageContent> {
7575
* </dl>
7676
*/
7777
EventMode mode;
78+
79+
/**
80+
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format.
81+
*/
82+
String webhookEventId;
83+
84+
/**
85+
* Get delivery context.
86+
*/
87+
DeliveryContext deliveryContext;
7888
}

0 commit comments

Comments
 (0)