NAME
WebService::GoogleAPI::Client::UserAgent - User Agent wrapper for working with Google APIs
VERSION
version 0.20
header_with_bearer_auth_token
returns a hashref describing gzip encoding and auth bearer token
build_http_transaction
Example of usage:
$gapi->build_http_transaction({
method => 'post', ## case insensitive [ GET|PATH|PUT|POST|PATCH|DELETE ]
path => 'https://www.googleapis.com/calendar/users/me/calendarList', ## NB - no interpolation
options => { key => value } ## form variables for POST etc otherwise - GET params treated properly
})
validated_api_query
Google API HTTP 'method' request to API End Point at 'path' with optional parameters described by 'options'
By 'validated' I mean that no checks are performed against dsivoery data structures and no interpolation is performed. The pre-processing functionality for the library is expected to be completed by the 'Client' class before passing the cleaner, sanitised and validated request to the agent here for submitting.
NB - handles auth headers injection and token refresh if required and possible
Required params: method, route
$self->access_token must be valid
Examples of usage:
$self->validated_api_query({
method => 'get',
path => 'https://www.googleapis.com/calendar/users/me/calendarList',
});
$self->validated_api_query({
method => 'post',
path => 'https://www.googleapis.com/calendar/v3/calendars/'.$calendar_id.'/events',
options => { key => value }
}
See Also: Client->api_query that augments the parameters with some Google API Specific fucntionality before calling here.
Returns Mojo::Message::Response object
refresh_access_token
Get new access token for user from Google API server
$self->refresh_access_token({
client_id => '',
client_secret => '',
refresh_token => ''
})
Q: under what conditions could we not have a refresh token? - what scopes are required? ensure that included in defaults if they are req'd
AUTHOR
Peter Scott <localshop@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2017-2018 by Peter Scott and others.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004