@@ -10,7 +10,7 @@ import debug from './NrcDebugger.js';
1010
1111
1212/**
13- * Description placeholder
13+ * Main node-rest-client component
1414 * @author aacerox
1515 *
1616 * @export
@@ -19,14 +19,14 @@ import debug from './NrcDebugger.js';
1919 */
2020export default class NodeRestClient extends events . EventEmitter {
2121 /**
22- * Description placeholder
22+ * nrc config
2323 * @author aacerox
2424 *
2525 * @type {options }
2626 */
2727 #config = { } ;
2828 /**
29- * Description placeholder
29+ * nrc parsers and serializers facade
3030 * @author aacerox
3131 *
3232 * @type {* }
@@ -35,61 +35,69 @@ export default class NodeRestClient extends events.EventEmitter {
3535
3636 #apis = { } ;
3737
38- // public namespaces
3938 /**
40- * Description placeholder
39+ * method registry
4140 * @author aacerox
4241 *
4342 * @type {{} }
4443 */
45- #parsers = { } ;
44+ #methods = { } ;
45+
4646 /**
47- * Description placeholder
47+ * parsers registry
4848 * @author aacerox
4949 *
5050 * @type {{} }
5151 */
52- #methods = { } ;
52+ #parsers = { } ;
5353
5454 /**
55- * Description placeholder
55+ * serializers registry
5656 * @author aacerox
5757 *
5858 * @type {{} }
5959 */
6060 #serializers = { } ;
6161
62- // default http methods
6362 /**
64- * Description placeholder
63+ * private GET HTTP method where callback
64+ * and promise logic are managed
6565 * @author aacerox
6666 *
6767 * @type {* }
6868 */
6969 #get;
70+
7071 /**
71- * Description placeholder
72+ * private POST HTTP method where callback
73+ * and promise logic are managed
7274 * @author aacerox
7375 *
7476 * @type {* }
7577 */
7678 #post;
79+
7780 /**
78- * Description placeholder
81+ * private PUT HTTP method where callback
82+ * and promise logic are managed
7983 * @author aacerox
8084 *
8185 * @type {* }
8286 */
8387 #put;
88+
8489 /**
85- * Description placeholder
90+ * private DELETE HTTP method where callback
91+ * and promise logic are managed
8692 * @author aacerox
8793 *
8894 * @type {* }
8995 */
9096 #delete;
97+
9198 /**
92- * Description placeholder
99+ * private PATCH HTTP method where callback
100+ * and promise logic are managed
93101 * @author aacerox
94102 *
95103 * @type {* }
@@ -98,12 +106,13 @@ export default class NodeRestClient extends events.EventEmitter {
98106
99107 #usePromises;
100108 /**
101- * Creates an instance of NodeRestClient.
109+ * Creates a NodeRestClient instance .
102110 * @author aacerox
103111 *
104112 * @constructor
105113 * @param {options } options to initialize client
106- * @param {usePromises } usePromises instead of callbacks
114+ * @param {usePromises } usePromises if true nrc will use promises
115+ * instead of callbacks
107116 */
108117 constructor (
109118 options = {
@@ -115,7 +124,7 @@ export default class NodeRestClient extends events.EventEmitter {
115124 } ,
116125 ) {
117126 super ( ) ;
118- const useProxy = options . proxy ? true : false ;
127+ const useProxy = ! ! options . proxy ;
119128 const useProxyTunnel =
120129 ! useProxy || options . proxy . tunnel === undefined ?
121130 false :
@@ -131,7 +140,8 @@ export default class NodeRestClient extends events.EventEmitter {
131140 }
132141
133142 /**
134- * Description placeholder
143+ * main initialization method where HTTP methods parsers and serializers
144+ * are initialized
135145 * @author aacerox
136146 */
137147 #initialize( ) {
@@ -191,7 +201,7 @@ export default class NodeRestClient extends events.EventEmitter {
191201 }
192202
193203 /**
194- * Description placeholder
204+ * returns the GET HTTP method wrapper
195205 * @author aacerox
196206 *
197207 * @readonly
@@ -202,7 +212,7 @@ export default class NodeRestClient extends events.EventEmitter {
202212 }
203213
204214 /**
205- * Description placeholder
215+ * returns the POST HTTP method wrapper
206216 * @author aacerox
207217 *
208218 * @readonly
@@ -213,7 +223,7 @@ export default class NodeRestClient extends events.EventEmitter {
213223 }
214224
215225 /**
216- * Description placeholder
226+ * returns the PUT HTTP method wrapper
217227 * @author aacerox
218228 *
219229 * @readonly
@@ -224,7 +234,7 @@ export default class NodeRestClient extends events.EventEmitter {
224234 }
225235
226236 /**
227- * Description placeholder
237+ * returns the DELETE HTTP method wrapper
228238 * @author aacerox
229239 *
230240 * @readonly
@@ -235,7 +245,7 @@ export default class NodeRestClient extends events.EventEmitter {
235245 }
236246
237247 /**
238- * Description placeholder
248+ * returns the PATCH HTTP method wrapper
239249 * @author aacerox
240250 *
241251 * @readonly
@@ -246,7 +256,7 @@ export default class NodeRestClient extends events.EventEmitter {
246256 }
247257
248258 /**
249- * Description placeholder
259+ * return all the nrc configured response parsers
250260 * @author aacerox
251261 *
252262 * @readonly
@@ -257,7 +267,7 @@ export default class NodeRestClient extends events.EventEmitter {
257267 }
258268
259269 /**
260- * Description placeholder
270+ * returns all the nrc configured request serializers
261271 * @author aacerox
262272 *
263273 * @readonly
@@ -268,7 +278,7 @@ export default class NodeRestClient extends events.EventEmitter {
268278 }
269279
270280 /**
271- * Description placeholder
281+ * returns all nrc registered methods
272282 * @author aacerox
273283 *
274284 * @readonly
@@ -279,7 +289,7 @@ export default class NodeRestClient extends events.EventEmitter {
279289 }
280290
281291 /**
282- * Description placeholder
292+ * add a new custom method to the method registry
283293 * @author aacerox
284294 *
285295 * @param {* } name
@@ -289,13 +299,13 @@ export default class NodeRestClient extends events.EventEmitter {
289299 registerMethod ( name , url , method ) {
290300 // create method in method registry with pre-configured REST invocation
291301 // method
292- this . #methods[ name ] = this . #usePromises?
293- this . #getHttpPromiseFn( url , method ) :
302+ this . #methods[ name ] = this . #usePromises ?
303+ this . #getHttpPromiseFn( url , method ) :
294304 this . #getHttpCallbackFn( url , method ) ;
295305 }
296306
297307 /**
298- * Description placeholder
308+ * unregister previously registered method
299309 * @author aacerox
300310 *
301311 * @param {* } name
@@ -304,9 +314,8 @@ export default class NodeRestClient extends events.EventEmitter {
304314 delete this . methods [ name ] ;
305315 }
306316
307-
308317 /**
309- * Description placeholder
318+ * returns a new HTTP method callback function
310319 * @author aacerox
311320 *
312321 * @param {* } url
@@ -322,7 +331,7 @@ export default class NodeRestClient extends events.EventEmitter {
322331 }
323332
324333 /**
325- * Description placeholder
334+ * returns a new HTTP method promise
326335 * @author aacerox
327336 *
328337 * @param {* } url
@@ -343,7 +352,8 @@ export default class NodeRestClient extends events.EventEmitter {
343352 }
344353
345354 /**
346- * Description placeholder
355+ * returns a new IOFacade object to access response parsers
356+ * and request serializers
347357 * @author aacerox
348358 *
349359 * @param {* } parserManager
0 commit comments