| 1 | package Google::RestApi::DriveApi3::Changes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | our $VERSION = '1.1.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Google::RestApi::Setup; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | state $check = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | bless => !!0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | named => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | drive_api => HasApi, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | return bless $check->(@_), $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | sub api { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
api: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | my %p = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 4 | my $uri = "changes"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | ▶ | $uri .= "/$p{uri}" if $p{uri}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | delete $p{uri}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | return $self->drive_api()->api(%p, uri => $uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | ▶ | sub get_start_page_token { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_start_page_token: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | state $check = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | bless => !!0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | named => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | drive_id => Str, { optional => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | supports_all_drives => Bool, { default => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | my $p = $check->(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 3 | my %params; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 3 | ▶ | $params{driveId} = $p->{drive_id} if defined $p->{drive_id}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | ▶ | $params{supportsAllDrives} = $p->{supports_all_drives} ? 'true' : 'false'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | my $result = $self->api(uri => 'startPageToken', params => \%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | return $result->{startPageToken}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | sub list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list: called CC=15 SCAR=32.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | state $check = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | bless => !!0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | named => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | page_token => Str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | spaces => Str, { default => 'drive' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | include_removed => Bool, { default => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | include_items_from_all_drives => Bool, { default => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | supports_all_drives => Bool, { default => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | fields => Str, { optional => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | page_size => PositiveInt, { default => 100 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | drive_id => Str, { optional => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | max_pages => Int, { default => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | page_callback => CodeRef, { optional => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | _extra_ => slurpy HashRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | my $p = named_extra($check->(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | my $max_pages = delete $p->{max_pages}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | my $page_callback = delete $p->{page_callback}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | my %params = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | pageToken => delete $p->{page_token}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | spaces => delete $p->{spaces}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | pageSize => delete $p->{page_size}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | includeRemoved => delete $p->{include_removed} ? 'true' : 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | includeItemsFromAllDrives => delete $p->{include_items_from_all_drives} ? 'true' : 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | ▶ | supportsAllDrives => delete $p->{supports_all_drives} ? 'true' : 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | ▶ | $params{fields} = delete $p->{fields} if defined $p->{fields}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | ▶ | $params{driveId} = delete $p->{drive_id} if defined $p->{drive_id}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | my @changes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | my $next_page_token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | my $new_start_page_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | my $page = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | my $keep_going = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition22%2/9
not $keep_going && $next_page_token or $max_pages > 0 and $page >= $max_pages
$keep_going && $next_page_token
$max_pages > 0 and $page >= $max_pages
MC/DC0%0/4
not $keep_going && $next_page_token or $max_pages > 0 and $page >= $max_pages
$keep_going
$next_page_token
$max_pages > 0
$page >= $max_pages
Truth table20%1/5
not(A && B) or C and D
A= $keep_goingB= $next_page_tokenC= $max_pages > 0D= $page >= $max_pages
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | ▶ | $params{pageToken} = $next_page_token if $next_page_token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | my $result = $self->api(params => \%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | ▶ | push(@changes, $result->{changes}->@*) if $result->{changes}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | $next_page_token = $result->{nextPageToken}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | $new_start_page_token = $result->{newStartPageToken}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | $page++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | ▶ | if ($page_callback && $result->{changes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$page_callback and $$result{"changes"}
MC/DC0%0/2
$page_callback and $$result{"changes"}
$page_callback
$$result{"changes"}
Truth table33%1/3
A and B
A= $page_callbackB= $$result{"changes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $keep_going = $page_callback->($result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } until !$keep_going || !$next_page_token || ($max_pages > 0 && $page >= $max_pages); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | ▶ | return wantarray ? @changes : { changes => \@changes, newStartPageToken => $new_start_page_token }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | sub watch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
watch: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | state $check = signature( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | bless => !!0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | named => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | page_token => Str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | id => Str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | type => Str, { default => 'web_hook' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | address => Str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | expiration => Int, { optional => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | _extra_ => slurpy HashRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $p = named_extra($check->(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | my %params = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | pageToken => delete $p->{page_token}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | my $content = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | id => delete $p->{id}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | type => delete $p->{type}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | address => delete $p->{address}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | $content->{expiration} = delete $p->{expiration} if defined $p->{expiration}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | DEBUG("Setting watch on changes"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return $self->api( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | uri => 'watch', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | method => 'post', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | params => \%params, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | content => $content, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 4 | ▶ | sub drive_api { shift->{drive_api}; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drive_api: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||