From 2c9cf1e164e0fe626c71823cce7474d0ef39c0e8 Mon Sep 17 00:00:00 2001 From: Timo Date: Tue, 11 May 2021 16:22:57 +0300 Subject: [PATCH] api compatibility --- .../dictionary-listing-screen.component.ts | 11 +- .../dictionary-overview-screen.component.ts | 8 +- .../lib/api/dictionaryController.service.ts | 414 ++++++++++++------ .../src/lib/api/versionsController.service.ts | 85 +++- 4 files changed, 356 insertions(+), 162 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts index c9997ae8e..e8dc49242 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts @@ -2,8 +2,8 @@ import { Component, Injector, OnInit } from '@angular/core'; import { DoughnutChartConfig } from '@shared/components/simple-doughnut-chart/simple-doughnut-chart.component'; import { DictionaryControllerService, TypeValue } from '@redaction/red-ui-http'; import { AppStateService } from '@state/app-state.service'; -import { defaultIfEmpty, tap } from 'rxjs/operators'; -import { forkJoin } from 'rxjs'; +import { catchError, defaultIfEmpty, tap } from 'rxjs/operators'; +import { forkJoin, of } from 'rxjs'; import { PermissionsService } from '@services/permissions.service'; import { ActivatedRoute } from '@angular/router'; import { AdminDialogService } from '../../services/admin-dialog.service'; @@ -61,9 +61,14 @@ export class DictionaryListingScreenComponent extends BaseListingComponent !d.virtual); this.displayedEntities = [...this.allEntities]; const dataObs = this.allEntities.map((dict) => - this._dictionaryControllerService.getDictionaryForType(dict.type, this._appStateService.activeRuleSetId).pipe( + this._dictionaryControllerService.getDictionaryForType(this._appStateService.activeRuleSetId, dict.type).pipe( tap((values) => { dict.entries = values.entries ? values.entries : []; + }), + catchError(() => { + console.log('error'); + dict.entries = []; + return of({}); }) ) ); diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts index 5713878c1..53200eafb 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-overview/dictionary-overview-screen.component.ts @@ -177,7 +177,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple this.processing = true; let obs: Observable; if (entriesToAdd.length > 0) { - obs = this._dictionaryControllerService.addEntry(entriesToAdd, this.dictionary.type, this.dictionary.ruleSetId, true); + obs = this._dictionaryControllerService.addEntry(entriesToAdd, this.dictionary.type, this.dictionary.ruleSetId, null, true); } else { obs = this._dictionaryControllerService.deleteEntries(this.initialDictionaryEntries, this.dictionary.type, this.dictionary.ruleSetId); } @@ -264,7 +264,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple private _onDictionaryChanged(dictionary: TypeValue) { if (dictionary !== this.selectDictionary) { - this._dictionaryControllerService.getDictionaryForType(dictionary.type, dictionary.ruleSetId).subscribe( + this._dictionaryControllerService.getDictionaryForType(dictionary.ruleSetId, dictionary.type).subscribe( (data) => { this.compareDictionaryEntries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' })); DictionaryOverviewScreenComponent._setEditorValue(this._compareEditorComponent, this.compareDictionaryEntries); @@ -298,12 +298,14 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple private _initializeEditor() { if (this.dictionary.type) - this._dictionaryControllerService.getDictionaryForType(this.dictionary.type, this.dictionary.ruleSetId).subscribe( + this._dictionaryControllerService.getDictionaryForType(this.dictionary.ruleSetId, this.dictionary.type).subscribe( (data) => { this.initialDictionaryEntries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' })); this.revert(); }, () => { + this.initialDictionaryEntries = []; + this.revert(); this.processing = false; } ); 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 24800b2c4..da1d191e8 100644 --- a/libs/red-ui-http/src/lib/api/dictionaryController.service.ts +++ b/libs/red-ui-http/src/lib/api/dictionaryController.service.ts @@ -8,7 +8,7 @@ * 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. - */ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; @@ -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,40 +41,63 @@ 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 type type + * @param dossierId dossierId * @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, ruleSetId: string, removeCurrent?: boolean, observe?: 'body', reportProgress?: boolean): Observable; - public addEntry( body: Array, - type: string, ruleSetId: string, + type: string, + dossierId?: string, + removeCurrent?: boolean, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public addEntry( + body: Array, + ruleSetId: string, + type: string, + dossierId?: string, removeCurrent?: boolean, observe?: 'response', reportProgress?: boolean ): Observable>; - public addEntry( body: Array, - type: string, ruleSetId: string, + type: string, + dossierId?: string, removeCurrent?: boolean, observe?: 'events', reportProgress?: boolean ): Observable>; - public addEntry( body: Array, - type: string, ruleSetId: string, + type: string, + dossierId?: string, removeCurrent?: boolean, observe: any = 'body', reportProgress: boolean = false @@ -83,15 +106,18 @@ export class DictionaryControllerService { throw new Error('Required parameter body was null or undefined when calling addEntry.'); } - if (type === null || type === undefined) { - 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.'); } + if (type === null || type === undefined) { + throw new Error('Required parameter type was null or undefined when calling addEntry.'); + } + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); + } if (removeCurrent !== undefined && removeCurrent !== null) { queryParameters = queryParameters.set('removeCurrent', removeCurrent); } @@ -136,21 +162,23 @@ export class DictionaryControllerService { * Creates entry type with colors, hint and caseInsensitive * None * @param body typeValue - * @param ruleSetId ruleSetId + * @param dossierId dossierId * @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, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public addType(body: TypeValue, dossierId?: string, observe?: 'response', reportProgress?: boolean): Observable>; + public addType(body: TypeValue, dossierId?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public addType(body: TypeValue, dossierId?: 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.'); } + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -175,6 +203,7 @@ export class DictionaryControllerService { return this.httpClient.request('post', `${this.basePath}/dictionary/type`, { body: body, + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -186,28 +215,52 @@ export class DictionaryControllerService { * Delete dictionary entries with entry type. * None * @param body entries - * @param type type * @param ruleSetId ruleSetId + * @param type type + * @param dossierId dossierId * @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, 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 { + public deleteEntries(body: Array, ruleSetId: string, type: string, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteEntries( + body: Array, + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public deleteEntries( + body: Array, + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public deleteEntries( + body: Array, + ruleSetId: string, + type: string, + dossierId?: 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.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling deleteEntries.'); + } + 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 deleteEntries.'); + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); } let headers = this.defaultHeaders; @@ -237,6 +290,7 @@ export class DictionaryControllerService { `${this.basePath}/dictionary/delete/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, { body: body, + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -248,29 +302,53 @@ export class DictionaryControllerService { /** * Delete dictionary entry with entry type. * None - * @param type type - * @param ruleSetId ruleSetId * @param entry entry + * @param ruleSetId ruleSetId + * @param type type + * @param dossierId dossierId * @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(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 deleteEntry.'); + public deleteEntry(entry: string, ruleSetId: string, type: string, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteEntry( + entry: string, + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public deleteEntry( + entry: string, + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public deleteEntry( + entry: string, + ruleSetId: string, + type: string, + dossierId?: string, + observe: any = 'body', + reportProgress: boolean = false + ): Observable { + if (entry === null || entry === undefined) { + throw new Error('Required parameter entry 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.'); + if (type === null || type === undefined) { + throw new Error('Required parameter type was null or undefined when calling deleteEntry.'); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); } let headers = this.defaultHeaders; @@ -288,13 +366,11 @@ export class DictionaryControllerService { headers = headers.set('Accept', httpHeaderAcceptSelected); } - // to determine the Content-Type header - const consumes: string[] = []; - return this.httpClient.request( 'delete', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}/${encodeURIComponent(String(entry))}`, { + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -306,24 +382,27 @@ export class DictionaryControllerService { /** * Deletes entry type * None - * @param type type * @param ruleSetId ruleSetId + * @param type type + * @param dossierId dossierId * @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, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteType(ruleSetId: string, type: string, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteType(ruleSetId: string, type: string, dossierId?: string, observe?: 'response', reportProgress?: boolean): Observable>; + public deleteType(ruleSetId: string, type: string, dossierId?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public deleteType(ruleSetId: string, type: string, dossierId?: 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 deleteType.'); + } - 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 (ruleSetId === null || ruleSetId === undefined) { - throw new Error('Required parameter ruleSetId was null or undefined when calling deleteType.'); + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); } let headers = this.defaultHeaders; @@ -341,13 +420,11 @@ export class DictionaryControllerService { headers = headers.set('Accept', httpHeaderAcceptSelected); } - // to determine the Content-Type header - const consumes: string[] = []; - return this.httpClient.request( 'delete', `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, { + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -359,24 +436,45 @@ export class DictionaryControllerService { /** * Returns file containing the the dictionary entries for given type.. * - * @param type type * @param ruleSetId ruleSetId + * @param type type + * @param dossierId dossierId * @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, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + public downloadDictionaryFile(ruleSetId: string, type: string, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public downloadDictionaryFile( + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public downloadDictionaryFile( + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public downloadDictionaryFile( + ruleSetId: string, + type: string, + dossierId?: 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 downloadDictionaryFile.'); + } - 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 queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); } let headers = this.defaultHeaders; @@ -401,6 +499,7 @@ export class DictionaryControllerService { 'get', `${this.basePath}/dictionary/download/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, { + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -413,20 +512,23 @@ export class DictionaryControllerService { * Retrieve all entry types * None * @param ruleSetId ruleSetId + * @param dossierId dossierId * @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(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 { + public getAllTypes(ruleSetId: string, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public getAllTypes(ruleSetId: string, dossierId?: string, observe?: 'response', reportProgress?: boolean): Observable>; + public getAllTypes(ruleSetId: string, dossierId?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public getAllTypes(ruleSetId: string, dossierId?: 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 queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); + } + let headers = this.defaultHeaders; // authentication (RED-OAUTH) required @@ -446,6 +548,7 @@ export class DictionaryControllerService { const consumes: string[] = []; return this.httpClient.request('get', `${this.basePath}/dictionary/type/${encodeURIComponent(String(ruleSetId))}`, { + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -461,11 +564,8 @@ export class DictionaryControllerService { * @param reportProgress flag to report request and response progress. */ 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.'); @@ -500,24 +600,39 @@ export class DictionaryControllerService { /** * Retrieves all dictionary entries of an entry type * None - * @param type type * @param ruleSetId ruleSetId + * @param type type + * @param dossierId dossierId * @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, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + public getDictionaryForType(ruleSetId: string, type: string, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public getDictionaryForType( + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public getDictionaryForType( + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public getDictionaryForType(ruleSetId: string, type: string, dossierId?: 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 getDictionaryForType.'); + } - 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 queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); } let headers = this.defaultHeaders; @@ -535,13 +650,11 @@ export class DictionaryControllerService { headers = headers.set('Accept', httpHeaderAcceptSelected); } - // to determine the Content-Type header - const consumes: string[] = []; - return this.httpClient.request( 'get', `${this.basePath}/dictionary/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, { + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -559,11 +672,8 @@ export class DictionaryControllerService { * @param reportProgress flag to report request and response progress. */ 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.'); @@ -608,28 +718,52 @@ export class DictionaryControllerService { * Updates colors, hint and caseInsensitive of an entry type. * None * @param body typeValue - * @param type type * @param ruleSetId ruleSetId + * @param type type + * @param dossierId dossierId * @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, 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 { + public updateType(body: UpdateTypeValue, ruleSetId: string, type: string, dossierId?: string, observe?: 'body', reportProgress?: boolean): Observable; + public updateType( + body: UpdateTypeValue, + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public updateType( + body: UpdateTypeValue, + ruleSetId: string, + type: string, + dossierId?: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public updateType( + body: UpdateTypeValue, + ruleSetId: string, + type: string, + dossierId?: 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.'); } + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling updateType.'); + } + if (type === null || type === undefined) { 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 queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (dossierId !== undefined && dossierId !== null) { + queryParameters = queryParameters.set('dossierId', dossierId); } let headers = this.defaultHeaders; @@ -659,6 +793,7 @@ export class DictionaryControllerService { `${this.basePath}/dictionary/type/${encodeURIComponent(String(type))}/${encodeURIComponent(String(ruleSetId))}`, { body: body, + params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -668,33 +803,55 @@ export class DictionaryControllerService { } /** - * Takes object containing string or rules as argument, which will be used by the redaction service. + * Upload a text-file with 1 entry per line and add each line as an entry to a dictionary for a specific type * - * @param file - * @param type type * @param ruleSetId ruleSetId + * @param type type + * @param file + * @param dossierId * @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, 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.'); + public uploadDictionaryFileForm( + ruleSetId: string, + type: string, + file?: Blob, + dossierId?: string, + observe?: 'body', + reportProgress?: boolean + ): Observable; + public uploadDictionaryFileForm( + ruleSetId: string, + type: string, + file?: Blob, + dossierId?: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public uploadDictionaryFileForm( + ruleSetId: string, + type: string, + file?: Blob, + dossierId?: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public uploadDictionaryFileForm( + ruleSetId: string, + type: string, + file?: Blob, + dossierId?: 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 uploadDictionaryFile.'); } if (type === null || type === undefined) { 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 @@ -730,6 +887,9 @@ export class DictionaryControllerService { if (file !== undefined) { formParams = (formParams.append('file', file) as any) || formParams; } + if (dossierId !== undefined) { + formParams = (formParams.append('dossierId', dossierId) as any) || formParams; + } return this.httpClient.request( 'post', @@ -743,18 +903,4 @@ 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; - } } 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 3276edb08..1416c0a41 100644 --- a/libs/red-ui-http/src/lib/api/versionsController.service.ts +++ b/libs/red-ui-http/src/lib/api/versionsController.service.ts @@ -8,7 +8,7 @@ * 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. - */ /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/member-ordering */ + */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; @@ -23,9 +23,9 @@ 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) { if (basePath) { @@ -37,6 +37,67 @@ export class VersionsControllerService { } } + /** + * @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; + } + + /** + * Retrieves current version for dossier dictionary. + * None + * @param dossierId dossierId + * @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 getDossierDictionaryVersion(dossierId: string, ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable; + public getDossierDictionaryVersion(dossierId: string, ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public getDossierDictionaryVersion(dossierId: string, ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public getDossierDictionaryVersion(dossierId: string, ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + if (dossierId === null || dossierId === undefined) { + throw new Error('Required parameter dossierId was null or undefined when calling getDossierDictionaryVersion.'); + } + + if (ruleSetId === null || ruleSetId === undefined) { + throw new Error('Required parameter ruleSetId was null or undefined when calling getDossierDictionaryVersion.'); + } + + 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); + } + + return this.httpClient.request( + 'get', + `${this.basePath}/version/dossier/${encodeURIComponent(String(ruleSetId))}/${encodeURIComponent(String(dossierId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Retrieves current versions. * None @@ -45,11 +106,8 @@ export class VersionsControllerService { * @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.'); @@ -77,9 +135,6 @@ export class VersionsControllerService { 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, @@ -88,18 +143,4 @@ export class VersionsControllerService { 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; - } }