Qore GoogleRestClient Module Reference 1.0
Loading...
Searching...
No Matches
GoogleRestClient.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* GoogleRestClient.qm Copyright (C) 2020 - 2023 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum qore version
26
27// require type definitions everywhere
28
29// enable all warnings
30
31// don't use "$" for vars, members, and methods, assume local variable scope
32
33// do not ignore argument errors
34
35
36
83
95
96public:
98 const DefaultUrl = "https://www.googleapis.com";
99
101 const DefaultAuthArgs = {"access_type": "offline"};
102
104 const DefaultAuthUrl = "https://accounts.google.com/o/oauth2/v2/auth";
105
107 const DefaultGrantType = "authorization_code";
108
110 const DefaultTokenUrl = "https://oauth2.googleapis.com/token";
111
113 const DefaultData = "json";
114
116 const DefaultOptions = {
117 "data": DefaultData,
118 "encode_chars": "+",
119 "oauth2_auth_args": DefaultAuthArgs,
120 "oauth2_auth_url": DefaultAuthUrl,
121 "oauth2_grant_type": DefaultGrantType,
122 "oauth2_token_url": DefaultTokenUrl,
123 "url": DefaultUrl,
124 };
125
127 const ApiProfiles = {
128 "none": {},
129 "calendar": {
130 "oauth2_scopes": (
131 "https://www.googleapis.com/auth/calendar",
132 ),
133 "ping_method": DefaultGooglePingMethod,
134 "ping_path": "/calendar/v3/users/me/calendarList?maxResults=1",
135 "ping_headers": DefaultGooglePingHeaders,
136 },
137 };
138
140 const DefaultGooglePingMethod= "GET";
141
143 const DefaultGooglePingHeaders = {
144 "Accept": MimeTypeJson,
145 };
146
148
165 constructor(hash<auto> opts, *softbool do_not_connect) ;
166
167
169 static hash<auto> getOptions(hash<auto> opts);
170};
171
173
183
184public:
186 const ConnectionScheme = <ConnectionSchemeInfo>{
187 "cls": Class::forName("GoogleRestConnection"),
188 "options": RestConnection::ConnectionScheme.options + {
189 "api_profile": <ConnectionOptionInfo>{
190 "type": "string",
191 "desc": "the API profile according to the Google API in use; this option will set the REST "
192 "options if they are not already set (`oauth2_scopes`, `ping_body`, `ping_headers`, and "
193 "`ping_method`); valid "
194 "values:\n"
195 "- `none`: no options configured (default)\n"
196 "- `calendar`: set options for the Google calendar API",
197 "default_value": "none",
198 "allowed_values": (
199 <AllowedValueInfo>{
200 "desc": "No options are set",
201 "value": "none",
202 },
203 <AllowedValueInfo>{
204 "desc": "Set REST client options for the Google calendar API",
205 "value": "calendar",
206 },
207 ),
208 },
209 "data": RestConnection::ConnectionScheme.options."data"
210 + <ConnectionOptionInfo>{
211 "default_value": GoogleRestClient::DefaultData,
212 },
213 "oauth2_auth_args": RestConnection::ConnectionScheme.options.oauth2_auth_args
214 + <ConnectionOptionInfo>{
215 "default_value": GoogleRestClient::DefaultAuthArgs,
216 },
217 "oauth2_auth_url": RestConnection::ConnectionScheme.options.oauth2_auth_url
218 + <ConnectionOptionInfo>{
219 "default_value": GoogleRestClient::DefaultAuthUrl,
220 },
221 "oauth2_grant_type": RestConnection::ConnectionScheme.options.oauth2_grant_type
222 + <ConnectionOptionInfo>{
223 "default_value": GoogleRestClient::DefaultGrantType,
224 },
225 "oauth2_token_url": RestConnection::ConnectionScheme.options.oauth2_token_url
226 + <ConnectionOptionInfo>{
227 "default_value": GoogleRestClient::DefaultTokenUrl,
228 },
229 },
230 "required_options": "token|oauth2_auth_url,oauth2_grant_type,oauth2_token_url,"
231 "oauth2_client_id,oauth2_client_secret",
232 };
233
235
245 constructor(string name, string description, string url = GoogleRestClient::DefaultUrl, hash<auto> attributes = {}, hash<auto> options = {})
246 ;
247
248
250 string getType();
251
252
254
259
260
262
264 DataProvider::AbstractDataProvider getDataProvider();
265
266
268 static hash<auto> getOptions(hash<auto> opts);
269
271protected:
273public:
274
275
277
282protected:
283 GoogleRestClient getImpl(bool connect = True, *hash<auto> rtopts);
284public:
285
286
288protected:
289 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
290public:
291
292};
293};
const DefaultGrantType
Default OAuth2 grant type.
Definition: GoogleRestClient.qm.dox.h:107
const DefaultTokenUrl
Default token request URL.
Definition: GoogleRestClient.qm.dox.h:110
static hash< auto > getOptions(hash< auto > opts)
returns options for GoogleRestClient::constructor()
const DefaultAuthUrl
Default authorization request URL.
Definition: GoogleRestClient.qm.dox.h:104
const DefaultUrl
Default Google REST API URL.
Definition: GoogleRestClient.qm.dox.h:98
constructor(hash< auto > opts, *softbool do_not_connect)
creates the object with the given options
const DefaultAuthArgs
Default addition auth request arguments.
Definition: GoogleRestClient.qm.dox.h:101
const DefaultData
Default "data" option value.
Definition: GoogleRestClient.qm.dox.h:113
Class for Google REST connections; returns GoogleRestClient objects.
Definition: GoogleRestClient.qm.dox.h:182
const ConnectionScheme
Connection entry info.
Definition: GoogleRestClient.qm.dox.h:186
setChildCapabilities()
Sets child data provider capabilities.
constructor(string name, string description, string url=GoogleRestClient::DefaultUrl, hash< auto > attributes={}, hash< auto > options={})
creates the GoogleRestConnection object
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
DataProvider::AbstractDataProvider getDataProvider()
returns a data provider object for this connection
static hash< auto > getOptions(hash< auto > opts)
returns options for GoogleRestConnection::constructor()
bool hasDataProvider()
returns True as this connection returns a data provider with the getDataProvider() method
GoogleRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a GoogleRestClient object
the GoogleRestClient namespace contains all the objects in the GoogleRestClient module
Definition: GoogleRestClient.qm.dox.h:81