Google-RestApi
view release on metacpan or search on metacpan
lib/Google/RestApi/DocsApi1/Document.pm view on Meta::CPAN
segment_id => Str, { optional => 1 },
],
);
my $p = $check->(@_);
my %location;
$location{index} = $p->{index} if defined $p->{index};
$location{segmentId} = $p->{segment_id} if defined $p->{segment_id};
$self->batch_requests(
insertText => {
text => $p->{text},
location => \%location,
},
);
return $self;
}
sub delete_content {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
range => HashRef,
],
);
my $p = $check->(@_);
$self->batch_requests(
deleteContentRange => {
range => $p->{range},
},
);
return $self;
}
sub replace_all_text {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
find => Str,
replacement => Str,
match_case => Bool, { default => 1 },
],
);
my $p = $check->(@_);
$self->batch_requests(
replaceAllText => {
containsText => {
text => $p->{find},
matchCase => $p->{match_case} ? JSON::MaybeXS::true() : JSON::MaybeXS::false(),
},
replaceText => $p->{replacement},
},
);
return $self;
}
sub update_text_style {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
range => HashRef,
style => HashRef,
fields => Str,
],
);
my $p = $check->(@_);
$self->batch_requests(
updateTextStyle => {
range => $p->{range},
textStyle => $p->{style},
fields => $p->{fields},
},
);
return $self;
}
sub update_paragraph_style {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
range => HashRef,
style => HashRef,
fields => Str,
],
);
my $p = $check->(@_);
$self->batch_requests(
updateParagraphStyle => {
range => $p->{range},
paragraphStyle => $p->{style},
fields => $p->{fields},
},
);
return $self;
}
sub insert_table {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
index => Int,
rows => Int,
columns => Int,
segment_id => Str, { optional => 1 },
],
);
my $p = $check->(@_);
my %location = (index => $p->{index});
$location{segmentId} = $p->{segment_id} if defined $p->{segment_id};
$self->batch_requests(
insertTable => {
rows => $p->{rows},
columns => $p->{columns},
location => \%location,
},
);
return $self;
}
sub insert_inline_image {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
index => Int,
uri => Str,
width => HashRef, { optional => 1 },
height => HashRef, { optional => 1 },
segment_id => Str, { optional => 1 },
],
);
my $p = $check->(@_);
lib/Google/RestApi/DocsApi1/Document.pm view on Meta::CPAN
state $check = signature(positional => [Str]);
my ($header_id) = $check->(@_);
$self->batch_requests(deleteHeader => { headerId => $header_id });
return $self;
}
sub delete_footer {
my $self = shift;
state $check = signature(positional => [Str]);
my ($footer_id) = $check->(@_);
$self->batch_requests(deleteFooter => { footerId => $footer_id });
return $self;
}
sub insert_page_break {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
index => Int,
segment_id => Str, { optional => 1 },
],
);
my $p = $check->(@_);
my %location = (index => $p->{index});
$location{segmentId} = $p->{segment_id} if defined $p->{segment_id};
$self->batch_requests(
insertPageBreak => {
location => \%location,
},
);
return $self;
}
sub insert_section_break {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
index => Int,
type => Str,
segment_id => Str, { optional => 1 },
],
);
my $p = $check->(@_);
my %location = (index => $p->{index});
$location{segmentId} = $p->{segment_id} if defined $p->{segment_id};
$self->batch_requests(
insertSectionBreak => {
sectionType => $p->{type},
location => \%location,
},
);
return $self;
}
sub update_document_style {
my $self = shift;
state $check = signature(
bless => !!0,
named => [
style => HashRef,
fields => Str,
],
);
my $p = $check->(@_);
$self->batch_requests(
updateDocumentStyle => {
documentStyle => $p->{style},
fields => $p->{fields},
},
);
return $self;
}
sub docs_api { shift->{docs_api}; }
sub rest_api { shift->docs_api()->rest_api(); }
sub transaction { shift->docs_api()->transaction(); }
sub stats { shift->docs_api()->stats(); }
sub reset_stats { shift->docs_api()->reset_stats(); }
1;
__END__
=head1 NAME
Google::RestApi::DocsApi1::Document - Represents a Google Docs document with batch update support.
=head1 DESCRIPTION
Document inherits from L<Google::RestApi::Request> and provides methods
to queue Google Docs API batch update requests. Requests are collected
and submitted together via C<submit_requests()>.
See the description and synopsis at L<Google::RestApi::DocsApi1>.
=head1 NAVIGATION
=over
=item * L<Google::RestApi::DocsApi1>
=item * L<Google::RestApi::DocsApi1::Document>
=back
=head1 SUBROUTINES
=over
=item new(%args)
Creates a new Document instance.
%args consists of:
( run in 0.859 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )