From 8199b565e16358b8cb286ddc820df709feb7495d Mon Sep 17 00:00:00 2001 From: Timo Date: Tue, 1 Jun 2021 11:19:26 +0300 Subject: [PATCH] http api refactor --- .../lib/api/dictionaryController.service.ts | 62 ++++++++----------- .../api/digitalSignatureController.service.ts | 38 +++++------- .../api/fileAttributesController.service.ts | 20 ++---- .../api/fileManagementController.service.ts | 10 +-- .../api/reportTemplateController.service.ts | 12 ++-- .../src/lib/api/uploadController.service.ts | 2 +- .../lib/api/watermarkController.service.ts | 12 +--- 7 files changed, 59 insertions(+), 97 deletions(-) diff --git a/libs/red-ui-http/src/lib/api/dictionaryController.service.ts b/libs/red-ui-http/src/lib/api/dictionaryController.service.ts index ea2d0fb45..b3faa1b25 100644 --- a/libs/red-ui-http/src/lib/api/dictionaryController.service.ts +++ b/libs/red-ui-http/src/lib/api/dictionaryController.service.ts @@ -157,9 +157,9 @@ export class DictionaryControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/dictionary/${encodeURIComponent( - String(type) - )}/${encodeURIComponent(String(dossierTemplateId))}`, + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent( + String(dossierTemplateId) + )}`, { body: body, params: queryParameters, @@ -239,18 +239,14 @@ export class DictionaryControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request( - 'post', - `${this.basePath}/redaction-gateway-v1/dictionary/type`, - { - body: body, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('post', `${this.basePath}/dictionary/type`, { + body: body, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } /** @@ -347,7 +343,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/dictionary/delete/${encodeURIComponent( + `${this.basePath}/dictionary/delete/${encodeURIComponent( String(type) )}/${encodeURIComponent(String(dossierTemplateId))}`, { @@ -447,11 +443,9 @@ export class DictionaryControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/redaction-gateway-v1/dictionary/${encodeURIComponent( - String(type) - )}/${encodeURIComponent(String(dossierTemplateId))}/${encodeURIComponent( - String(entry) - )}`, + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent( + String(dossierTemplateId) + )}/${encodeURIComponent(String(entry))}`, { params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -537,7 +531,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/redaction-gateway-v1/dictionary/type/${encodeURIComponent( + `${this.basePath}/dictionary/type/${encodeURIComponent( String(type) )}/${encodeURIComponent(String(dossierTemplateId))}`, { @@ -625,7 +619,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/dictionary/download/${encodeURIComponent( + `${this.basePath}/dictionary/download/${encodeURIComponent( String(type) )}/${encodeURIComponent(String(dossierTemplateId))}`, { @@ -702,9 +696,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/dictionary/type/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/dictionary/type/${encodeURIComponent(String(dossierTemplateId))}`, { params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -769,9 +761,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/color/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/color/${encodeURIComponent(String(dossierTemplateId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -856,9 +846,9 @@ export class DictionaryControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/dictionary/${encodeURIComponent( - String(type) - )}/${encodeURIComponent(String(dossierTemplateId))}`, + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent( + String(dossierTemplateId) + )}`, { params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -942,9 +932,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/color/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/color/${encodeURIComponent(String(dossierTemplateId))}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -1049,7 +1037,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/dictionary/type/${encodeURIComponent( + `${this.basePath}/dictionary/type/${encodeURIComponent( String(type) )}/${encodeURIComponent(String(dossierTemplateId))}`, { @@ -1162,7 +1150,7 @@ export class DictionaryControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/dictionary/upload/${encodeURIComponent( + `${this.basePath}/dictionary/upload/${encodeURIComponent( String(type) )}/${encodeURIComponent(String(dossierTemplateId))}`, { diff --git a/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts b/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts index 5288eed8d..f477ea93c 100644 --- a/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts +++ b/libs/red-ui-http/src/lib/api/digitalSignatureController.service.ts @@ -80,16 +80,12 @@ export class DigitalSignatureControllerService { headers = headers.set('Accept', httpHeaderAcceptSelected); } - return this.httpClient.request( - 'delete', - `${this.basePath}/redaction-gateway-v1/digital-signature`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('delete', `${this.basePath}/digital-signature`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } /** @@ -135,7 +131,7 @@ export class DigitalSignatureControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/digital-signature`, + `${this.basePath}/digital-signature`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -207,7 +203,7 @@ export class DigitalSignatureControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/digital-signature`, + `${this.basePath}/digital-signature`, { body: body, withCredentials: this.configuration.withCredentials, @@ -278,16 +274,12 @@ export class DigitalSignatureControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request( - 'put', - `${this.basePath}/redaction-gateway-v1/digital-signature`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('put', `${this.basePath}/digital-signature`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } } diff --git a/libs/red-ui-http/src/lib/api/fileAttributesController.service.ts b/libs/red-ui-http/src/lib/api/fileAttributesController.service.ts index 28bfb76d2..430a447b7 100644 --- a/libs/red-ui-http/src/lib/api/fileAttributesController.service.ts +++ b/libs/red-ui-http/src/lib/api/fileAttributesController.service.ts @@ -107,9 +107,7 @@ export class FileAttributesControllerService { return this.httpClient.request( 'delete', - `${ - this.basePath - }/redaction-gateway-v1/fileAttributes/config/fileAttribute/${encodeURIComponent( + `${this.basePath}/fileAttributes/config/fileAttribute/${encodeURIComponent( String(dossierTemplateId) )}/${encodeURIComponent(String(fileAttributeId))}`, { @@ -194,9 +192,7 @@ export class FileAttributesControllerService { return this.httpClient.request( 'post', - `${ - this.basePath - }/redaction-gateway-v1/fileAttributes/config/fileAttribute/${encodeURIComponent( + `${this.basePath}/fileAttributes/config/fileAttribute/${encodeURIComponent( String(dossierTemplateId) )}/delete`, { @@ -263,7 +259,7 @@ export class FileAttributesControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/fileAttributes/config/${encodeURIComponent( + `${this.basePath}/fileAttributes/config/${encodeURIComponent( String(dossierTemplateId) )}`, { @@ -359,7 +355,7 @@ export class FileAttributesControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/fileAttributes/set/${encodeURIComponent( + `${this.basePath}/fileAttributes/set/${encodeURIComponent( String(dossierId) )}/${encodeURIComponent(String(fileId))}`, { @@ -445,9 +441,7 @@ export class FileAttributesControllerService { return this.httpClient.request( 'put', - `${ - this.basePath - }/redaction-gateway-v1/fileAttributes/config/baseConfig/${encodeURIComponent( + `${this.basePath}/fileAttributes/config/baseConfig/${encodeURIComponent( String(dossierTemplateId) )}`, { @@ -533,9 +527,7 @@ export class FileAttributesControllerService { return this.httpClient.request( 'post', - `${ - this.basePath - }/redaction-gateway-v1/fileAttributes/config/fileAttribute/${encodeURIComponent( + `${this.basePath}/fileAttributes/config/fileAttribute/${encodeURIComponent( String(dossierTemplateId) )}`, { diff --git a/libs/red-ui-http/src/lib/api/fileManagementController.service.ts b/libs/red-ui-http/src/lib/api/fileManagementController.service.ts index 919de87fe..573beb758 100644 --- a/libs/red-ui-http/src/lib/api/fileManagementController.service.ts +++ b/libs/red-ui-http/src/lib/api/fileManagementController.service.ts @@ -104,9 +104,9 @@ export class FileManagementControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/redaction-gateway-v1/delete/${encodeURIComponent( - String(dossierId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/delete/${encodeURIComponent(String(dossierId))}/${encodeURIComponent( + String(fileId) + )}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -189,7 +189,7 @@ export class FileManagementControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/delete/${encodeURIComponent(String(dossierId))}`, + `${this.basePath}/delete/${encodeURIComponent(String(dossierId))}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -275,7 +275,7 @@ export class FileManagementControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/download/annotated/${encodeURIComponent( + `${this.basePath}/download/annotated/${encodeURIComponent( String(dossierId) )}/${encodeURIComponent(String(fileId))}`, { diff --git a/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts b/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts index c82a62c3c..24a2fd3f0 100644 --- a/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts +++ b/libs/red-ui-http/src/lib/api/reportTemplateController.service.ts @@ -120,7 +120,7 @@ export class ReportTemplateControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/redaction-gateway-v1/templateUpload/${encodeURIComponent( + `${this.basePath}/templateUpload/${encodeURIComponent( String(dossierTemplateId) )}/${encodeURIComponent(String(templateId))}`, { @@ -197,7 +197,7 @@ export class ReportTemplateControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/templateUpload/${encodeURIComponent( + `${this.basePath}/templateUpload/${encodeURIComponent( String(dossierTemplateId) )}/${encodeURIComponent(String(templateId))}`, { @@ -263,9 +263,7 @@ export class ReportTemplateControllerService { return this.httpClient.request>( 'get', - `${this.basePath}/redaction-gateway-v1/templateUpload/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/templateUpload/${encodeURIComponent(String(dossierTemplateId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -355,9 +353,7 @@ export class ReportTemplateControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/templateUpload/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/templateUpload/${encodeURIComponent(String(dossierTemplateId))}`, { body: convertFormParamsToString ? formParams.toString() : formParams, withCredentials: this.configuration.withCredentials, diff --git a/libs/red-ui-http/src/lib/api/uploadController.service.ts b/libs/red-ui-http/src/lib/api/uploadController.service.ts index 66b6245ca..51a96bc64 100644 --- a/libs/red-ui-http/src/lib/api/uploadController.service.ts +++ b/libs/red-ui-http/src/lib/api/uploadController.service.ts @@ -135,7 +135,7 @@ export class UploadControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/upload/${encodeURIComponent(String(dossierId))}`, + `${this.basePath}/upload/${encodeURIComponent(String(dossierId))}`, { body: convertFormParamsToString ? formParams.toString() : formParams, withCredentials: this.configuration.withCredentials, diff --git a/libs/red-ui-http/src/lib/api/watermarkController.service.ts b/libs/red-ui-http/src/lib/api/watermarkController.service.ts index 8617bc6a4..f2be33e20 100644 --- a/libs/red-ui-http/src/lib/api/watermarkController.service.ts +++ b/libs/red-ui-http/src/lib/api/watermarkController.service.ts @@ -95,9 +95,7 @@ export class WatermarkControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/redaction-gateway-v1/watermark/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/watermark/${encodeURIComponent(String(dossierTemplateId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -161,9 +159,7 @@ export class WatermarkControllerService { return this.httpClient.request( 'get', - `${this.basePath}/redaction-gateway-v1/watermark/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/watermark/${encodeURIComponent(String(dossierTemplateId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -246,9 +242,7 @@ export class WatermarkControllerService { return this.httpClient.request( 'post', - `${this.basePath}/redaction-gateway-v1/watermark/${encodeURIComponent( - String(dossierTemplateId) - )}`, + `${this.basePath}/watermark/${encodeURIComponent(String(dossierTemplateId))}`, { body: body, withCredentials: this.configuration.withCredentials,