@ouroboros/body 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouroboros/body",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Classes to communicate with Ouroboros Coding Inc. body services",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export type responseReject = (error: responseErrorStruct) => boolean;
60
60
  * @name Body
61
61
  */
62
62
  declare class Body {
63
- private domain;
63
+ private _domain;
64
64
  private error;
65
65
  private errorCode;
66
66
  private noSession;
@@ -69,6 +69,16 @@ declare class Body {
69
69
  private token;
70
70
  private verbose;
71
71
  private warning;
72
+ /**
73
+ * Domain
74
+ *
75
+ * Set the domain
76
+ *
77
+ * @name domain
78
+ * @access public
79
+ * @param domain The name of the domain to connect to
80
+ */
81
+ domain(domain: string): void;
72
82
  /**
73
83
  * Request
74
84
  *
package/src/index.js CHANGED
@@ -31,7 +31,7 @@ const ACTIONS_TO_METHODS = {
31
31
  */
32
32
  class Body {
33
33
  // The domain used to make requests to
34
- domain = '';
34
+ _domain = '';
35
35
  // The function to call for http and related errors that need to be reported
36
36
  error = null;
37
37
  // The function to call if we get body errors
@@ -49,6 +49,18 @@ class Body {
49
49
  verbose = false;
50
50
  // The function to call if we get body warnings
51
51
  warning = null;
52
+ /**
53
+ * Domain
54
+ *
55
+ * Set the domain
56
+ *
57
+ * @name domain
58
+ * @access public
59
+ * @param domain The name of the domain to connect to
60
+ */
61
+ domain(domain) {
62
+ this._domain = domain;
63
+ }
52
64
  /**
53
65
  * Request
54
66
  *
@@ -62,7 +74,7 @@ class Body {
62
74
  */
63
75
  request(action, service, noun, data) {
64
76
  // Generate the URL for the request
65
- let url = `https://${this.domain}/${service}/${noun}`;
77
+ let url = `https://${this._domain}/${service}/${noun}`;
66
78
  // Init the response object
67
79
  let res;
68
80
  // Set this
package/src/index.ts CHANGED
@@ -77,7 +77,7 @@ const ACTIONS_TO_METHODS = {
77
77
  class Body {
78
78
 
79
79
  // The domain used to make requests to
80
- private domain: string = '';
80
+ private _domain: string = '';
81
81
 
82
82
  // The function to call for http and related errors that need to be reported
83
83
  private error: onError | null = null;
@@ -104,6 +104,19 @@ class Body {
104
104
  // The function to call if we get body warnings
105
105
  private warning: onWarning | null = null;
106
106
 
107
+ /**
108
+ * Domain
109
+ *
110
+ * Set the domain
111
+ *
112
+ * @name domain
113
+ * @access public
114
+ * @param domain The name of the domain to connect to
115
+ */
116
+ domain(domain: string): void {
117
+ this._domain = domain;
118
+ }
119
+
107
120
  /**
108
121
  * Request
109
122
  *
@@ -118,7 +131,7 @@ class Body {
118
131
  request(action: actionOptions, service: string, noun: string, data: any): Promise<any> {
119
132
 
120
133
  // Generate the URL for the request
121
- let url = `https://${this.domain}/${service}/${noun}`;
134
+ let url = `https://${this._domain}/${service}/${noun}`;
122
135
 
123
136
  // Init the response object
124
137
  let res: responseStruct;
@@ -352,9 +365,9 @@ class Body {
352
365
  }
353
366
 
354
367
  /**
355
- * On No Session
368
+ * On Error Code
356
369
  *
357
- * Sets callback for whenever a request gets a REST_AUTHORIZATION error
370
+ * Sets callback for whenever a request gets an error back
358
371
  *
359
372
  * @name onNoSession
360
373
  * @access public