File Coverage

blib/lib/SignalWire/Agents/REST/Namespaces/Datasphere.pm
Criterion Covered Total %
statement 17 26 65.3
branch 0 2 0.0
condition n/a
subroutine 6 10 60.0
pod 0 4 0.0
total 23 42 54.7


line stmt bran cond sub pod time code
1             package SignalWire::Agents::REST::Namespaces::Datasphere;
2 4     4   29 use strict;
  4         9  
  4         200  
3 4     4   35 use warnings;
  4         9  
  4         201  
4 4     4   24 use Moo;
  4         6  
  4         27  
5              
6             # --- DatasphereDocuments ---
7             package SignalWire::Agents::REST::Namespaces::Datasphere::Documents;
8 4     4   1824 use Moo;
  4         8  
  4         39  
9             extends 'SignalWire::Agents::REST::Namespaces::CrudResource';
10              
11             sub search {
12 0     0 0 0 my ($self, %kwargs) = @_;
13 0         0 return $self->_http->post($self->_path('search'), body => \%kwargs);
14             }
15              
16             sub list_chunks {
17 0     0 0 0 my ($self, $document_id, %params) = @_;
18 0 0       0 my $p = %params ? \%params : undef;
19 0         0 return $self->_http->get($self->_path($document_id, 'chunks'), params => $p);
20             }
21              
22             sub get_chunk {
23 0     0 0 0 my ($self, $document_id, $chunk_id) = @_;
24 0         0 return $self->_http->get($self->_path($document_id, 'chunks', $chunk_id));
25             }
26              
27             sub delete_chunk {
28 0     0 0 0 my ($self, $document_id, $chunk_id) = @_;
29 0         0 return $self->_http->delete_request($self->_path($document_id, 'chunks', $chunk_id));
30             }
31              
32             # --- DatasphereNamespace ---
33             package SignalWire::Agents::REST::Namespaces::Datasphere;
34 4     4   2790 use Moo;
  4         8  
  4         18  
35              
36             has '_http' => ( is => 'ro', required => 1 );
37             has 'documents' => ( is => 'lazy' );
38              
39             sub _build_documents {
40 2     2   7746 my ($self) = @_;
41 2         69 return SignalWire::Agents::REST::Namespaces::Datasphere::Documents->new(
42             _http => $self->_http,
43             _base_path => '/api/datasphere/documents',
44             );
45             }
46              
47             1;