@aurigma/axios-design-atoms-api-client 2.32.1 → 2.34.1
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/cjs/design-atoms-api-client.d.ts +20 -0
- package/dist/cjs/design-atoms-api-client.js +125 -0
- package/dist/cjs/design-atoms-api-client.js.map +1 -1
- package/dist/esm/design-atoms-api-client.d.ts +20 -0
- package/dist/esm/design-atoms-api-client.js +125 -0
- package/dist/esm/design-atoms-api-client.js.map +1 -1
- package/package.json +1 -1
|
@@ -58,6 +58,10 @@ export interface IDesignAtomsCompatibilityApiClient {
|
|
|
58
58
|
* @return Success
|
|
59
59
|
*/
|
|
60
60
|
getCssFont(tenantId: number, fontKey?: string | null | undefined): Promise<FileResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* @return Success
|
|
63
|
+
*/
|
|
64
|
+
getFallbackFonts(tenantId: number): Promise<FileResponse>;
|
|
61
65
|
/**
|
|
62
66
|
* @param body (optional)
|
|
63
67
|
* @return Success
|
|
@@ -195,6 +199,11 @@ export declare class DesignAtomsCompatibilityApiClient extends ApiClientBase imp
|
|
|
195
199
|
*/
|
|
196
200
|
getCssFont(tenantId: number, fontKey?: string | null | undefined, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
|
|
197
201
|
protected processGetCssFont(response: AxiosResponse): Promise<FileResponse>;
|
|
202
|
+
/**
|
|
203
|
+
* @return Success
|
|
204
|
+
*/
|
|
205
|
+
getFallbackFonts(tenantId: number, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
|
|
206
|
+
protected processGetFallbackFonts(response: AxiosResponse): Promise<FileResponse>;
|
|
198
207
|
/**
|
|
199
208
|
* @param body (optional)
|
|
200
209
|
* @return Success
|
|
@@ -756,6 +765,11 @@ export interface IDesignAtomsViewerApiClient {
|
|
|
756
765
|
* @return Success
|
|
757
766
|
*/
|
|
758
767
|
getCssFont(fontKey?: string | null | undefined, tenantId?: number | undefined): Promise<FileResponse>;
|
|
768
|
+
/**
|
|
769
|
+
* @param tenantId (optional) Tenant identifier
|
|
770
|
+
* @return Success
|
|
771
|
+
*/
|
|
772
|
+
getFallbackFonts(tenantId?: number | undefined): Promise<FileResponse>;
|
|
759
773
|
/**
|
|
760
774
|
* @param tenantId (optional) Tenant identifier
|
|
761
775
|
* @param body (optional)
|
|
@@ -916,6 +930,12 @@ export declare class DesignAtomsViewerApiClient extends ApiClientBase implements
|
|
|
916
930
|
*/
|
|
917
931
|
getCssFont(fontKey?: string | null | undefined, tenantId?: number | undefined, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
|
|
918
932
|
protected processGetCssFont(response: AxiosResponse): Promise<FileResponse>;
|
|
933
|
+
/**
|
|
934
|
+
* @param tenantId (optional) Tenant identifier
|
|
935
|
+
* @return Success
|
|
936
|
+
*/
|
|
937
|
+
getFallbackFonts(tenantId?: number | undefined, cancelToken?: CancelToken | undefined): Promise<FileResponse>;
|
|
938
|
+
protected processGetFallbackFonts(response: AxiosResponse): Promise<FileResponse>;
|
|
919
939
|
/**
|
|
920
940
|
* @param tenantId (optional) Tenant identifier
|
|
921
941
|
* @param body (optional)
|
|
@@ -43,6 +43,9 @@ class ApiClientBase {
|
|
|
43
43
|
return options;
|
|
44
44
|
}
|
|
45
45
|
getBaseUrl(defultUrl) {
|
|
46
|
+
if (this.configuration.apiUrl.endsWith('/')) {
|
|
47
|
+
return this.configuration.apiUrl.slice(0, -1);
|
|
48
|
+
}
|
|
46
49
|
return this.configuration.apiUrl;
|
|
47
50
|
}
|
|
48
51
|
transformResult(url, res, cb) {
|
|
@@ -385,6 +388,66 @@ class DesignAtomsCompatibilityApiClient extends ApiClientBase {
|
|
|
385
388
|
}
|
|
386
389
|
return Promise.resolve(null);
|
|
387
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* @return Success
|
|
393
|
+
*/
|
|
394
|
+
getFallbackFonts(tenantId, cancelToken) {
|
|
395
|
+
let url_ = this.baseUrl + "/api/atoms/v1/tenants/{tenantId}/api/ccviewer/GetFallbackFonts";
|
|
396
|
+
if (tenantId === undefined || tenantId === null)
|
|
397
|
+
throw new Error("The parameter 'tenantId' must be defined.");
|
|
398
|
+
url_ = url_.replace("{tenantId}", encodeURIComponent("" + tenantId));
|
|
399
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
400
|
+
let options_ = {
|
|
401
|
+
responseType: "blob",
|
|
402
|
+
method: "GET",
|
|
403
|
+
url: url_,
|
|
404
|
+
headers: {
|
|
405
|
+
"Accept": "application/json"
|
|
406
|
+
},
|
|
407
|
+
cancelToken
|
|
408
|
+
};
|
|
409
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
410
|
+
return this.instance.request(transformedOptions_);
|
|
411
|
+
}).catch((_error) => {
|
|
412
|
+
if (isAxiosError(_error) && _error.response) {
|
|
413
|
+
return _error.response;
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
throw _error;
|
|
417
|
+
}
|
|
418
|
+
}).then((_response) => {
|
|
419
|
+
return this.transformResult(url_, _response, (_response) => this.processGetFallbackFonts(_response));
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
processGetFallbackFonts(response) {
|
|
423
|
+
const status = response.status;
|
|
424
|
+
let _headers = {};
|
|
425
|
+
if (response.headers && typeof response.headers === "object") {
|
|
426
|
+
for (let k in response.headers) {
|
|
427
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
428
|
+
_headers[k] = response.headers[k];
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
if (status === 200 || status === 206) {
|
|
433
|
+
const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
|
|
434
|
+
const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
|
435
|
+
const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
|
436
|
+
return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });
|
|
437
|
+
}
|
|
438
|
+
else if (status === 500) {
|
|
439
|
+
const _responseText = response.data;
|
|
440
|
+
let result500 = null;
|
|
441
|
+
let resultData500 = _responseText;
|
|
442
|
+
result500 = JSON.parse(resultData500);
|
|
443
|
+
return throwException("Internal server error", status, _responseText, _headers, result500);
|
|
444
|
+
}
|
|
445
|
+
else if (status !== 200 && status !== 204) {
|
|
446
|
+
const _responseText = response.data;
|
|
447
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
448
|
+
}
|
|
449
|
+
return Promise.resolve(null);
|
|
450
|
+
}
|
|
388
451
|
/**
|
|
389
452
|
* @param body (optional)
|
|
390
453
|
* @return Success
|
|
@@ -3715,6 +3778,68 @@ class DesignAtomsViewerApiClient extends ApiClientBase {
|
|
|
3715
3778
|
}
|
|
3716
3779
|
return Promise.resolve(null);
|
|
3717
3780
|
}
|
|
3781
|
+
/**
|
|
3782
|
+
* @param tenantId (optional) Tenant identifier
|
|
3783
|
+
* @return Success
|
|
3784
|
+
*/
|
|
3785
|
+
getFallbackFonts(tenantId, cancelToken) {
|
|
3786
|
+
let url_ = this.baseUrl + "/api/atoms/v1/ccviewer/GetFallbackFonts?";
|
|
3787
|
+
if (tenantId === null)
|
|
3788
|
+
throw new Error("The parameter 'tenantId' cannot be null.");
|
|
3789
|
+
else if (tenantId !== undefined)
|
|
3790
|
+
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
|
|
3791
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
3792
|
+
let options_ = {
|
|
3793
|
+
responseType: "blob",
|
|
3794
|
+
method: "GET",
|
|
3795
|
+
url: url_,
|
|
3796
|
+
headers: {
|
|
3797
|
+
"Accept": "application/json"
|
|
3798
|
+
},
|
|
3799
|
+
cancelToken
|
|
3800
|
+
};
|
|
3801
|
+
return this.transformOptions(options_).then(transformedOptions_ => {
|
|
3802
|
+
return this.instance.request(transformedOptions_);
|
|
3803
|
+
}).catch((_error) => {
|
|
3804
|
+
if (isAxiosError(_error) && _error.response) {
|
|
3805
|
+
return _error.response;
|
|
3806
|
+
}
|
|
3807
|
+
else {
|
|
3808
|
+
throw _error;
|
|
3809
|
+
}
|
|
3810
|
+
}).then((_response) => {
|
|
3811
|
+
return this.transformResult(url_, _response, (_response) => this.processGetFallbackFonts(_response));
|
|
3812
|
+
});
|
|
3813
|
+
}
|
|
3814
|
+
processGetFallbackFonts(response) {
|
|
3815
|
+
const status = response.status;
|
|
3816
|
+
let _headers = {};
|
|
3817
|
+
if (response.headers && typeof response.headers === "object") {
|
|
3818
|
+
for (let k in response.headers) {
|
|
3819
|
+
if (response.headers.hasOwnProperty(k)) {
|
|
3820
|
+
_headers[k] = response.headers[k];
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
if (status === 200 || status === 206) {
|
|
3825
|
+
const contentDisposition = response.headers ? response.headers["content-disposition"] : undefined;
|
|
3826
|
+
const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
|
|
3827
|
+
const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
|
|
3828
|
+
return Promise.resolve({ fileName: fileName, status: status, data: new Blob([response.data]), headers: _headers });
|
|
3829
|
+
}
|
|
3830
|
+
else if (status === 500) {
|
|
3831
|
+
const _responseText = response.data;
|
|
3832
|
+
let result500 = null;
|
|
3833
|
+
let resultData500 = _responseText;
|
|
3834
|
+
result500 = JSON.parse(resultData500);
|
|
3835
|
+
return throwException("Internal server error", status, _responseText, _headers, result500);
|
|
3836
|
+
}
|
|
3837
|
+
else if (status !== 200 && status !== 204) {
|
|
3838
|
+
const _responseText = response.data;
|
|
3839
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
3840
|
+
}
|
|
3841
|
+
return Promise.resolve(null);
|
|
3842
|
+
}
|
|
3718
3843
|
/**
|
|
3719
3844
|
* @param tenantId (optional) Tenant identifier
|
|
3720
3845
|
* @param body (optional)
|