| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Knowledge::V2::KnowledgeBasis; | ||||||||||||||||||||
| 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::Knowledge::V2::KnowledgeBasisList; | ||||||||||||||||||||
| 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 | 5 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 5 | my ($class, $version) = @_; | |||||||||||||||||||
| 17 | 5 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 5 | $self->{solution} = {}; | |||||||||||||||||||
| 19 | 5 | $self->{uri} = '/ControlPlane/KnowledgeBases'; | |||||||||||||||||||
| 20 | 5 | return $self; | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | sub create { | ||||||||||||||||||
|
Subroutine
create: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 1 | my ($self, $body) = @_; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 1 | my $data = Twilio::Serialize::json_body($body, {}); | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | my $response = $self->{version}->handle_request( | ||||||||||||||||||||
| 29 | 'POST', | ||||||||||||||||||||
| 30 | $self->{uri}, | ||||||||||||||||||||
| 31 | 1 | 'create', | |||||||||||||||||||
| 32 | { | ||||||||||||||||||||
| 33 | data => $data, | ||||||||||||||||||||
| 34 | headers => { 'Content-Type' => 'application/json', } | ||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||
| 37 | return Twilio::Rest::Knowledge::V2::CreateKnowledgeBase202ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 38 | 1 | $response->get_content); | |||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 0 | ▶ | sub read { | ||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 42 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 43 | 0 | return $self->read_records(@arguments); | |||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub stream { | ||||||||||||||||||
|
Subroutine
stream: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 47 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 48 | 0 | return $self->stream_records(@arguments); | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 1 | ▶ | sub page { | ||||||||||||||||||
|
Subroutine
page: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 52 | 1 | my ($self, $options, $page_size, $page_token) = @_; | |||||||||||||||||||
| 53 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | my $params = { | ||||||||||||||||||||
| 56 | orderBy => $options->{order_by}, | ||||||||||||||||||||
| 57 | 1 | pageSize => $page_size, | |||||||||||||||||||
| 58 | pageToken => $page_token, | ||||||||||||||||||||
| 59 | }; | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 62 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 63 | } | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 66 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 67 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 68 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 72 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 73 | return Twilio::Rest::Knowledge::V2::KnowledgeBasisPage->new($self->{version}, $response, | ||||||||||||||||||||
| 74 | 1 | $self->{solution}); | |||||||||||||||||||
| 75 | } | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 3 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 78 | 3 | my ($self, $kb_id) = @_; | |||||||||||||||||||
| 79 | 3 | return Twilio::Rest::Knowledge::V2::KnowledgeBasisContext->new($self->{version}, $kb_id); | |||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | package Twilio::Rest::Knowledge::V2::KnowledgeBasisPage; | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | 2 | ▶ | use parent 'Twilio::TokenPaginationPage'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | 1 | ▶ | sub records_key { return 'knowledgeBases' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 89 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 90 | 1 | return Twilio::Rest::Knowledge::V2::KnowledgeBasisInstance->new($self->{version}, $payload); | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | package Twilio::Rest::Knowledge::V2::KnowledgeBasisContext; | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 2 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | 2 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | 3 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 100 | 3 | my ($class, $version, $kb_id) = @_; | |||||||||||||||||||
| 101 | 3 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 102 | 3 | $self->{solution} = { kb_id => $kb_id }; | |||||||||||||||||||
| 103 | 3 | $self->{uri} = join q{}, '/ControlPlane/KnowledgeBases/', Twilio::Serialize::path_segment($kb_id); | |||||||||||||||||||
| 104 | 3 | return $self; | |||||||||||||||||||
| 105 | } | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | 1 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 108 | 1 | my ($self) = @_; | |||||||||||||||||||
| 109 | 1 | my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete'); | |||||||||||||||||||
| 110 | return Twilio::Rest::Knowledge::V2::DeleteKnowledgeBase202ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 111 | 1 | $response->get_content); | |||||||||||||||||||
| 112 | } | ||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | 1 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 115 | 1 | my ($self) = @_; | |||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | 1 | my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch'); | |||||||||||||||||||
| 118 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 119 | } | ||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | 1 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 122 | 1 | my ($self, $body, $options) = @_; | |||||||||||||||||||
| 123 | 1 | ▶ | $options //= {}; | ||||||||||||||||||
|
Condition50%1/2
$options //= {}
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
| |||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | 1 | my $data = Twilio::Serialize::json_body($body, {}); | |||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | my $response = $self->{version}->handle_request( | ||||||||||||||||||||
| 128 | 'PATCH', | ||||||||||||||||||||
| 129 | $self->{uri}, | ||||||||||||||||||||
| 130 | 'update', | ||||||||||||||||||||
| 131 | { | ||||||||||||||||||||
| 132 | data => $data, | ||||||||||||||||||||
| 133 | headers => { | ||||||||||||||||||||
| 134 | 'Content-Type' => 'application/json', | ||||||||||||||||||||
| 135 | 'If-Match' => $options->{if_match}, | ||||||||||||||||||||
| 136 | } | ||||||||||||||||||||
| 137 | } | ||||||||||||||||||||
| 138 | 1 | ); | |||||||||||||||||||
| 139 | return Twilio::Rest::Knowledge::V2::UpdateKnowledgeBase202ResponseInstance->new($self->{version}, | ||||||||||||||||||||
| 140 | 1 | $response->get_content); | |||||||||||||||||||
| 141 | } | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | 1 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 144 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 145 | return Twilio::Rest::Knowledge::V2::KnowledgeBasisInstance->new($self->{version}, | ||||||||||||||||||||
| 146 | 1 | $response->get_content, $self->{solution}{kb_id}); | |||||||||||||||||||
| 147 | } | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | package Twilio::Rest::Knowledge::V2::KnowledgeBasisInstance; | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 2 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | 2 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | 2 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 156 | 2 | my ($class, $version, $payload, $kb_id) = @_; | |||||||||||||||||||
| 157 | 2 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 158 | 2 | ▶ | $self->{solution} = { kb_id => $kb_id // $self->{properties}{id} }; | ||||||||||||||||||
|
Condition66%2/3
$kb_id // $self->{"properties"}{"id"}
MC/DC0%0/2
$kb_id // $self->{"properties"}{"id"}
$kb_id
$self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $kb_idB= $self->{"properties"}{"id"}
| |||||||||||||||||||||
| 159 | 2 | return $self; | |||||||||||||||||||
| 160 | } | ||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | 0 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 163 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 164 | 0 | return $self->_context->delete(@arguments); | |||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 0 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 168 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 169 | 0 | return $self->_context->fetch(@arguments); | |||||||||||||||||||
| 170 | } | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | 0 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 173 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 174 | 0 | return $self->_context->update(@arguments); | |||||||||||||||||||
| 175 | } | ||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 178 | 0 | my ($self) = @_; | |||||||||||||||||||
| 179 | return Twilio::Rest::Knowledge::V2::KnowledgeBasisContext->new($self->{version}, | ||||||||||||||||||||
| 180 | 0 | $self->{solution}{kb_id}); | |||||||||||||||||||
| 181 | } | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | 2 | ▶ | sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) } | ||||||||||||||||||
|
Subroutine
created_at: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 184 | 2 | ▶ | sub description { return $_[0]{properties}{description} } | ||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 185 | 2 | ▶ | sub display_name { return $_[0]{properties}{displayName} } | ||||||||||||||||||
|
Subroutine
display_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 186 | 2 | ▶ | sub id { return $_[0]{properties}{id} } | ||||||||||||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 187 | 2 | ▶ | sub status { return $_[0]{properties}{status} } | ||||||||||||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 188 | 2 | ▶ | sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) } | ||||||||||||||||||
|
Subroutine
updated_at: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 189 | 2 | ▶ | sub version { return $_[0]{properties}{version} } | ||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | package Twilio::Rest::Knowledge::V2::CreateKnowledgeBase202ResponseInstance; | ||||||||||||||||||||
| 192 | |||||||||||||||||||||
| 193 | 2 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | 2 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 1 | ▶ | sub message { return $_[0]{properties}{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 198 | 1 | ▶ | sub status_url { return $_[0]{properties}{statusUrl} } | ||||||||||||||||||
|
Subroutine
status_url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 199 | |||||||||||||||||||||
| 200 | package Twilio::Rest::Knowledge::V2::UpdateKnowledgeBase202ResponseInstance; | ||||||||||||||||||||
| 201 | |||||||||||||||||||||
| 202 | 2 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 203 | |||||||||||||||||||||
| 204 | 2 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 205 | |||||||||||||||||||||
| 206 | 1 | ▶ | sub message { return $_[0]{properties}{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 207 | 1 | ▶ | sub status_url { return $_[0]{properties}{statusUrl} } | ||||||||||||||||||
|
Subroutine
status_url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | package Twilio::Rest::Knowledge::V2::DeleteKnowledgeBase202ResponseInstance; | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | 2 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | 2 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | 1 | ▶ | sub message { return $_[0]{properties}{message} } | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 216 | 1 | ▶ | sub status_url { return $_[0]{properties}{statusUrl} } | ||||||||||||||||||
|
Subroutine
status_url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 217 | |||||||||||||||||||||
| 218 | 2 | 1; | |||||||||||||||||||
| 219 | |||||||||||||||||||||
| 220 | __END__ | ||||||||||||||||||||