From caec8cc007f9c7689a008af3ea50dd5b32075cd5 Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 6 Jan 2021 14:59:27 +0200 Subject: [PATCH] ruleSet basics --- README.md | 3 +- apps/red-ui/src/assets/config/config.json | 2 +- libs/red-ui-http/src/lib/api/api.ts | 23 +- .../src/lib/api/debugController.service.ts | 11 +- .../lib/api/dictionaryController.service.ts | 418 ++++++++++------ .../api/fileManagementController.service.ts | 51 +- .../src/lib/api/infoController.service.ts | 25 +- .../legalBasisMappingController.service.ts | 66 ++- .../api/licenseReportController.service.ts | 39 +- .../api/manualRedactionController.service.ts | 454 +++++------------ .../src/lib/api/projectController.service.ts | 216 +++----- .../lib/api/redactionLogController.service.ts | 36 +- .../src/lib/api/ruleSetController.service.ts | 228 +++++++++ .../src/lib/api/rulesController.service.ts | 159 ++---- .../src/lib/api/userController.service.ts | 465 ++++++++---------- .../api/userPreferenceController.service.ts | 192 ++++++++ .../src/lib/api/versionsController.service.ts | 110 +++-- .../lib/api/viewedPagesController.service.ts | 208 ++------ .../lib/api/watermarkController.service.ts | 89 ++-- libs/red-ui-http/src/lib/model/dictionary.ts | 4 + libs/red-ui-http/src/lib/model/fileStatus.ts | 9 +- libs/red-ui-http/src/lib/model/idRemoval.ts | 1 + .../src/lib/model/manualRedactionEntry.ts | 1 + libs/red-ui-http/src/lib/model/models.ts | 1 + libs/red-ui-http/src/lib/model/project.ts | 2 + .../src/lib/model/projectRequest.ts | 4 + .../red-ui-http/src/lib/model/redactionLog.ts | 1 + libs/red-ui-http/src/lib/model/reportData.ts | 1 + .../red-ui-http/src/lib/model/ruleSetModel.ts | 50 ++ libs/red-ui-http/src/lib/model/rules.ts | 4 + libs/red-ui-http/src/lib/model/typeValue.ts | 6 + .../src/lib/model/watermarkModel.ts | 10 + 32 files changed, 1558 insertions(+), 1331 deletions(-) create mode 100644 libs/red-ui-http/src/lib/api/ruleSetController.service.ts create mode 100644 libs/red-ui-http/src/lib/api/userPreferenceController.service.ts create mode 100644 libs/red-ui-http/src/lib/model/ruleSetModel.ts diff --git a/README.md b/README.md index 73cab8642..088a24339 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,11 @@ To regnerate http rune swaagger ``` -BASE=https://redapi-staging.iqser.cloud/ +BASE=http://localhost:8080/ URL="$BASE"v2/api-docs?group=redaction-gateway-v1 mkdir -p /tmp/swagger swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger +cd /tmp/swagger ``` ## To Create a new Stack in rancher diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index d447e7e9e..bfcb40971 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,5 +1,5 @@ { "OAUTH_URL": "https://redkc-staging.iqser.cloud/auth/realms/redaction", "OAUTH_CLIENT_ID": "redaction", - "API_URL": "https://redapi-staging.iqser.cloud" + "API_URL": "https://timo-redaction-dev.iqser.cloud" } diff --git a/libs/red-ui-http/src/lib/api/api.ts b/libs/red-ui-http/src/lib/api/api.ts index 702c2f624..867707001 100644 --- a/libs/red-ui-http/src/lib/api/api.ts +++ b/libs/red-ui-http/src/lib/api/api.ts @@ -1,25 +1,31 @@ -import { VersionsControllerService } from './versionsController.service'; - export * from './debugController.service'; import { DebugControllerService } from './debugController.service'; import { DictionaryControllerService } from './dictionaryController.service'; import { FileManagementControllerService } from './fileManagementController.service'; +import { InfoControllerService } from './infoController.service'; +import { LegalBasisMappingControllerService } from './legalBasisMappingController.service'; import { LicenseReportControllerService } from './licenseReportController.service'; import { ManualRedactionControllerService } from './manualRedactionController.service'; import { ProjectControllerService } from './projectController.service'; import { ReanalysisControllerService } from './reanalysisController.service'; import { RedactionLogControllerService } from './redactionLogController.service'; +import { RuleSetControllerService } from './ruleSetController.service'; import { RulesControllerService } from './rulesController.service'; import { StatusControllerService } from './statusController.service'; import { UserControllerService } from './userController.service'; +import { UserPreferenceControllerService } from './userPreferenceController.service'; +import { VersionsControllerService } from './versionsController.service'; import { ViewedPagesControllerService } from './viewedPagesController.service'; -import { LegalBasisMappingControllerService } from './legalBasisMappingController.service'; import { WatermarkControllerService } from './watermarkController.service'; export * from './dictionaryController.service'; export * from './fileManagementController.service'; +export * from './infoController.service'; + +export * from './legalBasisMappingController.service'; + export * from './licenseReportController.service'; export * from './manualRedactionController.service'; @@ -30,34 +36,39 @@ export * from './reanalysisController.service'; export * from './redactionLogController.service'; +export * from './ruleSetController.service'; + export * from './rulesController.service'; export * from './statusController.service'; export * from './userController.service'; +export * from './userPreferenceController.service'; + export * from './versionsController.service'; export * from './viewedPagesController.service'; -export * from './legalBasisMappingController.service'; - export * from './watermarkController.service'; export const APIS = [ DebugControllerService, DictionaryControllerService, FileManagementControllerService, + InfoControllerService, + LegalBasisMappingControllerService, LicenseReportControllerService, ManualRedactionControllerService, ProjectControllerService, ReanalysisControllerService, RedactionLogControllerService, + RuleSetControllerService, RulesControllerService, StatusControllerService, UserControllerService, + UserPreferenceControllerService, VersionsControllerService, ViewedPagesControllerService, - LegalBasisMappingControllerService, WatermarkControllerService ]; diff --git a/libs/red-ui-http/src/lib/api/debugController.service.ts b/libs/red-ui-http/src/lib/api/debugController.service.ts index b71f1cf6f..becb2fc38 100644 --- a/libs/red-ui-http/src/lib/api/debugController.service.ts +++ b/libs/red-ui-http/src/lib/api/debugController.service.ts @@ -68,7 +68,7 @@ export class DebugControllerService { } // to determine the Accept header - const httpHeaderAccepts: string[] = ['application/octet-stream']; + const httpHeaderAccepts: string[] = ['*/*']; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); @@ -138,7 +138,7 @@ export class DebugControllerService { } // to determine the Accept header - const httpHeaderAccepts: string[] = ['application/octet-stream']; + const httpHeaderAccepts: string[] = ['*/*']; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); @@ -165,8 +165,7 @@ export class DebugControllerService { formParams = (formParams.append('file', file) as any) || formParams; } - return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, { - responseType: 'text', + return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, { body: convertFormParamsToString ? formParams.toString() : formParams, params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -209,7 +208,7 @@ export class DebugControllerService { } // to determine the Accept header - const httpHeaderAccepts: string[] = ['application/octet-stream']; + const httpHeaderAccepts: string[] = ['*/*']; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); @@ -283,7 +282,7 @@ export class DebugControllerService { } // to determine the Accept header - const httpHeaderAccepts: string[] = ['application/octet-stream']; + const httpHeaderAccepts: string[] = ['*/*']; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); 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 7d270e0dc..e4320abd6 100644 --- a/libs/red-ui-http/src/lib/api/dictionaryController.service.ts +++ b/libs/red-ui-http/src/lib/api/dictionaryController.service.ts @@ -27,9 +27,9 @@ import { Configuration } from '../configuration'; @Injectable() export class DictionaryControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { @@ -41,33 +41,44 @@ export class DictionaryControllerService { } } - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - /** * Add dictionary entries with entry type. * None * @param body entries * @param type type + * @param ruleSetId ruleSetId * @param removeCurrent removeCurrent * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public addEntry(body: Array, type: string, removeCurrent?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - public addEntry(body: Array, type: string, removeCurrent?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; - public addEntry(body: Array, type: string, removeCurrent?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; - public addEntry(body: Array, type: string, removeCurrent?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { + public addEntry(body: Array, type: string, ruleSetId: string, removeCurrent?: boolean, observe?: 'body', reportProgress?: boolean): Observable; + + public addEntry( + body: Array, + type: string, + ruleSetId: string, + removeCurrent?: boolean, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public addEntry( + body: Array, + type: string, + ruleSetId: string, + removeCurrent?: boolean, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public addEntry( + body: Array, + type: string, + ruleSetId: string, + removeCurrent?: boolean, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addEntry.'); } @@ -76,6 +87,10 @@ export class DictionaryControllerService { throw new Error('Required parameter type was null or undefined when calling addEntry.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling addEntry.'); + } + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); if (removeCurrent !== undefined && removeCurrent !== null) { queryParameters = queryParameters.set('removeCurrent', removeCurrent); @@ -103,31 +118,43 @@ export class DictionaryControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, { - body: body, - params: queryParameters, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'post', + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, + { + body: body, + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } /** * Creates entry type with colors, hint and caseInsensitive * None * @param body typeValue + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public addType(body: TypeValue, observe?: 'body', reportProgress?: boolean): Observable; - public addType(body: TypeValue, observe?: 'response', reportProgress?: boolean): Observable>; - public addType(body: TypeValue, observe?: 'events', reportProgress?: boolean): Observable>; - public addType(body: TypeValue, observe: any = 'body', reportProgress: boolean = false): Observable { + public addType(body: TypeValue, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public addType(body: TypeValue, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public addType(body: TypeValue, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public addType(body: TypeValue, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addType.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling addType.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -150,7 +177,7 @@ export class DictionaryControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/dictionary/type`, { + return this.httpClient.request('post', `${this.basePath}/dictionary/type/${encodeURIComponent(String(ruleSetId))}`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, @@ -164,19 +191,27 @@ export class DictionaryControllerService { * None * @param body entries * @param type type + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteEntry(body: Array, type: string, observe?: 'body', reportProgress?: boolean): Observable; - public deleteEntry(body: Array, type: string, observe?: 'response', reportProgress?: boolean): Observable>; - public deleteEntry(body: Array, type: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteEntry(body: Array, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public deleteEntries(body: Array, type: string, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteEntries(body: Array, type: string, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public deleteEntries(body: Array, type: string, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public deleteEntries(body: Array, type: string, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling deleteEntry.'); + throw new Error('Required parameter body was null or undefined when calling deleteEntries.'); } if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling deleteEntry.'); + throw new Error('Required parameter type was null or undefined when calling deleteEntries.'); + } + + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling deleteEntries.'); } let headers = this.defaultHeaders; @@ -195,34 +230,51 @@ export class DictionaryControllerService { } // to determine the Content-Type header - const consumes: string[] = ['*/*']; + const consumes: string[] = ['application/json']; const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('delete', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'post', + `${this.basePath}/dictionary/delete/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } /** - * Deletes entry type + * Delete dictionary entry with entry type. * None * @param type type + * @param ruleSetId ruleSetId + * @param entry entry * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteType(type: string, observe?: 'body', reportProgress?: boolean): Observable; - public deleteType(type: string, observe?: 'response', reportProgress?: boolean): Observable>; - public deleteType(type: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteType(type: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public deleteEntry(type: string, ruleSetId: string, entry: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteEntry(type: string, ruleSetId: string, entry: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public deleteEntry(type: string, ruleSetId: string, entry: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public deleteEntry(type: string, ruleSetId: string, entry: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling deleteType.'); + throw new Error('Required parameter type was null or undefined when calling deleteEntry.'); + } + + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling deleteEntry.'); + } + + if (entry === null || entry === undefined) { + throw new Error('Required parameter entry was null or undefined when calling deleteEntry.'); } let headers = this.defaultHeaders; @@ -243,32 +295,39 @@ export class DictionaryControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('delete', `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}`, { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'delete', + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}/${encodeURIComponent(String(entry))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } /** - * Delete dictionary entries with entry type. + * Deletes entry type * None - * @param body entries * @param type type + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteEntries(body: Array, type: string, observe?: 'body', reportProgress?: boolean): Observable; - public deleteEntries(body: Array, type: string, observe?: 'response', reportProgress?: boolean): Observable>; - public deleteEntries(body: Array, type: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteEntries(body: Array, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling deleteEntries.'); + public deleteType(type: string, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteType(type: string, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public deleteType(type: string, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public deleteType(type: string, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (type === null || type === undefined) { + throw new Error('Required parameter type was null or undefined when calling deleteType.'); } - if (type === null || type === undefined) { - throw new Error('Required parameter type was null or undefined when calling deleteEntries.'); + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling deleteType.'); } let headers = this.defaultHeaders; @@ -287,36 +346,43 @@ export class DictionaryControllerService { } // to determine the Content-Type header - const consumes: string[] = ['application/json']; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } + const consumes: string[] = []; - return this.httpClient.request('post', `${this.basePath}/dictionary/delete/${encodeURIComponent(String(type))}`, { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'delete', + `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } /** * Returns file containing the the dictionary entries for given type.. * * @param type type + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public downloadDictionaryFile(type: string, observe?: 'body', reportProgress?: boolean): Observable; - public downloadDictionaryFile(type: string, observe?: 'response', reportProgress?: boolean): Observable>; - public downloadDictionaryFile(type: string, observe?: 'events', reportProgress?: boolean): Observable>; - public downloadDictionaryFile(type: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public downloadDictionaryFile(type: string, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public downloadDictionaryFile(type: string, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public downloadDictionaryFile(type: string, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public downloadDictionaryFile(type: string, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling downloadDictionaryFile.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling downloadDictionaryFile.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -335,24 +401,36 @@ export class DictionaryControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/dictionary/download/${encodeURIComponent(String(type))}`, { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'get', + `${this.basePath}/dictionary/download/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } /** * Retrieve all entry types * None + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getAllTypes(observe?: 'body', reportProgress?: boolean): Observable; - public getAllTypes(observe?: 'response', reportProgress?: boolean): Observable>; - public getAllTypes(observe?: 'events', reportProgress?: boolean): Observable>; - public getAllTypes(observe: any = 'body', reportProgress: boolean = false): Observable { + public getAllTypes(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getAllTypes(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getAllTypes(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getAllTypes(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getAllTypes.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -371,7 +449,7 @@ export class DictionaryControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/dictionary/type`, { + return this.httpClient.request('get', `${this.basePath}/dictionary/type/${encodeURIComponent(String(ruleSetId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -382,13 +460,21 @@ export class DictionaryControllerService { /** * Retrieves system colors for redaction. * None + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getColors(observe?: 'body', reportProgress?: boolean): Observable; - public getColors(observe?: 'response', reportProgress?: boolean): Observable>; - public getColors(observe?: 'events', reportProgress?: boolean): Observable>; - public getColors(observe: any = 'body', reportProgress: boolean = false): Observable { + public getColors(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getColors(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getColors(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getColors(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getColors.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -407,7 +493,7 @@ export class DictionaryControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/color`, { + return this.httpClient.request('get', `${this.basePath}/color/${encodeURIComponent(String(ruleSetId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -419,17 +505,25 @@ export class DictionaryControllerService { * Retrieves all dictionary entries of an entry type * None * @param type type + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getDictionaryForType(type: string, observe?: 'body', reportProgress?: boolean): Observable; - public getDictionaryForType(type: string, observe?: 'response', reportProgress?: boolean): Observable>; - public getDictionaryForType(type: string, observe?: 'events', reportProgress?: boolean): Observable>; - public getDictionaryForType(type: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public getDictionaryForType(type: string, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getDictionaryForType(type: string, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getDictionaryForType(type: string, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getDictionaryForType(type: string, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (type === null || type === undefined) { throw new Error('Required parameter type was null or undefined when calling getDictionaryForType.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getDictionaryForType.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -448,29 +542,41 @@ export class DictionaryControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}`, { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'get', + `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } /** * Set system colors for redaction * * @param body colors + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public setColors(body: Colors, observe?: 'body', reportProgress?: boolean): Observable; - public setColors(body: Colors, observe?: 'response', reportProgress?: boolean): Observable>; - public setColors(body: Colors, observe?: 'events', reportProgress?: boolean): Observable>; - public setColors(body: Colors, observe: any = 'body', reportProgress: boolean = false): Observable { + public setColors(body: Colors, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setColors(body: Colors, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setColors(body: Colors, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setColors(body: Colors, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling setColors.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling setColors.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -493,7 +599,7 @@ export class DictionaryControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/color`, { + return this.httpClient.request('post', `${this.basePath}/color/${encodeURIComponent(String(ruleSetId))}`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, @@ -507,13 +613,17 @@ export class DictionaryControllerService { * None * @param body typeValue * @param type type + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public updateType(body: UpdateTypeValue, type: string, observe?: 'body', reportProgress?: boolean): Observable; - public updateType(body: UpdateTypeValue, type: string, observe?: 'response', reportProgress?: boolean): Observable>; - public updateType(body: UpdateTypeValue, type: string, observe?: 'events', reportProgress?: boolean): Observable>; - public updateType(body: UpdateTypeValue, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public updateType(body: UpdateTypeValue, type: string, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public updateType(body: UpdateTypeValue, type: string, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public updateType(body: UpdateTypeValue, type: string, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public updateType(body: UpdateTypeValue, type: string, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling updateType.'); } @@ -522,6 +632,10 @@ export class DictionaryControllerService { throw new Error('Required parameter type was null or undefined when calling updateType.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling updateType.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -544,13 +658,17 @@ export class DictionaryControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}`, { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'post', + `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); } /** @@ -558,13 +676,17 @@ export class DictionaryControllerService { * * @param file * @param type type + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public uploadDictionaryFileForm(file: Blob, type: string, observe?: 'body', reportProgress?: boolean): Observable; - public uploadDictionaryFileForm(file: Blob, type: string, observe?: 'response', reportProgress?: boolean): Observable>; - public uploadDictionaryFileForm(file: Blob, type: string, observe?: 'events', reportProgress?: boolean): Observable>; - public uploadDictionaryFileForm(file: Blob, type: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public uploadDictionaryFileForm(file: Blob, type: string, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public uploadDictionaryFileForm(file: Blob, type: string, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public uploadDictionaryFileForm(file: Blob, type: string, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public uploadDictionaryFileForm(file: Blob, type: string, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (file === null || file === undefined) { throw new Error('Required parameter file was null or undefined when calling uploadDictionaryFile.'); } @@ -573,6 +695,10 @@ export class DictionaryControllerService { throw new Error('Required parameter type was null or undefined when calling uploadDictionaryFile.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling uploadDictionaryFile.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -609,12 +735,30 @@ export class DictionaryControllerService { formParams = (formParams.append('file', file) as any) || formParams; } - return this.httpClient.request('post', `${this.basePath}/dictionary/upload/${encodeURIComponent(String(type))}`, { - body: convertFormParamsToString ? formParams.toString() : formParams, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return this.httpClient.request( + 'post', + `${this.basePath}/dictionary/upload/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, + { + body: convertFormParamsToString ? formParams.toString() : formParams, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; } } 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 c7efca00d..ab2ebafa0 100644 --- a/libs/red-ui-http/src/lib/api/fileManagementController.service.ts +++ b/libs/red-ui-http/src/lib/api/fileManagementController.service.ts @@ -25,9 +25,9 @@ import { Configuration } from '../configuration'; @Injectable() export class FileManagementControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { @@ -39,20 +39,6 @@ export class FileManagementControllerService { } } - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - /** * Deletes a file for a given projectId and FileId * None @@ -62,8 +48,11 @@ export class FileManagementControllerService { * @param reportProgress flag to report request and response progress. */ public deleteFile(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteFile(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public deleteFile(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public deleteFile(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { throw new Error('Required parameter projectId was null or undefined when calling deleteFile.'); @@ -112,8 +101,11 @@ export class FileManagementControllerService { * @param reportProgress flag to report request and response progress. */ public deleteFiles(body: Array, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteFiles(body: Array, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public deleteFiles(body: Array, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public deleteFiles(body: Array, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling deleteFiles.'); @@ -195,6 +187,9 @@ export class FileManagementControllerService { if (inline !== undefined && inline !== null) { queryParameters = queryParameters.set('inline', inline); } + if (indicator !== undefined && indicator !== null) { + queryParameters = queryParameters.set('indicator', indicator); + } let headers = this.defaultHeaders; @@ -361,6 +356,7 @@ export class FileManagementControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public downloadRedactedFiles( body: BulkDownloadRedactedRequest, projectId: string, @@ -368,6 +364,7 @@ export class FileManagementControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public downloadRedactedFiles( body: BulkDownloadRedactedRequest, projectId: string, @@ -375,6 +372,7 @@ export class FileManagementControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public downloadRedactedFiles( body: BulkDownloadRedactedRequest, projectId: string, @@ -438,6 +436,7 @@ export class FileManagementControllerService { * @param reportProgress flag to report request and response progress. */ public downloadRedactionReport(body: FileIds, inline?: boolean, template?: string, observe?: 'body', reportProgress?: boolean): Observable; + public downloadRedactionReport( body: FileIds, inline?: boolean, @@ -445,6 +444,7 @@ export class FileManagementControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public downloadRedactionReport( body: FileIds, inline?: boolean, @@ -452,6 +452,7 @@ export class FileManagementControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public downloadRedactionReport( body: FileIds, inline?: boolean, @@ -520,6 +521,7 @@ export class FileManagementControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public downloadRedactionReportForProject( projectId: string, inline?: boolean, @@ -527,6 +529,7 @@ export class FileManagementControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public downloadRedactionReportForProject( projectId: string, inline?: boolean, @@ -534,6 +537,7 @@ export class FileManagementControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public downloadRedactionReportForProject( projectId: string, inline?: boolean, @@ -590,8 +594,11 @@ export class FileManagementControllerService { * @param reportProgress flag to report request and response progress. */ public uploadFileForm(file: Blob, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + public uploadFileForm(file: Blob, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public uploadFileForm(file: Blob, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public uploadFileForm(file: Blob, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (file === null || file === undefined) { throw new Error('Required parameter file was null or undefined when calling uploadFile.'); @@ -645,4 +652,18 @@ export class FileManagementControllerService { reportProgress: reportProgress }); } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } } diff --git a/libs/red-ui-http/src/lib/api/infoController.service.ts b/libs/red-ui-http/src/lib/api/infoController.service.ts index b01a58263..33e41b1a8 100644 --- a/libs/red-ui-http/src/lib/api/infoController.service.ts +++ b/libs/red-ui-http/src/lib/api/infoController.service.ts @@ -26,11 +26,7 @@ export class InfoControllerService { public configuration = new Configuration(); protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -48,33 +44,22 @@ export class InfoControllerService { */ public getAuthInfo(observe?: 'body', reportProgress?: boolean): Observable; - public getAuthInfo( - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public getAuthInfo(observe?: 'response', reportProgress?: boolean): Observable>; - public getAuthInfo( - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public getAuthInfo(observe?: 'events', reportProgress?: boolean): Observable>; public getAuthInfo(observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } diff --git a/libs/red-ui-http/src/lib/api/legalBasisMappingController.service.ts b/libs/red-ui-http/src/lib/api/legalBasisMappingController.service.ts index b0ee87cdf..1563177fb 100644 --- a/libs/red-ui-http/src/lib/api/legalBasisMappingController.service.ts +++ b/libs/red-ui-http/src/lib/api/legalBasisMappingController.service.ts @@ -22,9 +22,9 @@ import { Configuration } from '../configuration'; @Injectable() export class LegalBasisMappingControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { @@ -36,30 +36,24 @@ export class LegalBasisMappingControllerService { } } - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - /** * Set the mapping between legal basis and redaction reason. * None + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getLegalBasisMapping(observe?: 'body', reportProgress?: boolean): Observable; - public getLegalBasisMapping(observe?: 'response', reportProgress?: boolean): Observable>; - public getLegalBasisMapping(observe?: 'events', reportProgress?: boolean): Observable>; - public getLegalBasisMapping(observe: any = 'body', reportProgress: boolean = false): Observable { + public getLegalBasisMapping(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getLegalBasisMapping(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getLegalBasisMapping(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getLegalBasisMapping(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getLegalBasisMapping.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -78,7 +72,7 @@ export class LegalBasisMappingControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/legalBasis`, { + return this.httpClient.request('get', `${this.basePath}/legalBasis/${encodeURIComponent(String(ruleSetId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -90,17 +84,25 @@ export class LegalBasisMappingControllerService { * Set the mapping between legal basis and redaction reason. * None * @param body legalBasisMapping + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public setLegalBasisMapping(body: LegalBasisMapping, observe?: 'body', reportProgress?: boolean): Observable; - public setLegalBasisMapping(body: LegalBasisMapping, observe?: 'response', reportProgress?: boolean): Observable>; - public setLegalBasisMapping(body: LegalBasisMapping, observe?: 'events', reportProgress?: boolean): Observable>; - public setLegalBasisMapping(body: LegalBasisMapping, observe: any = 'body', reportProgress: boolean = false): Observable { + public setLegalBasisMapping(body: LegalBasisMapping, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setLegalBasisMapping(body: LegalBasisMapping, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setLegalBasisMapping(body: LegalBasisMapping, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setLegalBasisMapping(body: LegalBasisMapping, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling setLegalBasisMapping.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling setLegalBasisMapping.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -123,7 +125,7 @@ export class LegalBasisMappingControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/legalBasis`, { + return this.httpClient.request('post', `${this.basePath}/legalBasis/${encodeURIComponent(String(ruleSetId))}`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, @@ -131,4 +133,18 @@ export class LegalBasisMappingControllerService { reportProgress: reportProgress }); } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } } diff --git a/libs/red-ui-http/src/lib/api/licenseReportController.service.ts b/libs/red-ui-http/src/lib/api/licenseReportController.service.ts index 0b29c1c62..3a23cdc9c 100644 --- a/libs/red-ui-http/src/lib/api/licenseReportController.service.ts +++ b/libs/red-ui-http/src/lib/api/licenseReportController.service.ts @@ -28,11 +28,7 @@ export class LicenseReportControllerService { public configuration = new Configuration(); protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -51,13 +47,7 @@ export class LicenseReportControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public licenseReport( - body: LicenseReportRequest, - offset?: number, - limit?: number, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public licenseReport(body: LicenseReportRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; public licenseReport( body: LicenseReportRequest, @@ -75,17 +65,9 @@ export class LicenseReportControllerService { reportProgress?: boolean ): Observable>; - public licenseReport( - body: LicenseReportRequest, - offset?: number, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public licenseReport(body: LicenseReportRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling licenseReport.' - ); + throw new Error('Required parameter body was null or undefined when calling licenseReport.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); @@ -100,27 +82,20 @@ export class LicenseReportControllerService { // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } diff --git a/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts b/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts index 7fa583b15..39ba46009 100644 --- a/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts +++ b/libs/red-ui-http/src/lib/api/manualRedactionController.service.ts @@ -28,15 +28,11 @@ import { Configuration } from '../configuration'; @Injectable() export class ManualRedactionControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -46,20 +42,6 @@ export class ManualRedactionControllerService { } } - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - /** * Adds a comment to a redaction/redaction request * None @@ -78,6 +60,7 @@ export class ManualRedactionControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public addComment( body: AddCommentRequest, projectId: string, @@ -86,6 +69,7 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public addComment( body: AddCommentRequest, projectId: string, @@ -94,6 +78,7 @@ export class ManualRedactionControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public addComment( body: AddCommentRequest, projectId: string, @@ -103,63 +88,48 @@ export class ManualRedactionControllerService { reportProgress: boolean = false ): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling addComment.' - ); + throw new Error('Required parameter body was null or undefined when calling addComment.'); } if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling addComment.' - ); + throw new Error('Required parameter projectId was null or undefined when calling addComment.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling addComment.' - ); + throw new Error('Required parameter fileId was null or undefined when calling addComment.'); } if (annotationId === null || annotationId === undefined) { - throw new Error( - 'Required parameter annotationId was null or undefined when calling addComment.' - ); + throw new Error('Required parameter annotationId was null or undefined when calling addComment.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.request( 'post', - `${this.basePath}/manualRedaction/comment/add/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + `${this.basePath}/manualRedaction/comment/add/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent( + String(annotationId) + )}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -186,6 +156,7 @@ export class ManualRedactionControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public addRedaction( body: AddRedactionRequest, projectId: string, @@ -193,6 +164,7 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public addRedaction( body: AddRedactionRequest, projectId: string, @@ -200,65 +172,45 @@ export class ManualRedactionControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; - public addRedaction( - body: AddRedactionRequest, - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + + public addRedaction(body: AddRedactionRequest, projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling addRedaction.' - ); + throw new Error('Required parameter body was null or undefined when calling addRedaction.'); } if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling addRedaction.' - ); + throw new Error('Required parameter projectId was null or undefined when calling addRedaction.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling addRedaction.' - ); + throw new Error('Required parameter fileId was null or undefined when calling addRedaction.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.request( 'post', - `${this.basePath}/manualRedaction/redaction/add/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/manualRedaction/redaction/add/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -287,6 +239,7 @@ export class ManualRedactionControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public approveRequest( body: ApproveRequest, projectId: string, @@ -295,6 +248,7 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public approveRequest( body: ApproveRequest, projectId: string, @@ -303,6 +257,7 @@ export class ManualRedactionControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public approveRequest( body: ApproveRequest, projectId: string, @@ -312,63 +267,48 @@ export class ManualRedactionControllerService { reportProgress: boolean = false ): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling approveRequest.' - ); + throw new Error('Required parameter body was null or undefined when calling approveRequest.'); } if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling approveRequest.' - ); + throw new Error('Required parameter projectId was null or undefined when calling approveRequest.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling approveRequest.' - ); + throw new Error('Required parameter fileId was null or undefined when calling approveRequest.'); } if (annotationId === null || annotationId === undefined) { - throw new Error( - 'Required parameter annotationId was null or undefined when calling approveRequest.' - ); + throw new Error('Required parameter annotationId was null or undefined when calling approveRequest.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.request( 'post', - `${this.basePath}/manualRedaction/approve/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + `${this.basePath}/manualRedaction/approve/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent( + String(annotationId) + )}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -388,13 +328,8 @@ export class ManualRedactionControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public declineRequest( - projectId: string, - fileId: string, - annotationId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public declineRequest(projectId: string, fileId: string, annotationId: string, observe?: 'body', reportProgress?: boolean): Observable; + public declineRequest( projectId: string, fileId: string, @@ -402,54 +337,33 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; - public declineRequest( - projectId: string, - fileId: string, - annotationId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public declineRequest( - projectId: string, - fileId: string, - annotationId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + + public declineRequest(projectId: string, fileId: string, annotationId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public declineRequest(projectId: string, fileId: string, annotationId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling declineRequest.' - ); + throw new Error('Required parameter projectId was null or undefined when calling declineRequest.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling declineRequest.' - ); + throw new Error('Required parameter fileId was null or undefined when calling declineRequest.'); } if (annotationId === null || annotationId === undefined) { - throw new Error( - 'Required parameter annotationId was null or undefined when calling declineRequest.' - ); + throw new Error('Required parameter annotationId was null or undefined when calling declineRequest.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -459,9 +373,9 @@ export class ManualRedactionControllerService { return this.httpClient.request( 'post', - `${this.basePath}/manualRedaction/decline/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + `${this.basePath}/manualRedaction/decline/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent( + String(annotationId) + )}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -479,58 +393,32 @@ export class ManualRedactionControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getManualRedaction( - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public getManualRedaction( - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public getManualRedaction( - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public getManualRedaction( - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public getManualRedaction(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getManualRedaction(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getManualRedaction(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getManualRedaction(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling getManualRedaction.' - ); + throw new Error('Required parameter projectId was null or undefined when calling getManualRedaction.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling getManualRedaction.' - ); + throw new Error('Required parameter fileId was null or undefined when calling getManualRedaction.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -540,9 +428,7 @@ export class ManualRedactionControllerService { return this.httpClient.request( 'get', - `${this.basePath}/manualRedaction/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/manualRedaction/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -551,6 +437,7 @@ export class ManualRedactionControllerService { } ); } + /** * Removes a redaction * None @@ -567,6 +454,7 @@ export class ManualRedactionControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public removeRedaction( body: RemoveRedactionRequest, projectId: string, @@ -574,6 +462,7 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public removeRedaction( body: RemoveRedactionRequest, projectId: string, @@ -581,6 +470,7 @@ export class ManualRedactionControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public removeRedaction( body: RemoveRedactionRequest, projectId: string, @@ -589,57 +479,42 @@ export class ManualRedactionControllerService { reportProgress: boolean = false ): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling removeRedaction.' - ); + throw new Error('Required parameter body was null or undefined when calling removeRedaction.'); } if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling removeRedaction.' - ); + throw new Error('Required parameter projectId was null or undefined when calling removeRedaction.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling removeRedaction.' - ); + throw new Error('Required parameter fileId was null or undefined when calling removeRedaction.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.request( 'post', - `${this.basePath}/manualRedaction/redaction/remove/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/manualRedaction/redaction/remove/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -666,6 +541,7 @@ export class ManualRedactionControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public requestAddRedaction( body: AddRedactionRequest, projectId: string, @@ -673,6 +549,7 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public requestAddRedaction( body: AddRedactionRequest, projectId: string, @@ -680,6 +557,7 @@ export class ManualRedactionControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public requestAddRedaction( body: AddRedactionRequest, projectId: string, @@ -688,57 +566,42 @@ export class ManualRedactionControllerService { reportProgress: boolean = false ): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling requestAddRedaction.' - ); + throw new Error('Required parameter body was null or undefined when calling requestAddRedaction.'); } if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling requestAddRedaction.' - ); + throw new Error('Required parameter projectId was null or undefined when calling requestAddRedaction.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling requestAddRedaction.' - ); + throw new Error('Required parameter fileId was null or undefined when calling requestAddRedaction.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.request( 'post', - `${this.basePath}/manualRedaction/request/add/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/manualRedaction/request/add/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -765,6 +628,7 @@ export class ManualRedactionControllerService { observe?: 'body', reportProgress?: boolean ): Observable; + public requestRemoveRedaction( body: RemoveRedactionRequest, projectId: string, @@ -772,6 +636,7 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public requestRemoveRedaction( body: RemoveRedactionRequest, projectId: string, @@ -779,6 +644,7 @@ export class ManualRedactionControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public requestRemoveRedaction( body: RemoveRedactionRequest, projectId: string, @@ -787,57 +653,42 @@ export class ManualRedactionControllerService { reportProgress: boolean = false ): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling requestRemoveRedaction.' - ); + throw new Error('Required parameter body was null or undefined when calling requestRemoveRedaction.'); } if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling requestRemoveRedaction.' - ); + throw new Error('Required parameter projectId was null or undefined when calling requestRemoveRedaction.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling requestRemoveRedaction.' - ); + throw new Error('Required parameter fileId was null or undefined when calling requestRemoveRedaction.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.request( 'post', - `${this.basePath}/manualRedaction/request/remove/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/manualRedaction/request/remove/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -857,38 +708,15 @@ export class ManualRedactionControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public undo( - projectId: string, - fileId: string, - annotationId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public undo( - projectId: string, - fileId: string, - annotationId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public undo( - projectId: string, - fileId: string, - annotationId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public undo( - projectId: string, - fileId: string, - annotationId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public undo(projectId: string, fileId: string, annotationId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public undo(projectId: string, fileId: string, annotationId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public undo(projectId: string, fileId: string, annotationId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public undo(projectId: string, fileId: string, annotationId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling undo.' - ); + throw new Error('Required parameter projectId was null or undefined when calling undo.'); } if (fileId === null || fileId === undefined) { @@ -896,27 +724,20 @@ export class ManualRedactionControllerService { } if (annotationId === null || annotationId === undefined) { - throw new Error( - 'Required parameter annotationId was null or undefined when calling undo.' - ); + throw new Error('Required parameter annotationId was null or undefined when calling undo.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -926,9 +747,9 @@ export class ManualRedactionControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/manualRedaction/undo/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(annotationId))}`, + `${this.basePath}/manualRedaction/undo/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent( + String(annotationId) + )}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -948,14 +769,8 @@ export class ManualRedactionControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public undoComment( - projectId: string, - fileId: string, - annotationId: string, - commentId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public undoComment(projectId: string, fileId: string, annotationId: string, commentId: string, observe?: 'body', reportProgress?: boolean): Observable; + public undoComment( projectId: string, fileId: string, @@ -964,6 +779,7 @@ export class ManualRedactionControllerService { observe?: 'response', reportProgress?: boolean ): Observable>; + public undoComment( projectId: string, fileId: string, @@ -972,6 +788,7 @@ export class ManualRedactionControllerService { observe?: 'events', reportProgress?: boolean ): Observable>; + public undoComment( projectId: string, fileId: string, @@ -981,45 +798,32 @@ export class ManualRedactionControllerService { reportProgress: boolean = false ): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling undoComment.' - ); + throw new Error('Required parameter projectId was null or undefined when calling undoComment.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling undoComment.' - ); + throw new Error('Required parameter fileId was null or undefined when calling undoComment.'); } if (annotationId === null || annotationId === undefined) { - throw new Error( - 'Required parameter annotationId was null or undefined when calling undoComment.' - ); + throw new Error('Required parameter annotationId was null or undefined when calling undoComment.'); } if (commentId === null || commentId === undefined) { - throw new Error( - 'Required parameter commentId was null or undefined when calling undoComment.' - ); + throw new Error('Required parameter commentId was null or undefined when calling undoComment.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -1029,9 +833,7 @@ export class ManualRedactionControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/manualRedaction/comment/undo/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent( + `${this.basePath}/manualRedaction/comment/undo/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent( String(annotationId) )}/${encodeURIComponent(String(commentId))}`, { @@ -1042,4 +844,18 @@ export class ManualRedactionControllerService { } ); } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } } diff --git a/libs/red-ui-http/src/lib/api/projectController.service.ts b/libs/red-ui-http/src/lib/api/projectController.service.ts index 302a311bb..2ef5615d4 100644 --- a/libs/red-ui-http/src/lib/api/projectController.service.ts +++ b/libs/red-ui-http/src/lib/api/projectController.service.ts @@ -23,15 +23,11 @@ import { Configuration } from '../configuration'; @Injectable() export class ProjectControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -42,77 +38,41 @@ export class ProjectControllerService { } /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - - /** - * Creates or update a project. + * Creates or updates a project. * None * @param body project * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createProjectOrUpdateProject( - body: ProjectRequest, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public createProjectOrUpdateProject( - body: ProjectRequest, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public createProjectOrUpdateProject( - body: ProjectRequest, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public createProjectOrUpdateProject( - body: ProjectRequest, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public createOrUpdateProject(body: ProjectRequest, observe?: 'body', reportProgress?: boolean): Observable; + + public createOrUpdateProject(body: ProjectRequest, observe?: 'response', reportProgress?: boolean): Observable>; + + public createOrUpdateProject(body: ProjectRequest, observe?: 'events', reportProgress?: boolean): Observable>; + + public createOrUpdateProject(body: ProjectRequest, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling createProjectOrUpdateProject.' - ); + throw new Error('Required parameter body was null or undefined when calling createOrUpdateProject.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } @@ -133,48 +93,28 @@ export class ProjectControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteProject( - projectId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public deleteProject( - projectId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public deleteProject( - projectId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public deleteProject( - projectId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public deleteProject(projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteProject(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public deleteProject(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public deleteProject(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling deleteProject.' - ); + throw new Error('Required parameter projectId was null or undefined when calling deleteProject.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -182,16 +122,12 @@ export class ProjectControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request( - 'delete', - `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('delete', `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } /** @@ -201,48 +137,28 @@ export class ProjectControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getProject( - projectId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public getProject( - projectId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public getProject( - projectId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public getProject( - projectId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public getProject(projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getProject(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getProject(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getProject(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling getProject.' - ); + throw new Error('Required parameter projectId was null or undefined when calling getProject.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -250,16 +166,12 @@ export class ProjectControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request( - 'get', - `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('get', `${this.basePath}/project/${encodeURIComponent(String(projectId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } /** @@ -269,31 +181,23 @@ export class ProjectControllerService { * @param reportProgress flag to report request and response progress. */ public getProjects(observe?: 'body', reportProgress?: boolean): Observable>; - public getProjects( - observe?: 'response', - reportProgress?: boolean - ): Observable>>; - public getProjects( - observe?: 'events', - reportProgress?: boolean - ): Observable>>; + + public getProjects(observe?: 'response', reportProgress?: boolean): Observable>>; + + public getProjects(observe?: 'events', reportProgress?: boolean): Observable>>; + public getProjects(observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -308,4 +212,18 @@ export class ProjectControllerService { reportProgress: reportProgress }); } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } } diff --git a/libs/red-ui-http/src/lib/api/redactionLogController.service.ts b/libs/red-ui-http/src/lib/api/redactionLogController.service.ts index b927ab456..57c4c8db1 100644 --- a/libs/red-ui-http/src/lib/api/redactionLogController.service.ts +++ b/libs/red-ui-http/src/lib/api/redactionLogController.service.ts @@ -23,9 +23,9 @@ import { Configuration } from '../configuration'; @Injectable() export class RedactionLogControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { @@ -37,20 +37,6 @@ export class RedactionLogControllerService { } } - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - /** * Gets the redaction log for a fileId * None @@ -59,8 +45,11 @@ export class RedactionLogControllerService { * @param reportProgress flag to report request and response progress. */ public getRedactionLog(fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + public getRedactionLog(fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public getRedactionLog(fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public getRedactionLog(fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (fileId === null || fileId === undefined) { throw new Error('Required parameter fileId was null or undefined when calling getRedactionLog.'); @@ -100,8 +89,11 @@ export class RedactionLogControllerService { * @param reportProgress flag to report request and response progress. */ public getSectionGrid(fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + public getSectionGrid(fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public getSectionGrid(fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public getSectionGrid(fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (fileId === null || fileId === undefined) { throw new Error('Required parameter fileId was null or undefined when calling getSectionGrid.'); @@ -132,4 +124,18 @@ export class RedactionLogControllerService { reportProgress: reportProgress }); } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } } diff --git a/libs/red-ui-http/src/lib/api/ruleSetController.service.ts b/libs/red-ui-http/src/lib/api/ruleSetController.service.ts new file mode 100644 index 000000000..e902e4b8f --- /dev/null +++ b/libs/red-ui-http/src/lib/api/ruleSetController.service.ts @@ -0,0 +1,228 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ /* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { Observable } from 'rxjs'; + +import { RuleSetModel } from '../model/ruleSetModel'; + +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; + +@Injectable() +export class RuleSetControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + } + + /** + * Creates a new RuleSets or updates an existing one. + * None + * @param body ruleSetModel + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public createOrUpdateRuleSet(body: RuleSetModel, observe?: 'body', reportProgress?: boolean): Observable; + + public createOrUpdateRuleSet(body: RuleSetModel, observe?: 'response', reportProgress?: boolean): Observable>; + + public createOrUpdateRuleSet(body: RuleSetModel, observe?: 'events', reportProgress?: boolean): Observable>; + + public createOrUpdateRuleSet(body: RuleSetModel, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createOrUpdateRuleSet.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['*/*']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('post', `${this.basePath}/rule-set/${encodeURIComponent(String(ruleSetId))}`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Get a specific RuleSet by its ID + * None + * @param ruleSetId ruleSetId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getAllRuleSets(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getAllRuleSets(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getAllRuleSets(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getAllRuleSets(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getAllRuleSets.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('delete', `${this.basePath}/rule-set/${encodeURIComponent(String(ruleSetId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Lists all existing RuleSets. + * None + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getAllRuleSets1(observe?: 'body', reportProgress?: boolean): Observable>; + + public getAllRuleSets1(observe?: 'response', reportProgress?: boolean): Observable>>; + + public getAllRuleSets1(observe?: 'events', reportProgress?: boolean): Observable>>; + + public getAllRuleSets1(observe: any = 'body', reportProgress: boolean = false): Observable { + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['application/json']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request>('get', `${this.basePath}/rule-set`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Get a specific RuleSet by its ID + * None + * @param ruleSetId ruleSetId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getAllRuleSets2(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getAllRuleSets2(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getAllRuleSets2(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getAllRuleSets2(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getAllRuleSets2.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['application/json']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/rule-set/${encodeURIComponent(String(ruleSetId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } +} diff --git a/libs/red-ui-http/src/lib/api/rulesController.service.ts b/libs/red-ui-http/src/lib/api/rulesController.service.ts index 9a651b498..1463c66ce 100644 --- a/libs/red-ui-http/src/lib/api/rulesController.service.ts +++ b/libs/red-ui-http/src/lib/api/rulesController.service.ts @@ -27,11 +27,7 @@ export class RulesControllerService { public configuration = new Configuration(); protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -44,38 +40,32 @@ export class RulesControllerService { /** * Returns object containing the currently used Drools rules. * + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public downloadRules(observe?: 'body', reportProgress?: boolean): Observable; + public downloadRules(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; - public downloadRules( - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public downloadRules(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public downloadRules( - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public downloadRules(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public downloadRules(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling downloadRules.'); + } - public downloadRules(observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -83,7 +73,7 @@ export class RulesControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/rules`, { + return this.httpClient.request('get', `${this.basePath}/rules/${encodeURIComponent(String(ruleSetId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -94,41 +84,32 @@ export class RulesControllerService { /** * Returns file containing the currently used Drools rules. * + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public downloadRulesFile(observe?: 'body', reportProgress?: boolean): Observable; + public downloadRulesFile(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; - public downloadRulesFile( - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public downloadRulesFile(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public downloadRulesFile( - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public downloadRulesFile(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public downloadRulesFile(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling downloadRulesFile.'); + } - public downloadRulesFile( - observe: any = 'body', - reportProgress: boolean = false - ): Observable { let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header - const httpHeaderAccepts: string[] = ['application/octet-stream']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAccepts: string[] = ['*/*']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -136,7 +117,7 @@ export class RulesControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/rules/download`, { + return this.httpClient.request('get', `${this.basePath}/rules/${encodeURIComponent(String(ruleSetId))}/download`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -148,64 +129,48 @@ export class RulesControllerService { * Takes object containing string or rules as argument, which will be used by the redaction service. * * @param body rules + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public uploadRules(body: Rules, observe?: 'body', reportProgress?: boolean): Observable; + public uploadRules(body: Rules, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; - public uploadRules( - body: Rules, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public uploadRules(body: Rules, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public uploadRules( - body: Rules, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public uploadRules(body: Rules, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public uploadRules( - body: Rules, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public uploadRules(body: Rules, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling uploadRules.' - ); + throw new Error('Required parameter body was null or undefined when calling uploadRules.'); + } + + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling uploadRules.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/rules`, { + return this.httpClient.request('post', `${this.basePath}/rules/${encodeURIComponent(String(ruleSetId))}`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, @@ -218,54 +183,36 @@ export class RulesControllerService { * Takes object containing string or rules as argument, which will be used by the redaction service. * * @param file + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public uploadRulesFileForm( - file: Blob, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public uploadRulesFileForm(file: Blob, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; - public uploadRulesFileForm( - file: Blob, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public uploadRulesFileForm(file: Blob, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public uploadRulesFileForm( - file: Blob, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public uploadRulesFileForm(file: Blob, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public uploadRulesFileForm( - file: Blob, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public uploadRulesFileForm(file: Blob, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (file === null || file === undefined) { - throw new Error( - 'Required parameter file was null or undefined when calling uploadRulesFile.' - ); + throw new Error('Required parameter file was null or undefined when calling uploadRulesFile.'); + } + + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling uploadRulesFile.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -291,7 +238,7 @@ export class RulesControllerService { formParams = (formParams.append('file', file) as any) || formParams; } - return this.httpClient.request('post', `${this.basePath}/rules/upload`, { + return this.httpClient.request('post', `${this.basePath}/rules/${encodeURIComponent(String(ruleSetId))}/upload`, { body: convertFormParamsToString ? formParams.toString() : formParams, withCredentials: this.configuration.withCredentials, headers: headers, diff --git a/libs/red-ui-http/src/lib/api/userController.service.ts b/libs/red-ui-http/src/lib/api/userController.service.ts index 2347b77a6..81fb6e6eb 100644 --- a/libs/red-ui-http/src/lib/api/userController.service.ts +++ b/libs/red-ui-http/src/lib/api/userController.service.ts @@ -16,6 +16,8 @@ import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs'; +import { RolesRequest } from '../model/rolesRequest'; +import { User } from '../model/user'; import { UserRequest } from '../model/userRequest'; import { UserResponse } from '../model/userResponse'; @@ -28,11 +30,7 @@ export class UserControllerService { public configuration = new Configuration(); protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -45,64 +43,39 @@ export class UserControllerService { /** * Add admin role to users * None - * @param body userIds + * @param body rolesRequest * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public addAdminRoleToUsers( - body: Array, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public addAdminRoleToUsers(body: RolesRequest, observe?: 'body', reportProgress?: boolean): Observable; - public addAdminRoleToUsers( - body: Array, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public addAdminRoleToUsers(body: RolesRequest, observe?: 'response', reportProgress?: boolean): Observable>; - public addAdminRoleToUsers( - body: Array, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public addAdminRoleToUsers(body: RolesRequest, observe?: 'events', reportProgress?: boolean): Observable>; - public addAdminRoleToUsers( - body: Array, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public addAdminRoleToUsers(body: RolesRequest, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling addAdminRoleToUsers.' - ); + throw new Error('Required parameter body was null or undefined when calling addAdminRoleToUsers.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } @@ -119,158 +92,142 @@ export class UserControllerService { /** * Add a role to users * None - * @param body userIds + * @param body rolesRequest * @param role role * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public addRoleToUsers( - body: Array, - role: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public addRoleToUsers(body: RolesRequest, role: string, observe?: 'body', reportProgress?: boolean): Observable; - public addRoleToUsers( - body: Array, - role: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public addRoleToUsers(body: RolesRequest, role: string, observe?: 'response', reportProgress?: boolean): Observable>; - public addRoleToUsers( - body: Array, - role: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public addRoleToUsers(body: RolesRequest, role: string, observe?: 'events', reportProgress?: boolean): Observable>; - public addRoleToUsers( - body: Array, - role: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public addRoleToUsers(body: RolesRequest, role: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling addRoleToUsers.' - ); + throw new Error('Required parameter body was null or undefined when calling addRoleToUsers.'); } if (role === null || role === undefined) { - throw new Error( - 'Required parameter role was null or undefined when calling addRoleToUsers.' - ); + throw new Error('Required parameter role was null or undefined when calling addRoleToUsers.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request( - 'post', - `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('post', `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } /** - * Delete admin role from users + * Delete admin role from user * None - * @param body userIds + * @param userId userId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteAdminRoleFromUsers( - body: Array, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public deleteAdminRoleFromUser(userId: string, observe?: 'body', reportProgress?: boolean): Observable; - public deleteAdminRoleFromUsers( - body: Array, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public deleteAdminRoleFromUser(userId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public deleteAdminRoleFromUsers( - body: Array, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public deleteAdminRoleFromUser(userId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteAdminRoleFromUsers( - body: Array, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { - if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling deleteAdminRoleFromUsers.' - ); + public deleteAdminRoleFromUser(userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (userId === null || userId === undefined) { + throw new Error('Required parameter userId was null or undefined when calling deleteAdminRoleFromUser.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - const consumes: string[] = ['*/*']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const consumes: string[] = []; + + return this.httpClient.request('delete', `${this.basePath}/user/admin/${encodeURIComponent(String(userId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Delete admin role from users + * None + * @param body rolesRequest + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteAdminRoleFromUsers(body: RolesRequest, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteAdminRoleFromUsers(body: RolesRequest, observe?: 'response', reportProgress?: boolean): Observable>; + + public deleteAdminRoleFromUsers(body: RolesRequest, observe?: 'events', reportProgress?: boolean): Observable>; + + public deleteAdminRoleFromUsers(body: RolesRequest, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling deleteAdminRoleFromUsers.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('delete', `${this.basePath}/user/admin`, { + return this.httpClient.request('put', `${this.basePath}/user/admin`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, @@ -279,93 +236,107 @@ export class UserControllerService { }); } + /** + * Delete a role from user + * None + * @param role role + * @param userId userId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteRoleFromUser(role: string, userId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteRoleFromUser(role: string, userId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public deleteRoleFromUser(role: string, userId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public deleteRoleFromUser(role: string, userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (role === null || role === undefined) { + throw new Error('Required parameter role was null or undefined when calling deleteRoleFromUser.'); + } + + if (userId === null || userId === undefined) { + throw new Error('Required parameter userId was null or undefined when calling deleteRoleFromUser.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('delete', `${this.basePath}/user/role/${encodeURIComponent(String(role))}/${encodeURIComponent(String(userId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + /** * Delete a role from users * None - * @param body userIds + * @param body rolesRequest * @param role role * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteRoleFromUsers( - body: Array, - role: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public deleteRoleFromUsers(body: RolesRequest, role: string, observe?: 'body', reportProgress?: boolean): Observable; - public deleteRoleFromUsers( - body: Array, - role: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public deleteRoleFromUsers(body: RolesRequest, role: string, observe?: 'response', reportProgress?: boolean): Observable>; - public deleteRoleFromUsers( - body: Array, - role: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public deleteRoleFromUsers(body: RolesRequest, role: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteRoleFromUsers( - body: Array, - role: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public deleteRoleFromUsers(body: RolesRequest, role: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling deleteRoleFromUsers.' - ); + throw new Error('Required parameter body was null or undefined when calling deleteRoleFromUsers.'); } if (role === null || role === undefined) { - throw new Error( - 'Required parameter role was null or undefined when calling deleteRoleFromUsers.' - ); + throw new Error('Required parameter role was null or undefined when calling deleteRoleFromUsers.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header - const consumes: string[] = ['*/*']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request( - 'delete', - `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, - { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('post', `${this.basePath}/user/role/delete/${encodeURIComponent(String(role))}`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } /** @@ -377,13 +348,7 @@ export class UserControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getAllUsers( - body: UserRequest, - offset?: number, - limit?: number, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; public getAllUsers( body: UserRequest, @@ -393,25 +358,11 @@ export class UserControllerService { reportProgress?: boolean ): Observable>; - public getAllUsers( - body: UserRequest, - offset?: number, - limit?: number, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable>; - public getAllUsers( - body: UserRequest, - offset?: number, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { - throw new Error( - 'Required parameter body was null or undefined when calling getAllUsers.' - ); + throw new Error('Required parameter body was null or undefined when calling getAllUsers.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); @@ -426,27 +377,20 @@ export class UserControllerService { // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } @@ -461,6 +405,50 @@ export class UserControllerService { }); } + /** + * Gets the user in realm with information of roles. + * None + * @param userId userId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getUserById(userId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getUserById(userId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getUserById(userId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getUserById(userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (userId === null || userId === undefined) { + throw new Error('Required parameter userId was null or undefined when calling getUserById.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['application/json']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/user/${encodeURIComponent(String(userId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + /** * Gets the users who contain redaction roles. * None @@ -470,37 +458,13 @@ export class UserControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getUsers( - body: UserRequest, - offset?: number, - limit?: number, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; - public getUsers( - body: UserRequest, - offset?: number, - limit?: number, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable>; - public getUsers( - body: UserRequest, - offset?: number, - limit?: number, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable>; - public getUsers( - body: UserRequest, - offset?: number, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public getUsers(body: UserRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling getUsers.'); } @@ -517,27 +481,20 @@ export class UserControllerService { // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } diff --git a/libs/red-ui-http/src/lib/api/userPreferenceController.service.ts b/libs/red-ui-http/src/lib/api/userPreferenceController.service.ts new file mode 100644 index 000000000..8599a0b17 --- /dev/null +++ b/libs/red-ui-http/src/lib/api/userPreferenceController.service.ts @@ -0,0 +1,192 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ /* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; + +import { Observable } from 'rxjs'; + +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; + +@Injectable() +export class UserPreferenceControllerService { + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + protected basePath = ''; + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + } + + /** + * Delete User Preferences by key. + * None + * @param key key + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deletePreferences(key: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deletePreferences(key: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public deletePreferences(key: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public deletePreferences(key: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (key === null || key === undefined) { + throw new Error('Required parameter key was null or undefined when calling deletePreferences.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('delete', `${this.basePath}/preferences/${encodeURIComponent(String(key))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Get User Preferences by key. + * None + * @param key key + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getPreferences(key: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getPreferences(key: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getPreferences(key: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getPreferences(key: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (key === null || key === undefined) { + throw new Error('Required parameter key was null or undefined when calling getPreferences.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['application/json']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request('get', `${this.basePath}/preferences/${encodeURIComponent(String(key))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Store User JSON Preferences. + * None + * @param body jsonNode + * @param key key + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public savePreferences(body: any, key: string, observe?: 'body', reportProgress?: boolean): Observable; + + public savePreferences(body: any, key: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public savePreferences(body: any, key: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public savePreferences(body: any, key: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling savePreferences.'); + } + + if (key === null || key === undefined) { + throw new Error('Required parameter key was null or undefined when calling savePreferences.'); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('put', `${this.basePath}/preferences/${encodeURIComponent(String(key))}`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } +} diff --git a/libs/red-ui-http/src/lib/api/versionsController.service.ts b/libs/red-ui-http/src/lib/api/versionsController.service.ts index 31f9f00a6..f7a70a002 100644 --- a/libs/red-ui-http/src/lib/api/versionsController.service.ts +++ b/libs/red-ui-http/src/lib/api/versionsController.service.ts @@ -11,7 +11,8 @@ */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs'; @@ -22,15 +23,11 @@ import { Configuration } from '../configuration'; @Injectable() export class VersionsControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -40,6 +37,58 @@ export class VersionsControllerService { } } + /** + * Retrieves current versions. + * None + * @param ruleSetId ruleSetId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getVersions(ruleSetId: Array, observe?: 'body', reportProgress?: boolean): Observable<{ [key: string]: VersionsResponse }>; + + public getVersions(ruleSetId: Array, observe?: 'response', reportProgress?: boolean): Observable>; + + public getVersions(ruleSetId: Array, observe?: 'events', reportProgress?: boolean): Observable>; + + public getVersions(ruleSetId: Array, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getVersions.'); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (ruleSetId) { + ruleSetId.forEach((element) => { + queryParameters = queryParameters.append('ruleSetId', element); + }); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = ['*/*']; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = []; + + return this.httpClient.request<{ [key: string]: VersionsResponse }>('get', `${this.basePath}/version`, { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + /** * @param consumes string[] mime-types * @return true: consumes contains 'multipart/form-data', false: otherwise @@ -53,51 +102,4 @@ export class VersionsControllerService { } return false; } - - /** - * Retrieves current versions. - * None - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getVersions(observe?: 'body', reportProgress?: boolean): Observable; - public getVersions( - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public getVersions( - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public getVersions(observe: any = 'body', reportProgress: boolean = false): Observable { - let headers = this.defaultHeaders; - - // authentication (RED-OAUTH) required - if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers = headers.set('Authorization', 'Bearer ' + accessToken); - } - - // to determine the Accept header - const httpHeaderAccepts: string[] = ['*/*']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); - if (httpHeaderAcceptSelected !== undefined) { - headers = headers.set('Accept', httpHeaderAcceptSelected); - } - - // to determine the Content-Type header - const consumes: string[] = []; - - return this.httpClient.request('get', `${this.basePath}/version`, { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); - } } diff --git a/libs/red-ui-http/src/lib/api/viewedPagesController.service.ts b/libs/red-ui-http/src/lib/api/viewedPagesController.service.ts index 9691491d1..ec9616768 100644 --- a/libs/red-ui-http/src/lib/api/viewedPagesController.service.ts +++ b/libs/red-ui-http/src/lib/api/viewedPagesController.service.ts @@ -23,15 +23,11 @@ import { Configuration } from '../configuration'; @Injectable() export class ViewedPagesControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string, - @Optional() configuration: Configuration - ) { + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } @@ -41,20 +37,6 @@ export class ViewedPagesControllerService { } } - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - /** * Adds a page to the viewed pages * None @@ -64,84 +46,50 @@ export class ViewedPagesControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public addPage( - body: ViewedPagesRequest, - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public addPage( - body: ViewedPagesRequest, - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public addPage( - body: ViewedPagesRequest, - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public addPage( - body: ViewedPagesRequest, - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public addPage(body: ViewedPagesRequest, projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public addPage(body: ViewedPagesRequest, projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public addPage(body: ViewedPagesRequest, projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public addPage(body: ViewedPagesRequest, projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addPage.'); } if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling addPage.' - ); + throw new Error('Required parameter projectId was null or undefined when calling addPage.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling addPage.' - ); + throw new Error('Required parameter fileId was null or undefined when calling addPage.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = ['application/json']; - const httpContentTypeSelected: - | string - | undefined = this.configuration.selectHeaderContentType(consumes); + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.request( 'post', - `${this.basePath}/viewedPages/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/viewedPages/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { body: body, withCredentials: this.configuration.withCredentials, @@ -160,58 +108,32 @@ export class ViewedPagesControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getViewedPages( - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public getViewedPages( - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public getViewedPages( - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public getViewedPages( - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public getViewedPages(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getViewedPages(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getViewedPages(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getViewedPages(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling getViewedPages.' - ); + throw new Error('Required parameter projectId was null or undefined when calling getViewedPages.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling getViewedPages.' - ); + throw new Error('Required parameter fileId was null or undefined when calling getViewedPages.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = ['application/json']; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -221,9 +143,7 @@ export class ViewedPagesControllerService { return this.httpClient.request( 'get', - `${this.basePath}/viewedPages/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/viewedPages/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -242,68 +162,36 @@ export class ViewedPagesControllerService { * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public removePage( - projectId: string, - fileId: string, - page: number, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public removePage( - projectId: string, - fileId: string, - page: number, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public removePage( - projectId: string, - fileId: string, - page: number, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public removePage( - projectId: string, - fileId: string, - page: number, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public removePage(projectId: string, fileId: string, page: number, observe?: 'body', reportProgress?: boolean): Observable; + + public removePage(projectId: string, fileId: string, page: number, observe?: 'response', reportProgress?: boolean): Observable>; + + public removePage(projectId: string, fileId: string, page: number, observe?: 'events', reportProgress?: boolean): Observable>; + + public removePage(projectId: string, fileId: string, page: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { - throw new Error( - 'Required parameter projectId was null or undefined when calling removePage.' - ); + throw new Error('Required parameter projectId was null or undefined when calling removePage.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling removePage.' - ); + throw new Error('Required parameter fileId was null or undefined when calling removePage.'); } if (page === null || page === undefined) { - throw new Error( - 'Required parameter page was null or undefined when calling removePage.' - ); + throw new Error('Required parameter page was null or undefined when calling removePage.'); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { - const accessToken = - typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; - const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept( - httpHeaderAccepts - ); + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } @@ -313,9 +201,7 @@ export class ViewedPagesControllerService { return this.httpClient.request( 'delete', - `${this.basePath}/viewedPages/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(page))}`, + `${this.basePath}/viewedPages/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(page))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -324,4 +210,18 @@ export class ViewedPagesControllerService { } ); } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } } 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 1a7d4561c..0bf6e6f1c 100644 --- a/libs/red-ui-http/src/lib/api/watermarkController.service.ts +++ b/libs/red-ui-http/src/lib/api/watermarkController.service.ts @@ -11,21 +11,20 @@ */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpEvent } from '@angular/common/http'; -import { CustomHttpUrlEncodingCodec } from '../encoder'; +import { HttpClient, HttpEvent, HttpHeaders, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { WatermarkModel } from '../model/watermarkModel'; -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { BASE_PATH } from '../variables'; import { Configuration } from '../configuration'; @Injectable() export class WatermarkControllerService { - protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); + protected basePath = ''; constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { @@ -37,30 +36,24 @@ export class WatermarkControllerService { } } - /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise - */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } - } - return false; - } - /** * Remove watermark configuration * None + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public deleteWatermark(observe?: 'body', reportProgress?: boolean): Observable; - public deleteWatermark(observe?: 'response', reportProgress?: boolean): Observable>; - public deleteWatermark(observe?: 'events', reportProgress?: boolean): Observable>; - public deleteWatermark(observe: any = 'body', reportProgress: boolean = false): Observable { + public deleteWatermark(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public deleteWatermark(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public deleteWatermark(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public deleteWatermark(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling deleteWatermark.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -79,7 +72,7 @@ export class WatermarkControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('delete', `${this.basePath}/watermark`, { + return this.httpClient.request('delete', `${this.basePath}/watermark/${encodeURIComponent(String(ruleSetId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -90,13 +83,21 @@ export class WatermarkControllerService { /** * Get the current watermark configuration * None + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getWatermark(observe?: 'body', reportProgress?: boolean): Observable; - public getWatermark(observe?: 'response', reportProgress?: boolean): Observable>; - public getWatermark(observe?: 'events', reportProgress?: boolean): Observable>; - public getWatermark(observe: any = 'body', reportProgress: boolean = false): Observable { + public getWatermark(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getWatermark(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getWatermark(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getWatermark(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getWatermark.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -115,7 +116,7 @@ export class WatermarkControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('get', `${this.basePath}/watermark`, { + return this.httpClient.request('get', `${this.basePath}/watermark/${encodeURIComponent(String(ruleSetId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -127,17 +128,25 @@ export class WatermarkControllerService { * Save/Update watermark configuration * None * @param body watermark + * @param ruleSetId ruleSetId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public saveWatermark(body: WatermarkModel, observe?: 'body', reportProgress?: boolean): Observable; - public saveWatermark(body: WatermarkModel, observe?: 'response', reportProgress?: boolean): Observable>; - public saveWatermark(body: WatermarkModel, observe?: 'events', reportProgress?: boolean): Observable>; - public saveWatermark(body: WatermarkModel, observe: any = 'body', reportProgress: boolean = false): Observable { + public saveWatermark(body: WatermarkModel, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public saveWatermark(body: WatermarkModel, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public saveWatermark(body: WatermarkModel, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public saveWatermark(body: WatermarkModel, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling saveWatermark.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling saveWatermark.'); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -160,7 +169,7 @@ export class WatermarkControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/watermark`, { + return this.httpClient.request('post', `${this.basePath}/watermark/${encodeURIComponent(String(ruleSetId))}`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, @@ -168,4 +177,18 @@ export class WatermarkControllerService { reportProgress: reportProgress }); } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } } diff --git a/libs/red-ui-http/src/lib/model/dictionary.ts b/libs/red-ui-http/src/lib/model/dictionary.ts index 85eaf981f..21affb047 100644 --- a/libs/red-ui-http/src/lib/model/dictionary.ts +++ b/libs/red-ui-http/src/lib/model/dictionary.ts @@ -38,4 +38,8 @@ export interface Dictionary { * True if the type just for recommendations, not for redaction, default is false. */ recommendation?: boolean; + /** + * The RuleSet Id for this type + */ + ruleSetId?: string; } diff --git a/libs/red-ui-http/src/lib/model/fileStatus.ts b/libs/red-ui-http/src/lib/model/fileStatus.ts index 761d906d5..92c0a68a6 100644 --- a/libs/red-ui-http/src/lib/model/fileStatus.ts +++ b/libs/red-ui-http/src/lib/model/fileStatus.ts @@ -30,10 +30,6 @@ export interface FileStatus { * The current reviewer's (if any) user id. */ currentReviewer?: string; - /** - * The last reviewer's (if any) user id. - */ - lastReviewer?: string; /** * Shows which dictionary versions was used during the analysis. */ @@ -62,6 +58,10 @@ export interface FileStatus { * Shows the last date of a successful analysis. */ lastProcessed?: string; + /** + * The last reviewer's (if any) user id. + */ + lastReviewer?: string; /** * Date and time when the file was last updated. */ @@ -95,6 +95,7 @@ export interface FileStatus { */ uploader?: string; } + export namespace FileStatus { export type StatusEnum = 'UNPROCESSED' | 'REPROCESS' | 'PROCESSING' | 'ERROR' | 'UNASSIGNED' | 'UNDER_REVIEW' | 'UNDER_APPROVAL' | 'APPROVED'; export const StatusEnum = { diff --git a/libs/red-ui-http/src/lib/model/idRemoval.ts b/libs/red-ui-http/src/lib/model/idRemoval.ts index 58803a625..a2835cc8e 100644 --- a/libs/red-ui-http/src/lib/model/idRemoval.ts +++ b/libs/red-ui-http/src/lib/model/idRemoval.ts @@ -18,6 +18,7 @@ export interface IdRemoval { status?: IdRemoval.StatusEnum; user?: string; } + export namespace IdRemoval { export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; export const StatusEnum = { diff --git a/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts b/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts index e3876d517..eba2e8a4e 100644 --- a/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts +++ b/libs/red-ui-http/src/lib/model/manualRedactionEntry.ts @@ -24,6 +24,7 @@ export interface ManualRedactionEntry { user?: string; value?: string; } + export namespace ManualRedactionEntry { export type StatusEnum = 'REQUESTED' | 'APPROVED' | 'DECLINED'; export const StatusEnum = { diff --git a/libs/red-ui-http/src/lib/model/models.ts b/libs/red-ui-http/src/lib/model/models.ts index 4b80e558e..1273dc7b1 100644 --- a/libs/red-ui-http/src/lib/model/models.ts +++ b/libs/red-ui-http/src/lib/model/models.ts @@ -28,6 +28,7 @@ export * from './redactionLogEntry'; export * from './removeRedactionRequest'; export * from './reportData'; export * from './rolesRequest'; +export * from './ruleSetModel'; export * from './rules'; export * from './sectionGrid'; export * from './sectionRectangle'; diff --git a/libs/red-ui-http/src/lib/model/project.ts b/libs/red-ui-http/src/lib/model/project.ts index 5ea78ad67..119d1b1c1 100644 --- a/libs/red-ui-http/src/lib/model/project.ts +++ b/libs/red-ui-http/src/lib/model/project.ts @@ -18,8 +18,10 @@ export interface Project { ownerId?: string; projectId?: string; projectName?: string; + ruleSetId?: string; status?: Project.StatusEnum; } + export namespace Project { export type StatusEnum = 'ACTIVE' | 'DELETED'; export const StatusEnum = { diff --git a/libs/red-ui-http/src/lib/model/projectRequest.ts b/libs/red-ui-http/src/lib/model/projectRequest.ts index 8ffdbeb60..e45926891 100644 --- a/libs/red-ui-http/src/lib/model/projectRequest.ts +++ b/libs/red-ui-http/src/lib/model/projectRequest.ts @@ -38,4 +38,8 @@ export interface ProjectRequest { * The name of the project. Must be unique. */ projectName?: string; + /** + * The ruleSetId for this project. can be null for update request. + */ + ruleSetId?: string; } diff --git a/libs/red-ui-http/src/lib/model/redactionLog.ts b/libs/red-ui-http/src/lib/model/redactionLog.ts index fa177e171..4ac23dc46 100644 --- a/libs/red-ui-http/src/lib/model/redactionLog.ts +++ b/libs/red-ui-http/src/lib/model/redactionLog.ts @@ -15,5 +15,6 @@ export interface RedactionLog { dictionaryVersion?: number; filename?: string; redactionLogEntry?: Array; + ruleSetId?: string; rulesVersion?: number; } diff --git a/libs/red-ui-http/src/lib/model/reportData.ts b/libs/red-ui-http/src/lib/model/reportData.ts index af9ed5956..c756cb181 100644 --- a/libs/red-ui-http/src/lib/model/reportData.ts +++ b/libs/red-ui-http/src/lib/model/reportData.ts @@ -20,6 +20,7 @@ export interface ReportData { project?: string; status?: ReportData.StatusEnum; } + export namespace ReportData { export type StatusEnum = 'UNPROCESSED' | 'REPROCESS' | 'PROCESSING' | 'ERROR' | 'DELETED' | 'UNASSIGNED' | 'UNDER_REVIEW' | 'UNDER_APPROVAL' | 'APPROVED'; export const StatusEnum = { diff --git a/libs/red-ui-http/src/lib/model/ruleSetModel.ts b/libs/red-ui-http/src/lib/model/ruleSetModel.ts new file mode 100644 index 000000000..7f87a9f66 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/ruleSetModel.ts @@ -0,0 +1,50 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface RuleSetModel { + /** + * The userId of the user who created this RuleSet. Set by the system. + */ + createdBy?: string; + /** + * The date when this ruleSet was created. Set by System on create. + */ + dateAdded?: string; + /** + * The date when this ruleSet was last modified. Set by System on create. + */ + dateModified?: string; + /** + * The description of this ruleSet + */ + description?: string; + /** + * The userId of the user who last modified this RuleSet. Set by the system. + */ + modifiedBy?: string; + /** + * The name of this ruleSet. Must be set on create / update requests + */ + name?: string; + /** + * The Rule Set Id. Generated by the system on create. + */ + ruleSetId?: string; + /** + * Validity of start this ruleSet. + */ + validFrom?: string; + /** + * Validity of end this ruleSet. + */ + validTo?: string; +} diff --git a/libs/red-ui-http/src/lib/model/rules.ts b/libs/red-ui-http/src/lib/model/rules.ts index cd673e28a..3a4d5f6fd 100644 --- a/libs/red-ui-http/src/lib/model/rules.ts +++ b/libs/red-ui-http/src/lib/model/rules.ts @@ -18,4 +18,8 @@ export interface Rules { * The actual string of rules. */ rules?: string; + /** + * The ruleSetId for these rules + */ + ruleSetId?: string; } diff --git a/libs/red-ui-http/src/lib/model/typeValue.ts b/libs/red-ui-http/src/lib/model/typeValue.ts index 7692c3268..db8f726cb 100644 --- a/libs/red-ui-http/src/lib/model/typeValue.ts +++ b/libs/red-ui-http/src/lib/model/typeValue.ts @@ -39,6 +39,12 @@ export interface TypeValue { * The nonnull entry type. */ type?: string; + + /** + * The ruleSetId for this type + */ + ruleSetId?: string; + isDefaultFilter?: boolean; virtual?: boolean; diff --git a/libs/red-ui-http/src/lib/model/watermarkModel.ts b/libs/red-ui-http/src/lib/model/watermarkModel.ts index 224991b67..17b7826bd 100644 --- a/libs/red-ui-http/src/lib/model/watermarkModel.ts +++ b/libs/red-ui-http/src/lib/model/watermarkModel.ts @@ -15,4 +15,14 @@ export interface WatermarkModel { hexColor?: string; opacity?: number; text?: string; + watermarkOrientation?: WatermarkModel.WatermarkOrientationEnum; +} + +export namespace WatermarkModel { + export type WatermarkOrientationEnum = 'VERTICAL' | 'HORIZONTAL' | 'ROTATE_LEFT_45_DEG'; + export const WatermarkOrientationEnum = { + VERTICAL: 'VERTICAL' as WatermarkOrientationEnum, + HORIZONTAL: 'HORIZONTAL' as WatermarkOrientationEnum, + ROTATELEFT45DEG: 'ROTATE_LEFT_45_DEG' as WatermarkOrientationEnum + }; }