| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Chat::V2::Service::User::UserChannel; | ||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 2 | ▶ | use 5.016; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 2 | our $VERSION = '2.001'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | package Twilio::Rest::Chat::V2::Service::User::UserChannelList; | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 2 | ▶ | use parent 'Twilio::ListResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 2 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 4 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 4 | my ($class, $version, $service_sid, $user_sid) = @_; | |||||||||||||||||||
| 17 | 4 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 4 | $self->{solution} = { service_sid => $service_sid, user_sid => $user_sid }; | |||||||||||||||||||
| 19 | 4 | $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Users/', | |||||||||||||||||||
| 20 | Twilio::Serialize::path_segment($user_sid), '/Channels'; | ||||||||||||||||||||
| 21 | 4 | return $self; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 0 | ▶ | sub read { | ||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 25 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 26 | 0 | return $self->read_records(@arguments); | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 0 | ▶ | sub stream { | ||||||||||||||||||
|
Subroutine
stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 30 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 31 | 0 | return $self->stream_records(@arguments); | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 1 | ▶ | sub page { | ||||||||||||||||||
|
Subroutine
page: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 35 | 1 | my ($self, $options, $page_size, $page_token, $page_number) = @_; | |||||||||||||||||||
| 36 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 1 | my $params = { | |||||||||||||||||||
| 39 | PageToken => $page_token, | ||||||||||||||||||||
| 40 | Page => $page_number, | ||||||||||||||||||||
| 41 | PageSize => $page_size, | ||||||||||||||||||||
| 42 | }; | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 45 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 49 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 50 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 51 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 55 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 56 | return Twilio::Rest::Chat::V2::Service::User::UserChannelPage->new($self->{version}, $response, | ||||||||||||||||||||
| 57 | 1 | $self->{solution}); | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 3 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 61 | 3 | my ($self, $channel_sid) = @_; | |||||||||||||||||||
| 62 | return Twilio::Rest::Chat::V2::Service::User::UserChannelContext->new( | ||||||||||||||||||||
| 63 | $self->{version}, | ||||||||||||||||||||
| 64 | $self->{solution}{service_sid}, | ||||||||||||||||||||
| 65 | 3 | $self->{solution}{user_sid}, $channel_sid | |||||||||||||||||||
| 66 | ); | ||||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | package Twilio::Rest::Chat::V2::Service::User::UserChannelPage; | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 2 | ▶ | use parent 'Twilio::Page'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 1 | ▶ | sub records_key { return 'channels' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 76 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 77 | return Twilio::Rest::Chat::V2::Service::User::UserChannelInstance->new( | ||||||||||||||||||||
| 78 | $self->{version}, $payload, | ||||||||||||||||||||
| 79 | $self->{solution}{service_sid}, | ||||||||||||||||||||
| 80 | $self->{solution}{user_sid} | ||||||||||||||||||||
| 81 | 1 | ); | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | package Twilio::Rest::Chat::V2::Service::User::UserChannelContext; | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 2 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 2 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 91 | 3 | my ($class, $version, $service_sid, $user_sid, $channel_sid) = @_; | |||||||||||||||||||
| 92 | 3 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 93 | $self->{solution} = | ||||||||||||||||||||
| 94 | 3 | { service_sid => $service_sid, user_sid => $user_sid, channel_sid => $channel_sid }; | |||||||||||||||||||
| 95 | 3 | $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Users/', | |||||||||||||||||||
| 96 | Twilio::Serialize::path_segment($user_sid), '/Channels/', | ||||||||||||||||||||
| 97 | Twilio::Serialize::path_segment($channel_sid); | ||||||||||||||||||||
| 98 | 3 | return $self; | |||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | 1 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 102 | 1 | my ($self, $options) = @_; | |||||||||||||||||||
| 103 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 104 | $self->{version}->handle_request('DELETE', $self->{uri}, 'delete', | ||||||||||||||||||||
| 105 | 1 | { headers => { 'X-Twilio-Webhook-Enabled' => $options->{x_twilio_webhook_enabled}, } }); | |||||||||||||||||||
| 106 | 1 | return 1; | |||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | 1 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 110 | 1 | my ($self) = @_; | |||||||||||||||||||
| 111 | |||||||||||||||||||||
| 112 | 1 | my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch'); | |||||||||||||||||||
| 113 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 114 | } | ||||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | 1 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 117 | 1 | my ($self, $options) = @_; | |||||||||||||||||||
| 118 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | my $data = { | ||||||||||||||||||||
| 121 | LastConsumedMessageIndex => $options->{last_consumed_message_index}, | ||||||||||||||||||||
| 122 | LastConsumptionTimestamp => | ||||||||||||||||||||
| 123 | Twilio::Serialize::iso8601_date_time($options->{last_consumption_timestamp}), | ||||||||||||||||||||
| 124 | NotificationLevel => $options->{notification_level}, | ||||||||||||||||||||
| 125 | 1 | }; | |||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | my $response = | ||||||||||||||||||||
| 128 | 1 | $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data }); | |||||||||||||||||||
| 129 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 130 | } | ||||||||||||||||||||
| 131 | |||||||||||||||||||||
| 132 | 2 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 133 | 2 | my ($self, $response) = @_; | |||||||||||||||||||
| 134 | return Twilio::Rest::Chat::V2::Service::User::UserChannelInstance->new( | ||||||||||||||||||||
| 135 | $self->{version}, $response->get_content, $self->{solution}{service_sid}, | ||||||||||||||||||||
| 136 | $self->{solution}{user_sid}, $self->{solution}{channel_sid} | ||||||||||||||||||||
| 137 | 2 | ); | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | package Twilio::Rest::Chat::V2::Service::User::UserChannelInstance; | ||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | 2 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 143 | |||||||||||||||||||||
| 144 | 2 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 145 | |||||||||||||||||||||
| 146 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 147 | 3 | my ($class, $version, $payload, $service_sid, $user_sid, $channel_sid) = @_; | |||||||||||||||||||
| 148 | 3 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 149 | $self->{solution} = { | ||||||||||||||||||||
| 150 | service_sid => $service_sid, | ||||||||||||||||||||
| 151 | user_sid => $user_sid, | ||||||||||||||||||||
| 152 | channel_sid => $channel_sid // $self->{properties}{channel_sid} | ||||||||||||||||||||
| 153 | 3 | ▶ | }; | ||||||||||||||||||
|
Condition66%2/3
$channel_sid // $self->{"properties"}{"channel_sid"}
MC/DC0%0/2
$channel_sid // $self->{"properties"}{"channel_sid"}
$channel_sid
$self->{"properties"}{"channel_sid"}
Truth table66%2/3
A // B
A= $channel_sidB= $self->{"properties"}{"channel_sid"}
| |||||||||||||||||||||
| 154 | 3 | return $self; | |||||||||||||||||||
| 155 | } | ||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | 0 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 158 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 159 | 0 | return $self->_context->delete(@arguments); | |||||||||||||||||||
| 160 | } | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | 0 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 163 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 164 | 0 | return $self->_context->fetch(@arguments); | |||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 0 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 168 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 169 | 0 | return $self->_context->update(@arguments); | |||||||||||||||||||
| 170 | } | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 173 | 0 | my ($self) = @_; | |||||||||||||||||||
| 174 | return Twilio::Rest::Chat::V2::Service::User::UserChannelContext->new( | ||||||||||||||||||||
| 175 | $self->{version}, $self->{solution}{service_sid}, | ||||||||||||||||||||
| 176 | $self->{solution}{user_sid}, $self->{solution}{channel_sid} | ||||||||||||||||||||
| 177 | 0 | ); | |||||||||||||||||||
| 178 | } | ||||||||||||||||||||
| 179 | |||||||||||||||||||||
| 180 | 3 | ▶ | sub account_sid { return $_[0]{properties}{account_sid} } | ||||||||||||||||||
|
Subroutine
account_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 181 | 3 | ▶ | sub channel_sid { return $_[0]{properties}{channel_sid} } | ||||||||||||||||||
|
Subroutine
channel_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 182 | 3 | ▶ | sub last_consumed_message_index { return $_[0]{properties}{last_consumed_message_index} } | ||||||||||||||||||
|
Subroutine
last_consumed_message_index: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 183 | 3 | ▶ | sub links { return $_[0]{properties}{links} } | ||||||||||||||||||
|
Subroutine
links: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 184 | 3 | ▶ | sub member_sid { return $_[0]{properties}{member_sid} } | ||||||||||||||||||
|
Subroutine
member_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 185 | 3 | ▶ | sub notification_level { return $_[0]{properties}{notification_level} } | ||||||||||||||||||
|
Subroutine
notification_level: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 186 | 3 | ▶ | sub service_sid { return $_[0]{properties}{service_sid} } | ||||||||||||||||||
|
Subroutine
service_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 187 | 3 | ▶ | sub status { return $_[0]{properties}{status} } | ||||||||||||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 188 | 3 | ▶ | sub unread_messages_count { return $_[0]{properties}{unread_messages_count} } | ||||||||||||||||||
|
Subroutine
unread_messages_count: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 189 | 3 | ▶ | sub url { return $_[0]{properties}{url} } | ||||||||||||||||||
|
Subroutine
url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 190 | 3 | ▶ | sub user_sid { return $_[0]{properties}{user_sid} } | ||||||||||||||||||
|
Subroutine
user_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | 2 | 1; | |||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | __END__ | ||||||||||||||||||||