Qore YamlRpcClient Module Reference  1.4
YamlRpcClient.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* YamlRpcClient.qm Copyright 2012 - 2019 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 // requires the binary yaml module
28 
29 // need mime definitions
30 
31 
32 // do not use $ signs in declarations
33 // require type declarations
34 // enable all warnings
35 // do not ignore arg errors in calls, disallow access to all NOOP variants
36 
37 
152 namespace YamlRpcClient {
155 
163 class YamlRpcClient : public Qore::HTTPClient {
164 
165 public:
167  const Version = "1.0";
168 
170  const DefaultOptions = {
171  "protocols": {
172  "yamlrpc": {
173  "port": 80,
174  "ssl": False,
175  },
176  "yamlrpcs": {
177  "port": 443,
178  "ssl": True,
179  },
180  },
181  "default_path": "YAML",
182  };
183 
185  const VersionString = sprintf("Qore-YAML-RPC-Client/%s", YamlRpcClient::Version);
186 
188  const DefaultHeaders = {
189  "Content-Type": MimeTypeYamlRpc + ";charset=utf-8",
190  "Accept": MimeTypeYamlRpc,
191  "User-Agent": YamlRpcClient::VersionString,
192  };
193 
194 protected:
195  hash headers;
196  int flags = YAML::None;
197  string path;
198 
199 public:
200 
202 
213  constructor(hash opts = hash(), bool do_not_connect = False) ;
214 
215 
217 
219  constructor(bool do_not_connect = False) ;
220 
221 
223 
227  auto callArgs(string method, auto args);
228 
229 
231 
236  auto callArgsWithInfo(reference<auto> info, string method, auto args);
237 
238 
240 
243  auto call(string method);
244 
245 
247  static string makeRequest(string method, auto arg, int flags = YAML::None);
248  };
249 
251 
260 class YamlRpcConnection : public ConnectionProvider::HttpBasedConnection {
261 
262 public:
263  hash<auto> real_opts;
264 
266 
275  deprecated
276  constructor(string name, string desc, string url, bool monitor, *hash opts, hash urlh)
277  ;
278 
279 
281 
289  constructor(string name, string description, string url, hash<auto> attributes = {}, hash<auto> options = {})
290  ;
291 
292 
294 
299 protected:
300  YamlRpcClient getImpl(bool connect = True, *hash<auto> rtopts);
301 public:
302 
303 
305 
314  hash<auto> getOptions();
315 
316 
318  *hash<auto> getDefaultOptions();
319 
320 
322  string getType();
323 
324 
326 
328  deprecated
329  static YamlRpcConnection make(string name, string desc, string url, bool monitor, *hash opts, hash urlh);
330  };
331 };
YamlRpcClient::YamlRpcConnection::getDefaultOptions
*hash< auto > getDefaultOptions()
returns default options
YamlRpcClient::YamlRpcClient::callArgs
auto callArgs(string method, auto args)
makes a call to the YAML-RPC server using the second argument as the list of arguments to send
YamlRpcClient::YamlRpcClient::makeRequest
static string makeRequest(string method, auto arg, int flags=YAML::None)
makes a YAML-RPC request string
YamlRpcClient::YamlRpcClient::constructor
constructor(bool do_not_connect=False)
simple constructor using default arguments
YamlRpcClient::YamlRpcConnection::getType
string getType()
returns "yamlrpc"
YamlRpcClient::YamlRpcConnection::getOptions
hash< auto > getOptions()
gets options
YamlRpcClient::YamlRpcConnection
class for YAML-RPC connections; returns YamlRpcClient objects
Definition: YamlRpcClient.qm.dox.h:260
YamlRpcClient
the YamlRpcClient namespace holds all public definitions in the YamlRpcClient module
Definition: YamlRpcClient.qm.dox.h:153
YamlRpcClient::YamlRpcConnection::make
static deprecated YamlRpcConnection make(string name, string desc, string url, bool monitor, *hash opts, hash urlh)
DEPRECATED: static constructor.
YamlRpcClient::YamlRpcConnection::getImpl
YamlRpcClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a YamlRpcClient::YamlRpcClient object
YamlRpcClient::YamlRpcClient::callArgsWithInfo
auto callArgsWithInfo(reference< auto > info, string method, auto args)
makes a call to the YAML-RPC server using the third argument as the list of arguments to send
YamlRpcClient::YamlRpcConnection::constructor
constructor(string name, string description, string url, hash< auto > attributes={}, hash< auto > options={})
creates the YamlRpcConnection object
YamlRpcClient::YamlRpcConnection::constructor
deprecated constructor(string name, string desc, string url, bool monitor, *hash opts, hash urlh)
DEPRECATED: creates the YamlRpcConnection object.
YamlRpcClient::YamlRpcClient::call
auto call(string method)
makes a method call to the YAML-RPC server using the remaining arguments after the method name as the...
YamlRpcClient::YamlRpcClient::constructor
constructor(hash opts=hash(), bool do_not_connect=False)
calls the base class HTTPClient constructor, overrides the "protocols" key to "yamlrpc"