@scout9/admin 1.0.6 → 1.0.7

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.
@@ -11,6 +11,7 @@
11
11
  */
12
12
  export interface ConfigurationParameters {
13
13
  apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
14
+ business?: string;
14
15
  username?: string;
15
16
  password?: string;
16
17
  accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
@@ -25,6 +26,13 @@ export declare class Configuration {
25
26
  * @memberof Configuration
26
27
  */
27
28
  apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
29
+ /**
30
+ * Scout9 business id
31
+ *
32
+ * @type {string}
33
+ * @memberof Configuration
34
+ */
35
+ business?: string;
28
36
  /**
29
37
  * parameter for basic security
30
38
  *
@@ -14,6 +14,7 @@
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.Configuration = void 0;
17
+ const packageJson = require("../package.json");
17
18
  class Configuration {
18
19
  /**
19
20
  * parameter for apiKey security
@@ -21,6 +22,13 @@ class Configuration {
21
22
  * @memberof Configuration
22
23
  */
23
24
  apiKey;
25
+ /**
26
+ * Scout9 business id
27
+ *
28
+ * @type {string}
29
+ * @memberof Configuration
30
+ */
31
+ business;
24
32
  /**
25
33
  * parameter for basic security
26
34
  *
@@ -66,12 +74,27 @@ class Configuration {
66
74
  formDataCtor;
67
75
  constructor(param = {}) {
68
76
  this.apiKey = param.apiKey;
77
+ this.business = param.business;
69
78
  this.username = param.username;
70
79
  this.password = param.password;
71
80
  this.accessToken = param.accessToken;
72
81
  this.basePath = param.basePath;
73
82
  this.baseOptions = param.baseOptions;
74
83
  this.formDataCtor = param.formDataCtor;
84
+ if (!this.baseOptions) {
85
+ this.baseOptions = {};
86
+ }
87
+ this.baseOptions.headers = {
88
+ 'User-Agent': `Scout9/NodeJS/${packageJson.version}`,
89
+ 'Authorization': `Bearer ${this.apiKey}`,
90
+ ...this.baseOptions.headers,
91
+ };
92
+ if (this.business) {
93
+ this.baseOptions.headers['Scout9-Business'] = this.business;
94
+ }
95
+ if (!this.formDataCtor) {
96
+ this.formDataCtor = require("form-data");
97
+ }
75
98
  }
76
99
  /**
77
100
  * Check if the given MIME is a JSON MIME.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/admin",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",