Twilio/Rest/Conversations/V1/Service/User/UserConversation.pm

filter: Statementstmt 85.0% 85 / 100 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 84.7% 39 / 46 Podpod n/a totaltotal 81.5% 128 / 157 CC 4 SCAR 2.4
CC
4
Cov
83%
page
2.0
update
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Api/V2010/Account/Conference/Recording.pm ↑ Summary Twilio/Rest/Conversations/V1/User/UserConversation.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::Service::User::UserConversation;
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::Conversations::V1::Service::User::UserConversationList;
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, $chat_service_sid, $user_sid) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = { chat_service_sid => $chat_service_sid, user_sid => $user_sid };
19 4 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
20 '/Users/', Twilio::Serialize::path_segment($user_sid), '/Conversations';
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 //= {}
l!l
01
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
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::Conversations::V1::Service::User::UserConversationPage->new($self->{version},
57 1 $response, $self->{solution});
58 }
59  
60 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
61 3 my ($self, $conversation_sid) = @_;
62 return Twilio::Rest::Conversations::V1::Service::User::UserConversationContext->new(
63 $self->{version},
64 $self->{solution}{chat_service_sid},
65 $self->{solution}{user_sid},
66 3 $conversation_sid
67 );
68 }
69  
70 package Twilio::Rest::Conversations::V1::Service::User::UserConversationPage;
71  
72 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
73  
74 1 ▶sub records_key { return 'conversations' }
Subroutine records_key: called CC=1 SCAR=0.0
75  
76 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
77 1 my ($self, $payload) = @_;
78 return Twilio::Rest::Conversations::V1::Service::User::UserConversationInstance->new(
79 $self->{version}, $payload,
80 $self->{solution}{chat_service_sid},
81 $self->{solution}{user_sid}
82 1 );
83 }
84  
85 package Twilio::Rest::Conversations::V1::Service::User::UserConversationContext;
86  
87 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
88  
89 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
92 3 my ($class, $version, $chat_service_sid, $user_sid, $conversation_sid) = @_;
93 3 my $self = $class->SUPER::new($version);
94 $self->{solution} = {
95 3 chat_service_sid => $chat_service_sid,
96 user_sid => $user_sid,
97 conversation_sid => $conversation_sid
98 };
99 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($chat_service_sid),
100 '/Users/', Twilio::Serialize::path_segment($user_sid), '/Conversations/',
101 Twilio::Serialize::path_segment($conversation_sid);
102 3 return $self;
103 }
104  
105 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
106 1 my ($self) = @_;
107 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
108 1 return 1;
109 }
110  
111 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
112 1 my ($self) = @_;
113  
114 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
115 1 return $self->_build_instance($response);
116 }
117  
118 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
119 1 my ($self, $options) = @_;
120 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
121  
122 my $data = {
123 LastReadMessageIndex => $options->{last_read_message_index},
124 LastReadTimestamp => Twilio::Serialize::iso8601_date_time($options->{last_read_timestamp}),
125 NotificationLevel => $options->{notification_level},
126 1 };
127  
128 my $response =
129 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
130 1 return $self->_build_instance($response);
131 }
132  
133 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
134 2 my ($self, $response) = @_;
135 return Twilio::Rest::Conversations::V1::Service::User::UserConversationInstance->new(
136 $self->{version}, $response->get_content,
137 $self->{solution}{chat_service_sid}, $self->{solution}{user_sid},
138 $self->{solution}{conversation_sid}
139 2 );
140 }
141  
142 package Twilio::Rest::Conversations::V1::Service::User::UserConversationInstance;
143  
144 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
145  
146 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
147  
148 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
149 3 my ($class, $version, $payload, $chat_service_sid, $user_sid, $conversation_sid) = @_;
150 3 my $self = $class->SUPER::new($version, $payload);
151 $self->{solution} = {
152 chat_service_sid => $chat_service_sid,
153 user_sid => $user_sid,
154 conversation_sid => $conversation_sid // $self->{properties}{conversation_sid}
155 3 ▶ };
Condition66%2/3
$conversation_sid // $self->{"properties"}{"conversation_sid"}
l!l&&r!l&&!r
210
MC/DC0%0/2
$conversation_sid // $self->{"properties"}{"conversation_sid"}
$conversation_sid $self->{"properties"}{"conversation_sid"}
Truth table66%2/3
A // B
A= $conversation_sidB= $self->{"properties"}{"conversation_sid"}
ABresult
1X1
011
000
156 3 return $self;
157 }
158  
159 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
160 0 my ($self, @arguments) = @_;
161 0 return $self->_context->delete(@arguments);
162 }
163  
164 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
165 0 my ($self, @arguments) = @_;
166 0 return $self->_context->fetch(@arguments);
167 }
168  
169 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
170 0 my ($self, @arguments) = @_;
171 0 return $self->_context->update(@arguments);
172 }
173  
174 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
175 0 my ($self) = @_;
176 return Twilio::Rest::Conversations::V1::Service::User::UserConversationContext->new(
177 $self->{version}, $self->{solution}{chat_service_sid},
178 $self->{solution}{user_sid}, $self->{solution}{conversation_sid}
179 0 );
180 }
181  
182 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
183 3 ▶sub attributes { return $_[0]{properties}{attributes} }
Subroutine attributes: called CC=1 SCAR=0.0
184 3 ▶sub chat_service_sid { return $_[0]{properties}{chat_service_sid} }
Subroutine chat_service_sid: called CC=1 SCAR=0.0
185 3 ▶sub conversation_sid { return $_[0]{properties}{conversation_sid} }
Subroutine conversation_sid: called CC=1 SCAR=0.0
186 3 ▶sub conversation_state { return $_[0]{properties}{conversation_state} }
Subroutine conversation_state: called CC=1 SCAR=0.0
187 3 ▶sub created_by { return $_[0]{properties}{created_by} }
Subroutine created_by: called CC=1 SCAR=0.0
188 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
189 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
190 3 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
191 3 ▶sub last_read_message_index { return $_[0]{properties}{last_read_message_index} }
Subroutine last_read_message_index: called CC=1 SCAR=0.0
192 3 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
193 3 ▶sub notification_level { return $_[0]{properties}{notification_level} }
Subroutine notification_level: called CC=1 SCAR=0.0
194 3 ▶sub participant_sid { return $_[0]{properties}{participant_sid} }
Subroutine participant_sid: called CC=1 SCAR=0.0
195 3 ▶sub timers { return $_[0]{properties}{timers} }
Subroutine timers: called CC=1 SCAR=0.0
196 3 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
197 3 ▶sub unread_messages_count { return $_[0]{properties}{unread_messages_count} }
Subroutine unread_messages_count: called CC=1 SCAR=0.0
198 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
199 3 ▶sub user_sid { return $_[0]{properties}{user_sid} }
Subroutine user_sid: called CC=1 SCAR=0.0
200  
201 2 1;
202  
203 __END__
« Twilio/Rest/Api/V2010/Account/Conference/Recording.pm ↑ Summary Twilio/Rest/Conversations/V1/User/UserConversation.pm »