| 1 | # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file. | ||||||||||||||||||||
| 2 | package Twilio::Rest::Knowledge::V1::Knowledge; | ||||||||||||||||||||
| 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::V1::KnowledgeList; | ||||||||||||||||||||
| 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 | 7 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 7 | my ($class, $version) = @_; | |||||||||||||||||||
| 17 | 7 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 18 | 7 | $self->{solution} = {}; | |||||||||||||||||||
| 19 | 7 | $self->{uri} = '/Knowledge'; | |||||||||||||||||||
| 20 | 7 | 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::V1::KnowledgeInstance->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, $page_number) = @_; | |||||||||||||||||||
| 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 | Tags => $options->{tags}, | ||||||||||||||||||||
| 57 | 1 | PageToken => $page_token, | |||||||||||||||||||
| 58 | Page => $page_number, | ||||||||||||||||||||
| 59 | PageSize => $page_size, | ||||||||||||||||||||
| 60 | }; | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 1 | my $response = $self->{version}->page('GET', $self->{uri}, { params => $params }); | |||||||||||||||||||
| 63 | 1 | return $self->_build_page($response); | |||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 0 | ▶ | sub get_page { | ||||||||||||||||||
|
Subroutine
get_page: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 67 | 0 | my ($self, $target_url) = @_; | |||||||||||||||||||
| 68 | 0 | my $client = $self->{version}->get_domain->get_client; | |||||||||||||||||||
| 69 | 0 | return $self->_build_page($client->request('GET', $target_url)); | |||||||||||||||||||
| 70 | } | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 1 | ▶ | sub _build_page { | ||||||||||||||||||
|
Subroutine
_build_page: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 73 | 1 | my ($self, $response) = @_; | |||||||||||||||||||
| 74 | return Twilio::Rest::Knowledge::V1::KnowledgePage->new($self->{version}, $response, | ||||||||||||||||||||
| 75 | 1 | $self->{solution}); | |||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 5 | ▶ | sub get_context { | ||||||||||||||||||
|
Subroutine
get_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 79 | 5 | my ($self, $id) = @_; | |||||||||||||||||||
| 80 | 5 | return Twilio::Rest::Knowledge::V1::KnowledgeContext->new($self->{version}, $id); | |||||||||||||||||||
| 81 | } | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | package Twilio::Rest::Knowledge::V1::KnowledgePage; | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 2 | ▶ | use parent 'Twilio::Page'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 1 | ▶ | sub records_key { return 'knowledge' } | ||||||||||||||||||
|
Subroutine
records_key: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | 1 | ▶ | sub build_instance { | ||||||||||||||||||
|
Subroutine
build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 90 | 1 | my ($self, $payload) = @_; | |||||||||||||||||||
| 91 | 1 | return Twilio::Rest::Knowledge::V1::KnowledgeInstance->new($self->{version}, $payload); | |||||||||||||||||||
| 92 | } | ||||||||||||||||||||
| 93 | |||||||||||||||||||||
| 94 | package Twilio::Rest::Knowledge::V1::KnowledgeContext; | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 2 | ▶ | use parent 'Twilio::InstanceContext'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 2 | ▶ | use Twilio::Serialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | 5 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 101 | 5 | my ($class, $version, $id) = @_; | |||||||||||||||||||
| 102 | 5 | my $self = $class->SUPER::new($version); | |||||||||||||||||||
| 103 | 5 | $self->{solution} = { id => $id }; | |||||||||||||||||||
| 104 | 5 | $self->{uri} = join q{}, '/Knowledge/', Twilio::Serialize::path_segment($id); | |||||||||||||||||||
| 105 | 5 | return $self; | |||||||||||||||||||
| 106 | } | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | 1 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 109 | 1 | my ($self) = @_; | |||||||||||||||||||
| 110 | 1 | $self->{version}->handle_request('DELETE', $self->{uri}, 'delete'); | |||||||||||||||||||
| 111 | 1 | return 1; | |||||||||||||||||||
| 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=1 SCAR=0.0
| |||||||||||||||||||||
| 122 | 1 | my ($self, $body) = @_; | |||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | 1 | my $data = Twilio::Serialize::json_body($body, {}); | |||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | my $response = $self->{version}->handle_request( | ||||||||||||||||||||
| 127 | 'PUT', | ||||||||||||||||||||
| 128 | $self->{uri}, | ||||||||||||||||||||
| 129 | 1 | 'update', | |||||||||||||||||||
| 130 | { | ||||||||||||||||||||
| 131 | data => $data, | ||||||||||||||||||||
| 132 | headers => { 'Content-Type' => 'application/json', } | ||||||||||||||||||||
| 133 | } | ||||||||||||||||||||
| 134 | ); | ||||||||||||||||||||
| 135 | 1 | return $self->_build_instance($response); | |||||||||||||||||||
| 136 | } | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | 2 | ▶ | sub _build_instance { | ||||||||||||||||||
|
Subroutine
_build_instance: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 139 | 2 | my ($self, $response) = @_; | |||||||||||||||||||
| 140 | return Twilio::Rest::Knowledge::V1::KnowledgeInstance->new($self->{version}, | ||||||||||||||||||||
| 141 | 2 | $response->get_content, $self->{solution}{id}); | |||||||||||||||||||
| 142 | } | ||||||||||||||||||||
| 143 | |||||||||||||||||||||
| 144 | 1 | ▶ | sub chunks { | ||||||||||||||||||
|
Subroutine
chunks: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 145 | 1 | my ($self) = @_; | |||||||||||||||||||
| 146 | 1 | require Twilio::Rest::Knowledge::V1::Knowledge::Chunk; | |||||||||||||||||||
| 147 | return Twilio::Rest::Knowledge::V1::Knowledge::ChunkList->new($self->{version}, | ||||||||||||||||||||
| 148 | 1 | $self->{solution}{id}); | |||||||||||||||||||
| 149 | } | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 1 | ▶ | sub knowledge_status { | ||||||||||||||||||
|
Subroutine
knowledge_status: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 152 | 1 | my ($self) = @_; | |||||||||||||||||||
| 153 | 1 | require Twilio::Rest::Knowledge::V1::Knowledge::KnowledgeStatus; | |||||||||||||||||||
| 154 | return Twilio::Rest::Knowledge::V1::Knowledge::KnowledgeStatusContext->new($self->{version}, | ||||||||||||||||||||
| 155 | 1 | $self->{solution}{id}); | |||||||||||||||||||
| 156 | } | ||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | package Twilio::Rest::Knowledge::V1::KnowledgeInstance; | ||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | 2 | ▶ | use parent 'Twilio::InstanceResource'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 161 | |||||||||||||||||||||
| 162 | 2 | ▶ | use Twilio::Deserialize; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 163 | |||||||||||||||||||||
| 164 | 4 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 165 | 4 | my ($class, $version, $payload, $id) = @_; | |||||||||||||||||||
| 166 | 4 | my $self = $class->SUPER::new($version, $payload); | |||||||||||||||||||
| 167 | 4 | ▶ | $self->{solution} = { id => $id // $self->{properties}{id} }; | ||||||||||||||||||
|
Condition66%2/3
$id // $self->{"properties"}{"id"}
MC/DC0%0/2
$id // $self->{"properties"}{"id"}
$id
$self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $idB= $self->{"properties"}{"id"}
| |||||||||||||||||||||
| 168 | 4 | return $self; | |||||||||||||||||||
| 169 | } | ||||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | 0 | ▶ | sub delete { | ||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 172 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 173 | 0 | return $self->_context->delete(@arguments); | |||||||||||||||||||
| 174 | } | ||||||||||||||||||||
| 175 | |||||||||||||||||||||
| 176 | 0 | ▶ | sub fetch { | ||||||||||||||||||
|
Subroutine
fetch: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 177 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 178 | 0 | return $self->_context->fetch(@arguments); | |||||||||||||||||||
| 179 | } | ||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | 0 | ▶ | sub update { | ||||||||||||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 182 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 183 | 0 | return $self->_context->update(@arguments); | |||||||||||||||||||
| 184 | } | ||||||||||||||||||||
| 185 | |||||||||||||||||||||
| 186 | 0 | ▶ | sub chunks { | ||||||||||||||||||
|
Subroutine
chunks: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 187 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 188 | 0 | return $self->_context->chunks(@arguments); | |||||||||||||||||||
| 189 | } | ||||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | 0 | ▶ | sub knowledge_status { | ||||||||||||||||||
|
Subroutine
knowledge_status: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 192 | 0 | my ($self, @arguments) = @_; | |||||||||||||||||||
| 193 | 0 | return $self->_context->knowledge_status(@arguments); | |||||||||||||||||||
| 194 | } | ||||||||||||||||||||
| 195 | |||||||||||||||||||||
| 196 | 0 | ▶ | sub _context { | ||||||||||||||||||
|
Subroutine
_context: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 197 | 0 | my ($self) = @_; | |||||||||||||||||||
| 198 | return Twilio::Rest::Knowledge::V1::KnowledgeContext->new($self->{version}, | ||||||||||||||||||||
| 199 | 0 | $self->{solution}{id}); | |||||||||||||||||||
| 200 | } | ||||||||||||||||||||
| 201 | |||||||||||||||||||||
| 202 | 4 | ▶ | sub account_sid { return $_[0]{properties}{account_sid} } | ||||||||||||||||||
|
Subroutine
account_sid: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 203 | 4 | ▶ | sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) } | ||||||||||||||||||
|
Subroutine
date_created: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 204 | 4 | ▶ | sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) } | ||||||||||||||||||
|
Subroutine
date_updated: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 205 | 4 | ▶ | sub description { return $_[0]{properties}{description} } | ||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 206 | 4 | ▶ | sub embedding_model { return $_[0]{properties}{embedding_model} } | ||||||||||||||||||
|
Subroutine
embedding_model: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 207 | 4 | ▶ | sub id { return $_[0]{properties}{id} } | ||||||||||||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 208 | 4 | ▶ | sub knowledge_source_details { return $_[0]{properties}{knowledge_source_details} } | ||||||||||||||||||
|
Subroutine
knowledge_source_details: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 209 | 4 | ▶ | sub name { return $_[0]{properties}{name} } | ||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 210 | 4 | ▶ | sub status { return $_[0]{properties}{status} } | ||||||||||||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 211 | 4 | ▶ | sub type { return $_[0]{properties}{type} } | ||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 212 | 4 | ▶ | sub url { return $_[0]{properties}{url} } | ||||||||||||||||||
|
Subroutine
url: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 213 | |||||||||||||||||||||
| 214 | 2 | 1; | |||||||||||||||||||
| 215 | |||||||||||||||||||||
| 216 | __END__ | ||||||||||||||||||||