@emilgroup/account-sdk 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## @emilgroup/account-sdk@1.0.1
1
+ ## @emilgroup/account-sdk@1.0.2
2
2
 
3
3
  This TypeScript/JavaScript client utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
4
4
 
@@ -22,18 +22,14 @@ It can be used in both TypeScript and JavaScript. In TypeScript, the definition
22
22
  navigate to the folder of your consuming project and run one of the following commands.
23
23
 
24
24
  ```
25
- npm install @emilgroup/account-sdk@1.0.1 --save
25
+ npm install @emilgroup/account-sdk@1.0.2 --save
26
26
  ```
27
-
28
-
29
-
30
27
  And then you can import `AccountsApi`.
31
28
 
32
29
  ```ts
33
-
34
30
  import { AccountsApi } from '@emilgroup/account-sdk'
35
31
 
36
- const accounts = new AccountsApi();
32
+ const accountsApi = new AccountsApi();
37
33
  ```
38
34
 
39
35
  To use authentication protected endpoints, you have to first authorize. To do so, use the `authorize` function in `AccountsApi`:
@@ -41,11 +37,11 @@ To use authentication protected endpoints, you have to first authorize. To do so
41
37
  ```ts
42
38
  async function listAccounts(): Promise<Void> {
43
39
  try {
44
- const accounts = new AccountsApi();
40
+ const accountsApi = new AccountsApi();
45
41
 
46
- await accounts.authorize('username', 'password');
42
+ await accountsApi.authorize('username', 'password');
47
43
 
48
- const { data: { items } } = await accounts.listAccounts();
44
+ const { data: { items } } = await accountsApi.listAccounts();
49
45
 
50
46
  console.log(items);
51
47
  } catch(error) {
@@ -53,4 +49,3 @@ async function listAccounts(): Promise<Void> {
53
49
  }
54
50
  }
55
51
  ```
56
-
@@ -32,6 +32,10 @@ import { ListAccountsResponseClass } from '../models';
32
32
  import { UpdateAccountRequestDto } from '../models';
33
33
  // @ts-ignore
34
34
  import { UpdateAccountResponseClass } from '../models';
35
+ // URLSearchParams not necessarily used
36
+ // @ts-ignore
37
+ import { URL, URLSearchParams } from 'url';
38
+ const FormData = require('form-data');
35
39
  /**
36
40
  * AccountsApi - axios parameter creator
37
41
  * @export
package/api.ts CHANGED
@@ -15,6 +15,10 @@
15
15
 
16
16
  import { Configuration } from './configuration';
17
17
  import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
18
+ // URLSearchParams not necessarily used
19
+ // @ts-ignore
20
+ import { URL, URLSearchParams } from 'url';
21
+ import FormData from 'form-data'
18
22
  // Some imports not used depending on template conditions
19
23
  // @ts-ignore
20
24
  import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
package/base.ts CHANGED
@@ -58,7 +58,7 @@ export interface RequestArgs {
58
58
  * @class BaseAPI
59
59
  */
60
60
  export class BaseAPI {
61
- protected configuration: Configuration | undefined;
61
+ protected configuration: Configuration;
62
62
 
63
63
  constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
64
64
  if (configuration) {
@@ -111,6 +111,10 @@ export class BaseAPI {
111
111
  );
112
112
  }
113
113
 
114
+ getConfiguration(): Configuration {
115
+ return this.configuration;
116
+ }
117
+
114
118
  selectEnvironment(env: Environment) {
115
119
  this.configuration.basePath = env;
116
120
  }
@@ -120,7 +124,10 @@ export class BaseAPI {
120
124
  method: 'POST',
121
125
  url: `${Environment.Test}/authservice/v1/login`,
122
126
  headers: {'Content-Type': 'application/json'},
123
- data: {username, password, newPassword: null},
127
+ data: {
128
+ username,
129
+ password,
130
+ },
124
131
  withCredentials: true,
125
132
  };
126
133
 
package/common.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  import { Configuration } from "./configuration";
17
17
  import { RequiredError, RequestArgs } from "./base";
18
18
  import { AxiosInstance, AxiosResponse } from 'axios';
19
+ import { URL, URLSearchParams } from 'url';
19
20
 
20
21
  /**
21
22
  *
@@ -74,14 +74,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
74
74
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
75
75
  }
76
76
  };
77
+ var __importDefault = (this && this.__importDefault) || function (mod) {
78
+ return (mod && mod.__esModule) ? mod : { "default": mod };
79
+ };
77
80
  Object.defineProperty(exports, "__esModule", { value: true });
78
81
  exports.AccountsApi = exports.AccountsApiFactory = exports.AccountsApiFp = exports.AccountsApiAxiosParamCreator = void 0;
79
- var axios_1 = require("axios");
82
+ var axios_1 = __importDefault(require("axios"));
80
83
  // Some imports not used depending on template conditions
81
84
  // @ts-ignore
82
85
  var common_1 = require("../common");
83
86
  // @ts-ignore
84
87
  var base_1 = require("../base");
88
+ // URLSearchParams not necessarily used
89
+ // @ts-ignore
90
+ var url_1 = require("url");
91
+ var FormData = require('form-data');
85
92
  /**
86
93
  * AccountsApi - axios parameter creator
87
94
  * @export
@@ -107,7 +114,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
107
114
  // verify required parameter 'createAccountRequestDto' is not null or undefined
108
115
  (0, common_1.assertParamExists)('createAccount', 'createAccountRequestDto', createAccountRequestDto);
109
116
  localVarPath = "/accountservice/v1/accounts";
110
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
117
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
111
118
  if (configuration) {
112
119
  baseOptions = configuration.baseOptions;
113
120
  baseAccessToken = configuration.accessToken;
@@ -157,7 +164,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
157
164
  (0, common_1.assertParamExists)('deleteAccount', 'code', code);
158
165
  localVarPath = "/accountservice/v1/accounts/{code}"
159
166
  .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
160
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
167
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
161
168
  if (configuration) {
162
169
  baseOptions = configuration.baseOptions;
163
170
  baseAccessToken = configuration.accessToken;
@@ -206,7 +213,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
206
213
  (0, common_1.assertParamExists)('getAccount', 'code', code);
207
214
  localVarPath = "/accountservice/v1/accounts/{code}"
208
215
  .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
209
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
216
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
210
217
  if (configuration) {
211
218
  baseOptions = configuration.baseOptions;
212
219
  baseAccessToken = configuration.accessToken;
@@ -258,7 +265,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
258
265
  switch (_a.label) {
259
266
  case 0:
260
267
  localVarPath = "/accountservice/v1/accounts";
261
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
268
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
262
269
  if (configuration) {
263
270
  baseOptions = configuration.baseOptions;
264
271
  baseAccessToken = configuration.accessToken;
@@ -324,7 +331,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
324
331
  (0, common_1.assertParamExists)('updateAccount', 'updateAccountRequestDto', updateAccountRequestDto);
325
332
  localVarPath = "/accountservice/v1/accounts/{code}"
326
333
  .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
327
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
334
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
328
335
  if (configuration) {
329
336
  baseOptions = configuration.baseOptions;
330
337
  baseAccessToken = configuration.accessToken;
package/dist/base.d.ts CHANGED
@@ -48,8 +48,9 @@ export interface RequestArgs {
48
48
  export declare class BaseAPI {
49
49
  protected basePath: string;
50
50
  protected axios: AxiosInstance;
51
- protected configuration: Configuration | undefined;
51
+ protected configuration: Configuration;
52
52
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
53
+ getConfiguration(): Configuration;
53
54
  selectEnvironment(env: Environment): void;
54
55
  authorize(username: string, password: string): Promise<void>;
55
56
  refreshToken(): Promise<string>;
package/dist/base.js CHANGED
@@ -74,12 +74,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
74
74
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
75
75
  }
76
76
  };
77
+ var __importDefault = (this && this.__importDefault) || function (mod) {
78
+ return (mod && mod.__esModule) ? mod : { "default": mod };
79
+ };
77
80
  Object.defineProperty(exports, "__esModule", { value: true });
78
81
  exports.RequiredError = exports.BaseAPI = exports.Environment = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
79
82
  var configuration_1 = require("./configuration");
80
83
  // Some imports not used depending on template conditions
81
84
  // @ts-ignore
82
- var axios_1 = require("axios");
85
+ var axios_1 = __importDefault(require("axios"));
83
86
  exports.BASE_PATH = "http://localhost".replace(/\/+$/, "");
84
87
  /**
85
88
  *
@@ -156,6 +159,9 @@ var BaseAPI = /** @class */ (function () {
156
159
  });
157
160
  }); });
158
161
  }
162
+ BaseAPI.prototype.getConfiguration = function () {
163
+ return this.configuration;
164
+ };
159
165
  BaseAPI.prototype.selectEnvironment = function (env) {
160
166
  this.configuration.basePath = env;
161
167
  };
@@ -169,7 +175,10 @@ var BaseAPI = /** @class */ (function () {
169
175
  method: 'POST',
170
176
  url: "".concat(Environment.Test, "/authservice/v1/login"),
171
177
  headers: { 'Content-Type': 'application/json' },
172
- data: { username: username, password: password, newPassword: null },
178
+ data: {
179
+ username: username,
180
+ password: password,
181
+ },
173
182
  withCredentials: true,
174
183
  };
175
184
  return [4 /*yield*/, axios_1.default.request(options)];
package/dist/common.d.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  import { Configuration } from "./configuration";
13
13
  import { RequestArgs } from "./base";
14
14
  import { AxiosInstance, AxiosResponse } from 'axios';
15
+ import { URL } from 'url';
15
16
  /**
16
17
  *
17
18
  * @export
package/dist/common.js CHANGED
@@ -62,6 +62,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
62
62
  Object.defineProperty(exports, "__esModule", { value: true });
63
63
  exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
64
64
  var base_1 = require("./base");
65
+ var url_1 = require("url");
65
66
  /**
66
67
  *
67
68
  * @export
@@ -187,7 +188,7 @@ var setSearchParams = function (url) {
187
188
  for (var _i = 1; _i < arguments.length; _i++) {
188
189
  objects[_i - 1] = arguments[_i];
189
190
  }
190
- var searchParams = new URLSearchParams(url.search);
191
+ var searchParams = new url_1.URLSearchParams(url.search);
191
192
  for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {
192
193
  var object = objects_1[_a];
193
194
  for (var key in object) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/account-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "OpenAPI client for @emilgroup/account-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [
@@ -18,7 +18,9 @@
18
18
  "prepare": "npm run build"
19
19
  },
20
20
  "dependencies": {
21
- "axios": "^0.26.1"
21
+ "axios": "^0.26.1",
22
+ "form-data": "^4.0.0",
23
+ "url": "^0.11.0"
22
24
  },
23
25
  "devDependencies": {
24
26
  "@types/node": "^12.11.5",
package/tsconfig.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "target": "ES5",
5
5
  "module": "CommonJS",
6
6
  "noImplicitAny": true,
7
+ "esModuleInterop": true,
7
8
  "outDir": "dist",
8
9
  "rootDir": ".",
9
10
  "lib": [