@emilgroup/partner-sdk 1.3.0 → 1.3.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/README.md +2 -2
- package/api/partners-api.ts +31 -31
- package/base.ts +15 -7
- package/dist/api/partners-api.d.ts +31 -31
- package/dist/api/partners-api.js +16 -16
- package/dist/base.d.ts +3 -1
- package/dist/base.js +27 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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@1.3.0 --save
|
|
20
|
+
npm install @emilgroup/partner-sdk@1.3.1-beta.0 --save
|
|
21
21
|
```
|
|
22
22
|
or
|
|
23
23
|
```
|
|
24
|
-
yarn add @emilgroup/partner-sdk@1.3.0
|
|
24
|
+
yarn add @emilgroup/partner-sdk@1.3.1-beta.0
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
And then you can import `PartnersApi`.
|
package/api/partners-api.ts
CHANGED
|
@@ -185,20 +185,20 @@ export const PartnersApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
185
185
|
};
|
|
186
186
|
},
|
|
187
187
|
/**
|
|
188
|
-
* Returns a list of partners you have previously created.
|
|
188
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
189
189
|
* @summary List partners
|
|
190
190
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
191
191
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
192
192
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
193
|
-
* @param {
|
|
193
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
194
194
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
195
|
-
* @param {
|
|
196
|
-
* @param {
|
|
197
|
-
* @param {
|
|
195
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
196
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
197
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
198
198
|
* @param {*} [options] Override http request option.
|
|
199
199
|
* @throws {RequiredError}
|
|
200
200
|
*/
|
|
201
|
-
listPartners: async (authorization?: string, pageSize?: any, pageToken?: any, filter?:
|
|
201
|
+
listPartners: async (authorization?: string, pageSize?: any, pageToken?: any, filter?: string, search?: any, order?: string, expand?: string, filters?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
202
202
|
const localVarPath = `/partnerservice/v1/partners`;
|
|
203
203
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
204
204
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
@@ -410,20 +410,20 @@ export const PartnersApiFp = function(configuration?: Configuration) {
|
|
|
410
410
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
411
411
|
},
|
|
412
412
|
/**
|
|
413
|
-
* Returns a list of partners you have previously created.
|
|
413
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
414
414
|
* @summary List partners
|
|
415
415
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
416
416
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
417
417
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
418
|
-
* @param {
|
|
418
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
419
419
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
420
|
-
* @param {
|
|
421
|
-
* @param {
|
|
422
|
-
* @param {
|
|
420
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
421
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
422
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
423
423
|
* @param {*} [options] Override http request option.
|
|
424
424
|
* @throws {RequiredError}
|
|
425
425
|
*/
|
|
426
|
-
async listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?:
|
|
426
|
+
async listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?: string, search?: any, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPartnersResponseClass>> {
|
|
427
427
|
const localVarAxiosArgs = await localVarAxiosParamCreator.listPartners(authorization, pageSize, pageToken, filter, search, order, expand, filters, options);
|
|
428
428
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
429
429
|
},
|
|
@@ -498,20 +498,20 @@ export const PartnersApiFactory = function (configuration?: Configuration, baseP
|
|
|
498
498
|
return localVarFp.getPartner(code, authorization, expand, options).then((request) => request(axios, basePath));
|
|
499
499
|
},
|
|
500
500
|
/**
|
|
501
|
-
* Returns a list of partners you have previously created.
|
|
501
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
502
502
|
* @summary List partners
|
|
503
503
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
504
504
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
505
505
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
506
|
-
* @param {
|
|
506
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
507
507
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
508
|
-
* @param {
|
|
509
|
-
* @param {
|
|
510
|
-
* @param {
|
|
508
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
509
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
510
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
511
511
|
* @param {*} [options] Override http request option.
|
|
512
512
|
* @throws {RequiredError}
|
|
513
513
|
*/
|
|
514
|
-
listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?:
|
|
514
|
+
listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?: string, search?: any, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListPartnersResponseClass> {
|
|
515
515
|
return localVarFp.listPartners(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then((request) => request(axios, basePath));
|
|
516
516
|
},
|
|
517
517
|
/**
|
|
@@ -639,11 +639,11 @@ export interface PartnersApiListPartnersRequest {
|
|
|
639
639
|
readonly pageToken?: any
|
|
640
640
|
|
|
641
641
|
/**
|
|
642
|
-
* Filter the response by one or multiple fields.
|
|
643
|
-
* @type {
|
|
642
|
+
* Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
643
|
+
* @type {string}
|
|
644
644
|
* @memberof PartnersApiListPartners
|
|
645
645
|
*/
|
|
646
|
-
readonly filter?:
|
|
646
|
+
readonly filter?: string
|
|
647
647
|
|
|
648
648
|
/**
|
|
649
649
|
* To search the list by any field, pass search=xxx to fetch the result.
|
|
@@ -653,25 +653,25 @@ export interface PartnersApiListPartnersRequest {
|
|
|
653
653
|
readonly search?: any
|
|
654
654
|
|
|
655
655
|
/**
|
|
656
|
-
*
|
|
657
|
-
* @type {
|
|
656
|
+
* Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
657
|
+
* @type {string}
|
|
658
658
|
* @memberof PartnersApiListPartners
|
|
659
659
|
*/
|
|
660
|
-
readonly order?:
|
|
660
|
+
readonly order?: string
|
|
661
661
|
|
|
662
662
|
/**
|
|
663
|
-
*
|
|
664
|
-
* @type {
|
|
663
|
+
* Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
664
|
+
* @type {string}
|
|
665
665
|
* @memberof PartnersApiListPartners
|
|
666
666
|
*/
|
|
667
|
-
readonly expand?:
|
|
667
|
+
readonly expand?: string
|
|
668
668
|
|
|
669
669
|
/**
|
|
670
|
-
* Filters the response by one or multiple fields.
|
|
671
|
-
* @type {
|
|
670
|
+
* Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
671
|
+
* @type {string}
|
|
672
672
|
* @memberof PartnersApiListPartners
|
|
673
673
|
*/
|
|
674
|
-
readonly filters?:
|
|
674
|
+
readonly filters?: string
|
|
675
675
|
}
|
|
676
676
|
|
|
677
677
|
/**
|
|
@@ -774,7 +774,7 @@ export class PartnersApi extends BaseAPI {
|
|
|
774
774
|
}
|
|
775
775
|
|
|
776
776
|
/**
|
|
777
|
-
* Returns a list of partners you have previously created.
|
|
777
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
778
778
|
* @summary List partners
|
|
779
779
|
* @param {PartnersApiListPartnersRequest} requestParameters Request parameters.
|
|
780
780
|
* @param {*} [options] Override http request option.
|
package/base.ts
CHANGED
|
@@ -77,6 +77,7 @@ const TOKEN_DATA = 'APP_TOKEN';
|
|
|
77
77
|
export class BaseAPI {
|
|
78
78
|
protected configuration: Configuration | undefined;
|
|
79
79
|
private tokenData?: TokenData;
|
|
80
|
+
private permissions: Array<string> = [];
|
|
80
81
|
|
|
81
82
|
constructor(configuration?: Configuration,
|
|
82
83
|
protected basePath: string = BASE_PATH,
|
|
@@ -109,6 +110,10 @@ export class BaseAPI {
|
|
|
109
110
|
this.configuration.basePath = path;
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
getPermissions(): Array<string> {
|
|
114
|
+
return this.permissions;
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
async authorize(username: string, password: string): Promise<void> {
|
|
113
118
|
const options: AxiosRequestConfig = {
|
|
114
119
|
method: 'POST',
|
|
@@ -123,23 +128,24 @@ export class BaseAPI {
|
|
|
123
128
|
|
|
124
129
|
const response = await globalAxios.request<LoginClass>(options);
|
|
125
130
|
|
|
126
|
-
const { data: { accessToken } } = response;
|
|
131
|
+
const { data: { accessToken, permissions } } = response;
|
|
127
132
|
|
|
128
133
|
this.configuration.username = username;
|
|
129
134
|
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
130
135
|
this.tokenData.username = username;
|
|
131
136
|
this.tokenData.accessToken = accessToken;
|
|
137
|
+
this.permissions = permissions;
|
|
132
138
|
|
|
133
139
|
this.storeTokenData({
|
|
134
140
|
...this.tokenData
|
|
135
141
|
});
|
|
136
142
|
}
|
|
137
143
|
|
|
138
|
-
async refreshTokenInternal(): Promise<
|
|
144
|
+
async refreshTokenInternal(): Promise<LoginClass> {
|
|
139
145
|
const { username } = this.configuration;
|
|
140
146
|
|
|
141
147
|
if (!username) {
|
|
142
|
-
|
|
148
|
+
throw new Error('Failed to refresh token.');
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
const options: AxiosRequestConfig = {
|
|
@@ -152,9 +158,9 @@ export class BaseAPI {
|
|
|
152
158
|
withCredentials: true,
|
|
153
159
|
};
|
|
154
160
|
|
|
155
|
-
const
|
|
161
|
+
const response = await globalAxios.request<LoginClass>(options);
|
|
156
162
|
|
|
157
|
-
return
|
|
163
|
+
return response.data;
|
|
158
164
|
}
|
|
159
165
|
|
|
160
166
|
private storeTokenData(tokenData?: TokenData) {
|
|
@@ -188,8 +194,9 @@ export class BaseAPI {
|
|
|
188
194
|
&& !originalConfig._retry) {
|
|
189
195
|
originalConfig._retry = true;
|
|
190
196
|
try {
|
|
191
|
-
|
|
197
|
+
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
192
198
|
const accessToken = `Bearer ${tokenString}`;
|
|
199
|
+
this.permissions = permissions;
|
|
193
200
|
|
|
194
201
|
delete originalConfig.headers['Authorization']
|
|
195
202
|
|
|
@@ -214,8 +221,9 @@ export class BaseAPI {
|
|
|
214
221
|
) {
|
|
215
222
|
_retry_count++;
|
|
216
223
|
try {
|
|
217
|
-
|
|
224
|
+
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
218
225
|
const accessToken = `Bearer ${tokenString}`;
|
|
226
|
+
this.permissions = permissions;
|
|
219
227
|
|
|
220
228
|
_retry = true;
|
|
221
229
|
originalConfig.headers['Authorization'] = accessToken;
|
|
@@ -54,20 +54,20 @@ export declare const PartnersApiAxiosParamCreator: (configuration?: Configuratio
|
|
|
54
54
|
*/
|
|
55
55
|
getPartner: (code: string, authorization?: string, expand?: any, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
56
56
|
/**
|
|
57
|
-
* Returns a list of partners you have previously created.
|
|
57
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
58
58
|
* @summary List partners
|
|
59
59
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
60
60
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
61
61
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
62
|
-
* @param {
|
|
62
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
63
63
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
64
|
-
* @param {
|
|
65
|
-
* @param {
|
|
66
|
-
* @param {
|
|
64
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
65
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
66
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
67
67
|
* @param {*} [options] Override http request option.
|
|
68
68
|
* @throws {RequiredError}
|
|
69
69
|
*/
|
|
70
|
-
listPartners: (authorization?: string, pageSize?: any, pageToken?: any, filter?:
|
|
70
|
+
listPartners: (authorization?: string, pageSize?: any, pageToken?: any, filter?: string, search?: any, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
71
71
|
/**
|
|
72
72
|
* Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
|
73
73
|
* @summary Update the partner
|
|
@@ -123,20 +123,20 @@ export declare const PartnersApiFp: (configuration?: Configuration) => {
|
|
|
123
123
|
*/
|
|
124
124
|
getPartner(code: string, authorization?: string, expand?: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetPartnerResponseClass>>;
|
|
125
125
|
/**
|
|
126
|
-
* Returns a list of partners you have previously created.
|
|
126
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
127
127
|
* @summary List partners
|
|
128
128
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
129
129
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
130
130
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
131
|
-
* @param {
|
|
131
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
132
132
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
133
|
-
* @param {
|
|
134
|
-
* @param {
|
|
135
|
-
* @param {
|
|
133
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
134
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
135
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
136
136
|
* @param {*} [options] Override http request option.
|
|
137
137
|
* @throws {RequiredError}
|
|
138
138
|
*/
|
|
139
|
-
listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?:
|
|
139
|
+
listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?: string, search?: any, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPartnersResponseClass>>;
|
|
140
140
|
/**
|
|
141
141
|
* Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
|
142
142
|
* @summary Update the partner
|
|
@@ -192,20 +192,20 @@ export declare const PartnersApiFactory: (configuration?: Configuration, basePat
|
|
|
192
192
|
*/
|
|
193
193
|
getPartner(code: string, authorization?: string, expand?: any, options?: any): AxiosPromise<GetPartnerResponseClass>;
|
|
194
194
|
/**
|
|
195
|
-
* Returns a list of partners you have previously created.
|
|
195
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
196
196
|
* @summary List partners
|
|
197
197
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
198
198
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
199
199
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
200
|
-
* @param {
|
|
200
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
201
201
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
202
|
-
* @param {
|
|
203
|
-
* @param {
|
|
204
|
-
* @param {
|
|
202
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
203
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
204
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
205
205
|
* @param {*} [options] Override http request option.
|
|
206
206
|
* @throws {RequiredError}
|
|
207
207
|
*/
|
|
208
|
-
listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?:
|
|
208
|
+
listPartners(authorization?: string, pageSize?: any, pageToken?: any, filter?: string, search?: any, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListPartnersResponseClass>;
|
|
209
209
|
/**
|
|
210
210
|
* Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
|
211
211
|
* @summary Update the partner
|
|
@@ -315,11 +315,11 @@ export interface PartnersApiListPartnersRequest {
|
|
|
315
315
|
*/
|
|
316
316
|
readonly pageToken?: any;
|
|
317
317
|
/**
|
|
318
|
-
* Filter the response by one or multiple fields.
|
|
319
|
-
* @type {
|
|
318
|
+
* Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
319
|
+
* @type {string}
|
|
320
320
|
* @memberof PartnersApiListPartners
|
|
321
321
|
*/
|
|
322
|
-
readonly filter?:
|
|
322
|
+
readonly filter?: string;
|
|
323
323
|
/**
|
|
324
324
|
* To search the list by any field, pass search=xxx to fetch the result.
|
|
325
325
|
* @type {any}
|
|
@@ -327,23 +327,23 @@ export interface PartnersApiListPartnersRequest {
|
|
|
327
327
|
*/
|
|
328
328
|
readonly search?: any;
|
|
329
329
|
/**
|
|
330
|
-
*
|
|
331
|
-
* @type {
|
|
330
|
+
* Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
331
|
+
* @type {string}
|
|
332
332
|
* @memberof PartnersApiListPartners
|
|
333
333
|
*/
|
|
334
|
-
readonly order?:
|
|
334
|
+
readonly order?: string;
|
|
335
335
|
/**
|
|
336
|
-
*
|
|
337
|
-
* @type {
|
|
336
|
+
* Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
337
|
+
* @type {string}
|
|
338
338
|
* @memberof PartnersApiListPartners
|
|
339
339
|
*/
|
|
340
|
-
readonly expand?:
|
|
340
|
+
readonly expand?: string;
|
|
341
341
|
/**
|
|
342
|
-
* Filters the response by one or multiple fields.
|
|
343
|
-
* @type {
|
|
342
|
+
* Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
343
|
+
* @type {string}
|
|
344
344
|
* @memberof PartnersApiListPartners
|
|
345
345
|
*/
|
|
346
|
-
readonly filters?:
|
|
346
|
+
readonly filters?: string;
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Request parameters for tagPartner operation in PartnersApi.
|
|
@@ -430,7 +430,7 @@ export declare class PartnersApi extends BaseAPI {
|
|
|
430
430
|
*/
|
|
431
431
|
getPartner(requestParameters: PartnersApiGetPartnerRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetPartnerResponseClass, any>>;
|
|
432
432
|
/**
|
|
433
|
-
* Returns a list of partners you have previously created.
|
|
433
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
434
434
|
* @summary List partners
|
|
435
435
|
* @param {PartnersApiListPartnersRequest} requestParameters Request parameters.
|
|
436
436
|
* @param {*} [options] Override http request option.
|
package/dist/api/partners-api.js
CHANGED
|
@@ -242,16 +242,16 @@ var PartnersApiAxiosParamCreator = function (configuration) {
|
|
|
242
242
|
});
|
|
243
243
|
},
|
|
244
244
|
/**
|
|
245
|
-
* Returns a list of partners you have previously created.
|
|
245
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
246
246
|
* @summary List partners
|
|
247
247
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
248
248
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
249
249
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
250
|
-
* @param {
|
|
250
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
251
251
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
252
|
-
* @param {
|
|
253
|
-
* @param {
|
|
254
|
-
* @param {
|
|
252
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
253
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
254
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
255
255
|
* @param {*} [options] Override http request option.
|
|
256
256
|
* @throws {RequiredError}
|
|
257
257
|
*/
|
|
@@ -494,16 +494,16 @@ var PartnersApiFp = function (configuration) {
|
|
|
494
494
|
});
|
|
495
495
|
},
|
|
496
496
|
/**
|
|
497
|
-
* Returns a list of partners you have previously created.
|
|
497
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
498
498
|
* @summary List partners
|
|
499
499
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
500
500
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
501
501
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
502
|
-
* @param {
|
|
502
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
503
503
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
504
|
-
* @param {
|
|
505
|
-
* @param {
|
|
506
|
-
* @param {
|
|
504
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
505
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
506
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
507
507
|
* @param {*} [options] Override http request option.
|
|
508
508
|
* @throws {RequiredError}
|
|
509
509
|
*/
|
|
@@ -609,16 +609,16 @@ var PartnersApiFactory = function (configuration, basePath, axios) {
|
|
|
609
609
|
return localVarFp.getPartner(code, authorization, expand, options).then(function (request) { return request(axios, basePath); });
|
|
610
610
|
},
|
|
611
611
|
/**
|
|
612
|
-
* Returns a list of partners you have previously created.
|
|
612
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
613
613
|
* @summary List partners
|
|
614
614
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
615
615
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
616
616
|
* @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
|
|
617
|
-
* @param {
|
|
617
|
+
* @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
618
618
|
* @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
|
|
619
|
-
* @param {
|
|
620
|
-
* @param {
|
|
621
|
-
* @param {
|
|
619
|
+
* @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, version, tags, tagSlugs</i>
|
|
620
|
+
* @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: partnerType, tags.<i>
|
|
621
|
+
* @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, displayName, createdAt, updatedAt, tags, tagSlugs, partnerTypeId</i>
|
|
622
622
|
* @param {*} [options] Override http request option.
|
|
623
623
|
* @throws {RequiredError}
|
|
624
624
|
*/
|
|
@@ -700,7 +700,7 @@ var PartnersApi = /** @class */ (function (_super) {
|
|
|
700
700
|
return (0, exports.PartnersApiFp)(this.configuration).getPartner(requestParameters.code, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
701
701
|
};
|
|
702
702
|
/**
|
|
703
|
-
* Returns a list of partners you have previously created.
|
|
703
|
+
* Returns a list of partners you have previously created. The partners are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
704
704
|
* @summary List partners
|
|
705
705
|
* @param {PartnersApiListPartnersRequest} requestParameters Request parameters.
|
|
706
706
|
* @param {*} [options] Override http request option.
|
package/dist/base.d.ts
CHANGED
|
@@ -52,11 +52,13 @@ export declare class BaseAPI {
|
|
|
52
52
|
protected axios: AxiosInstance;
|
|
53
53
|
protected configuration: Configuration | undefined;
|
|
54
54
|
private tokenData?;
|
|
55
|
+
private permissions;
|
|
55
56
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
56
57
|
selectEnvironment(env: Environment): void;
|
|
57
58
|
selectBasePath(path: string): void;
|
|
59
|
+
getPermissions(): Array<string>;
|
|
58
60
|
authorize(username: string, password: string): Promise<void>;
|
|
59
|
-
refreshTokenInternal(): Promise<
|
|
61
|
+
refreshTokenInternal(): Promise<LoginClass>;
|
|
60
62
|
private storeTokenData;
|
|
61
63
|
loadTokenData(): void;
|
|
62
64
|
cleanTokenData(): void;
|
package/dist/base.js
CHANGED
|
@@ -121,6 +121,7 @@ var BaseAPI = /** @class */ (function () {
|
|
|
121
121
|
if (axios === void 0) { axios = axios_1.default; }
|
|
122
122
|
this.basePath = basePath;
|
|
123
123
|
this.axios = axios;
|
|
124
|
+
this.permissions = [];
|
|
124
125
|
this.loadTokenData();
|
|
125
126
|
if (configuration) {
|
|
126
127
|
this.configuration = configuration;
|
|
@@ -143,11 +144,14 @@ var BaseAPI = /** @class */ (function () {
|
|
|
143
144
|
BaseAPI.prototype.selectBasePath = function (path) {
|
|
144
145
|
this.configuration.basePath = path;
|
|
145
146
|
};
|
|
147
|
+
BaseAPI.prototype.getPermissions = function () {
|
|
148
|
+
return this.permissions;
|
|
149
|
+
};
|
|
146
150
|
BaseAPI.prototype.authorize = function (username, password) {
|
|
147
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
-
var options, response, accessToken;
|
|
149
|
-
return __generator(this, function (
|
|
150
|
-
switch (
|
|
152
|
+
var options, response, _a, accessToken, permissions;
|
|
153
|
+
return __generator(this, function (_b) {
|
|
154
|
+
switch (_b.label) {
|
|
151
155
|
case 0:
|
|
152
156
|
options = {
|
|
153
157
|
method: 'POST',
|
|
@@ -161,12 +165,13 @@ var BaseAPI = /** @class */ (function () {
|
|
|
161
165
|
};
|
|
162
166
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
163
167
|
case 1:
|
|
164
|
-
response =
|
|
165
|
-
|
|
168
|
+
response = _b.sent();
|
|
169
|
+
_a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
|
|
166
170
|
this.configuration.username = username;
|
|
167
171
|
this.configuration.accessToken = "Bearer ".concat(accessToken);
|
|
168
172
|
this.tokenData.username = username;
|
|
169
173
|
this.tokenData.accessToken = accessToken;
|
|
174
|
+
this.permissions = permissions;
|
|
170
175
|
this.storeTokenData(__assign({}, this.tokenData));
|
|
171
176
|
return [2 /*return*/];
|
|
172
177
|
}
|
|
@@ -175,13 +180,13 @@ var BaseAPI = /** @class */ (function () {
|
|
|
175
180
|
};
|
|
176
181
|
BaseAPI.prototype.refreshTokenInternal = function () {
|
|
177
182
|
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
-
var username, options,
|
|
183
|
+
var username, options, response;
|
|
179
184
|
return __generator(this, function (_a) {
|
|
180
185
|
switch (_a.label) {
|
|
181
186
|
case 0:
|
|
182
187
|
username = this.configuration.username;
|
|
183
188
|
if (!username) {
|
|
184
|
-
|
|
189
|
+
throw new Error('Failed to refresh token.');
|
|
185
190
|
}
|
|
186
191
|
options = {
|
|
187
192
|
method: 'POST',
|
|
@@ -194,8 +199,8 @@ var BaseAPI = /** @class */ (function () {
|
|
|
194
199
|
};
|
|
195
200
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
196
201
|
case 1:
|
|
197
|
-
|
|
198
|
-
return [2 /*return*/,
|
|
202
|
+
response = _a.sent();
|
|
203
|
+
return [2 /*return*/, response.data];
|
|
199
204
|
}
|
|
200
205
|
});
|
|
201
206
|
});
|
|
@@ -221,22 +226,23 @@ var BaseAPI = /** @class */ (function () {
|
|
|
221
226
|
axios.interceptors.response.use(function (res) {
|
|
222
227
|
return res;
|
|
223
228
|
}, function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
224
|
-
var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
|
|
225
|
-
return __generator(this, function (
|
|
226
|
-
switch (
|
|
229
|
+
var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
|
|
230
|
+
return __generator(this, function (_c) {
|
|
231
|
+
switch (_c.label) {
|
|
227
232
|
case 0:
|
|
228
233
|
originalConfig = err.config;
|
|
229
234
|
if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
|
|
230
235
|
if (!((err.response.status === 401 || err.response.status === 403)
|
|
231
236
|
&& !originalConfig._retry)) return [3 /*break*/, 4];
|
|
232
237
|
originalConfig._retry = true;
|
|
233
|
-
|
|
238
|
+
_c.label = 1;
|
|
234
239
|
case 1:
|
|
235
|
-
|
|
240
|
+
_c.trys.push([1, 3, , 4]);
|
|
236
241
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
237
242
|
case 2:
|
|
238
|
-
|
|
243
|
+
_a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
|
|
239
244
|
accessToken = "Bearer ".concat(tokenString);
|
|
245
|
+
this.permissions = permissions;
|
|
240
246
|
delete originalConfig.headers['Authorization'];
|
|
241
247
|
originalConfig.headers['Authorization'] = accessToken;
|
|
242
248
|
this.configuration.accessToken = accessToken;
|
|
@@ -244,7 +250,7 @@ var BaseAPI = /** @class */ (function () {
|
|
|
244
250
|
this.storeTokenData(this.tokenData);
|
|
245
251
|
return [2 /*return*/, axios(originalConfig)];
|
|
246
252
|
case 3:
|
|
247
|
-
_error_1 =
|
|
253
|
+
_error_1 = _c.sent();
|
|
248
254
|
if (_error_1.response && _error_1.response.data) {
|
|
249
255
|
return [2 /*return*/, Promise.reject(_error_1.response.data)];
|
|
250
256
|
}
|
|
@@ -255,13 +261,14 @@ var BaseAPI = /** @class */ (function () {
|
|
|
255
261
|
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
256
262
|
&& _retry_count < 4)) return [3 /*break*/, 9];
|
|
257
263
|
_retry_count++;
|
|
258
|
-
|
|
264
|
+
_c.label = 6;
|
|
259
265
|
case 6:
|
|
260
|
-
|
|
266
|
+
_c.trys.push([6, 8, , 9]);
|
|
261
267
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
262
268
|
case 7:
|
|
263
|
-
|
|
269
|
+
_b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
|
|
264
270
|
accessToken = "Bearer ".concat(tokenString);
|
|
271
|
+
this.permissions = permissions;
|
|
265
272
|
_retry = true;
|
|
266
273
|
originalConfig.headers['Authorization'] = accessToken;
|
|
267
274
|
this.configuration.accessToken = accessToken;
|
|
@@ -269,7 +276,7 @@ var BaseAPI = /** @class */ (function () {
|
|
|
269
276
|
this.storeTokenData(this.tokenData);
|
|
270
277
|
return [2 /*return*/, axios.request(__assign({}, originalConfig))];
|
|
271
278
|
case 8:
|
|
272
|
-
_error_2 =
|
|
279
|
+
_error_2 = _c.sent();
|
|
273
280
|
if (_error_2.response && _error_2.response.data) {
|
|
274
281
|
return [2 /*return*/, Promise.reject(_error_2.response.data)];
|
|
275
282
|
}
|