NAME
Google::RestApi::Request - A base class for building Google API batchUpdate requests.
DESCRIPTION
A Request is a lightweight base class that provides generic batch request queuing and response infrastructure. It is used by both Google Sheets (via SheetsApi4::Request) and Google Docs (via DocsApi1::Document) to collect requests and distribute responses.
Batch requests are formulated and queued up to be submitted later via 'submit_requests'. Derived classes must override submit_requests to implement the actual API call.
The default merge_request returns false (no merging). Sheets overrides this with its own merge logic for combining compatible requests.
SUBROUTINES
- batch_requests(%request);
-
Returns all the queued requests if none is passed, or adds the passed request to the queue. A request may be merged into an already-existing request of the same name if merge_request returns true.
- merge_request(\%request);
-
Hook for derived classes to merge a new request with an existing one. Returns false by default (no merging). Sheets overrides this to merge compatible formatting requests.
- submit_requests(%args);
-
This is a pure virtual function that must be overridden in the derived class. The derived class must decide what to do when the queued requests are ready to be submitted.
- requests_response_from_api(\@responses);
-
Strips off responses from the API response array corresponding to the requests that were submitted. Called after submit_requests to distribute responses to the correct requestor.
AUTHORS
Robin Murray mvsjes@cpan.org
COPYRIGHT
Copyright (c) 2019-2026 Robin Murray. All rights reserved.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.