« API/Response/AudienceGroupForImpressionRetargeting.pm
↑ Summary
API/Response/AudienceGroupForUploadingUserId.pm »
| 1 | package LINE::Bot::Message::Narrowcast; | ||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use LINE::Bot::API::Client; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use LINE::Bot::API::Response::NarrowcastStatus; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 3 | DEFAULT_MESSAGING_API_ENDPOINT => 'https://api.line.me/v2/bot/', | |||||||||||||||||||||||||||
| 10 | 3 | }; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 3 | my ($class, %args) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 3 | my $client = LINE::Bot::API::Client->new(%args); | |||||||||||||||||||||||||||
| 16 | bless { | ||||||||||||||||||||||||||||
| 17 | client => $client, | ||||||||||||||||||||||||||||
| 18 | channel_secret => $args{channel_secret}, | ||||||||||||||||||||||||||||
| 19 | channel_access_token => $args{channel_access_token}, | ||||||||||||||||||||||||||||
| 20 | 3 | ▶ | messaging_api_endpoint => $args{messaging_api_endpoint} // DEFAULT_MESSAGING_API_ENDPOINT, | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"messaging_api_endpoint"} // "https://api.line.me/v2/bot/"
MC/DC0%0/1
$args{"messaging_api_endpoint"} // "https://api.line.me/v2/bot/"
$args{"messaging_api_endpoint"}
Truth table50%1/2
A
A= $args{"messaging_api_endpoint"}
| |||||||||||||||||||||||||||||
| 21 | }, $class; | ||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | sub request { | ||||||||||||||||||||||||||
|
Subroutine
request: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 3 | my ($self, $method, $path, @payload) = @_; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | return $self->{client}->$method( | ||||||||||||||||||||||||||||
| 28 | 3 | $self->{messaging_api_endpoint} . $path, | |||||||||||||||||||||||||||
| 29 | @payload, | ||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 2 | ▶ | sub send_message { | ||||||||||||||||||||||||||
|
Subroutine
send_message: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 2 | my ($self, $messages, $recipient, $demographic, $limit, $options) = @_; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 2 | my @headers = (); | |||||||||||||||||||||||||||
| 37 | 2 | ▶ | if ($options && defined($options->{'retry_key'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$options and defined $options->{"retry_key"}
MC/DC50%1/2
$options and defined $options->{"retry_key"}
$options
defined $options->{"retry_key"}
Truth table66%2/3
A and B
A= $optionsB= defined $options->{"retry_key"}
| |||||||||||||||||||||||||||||
| 38 | 1 | push @headers, 'X-Line-Retry-Key' => $options->{'retry_key'}; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 2 | my $res = $self->request( | |||||||||||||||||||||||||||
| 42 | post => 'message/narrowcast', | ||||||||||||||||||||||||||||
| 43 | \@headers, | ||||||||||||||||||||||||||||
| 44 | +{ | ||||||||||||||||||||||||||||
| 45 | messages => $messages, | ||||||||||||||||||||||||||||
| 46 | recipient => $recipient, | ||||||||||||||||||||||||||||
| 47 | filter => { | ||||||||||||||||||||||||||||
| 48 | demographic => $demographic, | ||||||||||||||||||||||||||||
| 49 | }, | ||||||||||||||||||||||||||||
| 50 | limit => $limit, | ||||||||||||||||||||||||||||
| 51 | }, | ||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 2 | LINE::Bot::API::Response::Common->new(%{ $res }); | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | ▶ | sub get_narrowcast_message_status { | ||||||||||||||||||||||||||
|
Subroutine
get_narrowcast_message_status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | 1 | my ($self, $request_id) = @_; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 1 | my $res = $self->request( | |||||||||||||||||||||||||||
| 61 | get => "message/progress/narrowcast?requestId=${request_id}" | ||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1 | LINE::Bot::API::Response::NarrowcastStatus->new(%{ $res }); | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 3 | 1; | |||||||||||||||||||||||||||
| 68 | __END__ | ||||||||||||||||||||||||||||