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}
37
88
92
93public:
95 const DefaultSendEncoding = "gzip";
96
98 const OAuth2UriPath = "oauth2/apitoken/v1?grant_type=client_credentials";
99
100private:
101 // for access based on a simple API key
102 string apikey;
103
104 // for OAuth2-based access
105 string client_id;
106 string client_secret;
107 string token;
108
109public:
110
112
145 constructor(hash<auto> opts, *softbool do_not_connect) ;
146
147
148 hash<auto> doRequest(string m, string path, auto body, *reference<hash> info, softbool decode_errors = True, *hash<auto> hdr);
149
150
152protected:
153 loginIntern(*reference<hash<auto>> info);
154public:
155
156
158 static string getString(hash<auto> opts, string key);
159
161 static error(string fmt);
162
164 static hash<auto> getOptions(hash<auto> opts);
165};
166
168
191
192public:
194 const ConnectionScheme = <ConnectionSchemeInfo>{
195 "cls": Class::forName("Sap4HanaRestConnection"),
196 "options": RestConnection::ConnectionScheme.options + {
197 "apikey": <ConnectionOptionInfo>{
198 "type": "string",
199 "desc": "the SAP S/4 Hana API key",
200 },
201 "client_id": <ConnectionOptionInfo>{
202 "type": "string",
203 "desc": "the OAuth2 client ID",
204 },
205 "client_secret": <ConnectionOptionInfo>{
206 "type": "string",
207 "desc": "the OAuth2 client secret",
208 "sensitive": True,
209 },
210 },
211 "required_options": "client_id,client_secret|apikey",
212 };
213
215
225 constructor(string name, string description, string url, hash<auto> attributes = {}, hash<auto> options = {})
226 ;
227
228
230 string getType();
231
232
234
239protected:
240 Sap4HanaRestClient getImpl(bool connect = True, *hash<auto> rtopts);
241public:
242
243
245protected:
246 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
247public:
248
249};
250};
loginIntern(*reference< hash< auto > > info)
performs authentication and authorization with SAP using the OAuth2 authorization URL
static error(string fmt)
throws an exception due to an error
static string getString(hash< auto > opts, string key)
gets a string option
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()
class for SAP S/4Hana REST connections; returns Sap4HanaRestClient::Sap4HanaRestClient objects
Definition: Sap4HanaRestClient.qm.dox.h:190
Sap4HanaRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a Sap4HanaRestClient::Sap4HanaRestClient object
string getType()
returns "sap4hanarests"
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
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:194
the Sap4HanaRestClient namespace contains all the objects in the Sap4HanaRestClient module
Definition: Sap4HanaRestClient.qm.dox.h:86