Qore YamlRpcHandler Module Reference  1.4
YamlRpcHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* YamlRpcHandler.qm Copyright (C) 2012 - 2021 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 // need Util module
32 
33 // need HttpServerUtil module at a minimum in this module
34 
35 // do not use $ signs in declarations
36 
37 
102 namespace YamlRpcHandler {
105 
107 class YamlRpcHandler : public AbstractHttpRequestHandler {
108 
109 public:
111  const Version = "1.0";
112 
114  const InternalMethods = ...;
115 
116 
118 protected:
119  list methods = ();
120  hash mi;
121  int loglevel;
122 
123  // if True then verbose exception info will be logged
124  bool debug;
125 
126  // prefix to add to derived methods with GET requests if no "." characters are in the path
127  *string get_prefix;
128 
129  // a closure/call reference to get the log message and/or process arguments in incoming requests
130  *code getLogMessage;
131 
132  // a closure/call reference for logging (when set this is used instead of the HTTP server's logfunc for logging)
133  *code clog;
134 
135 public:
137 
139 
153 constructor(HttpServer::AbstractAuthenticator auth, list<auto> methods, *code get_log_msg, bool dbg = False, *string get_prefix, *code log) ;
154 
155 
157 
166  addMethod(string name, code func, string text, string help, auto logopt, auto cmark);
167 
168 
170  setDebug(bool dbg = True);
171 
172 
174  bool getDebug();
175 
176 
178  static string makeResponse(auto response, int flags = YAML::None);
179 
181  static string makeErrorResponse(int code, string mess, auto err, int flags = YAML::None);
182 
184  // method called by HttpServer to handle a request
185  // don't reimplement this method; fix/enhance it in the module
186  final hash handleRequest(hash cx, hash<auto> hdr, *data body);
187 
188 
189  // don't reimplement this method; fix/enhance it in the module
190 protected:
191  final addMethodInternal(hash h);
192 public:
193 
194 
195 protected:
196  hash<auto> help();
197 public:
198 
199 
200 protected:
201  hash<auto> system_describe();
202 public:
203 
204 
205 protected:
206  softlist<string> listMethods();
207 public:
208 
209 
210 protected:
211  log(hash<auto> cx, string str);
212 public:
213 
214 
215  // don't reimplement this method; fix/enhance it in the module
216 protected:
217  final hash<auto> callMethod(hash cx, auto params);
218 public:
219 
221  };
222 };
the YamlRpcHandler namespace holds all public definitions in the YamlRpcHandler module ...
Definition: YamlRpcHandler.qm.dox.h:103