| Qore GoogleRestClient Module Reference 1.0

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
GoogleRestClient::GoogleRestClient Class Reference

this class provides the REST client API for communication with Google servers More...

Inheritance diagram for GoogleRestClient::GoogleRestClient:
[legend]

## Public Member Functions
| constructor (hash< auto > opts, *softbool do_not_connect)
| creates the object with the given options
bool | isAuthTokenError (int status_code, hash< auto > headers, *bool body_deserialized, *string body_content_type, auto body)
| Returns True if the response was related to an authorization token error.

## Static Public Member Functions
static hash< auto > | getOptions (hash< auto > opts)
| returns options for GoogleRestClient::constructor()

## Public Attributes
const | ApiProfiles = ...
| API profiles.
const | DefaultAuthArgs = ...
| Default additional auth request arguments to ensure we get a refresh token with every auth action.
const | DefaultAuthUrl = "https://accounts.google.com/o/oauth2/v2/auth"
| Default authorization request URL.
const | DefaultData = "json"
| Default "data" option value.
const | DefaultGooglePingHeaders = ...
| Default Google ping headers.
const | DefaultGooglePingMethod = "GET"
| Default Google ping method.
const | DefaultGrantType = "authorization_code"
| Default OAuth2 grant type.
const | DefaultOptions = ...
| Default constructor options.
const | DefaultTokenUrl = "https://oauth2.googleapis.com/token"
| Default token request URL.
const | DefaultUrl = "https://www.googleapis.com"
| Default Google REST API URL.

## Detailed Description

this class provides the REST client API for communication with Google servers

You must use an OAuth2 token by setting the `token` and `oauth2_refresh_token` options; the following options need to be set as well:

- `oauth2_client_id:` the OAuth2 client ID
- `oauth2_client_secret:` the OAuth2 client secret

Then an external program has to guide the user through using the authorization_grant flow to get a token to use; this module does not implement that flow.

Note
  This class encodes `"+"` characters in URI paths as `"%2B"`, as the Google API server will return a `400 Bad Request` error to requests with this character unencoded

## Member Function Documentation

## ◆ constructor()

GoogleRestClient::GoogleRestClient::constructor | ( | hash< auto > | opts,
|  | *softbool | do_not_connect )

creates the object with the given options

Example:
  GoogleRestClient rest(opts);

Parameters

  opts | valid options are all the options for the RestClient class; note that the URL is set by default if not provided (see DefaultUrl); the following options are unique to this class: `api_profile:` one of: `none` (no options set) `calendar` (set client options for the Google calendar API)
  do_not_connect | if `False` (the default), then a connection will be immediately established to the remote server

Exceptions

  RESTCLIENT-ERROR | invalid option passed to constructor, unsupported data serialization, etc

## ◆ isAuthTokenError()

bool GoogleRestClient::GoogleRestClient::isAuthTokenError | ( | int | status_code,
|  | hash< auto > | headers,
|  | *bool | body_deserialized,
|  | *string | body_content_type,
|  | auto | body )

Returns True if the response was related to an authorization token error.

Returns
  True if the response was related to an authorization token error