Qore Sap4HanaRestClient Module Reference 1.1
Loading...
Searching...
No Matches
Sap4HanaRestClient.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* Sap4HanaRestClient.qm Copyright (C) 2019 - 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
87
91
92public:
94 const DefaultSendEncoding = "gzip";
95
97 const OAuth2TokenUriPath = "oauth2/apitoken/v1";
98
99private:
100 // for access based on a simple API key
101 string apikey;
102
103public:
104
106
154 constructor(hash<auto> opts, *softbool do_not_connect) ;
155
156
158 static string getString(hash<auto> opts, string key);
159
161 static raiseError(string fmt);
162
164 static hash<auto> getOptions(hash<auto> opts);
165};
166
168
180
181public:
183 const ConnectionScheme = <ConnectionSchemeInfo>{
184 "cls": Class::forName("Sap4HanaRestConnection"),
185 "options": RestConnection::ConnectionScheme.options + {
186 "apikey": <ConnectionOptionInfo>{
187 "type": "string",
188 "desc": "the SAP S/4 Hana API key",
189 },
190 "client_id": RestConnection::ConnectionScheme.options.oauth2_client_id,
191 "client_secret": RestConnection::ConnectionScheme.options.oauth2_client_secret,
192 "oauth2_token_url": RestConnection::ConnectionScheme.options.oauth2_token_url + <ConnectionOptionInfo>{
194 },
195 "send_encoding": RestConnection::ConnectionScheme.options.send_encoding + <ConnectionOptionInfo>{
197 },
198 },
199 "required_options": "client_id,client_secret|apikey",
200 };
201
204
205
208 "oauth2_auto_refresh": "oauth2_auto_refresh",
209 "oauth2_auth_args": "oauth2_auth_args",
210 "oauth2_auth_url": "oauth2_auth_url",
211 "client_id": "oauth2_client_id",
212 "client_secret": "oauth2_client_secret",
213 "oauth2_redirect_url": "oauth2_redirect_url",
214 "oauth2_refresh_token": "oauth2_refresh_token",
215 "oauth2_scopes": "oauth2_scopes",
216 "oauth2_token_url": "oauth2_token_url",
217 "password": "password",
218 "username": "username",
219 };
220
222 const OAuth2StandardToSapOptionMap = map {$1.value: $1.key}, OAuth2Options.pairIterator();
223
225 const OAuth2DifferentOptionMap = map {$1.value: $1.key}, OAuth2Options.pairIterator(), $1.key != $1.value;
226
228
238 constructor(string name, string description, string url, hash<auto> attributes = {}, hash<auto> options = {})
239 ;
240
241
243 string getType();
244
245
247
249 string getOAuth2OptionName(string opt);
250
251
253
255 hash<auto> getOAuth2Options();
256
257
259
264protected:
265 Sap4HanaRestClient getImpl(bool connect = True, *hash<auto> rtopts);
266public:
267
268
270protected:
271 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
272public:
273
274};
275};
static raiseError(string fmt)
throws an exception due to an error
static string getString(hash< auto > opts, string key)
gets a string option
const OAuth2TokenUriPath
OAuth2 URI path.
Definition: Sap4HanaRestClient.qm.dox.h:97
constructor(hash< auto > opts, *softbool do_not_connect)
creates the object with the given options (which include the mandatory apikey option for SAP S/4Hana ...
static hash< auto > getOptions(hash< auto > opts)
returns options for the Sap4HanaRestClient::constructor()
const DefaultSendEncoding
default send encoding
Definition: Sap4HanaRestClient.qm.dox.h:94
class for SAP S/4Hana REST connections; returns Sap4HanaRestClient::Sap4HanaRestClient objects
Definition: Sap4HanaRestClient.qm.dox.h:179
const OAuth2StandardToSapOptionMap
Maps standard option names to SAP REST option names.
Definition: Sap4HanaRestClient.qm.dox.h:222
Sap4HanaRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a Sap4HanaRestClient::Sap4HanaRestClient object
string getType()
returns "sap4hanarests"
string getOAuth2OptionName(string opt)
Returns the OAuth2 option name for this connection.
const OAuth2Options
Maps SAP REST options to standard options.
Definition: Sap4HanaRestClient.qm.dox.h:207
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
const OAuth2DifferentOptionMap
Different OAuth2 option map; standard name => extern name.
Definition: Sap4HanaRestClient.qm.dox.h:225
const OAuth2AuthRequestOptions
options required to support the OAuth2 authorization code grant flow
Definition: Sap4HanaRestClient.qm.dox.h:203
hash< auto > getOAuth2Options()
Returns OAuth2 options in a standard format.
constructor(string name, string description, string url, hash< auto > attributes={}, hash< auto > options={})
creates the Sap4HanaRestConnection object
const ConnectionScheme
Connection entry info.
Definition: Sap4HanaRestClient.qm.dox.h:183
the Sap4HanaRestClient namespace contains all the objects in the Sap4HanaRestClient module
Definition: Sap4HanaRestClient.qm.dox.h:85