Skip to content

Commit e89cce6

Browse files
authored
Merge pull request #506 from kazuki-ma/sticon
Support LINE emoji in messages
2 parents a091f68 + b28ea15 commit e89cce6

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

line-bot-model/src/main/java/com/linecorp/bot/model/message/TextMessage.java

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
package com.linecorp.bot.model.message;
1818

19+
import java.util.List;
20+
21+
import com.fasterxml.jackson.annotation.JsonInclude;
22+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
1923
import com.fasterxml.jackson.annotation.JsonTypeName;
2024
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2125
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
@@ -39,20 +43,60 @@ public class TextMessage implements Message {
3943
QuickReply quickReply;
4044
Sender sender;
4145

46+
/**
47+
* Included LINE emoji information.
48+
*/
49+
@JsonInclude(Include.NON_NULL)
50+
List<Sticon> sticon;
51+
4252
/**
4353
* Constructor without {@link #quickReply} parameter.
4454
*
4555
* <p>If you want use {@link QuickReply}, please use {@link #builder()} instead.
4656
*/
4757
public TextMessage(final String text) {
48-
this(text, null, null);
58+
this(text, null, null, null);
4959
}
5060

5161
public TextMessage(final @NonNull String text, final QuickReply quickReply) {
52-
this(text, quickReply, null);
62+
this(text, quickReply, null, null);
5363
}
5464

5565
@JsonPOJOBuilder(withPrefix = "")
5666
public static class TextMessageBuilder {
5767
}
68+
69+
@Value
70+
@Builder(toBuilder = true)
71+
@JsonDeserialize(builder = Sticon.SticonBuilder.class)
72+
public static class Sticon {
73+
/**
74+
* Index position for a character in text, with the first character being at position 0.
75+
*
76+
* <p>The specified position must correspond to a $ character,
77+
* which serves as a placeholder for the LINE emoji.
78+
* If you specify a position that doesn't contain a $ character, the API returns HTTP 400 Bad request.
79+
* See the <a href="https://developers.line.biz/en/reference/messaging-api/#text-message">text message example</a> for details.
80+
*/
81+
int index;
82+
83+
/**
84+
* Product ID for a set of LINE emoji.
85+
*
86+
* @see <a href="https://d.line-scdn.net/r/devcenter/Default_sticon_list.pdf">LINE Available Sticon List</a>
87+
*/
88+
String productId;
89+
90+
/**
91+
* ID for a LINE emoji inside a set.
92+
*
93+
* @see <a href="https://d.line-scdn.net/r/devcenter/Default_sticon_list.pdf">LINE Available Sticon List</a>
94+
*/
95+
String sticonId;
96+
97+
@JsonPOJOBuilder(withPrefix = "")
98+
public static class SticonBuilder {
99+
// Providing builder instead of public constructor. Class body is filled by lombok.
100+
}
101+
}
58102
}

0 commit comments

Comments
 (0)