@emilgroup/partner-sdk-node 1.4.0 → 1.4.1-beta.0
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/.openapi-generator/FILES +1 -0
- package/README.md +38 -5
- package/api/default-api.ts +4 -0
- package/api/partner-relations-api.ts +4 -0
- package/api/partner-tags-api.ts +4 -0
- package/api/partner-types-api.ts +4 -0
- package/api/partner-version-api.ts +4 -0
- package/api/partners-api.ts +4 -0
- package/api.ts +4 -0
- package/base.ts +91 -62
- package/common.ts +1 -0
- package/configuration.ts +8 -0
- package/dist/api/default-api.js +5 -1
- package/dist/api/partner-relations-api.js +11 -7
- package/dist/api/partner-tags-api.js +9 -5
- package/dist/api/partner-types-api.js +9 -5
- package/dist/api/partner-version-api.js +6 -2
- package/dist/api/partners-api.js +10 -6
- package/dist/base.d.ts +9 -6
- package/dist/base.js +137 -45
- package/dist/common.d.ts +1 -0
- package/dist/common.js +2 -1
- package/dist/configuration.d.ts +7 -0
- package/dist/models/create-partner-type-request-dto.d.ts +3 -2
- package/dist/models/create-tag-request-dto.d.ts +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/partner-type-custom-schema-dto.d.ts +102 -0
- package/dist/models/partner-type-custom-schema-dto.js +15 -0
- package/dist/models/update-partner-type-request-dto.d.ts +3 -2
- package/models/create-partner-type-request-dto.ts +3 -2
- package/models/create-tag-request-dto.ts +1 -1
- package/models/index.ts +1 -0
- package/models/partner-type-custom-schema-dto.ts +108 -0
- package/models/update-partner-type-request-dto.ts +3 -2
- package/package.json +5 -2
package/.openapi-generator/FILES
CHANGED
|
@@ -42,6 +42,7 @@ models/partner-class.ts
|
|
|
42
42
|
models/partner-relation-class.ts
|
|
43
43
|
models/partner-relation-type-class.ts
|
|
44
44
|
models/partner-type-class.ts
|
|
45
|
+
models/partner-type-custom-schema-dto.ts
|
|
45
46
|
models/tag-class.ts
|
|
46
47
|
models/tag-partner-request-dto-rest.ts
|
|
47
48
|
models/update-partner-relation-request-dto-rest.ts
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Emil Partner SDK
|
|
2
2
|
|
|
3
|
-
This TypeScript/JavaScript client utilizes [axios](https://github.com/axios/axios). The generated module can be used with
|
|
3
|
+
This TypeScript/JavaScript client utilizes [axios](https://github.com/axios/axios). The generated Node module can be used with Nodejs based applications.
|
|
4
4
|
|
|
5
5
|
Language level
|
|
6
6
|
* ES5 - you must have a Promises/A+ library installed
|
|
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
|
|
|
17
17
|
Navigate to the folder of your consuming project and run one of the following commands:
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
npm install @emilgroup/partner-sdk-node@1.4.0 --save
|
|
20
|
+
npm install @emilgroup/partner-sdk-node@1.4.1-beta.0 --save
|
|
21
21
|
```
|
|
22
22
|
or
|
|
23
23
|
```
|
|
24
|
-
yarn add @emilgroup/partner-sdk-node@1.4.0
|
|
24
|
+
yarn add @emilgroup/partner-sdk-node@1.4.1-beta.0
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
And then you can import `PartnersApi`.
|
|
@@ -31,15 +31,48 @@ import { PartnersApi } from '@emilgroup/partner-sdk-node'
|
|
|
31
31
|
|
|
32
32
|
const partnersApi = new PartnersApi();
|
|
33
33
|
```
|
|
34
|
+
## Credentials
|
|
34
35
|
|
|
35
|
-
To use authentication protected endpoints, you have to first authorize. To do so,
|
|
36
|
+
To use authentication protected endpoints, you have to first authorize. To do so, the easiest way is to provide a configuration file under `~/.emil/credentials` with the following content:
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
emil_username=XXXXX@XXXX.XXX
|
|
40
|
+
emil_password=XXXXXXXXXXXXXX
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
It is also possible to provide environment variables instead:
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
export EMIL_USERNAME=XXXXX@XXXX.XXX
|
|
47
|
+
export EMIL_PASSWORD=XXXXXXXXXXXXXX
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Base path
|
|
51
|
+
|
|
52
|
+
To select the basic path for using the API, we can use two approaches. The first is to use one of the predefined environments, and the second is to specify the domain as a string.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { PartnersApi, Environment } from '@emilgroup/partner-sdk-node'
|
|
56
|
+
|
|
57
|
+
const partnersApi = new PartnersApi();
|
|
58
|
+
|
|
59
|
+
// Allows you to simply choose environment. It will usually be Environment.Production.
|
|
60
|
+
partnersApi.selectEnvironment(Environment.Production);
|
|
61
|
+
|
|
62
|
+
// For advanced users, use the custom baseUrl of the website you need to connect to.
|
|
63
|
+
partnersApi.selectBasePath('https://my-custom-domain.com');
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Example
|
|
67
|
+
|
|
68
|
+
Here is a basic functionning example:
|
|
36
69
|
|
|
37
70
|
```ts
|
|
38
71
|
async function listPartners(): Promise<Void> {
|
|
39
72
|
try {
|
|
40
73
|
const partnersApi = new PartnersApi();
|
|
41
74
|
|
|
42
|
-
await partnersApi.
|
|
75
|
+
await partnersApi.initialize(); // should be called only once per Api.
|
|
43
76
|
|
|
44
77
|
const { data: { items } } = await partnersApi.listPartners();
|
|
45
78
|
|
package/api/default-api.ts
CHANGED
|
@@ -24,6 +24,10 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr
|
|
|
24
24
|
import { InlineResponse200 } from '../models';
|
|
25
25
|
// @ts-ignore
|
|
26
26
|
import { InlineResponse503 } from '../models';
|
|
27
|
+
// URLSearchParams not necessarily used
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
import { URL, URLSearchParams } from 'url';
|
|
30
|
+
const FormData = require('form-data');
|
|
27
31
|
/**
|
|
28
32
|
* DefaultApi - axios parameter creator
|
|
29
33
|
* @export
|
|
@@ -36,6 +36,10 @@ import { ListPartnerRelationClass } from '../models';
|
|
|
36
36
|
import { ListPartnerRelationTypesClass } from '../models';
|
|
37
37
|
// @ts-ignore
|
|
38
38
|
import { UpdatePartnerRelationRequestDtoRest } from '../models';
|
|
39
|
+
// URLSearchParams not necessarily used
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
import { URL, URLSearchParams } from 'url';
|
|
42
|
+
const FormData = require('form-data');
|
|
39
43
|
/**
|
|
40
44
|
* PartnerRelationsApi - axios parameter creator
|
|
41
45
|
* @export
|
package/api/partner-tags-api.ts
CHANGED
|
@@ -32,6 +32,10 @@ import { GetTagResponseClass } from '../models';
|
|
|
32
32
|
import { ListTagsResponseClass } from '../models';
|
|
33
33
|
// @ts-ignore
|
|
34
34
|
import { UpdateTagResponseClass } 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
|
* PartnerTagsApi - axios parameter creator
|
|
37
41
|
* @export
|
package/api/partner-types-api.ts
CHANGED
|
@@ -34,6 +34,10 @@ import { ListPartnerTypesResponseClass } from '../models';
|
|
|
34
34
|
import { UpdatePartnerTypeRequestDto } from '../models';
|
|
35
35
|
// @ts-ignore
|
|
36
36
|
import { UpdatePartnerTypeResponseClass } from '../models';
|
|
37
|
+
// URLSearchParams not necessarily used
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
import { URL, URLSearchParams } from 'url';
|
|
40
|
+
const FormData = require('form-data');
|
|
37
41
|
/**
|
|
38
42
|
* PartnerTypesApi - axios parameter creator
|
|
39
43
|
* @export
|
|
@@ -24,6 +24,10 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr
|
|
|
24
24
|
import { GetPartnerVersionResponseClass } from '../models';
|
|
25
25
|
// @ts-ignore
|
|
26
26
|
import { ListPartnerVersionsResponseClass } from '../models';
|
|
27
|
+
// URLSearchParams not necessarily used
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
import { URL, URLSearchParams } from 'url';
|
|
30
|
+
const FormData = require('form-data');
|
|
27
31
|
/**
|
|
28
32
|
* PartnerVersionApi - axios parameter creator
|
|
29
33
|
* @export
|
package/api/partners-api.ts
CHANGED
|
@@ -36,6 +36,10 @@ import { TagPartnerRequestDtoRest } from '../models';
|
|
|
36
36
|
import { UpdatePartnerRequestDto } from '../models';
|
|
37
37
|
// @ts-ignore
|
|
38
38
|
import { UpdatePartnerResponseClass } from '../models';
|
|
39
|
+
// URLSearchParams not necessarily used
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
import { URL, URLSearchParams } from 'url';
|
|
42
|
+
const FormData = require('form-data');
|
|
39
43
|
/**
|
|
40
44
|
* PartnersApi - axios parameter creator
|
|
41
45
|
* @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
|
@@ -14,13 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
import { Configuration } from "./configuration";
|
|
17
|
-
import { defaultStorage } from "./common";
|
|
18
17
|
// Some imports not used depending on template conditions
|
|
19
18
|
// @ts-ignore
|
|
20
19
|
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
21
|
-
|
|
20
|
+
import * as fs from 'fs';
|
|
21
|
+
import * as path from 'path';
|
|
22
|
+
import * as os from 'os';
|
|
22
23
|
|
|
23
24
|
export const BASE_PATH = "https://apiv2.emil.de".replace(/\/+$/, "");
|
|
25
|
+
const CONFIG_DIRECTORY = '.emil';
|
|
26
|
+
const CONFIG_FILENAME = 'credentials';
|
|
27
|
+
const KEY_USERNAME = 'emil_username';
|
|
28
|
+
const KEY_PASSWORD = 'emil_password';
|
|
29
|
+
|
|
30
|
+
const filePath = os.homedir() + path.sep + CONFIG_DIRECTORY + path.sep + CONFIG_FILENAME;
|
|
24
31
|
/**
|
|
25
32
|
*
|
|
26
33
|
* @export
|
|
@@ -61,13 +68,7 @@ export interface RequestArgs {
|
|
|
61
68
|
options: AxiosRequestConfig;
|
|
62
69
|
}
|
|
63
70
|
|
|
64
|
-
interface TokenData {
|
|
65
|
-
accessToken?: string;
|
|
66
|
-
username?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
71
|
const NETWORK_ERROR_MESSAGE = "Network Error";
|
|
70
|
-
const TOKEN_DATA = 'APP_TOKEN';
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
74
|
*
|
|
@@ -75,39 +76,78 @@ const TOKEN_DATA = 'APP_TOKEN';
|
|
|
75
76
|
* @class BaseAPI
|
|
76
77
|
*/
|
|
77
78
|
export class BaseAPI {
|
|
78
|
-
protected configuration: Configuration
|
|
79
|
-
private
|
|
79
|
+
protected configuration: Configuration;
|
|
80
|
+
private username?: string;
|
|
81
|
+
private password?: string;
|
|
80
82
|
private permissions: Array<string> = [];
|
|
81
83
|
|
|
82
|
-
constructor(configuration?: Configuration,
|
|
83
|
-
protected basePath: string = BASE_PATH,
|
|
84
|
-
protected axios: AxiosInstance = globalAxios) {
|
|
85
|
-
|
|
86
|
-
this.loadTokenData();
|
|
87
|
-
|
|
84
|
+
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
88
85
|
if (configuration) {
|
|
89
86
|
this.configuration = configuration;
|
|
90
87
|
this.basePath = configuration.basePath || this.basePath;
|
|
91
|
-
this.configuration.accessToken = this.tokenData.accessToken ? `Bearer ${this.tokenData.accessToken}` : '';
|
|
92
88
|
} else {
|
|
93
|
-
const { accessToken, username } = this.tokenData;
|
|
94
|
-
|
|
95
89
|
this.configuration = new Configuration({
|
|
96
90
|
basePath: this.basePath,
|
|
97
|
-
accessToken: accessToken ? `Bearer ${accessToken}` : '',
|
|
98
|
-
username,
|
|
99
91
|
});
|
|
100
92
|
}
|
|
101
93
|
|
|
102
94
|
this.attachInterceptor(axios);
|
|
103
95
|
}
|
|
104
96
|
|
|
105
|
-
|
|
106
|
-
this.
|
|
97
|
+
async initialize(env: Environment = Environment.Production) {
|
|
98
|
+
this.configuration.basePath = env;
|
|
99
|
+
|
|
100
|
+
await this.loadCredentials();
|
|
101
|
+
|
|
102
|
+
if (this.username) {
|
|
103
|
+
await this.authorize(this.username, this.password);
|
|
104
|
+
this.password = null; // to avoid keeping password loaded in memory.
|
|
105
|
+
}
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
private async loadCredentials() {
|
|
109
|
+
try {
|
|
110
|
+
await this.readConfigFile();
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.warn(`No credentials file found. Check that ${filePath} exists.`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
this.readEnvVariables();
|
|
116
|
+
|
|
117
|
+
if (!this.username) {
|
|
118
|
+
console.info(`No credentials found in credentials file or environment variables. Either provide some or use
|
|
119
|
+
authorize() function.`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private async readConfigFile() {
|
|
124
|
+
const file = await fs.promises.readFile(filePath, 'utf-8');
|
|
125
|
+
|
|
126
|
+
const lines = file.split(os.EOL)
|
|
127
|
+
.filter(Boolean);
|
|
128
|
+
|
|
129
|
+
lines.forEach((line: string) => {
|
|
130
|
+
if (line.startsWith(KEY_USERNAME)) {
|
|
131
|
+
this.username = line.length > KEY_USERNAME.length + 1 ? line.substring(KEY_USERNAME.length + 1) : '';
|
|
132
|
+
} else if (line.startsWith(KEY_PASSWORD)) {
|
|
133
|
+
this.password = line.length > KEY_PASSWORD.length + 1 ? line.substring(KEY_PASSWORD.length + 1) : '';
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private readEnvVariables(): boolean {
|
|
139
|
+
if (process.env.EMIL_USERNAME) {
|
|
140
|
+
this.username = process.env.EMIL_USERNAME;
|
|
141
|
+
this.password = process.env.EMIL_PASSWORD || '';
|
|
142
|
+
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
selectEnvironment(env: Environment) {
|
|
150
|
+
this.configuration.basePath = env;
|
|
111
151
|
}
|
|
112
152
|
|
|
113
153
|
getPermissions(): Array<string> {
|
|
@@ -129,22 +169,19 @@ export class BaseAPI {
|
|
|
129
169
|
const response = await globalAxios.request<LoginClass>(options);
|
|
130
170
|
|
|
131
171
|
const { data: { accessToken, permissions } } = response;
|
|
132
|
-
|
|
133
172
|
this.configuration.username = username;
|
|
134
173
|
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
135
|
-
this.tokenData.username = username;
|
|
136
|
-
this.tokenData.accessToken = accessToken;
|
|
137
174
|
this.permissions = permissions;
|
|
138
175
|
|
|
139
|
-
this.
|
|
140
|
-
|
|
141
|
-
});
|
|
176
|
+
const refreshToken = this.extractRefreshToken(response)
|
|
177
|
+
this.configuration.refreshToken = refreshToken;
|
|
142
178
|
}
|
|
143
179
|
|
|
144
180
|
async refreshTokenInternal(): Promise<LoginClass> {
|
|
145
|
-
const { username } = this.configuration;
|
|
181
|
+
const { username, refreshToken } = this.configuration;
|
|
182
|
+
|
|
146
183
|
|
|
147
|
-
if (!username) {
|
|
184
|
+
if (!username || !refreshToken) {
|
|
148
185
|
throw new Error('Failed to refresh token.');
|
|
149
186
|
}
|
|
150
187
|
|
|
@@ -153,6 +190,7 @@ export class BaseAPI {
|
|
|
153
190
|
url: `${this.configuration.basePath}/authservice/v1/refresh-token`,
|
|
154
191
|
headers: {
|
|
155
192
|
'Content-Type': 'application/json',
|
|
193
|
+
Cookie: refreshToken,
|
|
156
194
|
},
|
|
157
195
|
data: { username: username },
|
|
158
196
|
withCredentials: true,
|
|
@@ -163,22 +201,18 @@ export class BaseAPI {
|
|
|
163
201
|
return response.data;
|
|
164
202
|
}
|
|
165
203
|
|
|
166
|
-
private
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
}
|
|
204
|
+
private extractRefreshToken(response: AxiosResponse): string {
|
|
205
|
+
if (response.headers && response.headers['set-cookie']
|
|
206
|
+
&& response.headers['set-cookie'].length > 0) {
|
|
171
207
|
|
|
172
|
-
|
|
173
|
-
if (typeof window !== 'undefined') {
|
|
174
|
-
this.tokenData = defaultStorage().get<TokenData>(TOKEN_DATA) || {};
|
|
175
|
-
} else {
|
|
176
|
-
this.tokenData = {};
|
|
208
|
+
return `${response.headers['set-cookie'][0].split(';')[0]};`;
|
|
177
209
|
}
|
|
210
|
+
|
|
211
|
+
return '';
|
|
178
212
|
}
|
|
179
213
|
|
|
180
|
-
|
|
181
|
-
this.
|
|
214
|
+
getConfiguration(): Configuration {
|
|
215
|
+
return this.configuration;
|
|
182
216
|
}
|
|
183
217
|
|
|
184
218
|
private attachInterceptor(axios: AxiosInstance) {
|
|
@@ -188,26 +222,20 @@ export class BaseAPI {
|
|
|
188
222
|
},
|
|
189
223
|
async (err) => {
|
|
190
224
|
let originalConfig = err.config;
|
|
191
|
-
if (err.response
|
|
225
|
+
if (err.response) {
|
|
192
226
|
// Access Token was expired
|
|
193
|
-
if (
|
|
194
|
-
&& !originalConfig._retry) {
|
|
227
|
+
if (err.response.status === 401 && !originalConfig._retry) {
|
|
195
228
|
originalConfig._retry = true;
|
|
196
229
|
try {
|
|
197
230
|
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
198
231
|
const accessToken = `Bearer ${tokenString}`;
|
|
199
232
|
this.permissions = permissions;
|
|
200
233
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
originalConfig.headers['Authorization'] = accessToken;
|
|
234
|
+
originalConfig.headers['Authorization'] = `Bearer ${accessToken}`
|
|
204
235
|
|
|
205
236
|
this.configuration.accessToken = accessToken;
|
|
206
|
-
this.tokenData.accessToken = tokenString;
|
|
207
|
-
|
|
208
|
-
this.storeTokenData(this.tokenData);
|
|
209
237
|
|
|
210
|
-
return axios(originalConfig);
|
|
238
|
+
return axios.request(originalConfig);
|
|
211
239
|
} catch (_error) {
|
|
212
240
|
if (_error.response && _error.response.data) {
|
|
213
241
|
return Promise.reject(_error.response.data);
|
|
@@ -215,10 +243,14 @@ export class BaseAPI {
|
|
|
215
243
|
return Promise.reject(_error);
|
|
216
244
|
}
|
|
217
245
|
}
|
|
218
|
-
|
|
246
|
+
if (err.response.status === 403 && err.response.data) {
|
|
247
|
+
return Promise.reject(err.response.data);
|
|
248
|
+
}
|
|
249
|
+
} else if(err.message === NETWORK_ERROR_MESSAGE
|
|
250
|
+
&& err.isAxiosError
|
|
219
251
|
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
220
252
|
&& _retry_count < 4
|
|
221
|
-
)
|
|
253
|
+
){
|
|
222
254
|
_retry_count++;
|
|
223
255
|
try {
|
|
224
256
|
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
@@ -226,12 +258,9 @@ export class BaseAPI {
|
|
|
226
258
|
this.permissions = permissions;
|
|
227
259
|
|
|
228
260
|
_retry = true;
|
|
229
|
-
originalConfig.headers['Authorization'] = accessToken;
|
|
261
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
230
262
|
|
|
231
263
|
this.configuration.accessToken = accessToken;
|
|
232
|
-
this.tokenData.accessToken = tokenString;
|
|
233
|
-
|
|
234
|
-
this.storeTokenData(this.tokenData);
|
|
235
264
|
|
|
236
265
|
return axios.request({
|
|
237
266
|
...originalConfig,
|
|
@@ -241,7 +270,7 @@ export class BaseAPI {
|
|
|
241
270
|
return Promise.reject(_error.response.data);
|
|
242
271
|
}
|
|
243
272
|
return Promise.reject(_error);
|
|
244
|
-
}
|
|
273
|
+
}
|
|
245
274
|
}
|
|
246
275
|
return Promise.reject(err);
|
|
247
276
|
}
|
package/common.ts
CHANGED
package/configuration.ts
CHANGED
|
@@ -74,6 +74,14 @@ export class Configuration {
|
|
|
74
74
|
*/
|
|
75
75
|
formDataCtor?: new () => any;
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* parameter for automatically refreshing access token for oauth2 security
|
|
79
|
+
*
|
|
80
|
+
* @type {string}
|
|
81
|
+
* @memberof Configuration
|
|
82
|
+
*/
|
|
83
|
+
refreshToken?: string;
|
|
84
|
+
|
|
77
85
|
constructor(param: ConfigurationParameters = {}) {
|
|
78
86
|
this.apiKey = param.apiKey;
|
|
79
87
|
this.username = param.username;
|
package/dist/api/default-api.js
CHANGED
|
@@ -85,6 +85,10 @@ var axios_1 = __importDefault(require("axios"));
|
|
|
85
85
|
var common_1 = require("../common");
|
|
86
86
|
// @ts-ignore
|
|
87
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');
|
|
88
92
|
/**
|
|
89
93
|
* DefaultApi - axios parameter creator
|
|
90
94
|
* @export
|
|
@@ -104,7 +108,7 @@ var DefaultApiAxiosParamCreator = function (configuration) {
|
|
|
104
108
|
var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
|
|
105
109
|
return __generator(this, function (_a) {
|
|
106
110
|
localVarPath = "/partnerservice/health";
|
|
107
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
111
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
108
112
|
if (configuration) {
|
|
109
113
|
baseOptions = configuration.baseOptions;
|
|
110
114
|
baseAccessToken = configuration.accessToken;
|
|
@@ -85,6 +85,10 @@ var axios_1 = __importDefault(require("axios"));
|
|
|
85
85
|
var common_1 = require("../common");
|
|
86
86
|
// @ts-ignore
|
|
87
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');
|
|
88
92
|
/**
|
|
89
93
|
* PartnerRelationsApi - axios parameter creator
|
|
90
94
|
* @export
|
|
@@ -110,7 +114,7 @@ var PartnerRelationsApiAxiosParamCreator = function (configuration) {
|
|
|
110
114
|
// verify required parameter 'createPartnerRelationRequestDtoRest' is not null or undefined
|
|
111
115
|
(0, common_1.assertParamExists)('createPartnerRelation', 'createPartnerRelationRequestDtoRest', createPartnerRelationRequestDtoRest);
|
|
112
116
|
localVarPath = "/partnerservice/v1/partners/relations";
|
|
113
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
117
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
114
118
|
if (configuration) {
|
|
115
119
|
baseOptions = configuration.baseOptions;
|
|
116
120
|
baseAccessToken = configuration.accessToken;
|
|
@@ -160,7 +164,7 @@ var PartnerRelationsApiAxiosParamCreator = function (configuration) {
|
|
|
160
164
|
(0, common_1.assertParamExists)('deletePartnerRelation', 'id', id);
|
|
161
165
|
localVarPath = "/partnerservice/v1/partners/relations/{id}"
|
|
162
166
|
.replace("{".concat("id", "}"), encodeURIComponent(String(id)));
|
|
163
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
167
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
164
168
|
if (configuration) {
|
|
165
169
|
baseOptions = configuration.baseOptions;
|
|
166
170
|
baseAccessToken = configuration.accessToken;
|
|
@@ -208,7 +212,7 @@ var PartnerRelationsApiAxiosParamCreator = function (configuration) {
|
|
|
208
212
|
(0, common_1.assertParamExists)('getPartnerRelation', 'id', id);
|
|
209
213
|
localVarPath = "/partnerservice/v1/partners/relations/{id}"
|
|
210
214
|
.replace("{".concat("id", "}"), encodeURIComponent(String(id)));
|
|
211
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
215
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
212
216
|
if (configuration) {
|
|
213
217
|
baseOptions = configuration.baseOptions;
|
|
214
218
|
baseAccessToken = configuration.accessToken;
|
|
@@ -256,7 +260,7 @@ var PartnerRelationsApiAxiosParamCreator = function (configuration) {
|
|
|
256
260
|
(0, common_1.assertParamExists)('getPartnerRelationType', 'slug', slug);
|
|
257
261
|
localVarPath = "/partnerservice/v1/partners/relations/types/{slug}"
|
|
258
262
|
.replace("{".concat("slug", "}"), encodeURIComponent(String(slug)));
|
|
259
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
263
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
260
264
|
if (configuration) {
|
|
261
265
|
baseOptions = configuration.baseOptions;
|
|
262
266
|
baseAccessToken = configuration.accessToken;
|
|
@@ -307,7 +311,7 @@ var PartnerRelationsApiAxiosParamCreator = function (configuration) {
|
|
|
307
311
|
switch (_a.label) {
|
|
308
312
|
case 0:
|
|
309
313
|
localVarPath = "/partnerservice/v1/partners/relations/types";
|
|
310
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
314
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
311
315
|
if (configuration) {
|
|
312
316
|
baseOptions = configuration.baseOptions;
|
|
313
317
|
baseAccessToken = configuration.accessToken;
|
|
@@ -379,7 +383,7 @@ var PartnerRelationsApiAxiosParamCreator = function (configuration) {
|
|
|
379
383
|
switch (_a.label) {
|
|
380
384
|
case 0:
|
|
381
385
|
localVarPath = "/partnerservice/v1/partners/relations";
|
|
382
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
386
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
383
387
|
if (configuration) {
|
|
384
388
|
baseOptions = configuration.baseOptions;
|
|
385
389
|
baseAccessToken = configuration.accessToken;
|
|
@@ -451,7 +455,7 @@ var PartnerRelationsApiAxiosParamCreator = function (configuration) {
|
|
|
451
455
|
(0, common_1.assertParamExists)('updatePartnerRelation', 'updatePartnerRelationRequestDtoRest', updatePartnerRelationRequestDtoRest);
|
|
452
456
|
localVarPath = "/partnerservice/v1/partners/relations/{id}"
|
|
453
457
|
.replace("{".concat("id", "}"), encodeURIComponent(String(id)));
|
|
454
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
458
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
455
459
|
if (configuration) {
|
|
456
460
|
baseOptions = configuration.baseOptions;
|
|
457
461
|
baseAccessToken = configuration.accessToken;
|
|
@@ -85,6 +85,10 @@ var axios_1 = __importDefault(require("axios"));
|
|
|
85
85
|
var common_1 = require("../common");
|
|
86
86
|
// @ts-ignore
|
|
87
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');
|
|
88
92
|
/**
|
|
89
93
|
* PartnerTagsApi - axios parameter creator
|
|
90
94
|
* @export
|
|
@@ -110,7 +114,7 @@ var PartnerTagsApiAxiosParamCreator = function (configuration) {
|
|
|
110
114
|
// verify required parameter 'createTagRequestDto' is not null or undefined
|
|
111
115
|
(0, common_1.assertParamExists)('createTag', 'createTagRequestDto', createTagRequestDto);
|
|
112
116
|
localVarPath = "/partnerservice/v1/tags";
|
|
113
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
117
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
114
118
|
if (configuration) {
|
|
115
119
|
baseOptions = configuration.baseOptions;
|
|
116
120
|
baseAccessToken = configuration.accessToken;
|
|
@@ -160,7 +164,7 @@ var PartnerTagsApiAxiosParamCreator = function (configuration) {
|
|
|
160
164
|
(0, common_1.assertParamExists)('deleteTag', 'code', code);
|
|
161
165
|
localVarPath = "/partnerservice/v1/tags/{code}"
|
|
162
166
|
.replace("{".concat("code", "}"), encodeURIComponent(String(code)));
|
|
163
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
167
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
164
168
|
if (configuration) {
|
|
165
169
|
baseOptions = configuration.baseOptions;
|
|
166
170
|
baseAccessToken = configuration.accessToken;
|
|
@@ -208,7 +212,7 @@ var PartnerTagsApiAxiosParamCreator = function (configuration) {
|
|
|
208
212
|
(0, common_1.assertParamExists)('getTag', 'code', code);
|
|
209
213
|
localVarPath = "/partnerservice/v1/tags/{code}"
|
|
210
214
|
.replace("{".concat("code", "}"), encodeURIComponent(String(code)));
|
|
211
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
215
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
212
216
|
if (configuration) {
|
|
213
217
|
baseOptions = configuration.baseOptions;
|
|
214
218
|
baseAccessToken = configuration.accessToken;
|
|
@@ -259,7 +263,7 @@ var PartnerTagsApiAxiosParamCreator = function (configuration) {
|
|
|
259
263
|
switch (_a.label) {
|
|
260
264
|
case 0:
|
|
261
265
|
localVarPath = "/partnerservice/v1/tags";
|
|
262
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
266
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
263
267
|
if (configuration) {
|
|
264
268
|
baseOptions = configuration.baseOptions;
|
|
265
269
|
baseAccessToken = configuration.accessToken;
|
|
@@ -328,7 +332,7 @@ var PartnerTagsApiAxiosParamCreator = function (configuration) {
|
|
|
328
332
|
(0, common_1.assertParamExists)('updateTag', 'code', code);
|
|
329
333
|
localVarPath = "/partnerservice/v1/tags/{code}"
|
|
330
334
|
.replace("{".concat("code", "}"), encodeURIComponent(String(code)));
|
|
331
|
-
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
335
|
+
localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
332
336
|
if (configuration) {
|
|
333
337
|
baseOptions = configuration.baseOptions;
|
|
334
338
|
baseAccessToken = configuration.accessToken;
|