Skip to content

Commit 8a2e856

Browse files
author
Hyunje Jun
committed
Add 'datetimepicker' template action type
Resolves #19.
1 parent 18d52c4 commit 8a2e856

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

types/global.d.ts

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ declare namespace Line {
4141
export type UnfollowEvent = { type: "unfollow" } & EventBase;
4242
export type JoinEvent = { type: "join" } & ReplyableEvent;
4343
export type LeaveEvent = { type: "leave" } & EventBase;
44-
export type PostbackEvent = { type: "postback", postback: { data: string } } & ReplyableEvent;
44+
export type PostbackEvent = {
45+
type: "postback",
46+
postback: {
47+
data: string,
48+
params?: string,
49+
},
50+
} & ReplyableEvent;
4551
export type BeaconEvent = ReplyableEvent & {
4652
type: "beacon",
4753
beacon: {
@@ -135,20 +141,20 @@ declare namespace Line {
135141
thumbnailImageUrl?: string,
136142
title?: string,
137143
text: string,
138-
actions: TemplateAction[],
144+
actions: TemplateAction<{ label: string }>[],
139145
};
140146
export type TemplateConfirm = {
141147
type: "confirm",
142148
text: string,
143-
actions: TemplateAction[],
149+
actions: TemplateAction<{ label: string }>[],
144150
};
145151
export type TemplateCarousel = { type: "carousel", columns: TemplateColumn[] };
146152

147153
export type TemplateColumn = {
148154
thumbnailImageUrl?: string,
149155
title?: string,
150156
text: string,
151-
actions: TemplateAction[],
157+
actions: TemplateAction<{ label: string }>[],
152158
};
153159

154160
export type TemplateImageCarousel = {
@@ -158,22 +164,33 @@ declare namespace Line {
158164

159165
export type TemplateImageColumn = {
160166
imageUrl: string,
161-
action: TemplateAction,
167+
action: TemplateAction<{ label?: string }>,
162168
};
163169

164-
export type TemplateAction = TemplatePostbackAction | TemplateMessageAction | TemplateURIAction;
165-
export type TemplateActionBase = { label: string };
170+
export type TemplateAction<Label> =
171+
| TemplatePostbackAction & Label
172+
| TemplateMessageAction & Label
173+
| TemplateURIAction & Label
174+
| TemplateDatetimePickerAction & Label;
166175
export type TemplatePostbackAction = {
167176
type: "postback",
168177
data: string,
169178
text?: string,
170-
} & TemplateActionBase;
179+
};
171180
export type TemplateMessageAction = {
172181
type: "message",
173182
text: string,
174-
} & TemplateActionBase;
183+
};
175184
export type TemplateURIAction = {
176185
type: "template",
177186
uri: string,
178-
} & TemplateActionBase;
187+
};
188+
export type TemplateDatetimePickerAction = {
189+
type: "datetimepicker",
190+
data: string,
191+
mode: "date" | "time" | "datetime",
192+
initial?: string,
193+
max?: string,
194+
min?: string,
195+
};
179196
}

0 commit comments

Comments
 (0)