ob-bms-sdk 0.0.16 → 0.0.17

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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DefaultApi } from './api';
2
2
  declare const axiosInstance: import("axios").AxiosInstance;
3
- declare const client: DefaultApi;
4
3
  declare function setAcessToken(accessToken: string): void;
5
4
  declare function setBaseUrl(string: string): void;
5
+ declare const client: DefaultApi;
6
6
  export { client, axiosInstance, setAcessToken, setBaseUrl };
package/dist/index.js CHANGED
@@ -6,13 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.setBaseUrl = exports.setAcessToken = exports.axiosInstance = exports.client = void 0;
7
7
  const api_1 = require("./api");
8
8
  const axios_1 = __importDefault(require("axios"));
9
- const axiosInstance = axios_1.default.create();
10
- exports.axiosInstance = axiosInstance;
11
- const config = new api_1.Configuration({
12
- basePath: process.env['OB_BMS_URL'] || 'https://dev.glorymtel.xyz/ob-bms',
9
+ const axiosInstance = axios_1.default.create({
10
+ baseURL: process.env.OB_BMS_URL || 'localhost:3000',
13
11
  });
14
- const client = new api_1.DefaultApi(config, undefined, axiosInstance);
15
- exports.client = client;
12
+ exports.axiosInstance = axiosInstance;
16
13
  function setAcessToken(accessToken) {
17
14
  axiosInstance.defaults.headers.common['x-access-token'] = accessToken;
18
15
  }
@@ -21,3 +18,5 @@ function setBaseUrl(string) {
21
18
  axiosInstance.defaults.baseURL = string;
22
19
  }
23
20
  exports.setBaseUrl = setBaseUrl;
21
+ const client = new api_1.DefaultApi(undefined, undefined, axiosInstance);
22
+ exports.client = client;
package/index.ts CHANGED
@@ -1,12 +1,9 @@
1
- import { Configuration, DefaultApi } from './api';
1
+ import { DefaultApi } from './api';
2
2
  import axios from 'axios';
3
3
 
4
- const axiosInstance = axios.create();
5
-
6
- const config: Configuration = new Configuration({
7
- basePath: process.env['OB_BMS_URL'] || 'https://dev.glorymtel.xyz/ob-bms',
4
+ const axiosInstance = axios.create({
5
+ baseURL: process.env.OB_BMS_URL || 'localhost:3000',
8
6
  });
9
- const client = new DefaultApi(config, undefined, axiosInstance);
10
7
 
11
8
  function setAcessToken(accessToken: string): void {
12
9
  axiosInstance.defaults.headers.common['x-access-token'] = accessToken;
@@ -16,4 +13,6 @@ function setBaseUrl(string: string): void {
16
13
  axiosInstance.defaults.baseURL = string;
17
14
  }
18
15
 
16
+ const client = new DefaultApi(undefined, undefined, axiosInstance);
17
+
19
18
  export { client, axiosInstance, setAcessToken, setBaseUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ob-bms-sdk",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "API interfaces for OB BMS",
5
5
  "main": "./dist/index.js",
6
6
  "license": "MIT"
package/test.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import * as OB_BMS_SDK from './dist';
2
2
 
3
- OB_BMS_SDK.setAcessToken('123');
4
- OB_BMS_SDK.setBaseUrl('');
3
+ // OB_BMS_SDK.setAcessToken('789');
4
+ OB_BMS_SDK.setBaseUrl('http://google.com');
5
5
 
6
6
  (async () => {
7
7
  try {
8
- await OB_BMS_SDK.client.memberShow('1');
8
+ const res = await OB_BMS_SDK.client.memberShow('1', {});
9
+ console.dir(res);
9
10
  } catch (err) {
10
11
  console.log(err);
11
12
  }