| 1 | package LINE::Bot::API::Types; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use Type::Library -base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Type::Utils -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Types::Standard qw<Str Num Dict Enum Optional ArrayRef HashRef>; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use Types::Common::Numeric qw< PositiveOrZeroInt PositiveOrZeroNum >; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use Types::Common::String qw< StrLength NonEmptyStr >; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | # https://developers.line.biz/en/reference/messaging-api/#source-user | ||
| 12 | 1 | my $SourceUser = declare SourceUser => as Dict[ | |
| 13 | type => Enum["user"], | ||
| 14 | userId => NonEmptyStr, | ||
| 15 | ]; | ||
| 16 | |||
| 17 | # https://developers.line.biz/en/reference/messaging-api/#source-group | ||
| 18 | 1 | my $SourceGroup = declare SourceGroup => as Dict[ | |
| 19 | type => Enum["group"], | ||
| 20 | groupId => NonEmptyStr, | ||
| 21 | userId => Optional[Str], | ||
| 22 | ]; | ||
| 23 | |||
| 24 | # https://developers.line.biz/en/reference/messaging-api/#source-room | ||
| 25 | 1 | my $SourceRoom = declare SourceRoom => as Dict[ | |
| 26 | type => Enum["room"], | ||
| 27 | groupId => NonEmptyStr, | ||
| 28 | userId => Optional[NonEmptyStr], | ||
| 29 | ]; | ||
| 30 | |||
| 31 | 1 | my $ContentProvider = Dict [ | |
| 32 | type => Enum["line", "external"], | ||
| 33 | previewImageUrl => Optional[NonEmptyStr], | ||
| 34 | originalContentUrl => Optional[NonEmptyStr], | ||
| 35 | ]; | ||
| 36 | |||
| 37 | # https://developers.line.biz/en/reference/messaging-api/#text-message | ||
| 38 | 1 | my $TextMessage = declare TextMessage => as Dict[ id => Str, type => Enum["text"], text => StrLength[1,5000] ]; | |
| 39 | |||
| 40 | # https://developers.line.biz/en/reference/messaging-api/#wh-image | ||
| 41 | 1 | my $ImageMessage = declare ImageMessage => as Dict[ | |
| 42 | id => NonEmptyStr, | ||
| 43 | type => Enum["image"], | ||
| 44 | contentProvider => $ContentProvider, | ||
| 45 | ]; | ||
| 46 | |||
| 47 | # https://developers.line.biz/en/reference/messaging-api/#wh-video | ||
| 48 | 1 | my $VideoMessage = declare VideoMessage => as Dict[ | |
| 49 | id => NonEmptyStr, | ||
| 50 | type => Enum["video"], | ||
| 51 | duration => PositiveOrZeroInt, | ||
| 52 | contentProvider => $ContentProvider, | ||
| 53 | ]; | ||
| 54 | |||
| 55 | # https://developers.line.biz/en/reference/messaging-api/#wh-audio | ||
| 56 | 1 | my $AudioMessage = declare AudioMessage => as Dict[ | |
| 57 | id => NonEmptyStr, | ||
| 58 | type => Enum["audio"], | ||
| 59 | duration => PositiveOrZeroInt, | ||
| 60 | contentProvider => $ContentProvider, | ||
| 61 | ]; | ||
| 62 | |||
| 63 | # https://developers.line.biz/en/reference/messaging-api/#wh-file | ||
| 64 | 1 | my $FileMessage = declare FileMessage => as Dict[ | |
| 65 | id => NonEmptyStr, | ||
| 66 | type => Enum["file"], | ||
| 67 | fileName => NonEmptyStr, | ||
| 68 | fileSize => PositiveOrZeroInt, | ||
| 69 | ]; | ||
| 70 | |||
| 71 | # https://developers.line.biz/en/reference/messaging-api/#wh-location | ||
| 72 | 1 | my $LocationMessage = declare LocationMessage => as Dict[ | |
| 73 | id => NonEmptyStr, | ||
| 74 | type => Enum["location"], | ||
| 75 | title => NonEmptyStr, | ||
| 76 | address => NonEmptyStr, | ||
| 77 | latitude => Num, | ||
| 78 | longtitude => Num, | ||
| 79 | ]; | ||
| 80 | |||
| 81 | # https://developers.line.biz/en/reference/messaging-api/#wh-sticker | ||
| 82 | 1 | my $StickerMessage = declare StickerMessage => as Dict[ | |
| 83 | id => NonEmptyStr, | ||
| 84 | type => Enum["sticker"], | ||
| 85 | packageId => NonEmptyStr, | ||
| 86 | stickerId => NonEmptyStr, | ||
| 87 | ]; | ||
| 88 | |||
| 89 | # https://developers.line.biz/en/reference/messaging-api/#message-event | ||
| 90 | 1 | declare MessageEvent => as Dict[ | |
| 91 | type => Enum["message"], | ||
| 92 | replyToken => NonEmptyStr, | ||
| 93 | timestamp => PositiveOrZeroNum, | ||
| 94 | source => $SourceGroup | $SourceUser | $SourceRoom, | ||
| 95 | message => $TextMessage | $ImageMessage | $AudioMessage | $VideoMessage | $FileMessage | $LocationMessage | $StickerMessage, | ||
| 96 | ]; | ||
| 97 | |||
| 98 | # https://developers.line.biz/en/reference/messaging-api/#error-responses | ||
| 99 | 1 | declare ErrorResponse => as Dict[ | |
| 100 | message => NonEmptyStr, | ||
| 101 | details => ArrayRef[ | ||
| 102 | Dict[ | ||
| 103 | message => NonEmptyStr, | ||
| 104 | property => NonEmptyStr, | ||
| 105 | ] | ||
| 106 | ] | ||
| 107 | ]; | ||
| 108 | |||
| 109 | 1 | my @__common__ = ( | |
| 110 | timestamp => PositiveOrZeroNum, | ||
| 111 | source => $SourceGroup | $SourceUser | $SourceRoom, | ||
| 112 | ); | ||
| 113 | |||
| 114 | # https://developers.line.biz/en/reference/messaging-api/#follow-event | ||
| 115 | 1 | declare FollowEvent => as Dict[ | |
| 116 | type => Enum["follow"], | ||
| 117 | replyToken => NonEmptyStr, | ||
| 118 | @__common__ | ||
| 119 | ]; | ||
| 120 | |||
| 121 | # https://developers.line.biz/en/reference/messaging-api/#unfollow-event | ||
| 122 | 1 | declare UnfollowEvent => as Dict[ | |
| 123 | type => Enum["unfollow"], | ||
| 124 | @__common__ | ||
| 125 | ]; | ||
| 126 | |||
| 127 | # https://developers.line.biz/en/reference/messaging-api/#join-event | ||
| 128 | 1 | declare JoinEvent => as Dict[ | |
| 129 | type => Enum["join"], | ||
| 130 | replyToken => NonEmptyStr, | ||
| 131 | @__common__, | ||
| 132 | ]; | ||
| 133 | |||
| 134 | # https://developers.line.biz/en/reference/messaging-api/#leave-event | ||
| 135 | 1 | declare LeaveEvent => as Dict[ | |
| 136 | type => Enum["leave"], | ||
| 137 | @__common__, | ||
| 138 | ]; | ||
| 139 | |||
| 140 | # https://developers.line.biz/en/reference/messaging-api/#member-joined-event | ||
| 141 | 1 | declare MemberJoinedEvent => as Dict[ | |
| 142 | type => Enum["memberJoined"], | ||
| 143 | replyToken => NonEmptyStr, | ||
| 144 | joined => Dict[ | ||
| 145 | members => ArrayRef[ $SourceUser ] | ||
| 146 | ], | ||
| 147 | @__common__, | ||
| 148 | ]; | ||
| 149 | |||
| 150 | # https://developers.line.biz/en/reference/messaging-api/#member-left-event | ||
| 151 | 1 | declare MemberLeftEvent => as Dict[ | |
| 152 | type => Enum["memberLeft"], | ||
| 153 | left => Dict[ | ||
| 154 | members => ArrayRef[ $SourceUser ] | ||
| 155 | ], | ||
| 156 | @__common__, | ||
| 157 | ]; | ||
| 158 | |||
| 159 | # https://developers.line.biz/en/reference/messaging-api/#postback-event | ||
| 160 | 1 | declare PostbackEvent => as Dict[ | |
| 161 | type => Enum["postback"], | ||
| 162 | replyToken => NonEmptyStr, | ||
| 163 | postback => Dict[ | ||
| 164 | data => Str, | ||
| 165 | params => HashRef | ||
| 166 | ], | ||
| 167 | @__common__, | ||
| 168 | ]; | ||
| 169 | |||
| 170 | # https://developers.line.biz/en/reference/messaging-api/#beacon-event | ||
| 171 | 1 | declare BeaconEvent => as Dict[ | |
| 172 | type => Enum["beacon"], | ||
| 173 | replyToken => NonEmptyStr, | ||
| 174 | beacon => Dict[ | ||
| 175 | hwid => NonEmptyStr, | ||
| 176 | type => Enum["enter", "leave", "banner", "stay"], | ||
| 177 | dm => Optional[Str], | ||
| 178 | ], | ||
| 179 | @__common__, | ||
| 180 | ]; | ||
| 181 | |||
| 182 | # https://developers.line.biz/en/reference/messaging-api/#account-link-event | ||
| 183 | 1 | declare AccountLinkEvent => as Dict[ | |
| 184 | type => Enum["accountLink"], | ||
| 185 | replyToken => NonEmptyStr, | ||
| 186 | link => Dict[ | ||
| 187 | result => Enum["ok", "failed"], | ||
| 188 | nonce => Str | ||
| 189 | ], | ||
| 190 | @__common__, | ||
| 191 | ]; | ||
| 192 | |||
| 193 | # https://developers.line.biz/en/reference/messaging-api/#device-link-event | ||
| 194 | 1 | declare DeviceLinkEvent => as Dict[ | |
| 195 | type => Enum["things"], | ||
| 196 | replyToken => NonEmptyStr, | ||
| 197 | things => Dict[ | ||
| 198 | type => Enum["link"], | ||
| 199 | deviceId => NonEmptyStr, | ||
| 200 | ], | ||
| 201 | @__common__, | ||
| 202 | ]; | ||
| 203 | |||
| 204 | # https://developers.line.biz/en/reference/messaging-api/#device-unlink-event | ||
| 205 | 1 | declare DeviceUnlinkEvent => as Dict[ | |
| 206 | type => Enum["things"], | ||
| 207 | replyToken => NonEmptyStr, | ||
| 208 | things => Dict[ | ||
| 209 | type => Enum["unlink"], | ||
| 210 | deviceId => NonEmptyStr, | ||
| 211 | ], | ||
| 212 | @__common__, | ||
| 213 | ]; | ||
| 214 | |||
| 215 | # https://developers.line.biz/en/reference/messaging-api/#unsend-event | ||
| 216 | 1 | declare UnsendEvent => as Dict[ | |
| 217 | type => Enum["unsend"], | ||
| 218 | unsend => Dict [ | ||
| 219 | messageId => Str, | ||
| 220 | ], | ||
| 221 | @__common__, | ||
| 222 | ]; | ||
| 223 | |||
| 224 | # https://developers.line.biz/en/reference/messaging-api/#video-viewing-complete | ||
| 225 | 1 | declare VideoViewingCompleteEvent => as Dict[ | |
| 226 | type => Enum["videoPlayComplete"], | ||
| 227 | replyToken => Str, | ||
| 228 | videoPlayComplete => Dict [ | ||
| 229 | trackingId => Str, | ||
| 230 | ], | ||
| 231 | @__common__, | ||
| 232 | ]; | ||
| 233 | |||
| 234 | 1 | 1; | |