Qore YamlRpcClient Module Reference  1.1
 All Classes Namespaces Functions Variables Pages
YamlRpcClient.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* YamlRpcClient.qm Copyright 2012 - 2016 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 
135 namespace YamlRpcClient {
138 
146 class YamlRpcClient : public Qore::HTTPClient {
147 
148 public:
150  const Version = "1.0";
151 
153  const DefaultOptions = (
154  "protocols": (
155  "yamlrpc": (
156  "port": 80,
157  "ssl": False,
158  ),
159  "yamlrpcs": (
160  "port": 443,
161  "ssl": True,
162  ),
163  ),
164  "default_path": "YAML",
165  );
166 
168  const VersionString = sprintf("Qore-YAML-RPC-Client/%s", YamlRpcClient::Version);
169 
171  const DefaultHeaders = (
172  "Content-Type": MimeTypeYamlRpc + ";charset=utf-8",
173  "Accept": MimeTypeYamlRpc,
174  "User-Agent": YamlRpcClient::VersionString,
175  );
176 
177  private :
178  hash headers;
179  int flags = YAML::None;
180  string path;
181 
182 public:
183 
185 
196  constructor(hash opts = hash(), bool do_not_connect = False) ;
197 
198 
200 
202  constructor(bool do_not_connect = False) ;
203 
204 
206 
210  any callArgs(string method, any args);
211 
212 
214 
219  any callArgsWithInfo(reference info, string method, any args);
220 
221 
223 
226  any call(string method);
227 
228 
230  static string makeRequest(string method, any arg, int flags = YAML::None);
231  };
232 
234 
243 class YamlRpcConnection : public ConnectionProvider::HttpBasedConnection {
244 
245 public:
246  public :
247  hash real_opts;
248 
249 public:
250 
252 
259  constructor(string name, string desc, string url, bool monitor, *hash opts, hash urlh) ;
260 
261 
263 
269 private:
270  YamlRpcClient getImpl(bool connect = True, *hash rtopts);
271 public:
272 
273 
275 
284  hash getOptions();
285 
286 
288  *hash getDefaultOptions();
289 
290 
292  string getType();
293 
294 
296  static YamlRpcConnection make(string name, string desc, string url, bool monitor, *hash opts, hash urlh);
297  };
298 };
const VersionString
YAML-RPC Client Version String.
Definition: YamlRpcClient.qm.dox.h:168
const Version
YAML-RPC Client Version.
Definition: YamlRpcClient.qm.dox.h:150
defines a YAML-RPC client class
Definition: YamlRpcClient.qm.dox.h:146
class for YAML-RPC connections; returns YamlRpcClient objects
Definition: YamlRpcClient.qm.dox.h:243
const DefaultOptions
default options for the YamlRpcClient::constructor()
Definition: YamlRpcClient.qm.dox.h:153
const DefaultHeaders
default HTTP headers
Definition: YamlRpcClient.qm.dox.h:171
string getType()
returns "yamlrpc"
constructor(string name, string desc, string url, bool monitor, *hash opts, hash urlh)
creates the YamlRpcConnection object
static YamlRpcConnection make(string name, string desc, string url, bool monitor, *hash opts, hash urlh)
static constructor
any callArgs(string method, any args)
makes a call to the YAML-RPC server using the second argument as the list of arguments to send ...
YamlRpcClient getImpl(bool connect=True, *hash rtopts)
returns a YamlRpcClient::YamlRpcClient object
static string makeRequest(string method, any arg, int flags=YAML::None)
makes a YAML-RPC request string
constructor(hash opts=hash(), bool do_not_connect=False)
calls the base class HTTPClient constructor, overrides the "protocols" key to "yamlrpc" ...
hash getOptions()
gets options
*hash getDefaultOptions()
returns default options
any callArgsWithInfo(reference info, string method, any args)
makes a call to the YAML-RPC server using the third argument as the list of arguments to send ...
any call(string method)
makes a method call to the YAML-RPC server using the remaining arguments after the method name as the...