| 1 | package Google::RestApi::GmailApi1::Message; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | our $VERSION = '2.2.5'; | |||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use Google::RestApi::Setup; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use parent 'Google::RestApi::SubResource'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | use aliased 'Google::RestApi::GmailApi1::Attachment'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 12 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 12 | 12 | my $class = shift; | |||||||||
| 13 | 12 | state $check = signature( | |||||||||
| 14 | bless => !!0, | ||||||||||
| 15 | named => [ | ||||||||||
| 16 | gmail_api => HasApi, | ||||||||||
| 17 | id => Str, { optional => 1 }, | ||||||||||
| 18 | ], | ||||||||||
| 19 | ); | ||||||||||
| 20 | 12 | return bless $check->(@_), $class; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 8 | ▶ | sub _uri_base { 'messages' } | ||||||||
|
Subroutine
_uri_base: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 8 | ▶ | sub _parent_accessor { 'gmail_api' } | ||||||||
|
Subroutine
_parent_accessor: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | 3 | ▶ | sub get { | ||||||||
|
Subroutine
get: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||
| 27 | 3 | my $self = shift; | |||||||||
| 28 | 3 | state $check = signature( | |||||||||
| 29 | bless => !!0, | ||||||||||
| 30 | named => [ | ||||||||||
| 31 | format => Str, { optional => 1 }, | ||||||||||
| 32 | fields => Str, { optional => 1 }, | ||||||||||
| 33 | ], | ||||||||||
| 34 | ); | ||||||||||
| 35 | 3 | my $p = $check->(@_); | |||||||||
| 36 | |||||||||||
| 37 | 3 | $self->require_id('get'); | |||||||||
| 38 | |||||||||||
| 39 | 2 | my %params; | |||||||||
| 40 | 2 | ▶ | $params{format} = $p->{format} if defined $p->{format}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 2 | ▶ | $params{fields} = $p->{fields} if defined $p->{fields}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | 2 | return $self->api(params => \%params); | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 2 | ▶ | sub modify { | ||||||||
|
Subroutine
modify: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||
| 47 | 2 | my $self = shift; | |||||||||
| 48 | 2 | state $check = signature( | |||||||||
| 49 | bless => !!0, | ||||||||||
| 50 | named => [ | ||||||||||
| 51 | add_label_ids => ArrayRef[Str], { default => [] }, | ||||||||||
| 52 | remove_label_ids => ArrayRef[Str], { default => [] }, | ||||||||||
| 53 | ], | ||||||||||
| 54 | ); | ||||||||||
| 55 | 2 | my $p = $check->(@_); | |||||||||
| 56 | |||||||||||
| 57 | 2 | $self->require_id('modify'); | |||||||||
| 58 | |||||||||||
| 59 | 1 | my %content; | |||||||||
| 60 | 1 | ▶ | $content{addLabelIds} = $p->{add_label_ids} if $p->{add_label_ids}->@*; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 1 | ▶ | $content{removeLabelIds} = $p->{remove_label_ids} if $p->{remove_label_ids}->@*; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | |||||||||||
| 63 | 1 | DEBUG(sprintf("Modifying message '%s'", $self->{id})); | |||||||||
| 64 | 1 | return $self->api( | |||||||||
| 65 | uri => 'modify', | ||||||||||
| 66 | method => 'post', | ||||||||||
| 67 | content => \%content, | ||||||||||
| 68 | ); | ||||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 5 | ▶ | sub trash { | ||||||||
|
Subroutine
trash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 72 | 5 | my $self = shift; | |||||||||
| 73 | |||||||||||
| 74 | 5 | $self->require_id('trash'); | |||||||||
| 75 | |||||||||||
| 76 | 4 | DEBUG(sprintf("Trashing message '%s'", $self->{id})); | |||||||||
| 77 | 4 | return $self->api(uri => 'trash', method => 'post'); | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 2 | ▶ | sub untrash { | ||||||||
|
Subroutine
untrash: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 81 | 2 | my $self = shift; | |||||||||
| 82 | |||||||||||
| 83 | 2 | $self->require_id('untrash'); | |||||||||
| 84 | |||||||||||
| 85 | 1 | DEBUG(sprintf("Untrashing message '%s'", $self->{id})); | |||||||||
| 86 | 1 | return $self->api(uri => 'untrash', method => 'post'); | |||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | 1 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||
| 90 | 1 | my $self = shift; | |||||||||
| 91 | |||||||||||
| 92 | 1 | $self->require_id('delete'); | |||||||||
| 93 | |||||||||||
| 94 | 0 | DEBUG(sprintf("Deleting message '%s'", $self->{id})); | |||||||||
| 95 | 0 | return $self->api(method => 'delete'); | |||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | 2 | ▶ | sub attachment { | ||||||||
|
Subroutine
attachment: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 99 | 2 | my $self = shift; | |||||||||
| 100 | 2 | state $check = signature( | |||||||||
| 101 | bless => !!0, | ||||||||||
| 102 | named => [ | ||||||||||
| 103 | id => Str, | ||||||||||
| 104 | ], | ||||||||||
| 105 | ); | ||||||||||
| 106 | 2 | my $p = $check->(@_); | |||||||||
| 107 | |||||||||||
| 108 | 2 | $self->require_id('attachment'); | |||||||||
| 109 | |||||||||||
| 110 | 1 | return Attachment->new(message => $self, %$p); | |||||||||
| 111 | } | ||||||||||
| 112 | |||||||||||
| 113 | 3 | ▶ | sub message_id { shift->{id}; } | ||||||||
|
Subroutine
message_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 114 | 8 | ▶ | sub gmail_api { shift->{gmail_api}; } | ||||||||
|
Subroutine
gmail_api: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 115 | |||||||||||
| 116 | 2 | 1; | |||||||||
| 117 | |||||||||||
| 118 | __END__ | ||||||||||