| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage; |
|
2
|
1
|
|
|
1
|
|
683
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
45
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
327
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new_buttons { |
|
6
|
1
|
|
|
1
|
0
|
17
|
my($class, %args) = @_; |
|
7
|
1
|
|
|
|
|
10
|
LINE::Bot::API::Builder::TemplateMessage::Buttons->new(%args); |
|
8
|
|
|
|
|
|
|
} |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new_confirm { |
|
11
|
1
|
|
|
1
|
0
|
7
|
my($class, %args) = @_; |
|
12
|
1
|
|
|
|
|
6
|
LINE::Bot::API::Builder::TemplateMessage::Confirm->new(%args); |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new_carousel { |
|
16
|
1
|
|
|
1
|
0
|
8
|
my($class, %args) = @_; |
|
17
|
1
|
|
|
|
|
6
|
LINE::Bot::API::Builder::TemplateMessage::Carousel->new(%args); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new_image_carousel { |
|
21
|
1
|
|
|
1
|
0
|
6
|
my($class, %args) = @_; |
|
22
|
1
|
|
|
|
|
6
|
LINE::Bot::API::Builder::TemplateMessage::ImageCarousel->new(%args); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage::ActionBase { |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub add_action { |
|
29
|
6
|
|
|
6
|
|
11
|
my($self, $action) = @_; |
|
30
|
6
|
|
|
|
|
7
|
push @{ $self->_actions }, $action; |
|
|
6
|
|
|
|
|
10
|
|
|
31
|
6
|
|
|
|
|
29
|
$self; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub add_postback_action { |
|
35
|
3
|
|
|
3
|
|
11
|
my($self, %args) = @_; |
|
36
|
|
|
|
|
|
|
$self->add_action(+{ |
|
37
|
|
|
|
|
|
|
type => 'postback', |
|
38
|
|
|
|
|
|
|
label => $args{label}, |
|
39
|
|
|
|
|
|
|
data => $args{data}, |
|
40
|
|
|
|
|
|
|
text => $args{text}, |
|
41
|
3
|
|
|
|
|
17
|
}); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub add_message_action { |
|
45
|
3
|
|
|
3
|
|
8
|
my($self, %args) = @_; |
|
46
|
|
|
|
|
|
|
$self->add_action(+{ |
|
47
|
|
|
|
|
|
|
type => 'message', |
|
48
|
|
|
|
|
|
|
label => $args{label}, |
|
49
|
|
|
|
|
|
|
text => $args{text}, |
|
50
|
3
|
|
|
|
|
16
|
}); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub add_uri_action { |
|
54
|
3
|
|
|
3
|
|
8
|
my($self, %args) = @_; |
|
55
|
|
|
|
|
|
|
$self->add_action(+{ |
|
56
|
|
|
|
|
|
|
type => 'uri', |
|
57
|
|
|
|
|
|
|
label => $args{label}, |
|
58
|
|
|
|
|
|
|
uri => $args{uri}, |
|
59
|
3
|
|
|
|
|
8
|
}); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage::Buttons { |
|
64
|
1
|
|
|
1
|
|
7
|
use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub new { |
|
67
|
1
|
|
|
1
|
|
4
|
my($class, %args) = @_; |
|
68
|
|
|
|
|
|
|
bless { |
|
69
|
|
|
|
|
|
|
type => 'template', |
|
70
|
|
|
|
|
|
|
altText => $args{alt_text}, |
|
71
|
|
|
|
|
|
|
template => +{ |
|
72
|
|
|
|
|
|
|
type => 'buttons', |
|
73
|
|
|
|
|
|
|
thumbnailImageUrl => $args{image_url}, |
|
74
|
|
|
|
|
|
|
title => $args{title}, |
|
75
|
|
|
|
|
|
|
text => $args{text}, |
|
76
|
1
|
|
50
|
|
|
20
|
actions => $args{actions} // +[], |
|
77
|
|
|
|
|
|
|
}, |
|
78
|
|
|
|
|
|
|
}, $class; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub build { |
|
82
|
1
|
|
|
1
|
|
6
|
my($self, ) = @_; |
|
83
|
1
|
|
|
|
|
2
|
+{ %{ $self } }; |
|
|
1
|
|
|
|
|
7
|
|
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
3
|
|
|
3
|
|
7
|
sub _actions { $_[0]{template}{actions} } |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage::Confirm { |
|
90
|
1
|
|
|
1
|
|
167
|
use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub new { |
|
93
|
1
|
|
|
1
|
|
4
|
my($class, %args) = @_; |
|
94
|
|
|
|
|
|
|
bless { |
|
95
|
|
|
|
|
|
|
type => 'template', |
|
96
|
|
|
|
|
|
|
altText => $args{alt_text}, |
|
97
|
|
|
|
|
|
|
template => +{ |
|
98
|
|
|
|
|
|
|
type => 'confirm', |
|
99
|
|
|
|
|
|
|
text => $args{text}, |
|
100
|
1
|
|
50
|
|
|
10
|
actions => $args{actions} // +[], |
|
101
|
|
|
|
|
|
|
}, |
|
102
|
|
|
|
|
|
|
}, $class; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub build { |
|
106
|
1
|
|
|
1
|
|
5
|
my($self, ) = @_; |
|
107
|
1
|
|
|
|
|
2
|
+{ %{ $self } }; |
|
|
1
|
|
|
|
|
7
|
|
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
0
|
|
0
|
sub _actions { $_[0]{template}{actions} } |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage::Carousel { |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub new { |
|
116
|
1
|
|
|
1
|
|
3
|
my($class, %args) = @_; |
|
117
|
|
|
|
|
|
|
bless { |
|
118
|
|
|
|
|
|
|
type => 'template', |
|
119
|
|
|
|
|
|
|
altText => $args{alt_text}, |
|
120
|
|
|
|
|
|
|
template => +{ |
|
121
|
|
|
|
|
|
|
type => 'carousel', |
|
122
|
1
|
|
50
|
|
|
9
|
columns => $args{columns} // +[], |
|
123
|
|
|
|
|
|
|
}, |
|
124
|
|
|
|
|
|
|
}, $class; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub build { |
|
128
|
1
|
|
|
1
|
|
2
|
my($self, ) = @_; |
|
129
|
1
|
|
|
|
|
3
|
+{ %{ $self } }; |
|
|
1
|
|
|
|
|
5
|
|
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub add_column { |
|
133
|
1
|
|
|
1
|
|
2
|
my($self, $column) = @_; |
|
134
|
1
|
|
|
|
|
3
|
push @{ $self->{template}{columns} }, $column; |
|
|
1
|
|
|
|
|
5
|
|
|
135
|
1
|
|
|
|
|
1
|
$self; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage::ImageCarousel { |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub new { |
|
142
|
1
|
|
|
1
|
|
3
|
my($class, %args) = @_; |
|
143
|
|
|
|
|
|
|
bless { |
|
144
|
|
|
|
|
|
|
type => 'template', |
|
145
|
|
|
|
|
|
|
altText => $args{alt_text}, |
|
146
|
|
|
|
|
|
|
template => +{ |
|
147
|
|
|
|
|
|
|
type => 'image_carousel', |
|
148
|
1
|
|
50
|
|
|
17
|
columns => $args{columns} // +[], |
|
149
|
|
|
|
|
|
|
}, |
|
150
|
|
|
|
|
|
|
}, $class; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub build { |
|
154
|
1
|
|
|
1
|
|
5
|
my($self, ) = @_; |
|
155
|
1
|
|
|
|
|
2
|
+{ %{ $self } }; |
|
|
1
|
|
|
|
|
4
|
|
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub add_column { |
|
159
|
3
|
|
|
3
|
|
4
|
my($self, $column) = @_; |
|
160
|
3
|
|
|
|
|
4
|
push @{ $self->{template}{columns} }, $column; |
|
|
3
|
|
|
|
|
7
|
|
|
161
|
3
|
|
|
|
|
9
|
$self; |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage::Column { |
|
166
|
1
|
|
|
1
|
|
364
|
use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
5
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub new { |
|
169
|
1
|
|
|
1
|
|
11
|
my($class, %args) = @_; |
|
170
|
|
|
|
|
|
|
bless { |
|
171
|
|
|
|
|
|
|
thumbnailImageUrl => $args{image_url}, |
|
172
|
|
|
|
|
|
|
title => $args{title}, |
|
173
|
|
|
|
|
|
|
text => $args{text}, |
|
174
|
1
|
|
50
|
|
|
12
|
actions => $args{actions} // +[], |
|
175
|
|
|
|
|
|
|
}, $class; |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub build { |
|
179
|
1
|
|
|
1
|
|
16
|
my($self, ) = @_; |
|
180
|
1
|
|
|
|
|
2
|
+{ %{ $self } }; |
|
|
1
|
|
|
|
|
6
|
|
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
|
|
183
|
3
|
|
|
3
|
|
18
|
sub _actions { $_[0]{actions} } |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
package LINE::Bot::API::Builder::TemplateMessage::ImageColumn { |
|
187
|
1
|
|
|
1
|
|
221
|
use parent -norequire, 'LINE::Bot::API::Builder::TemplateMessage::ActionBase'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub new { |
|
190
|
3
|
|
|
3
|
|
20
|
my($class, %args) = @_; |
|
191
|
|
|
|
|
|
|
bless { |
|
192
|
|
|
|
|
|
|
imageUrl => $args{image_url}, |
|
193
|
3
|
|
|
|
|
22
|
action => undef, |
|
194
|
|
|
|
|
|
|
}, $class; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub build { |
|
198
|
3
|
|
|
3
|
|
11
|
my($self, ) = @_; |
|
199
|
3
|
|
|
|
|
3
|
+{ %{ $self } }; |
|
|
3
|
|
|
|
|
12
|
|
|
200
|
|
|
|
|
|
|
} |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub add_action { |
|
203
|
3
|
|
|
3
|
|
4
|
my($self, $action) = @_; |
|
204
|
3
|
|
|
|
|
6
|
$self->{action} = $action; |
|
205
|
3
|
|
|
|
|
7
|
$self; |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
1; |