diff --git a/README.md b/README.md index f28f4a2c0..73cab8642 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ To regnerate http rune swaagger ``` -BASE=https://timo-redaction-dev.iqser.cloud/ +BASE=https://redapi-staging.iqser.cloud/ URL="$BASE"v2/api-docs?group=redaction-gateway-v1 mkdir -p /tmp/swagger swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger diff --git a/apps/red-ui/src/app/app-config/app-config.service.ts b/apps/red-ui/src/app/app-config/app-config.service.ts index a8327b3a3..c81269b6d 100644 --- a/apps/red-ui/src/app/app-config/app-config.service.ts +++ b/apps/red-ui/src/app/app-config/app-config.service.ts @@ -9,7 +9,8 @@ export enum AppConfigKey { API_URL = 'API_URL', ADMIN_CONTACT_NAME = 'ADMIN_CONTACT_NAME', ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL', - AUTO_READ_TIME = 'AUTO_READ_TIME' + AUTO_READ_TIME = 'AUTO_READ_TIME', + MAX_FILE_SIZE_MB = 'MAX_FILE_SIZE_MB' } @Injectable({ diff --git a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html index 2365f33b6..f4ee5e31a 100644 --- a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html +++ b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.html @@ -77,9 +77,10 @@ -
- {{ 'dictionary-overview.compare' | translate }} -
+ + + +
diff --git a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts index e7e1843b7..540f797bf 100644 --- a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts @@ -19,7 +19,7 @@ declare var ace; styleUrls: ['./dictionary-overview-screen.component.scss'] }) export class DictionaryOverviewScreenComponent { - static readonly MIN_WORD_LENGTH: number = 3; + static readonly MIN_WORD_LENGTH: number = 2; public compareActive = false; @ViewChild('editorComponent') @@ -207,6 +207,7 @@ export class DictionaryOverviewScreenComponent { } ); } else { + console.log(invalidRowsExist); this._notificationService.showToastNotification( this._translateService.instant('dictionary-overview.error.entries-too-short'), null, diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html index b95c2adee..ca71f53e8 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html @@ -175,7 +175,7 @@
{ await this.appStateService.reloadActiveProjectFilesIfNecessary(); diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 351ee55b3..a72df556d 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -2,6 +2,7 @@ import { EventEmitter, Injectable } from '@angular/core'; import { DictionaryControllerService, FileManagementControllerService, + FileStatus, Project, ProjectControllerService, ReanalysisControllerService, @@ -153,8 +154,12 @@ export class AppStateService { return new ProjectWrapper(p, this._getExistingFiles(p.projectId)); }); - for (const project of mappedProjects) { - await this.getFiles(project); + const fileData = await this._statusControllerService.getFileStatusForProjects(mappedProjects.map((p) => p.projectId)).toPromise(); + for (let projectId of Object.keys(fileData)) { + this._processFiles( + mappedProjects.find((p) => p.projectId === projectId), + fileData[projectId] + ); } this._appState.projects = mappedProjects; @@ -222,6 +227,10 @@ export class AppStateService { } const files = await this._statusControllerService.getProjectStatus(project.project.projectId).toPromise(); + return this._processFiles(project, files); + } + + private _processFiles(project: ProjectWrapper, files: FileStatus[]) { const oldFiles = [...project.files]; const fileStatusChangedEvent = []; @@ -251,7 +260,7 @@ export class AppStateService { } project.files = files.map((f) => new FileStatusWrapper(f, this._userService.getNameForId(f.currentReviewer))); - this._automaticallyReanalyseErrorFiles(project); + // this._automaticallyReanalyseErrorFiles(project); this._computeStats(); fileReanalysedEvent.forEach((file) => this.fileReanalysed.emit(file)); diff --git a/apps/red-ui/src/app/upload/file-upload.service.ts b/apps/red-ui/src/app/upload/file-upload.service.ts index c64284b9e..e94ead8d4 100644 --- a/apps/red-ui/src/app/upload/file-upload.service.ts +++ b/apps/red-ui/src/app/upload/file-upload.service.ts @@ -4,6 +4,8 @@ import { AppStateService } from '../state/app-state.service'; import { HttpEventType } from '@angular/common/http'; import { FileManagementControllerService } from '@redaction/red-ui-http'; import { interval, Subscription } from 'rxjs'; +import { AppConfigKey, AppConfigService } from '../app-config/app-config.service'; +import { TranslateService } from '@ngx-translate/core'; @Injectable({ providedIn: 'root' @@ -19,6 +21,8 @@ export class FileUploadService { constructor( private readonly _appStateService: AppStateService, private readonly _applicationRef: ApplicationRef, + private readonly _translateService: TranslateService, + private readonly _appConfigService: AppConfigService, private readonly _fileManagementControllerService: FileManagementControllerService ) { interval(2500).subscribe((val) => { @@ -27,15 +31,24 @@ export class FileUploadService { } scheduleUpload(item: FileUploadModel) { - item.progress = 0; - item.completed = false; - item.error = null; - this._pendingUploads.push(item); + if (!item.sizeError) { + item.progress = 0; + item.completed = false; + item.error = null; + this._pendingUploads.push(item); + } } uploadFiles(files: FileUploadModel[]) { - files = files.filter((file) => file.file.type?.toLowerCase() === 'application/pdf' || file.file.name.toLowerCase().endsWith('.pdf')); - files.sort((a, b) => a.file.size - b.file.size); + const maxSizeMB = this._appConfigService.getConfig(AppConfigKey.MAX_FILE_SIZE_MB, 50); + const maxSizeBytes = maxSizeMB * 1024 * 1024; + files.forEach((file) => { + if (file.size > maxSizeBytes) { + file.completed = true; + file.error = { message: this._translateService.instant('upload-status.error.file-size', { size: maxSizeMB }) }; + file.sizeError = true; + } + }); this.files.push(...files); files.forEach((newFile) => { this.scheduleUpload(newFile); @@ -82,7 +95,7 @@ export class FileUploadService { uploadFile.completed = true; } else { uploadFile.completed = true; - uploadFile.error = event.body; + uploadFile.error = { message: this._translateService.instant('upload-status.error.generic') }; } this._removeUpload(subscription); await this._appStateService.reloadActiveProjectFiles(); @@ -90,7 +103,7 @@ export class FileUploadService { }, (error) => { uploadFile.completed = true; - uploadFile.error = error; + uploadFile.error = { message: this._translateService.instant('upload-status.error.generic') }; this._removeUpload(subscription); if (uploadFile.retryCount < 5) { uploadFile.retryCount += 1; diff --git a/apps/red-ui/src/app/upload/model/file-upload.model.ts b/apps/red-ui/src/app/upload/model/file-upload.model.ts index d46e2af92..7ff1519c9 100644 --- a/apps/red-ui/src/app/upload/model/file-upload.model.ts +++ b/apps/red-ui/src/app/upload/model/file-upload.model.ts @@ -4,4 +4,6 @@ export interface FileUploadModel { completed: boolean; error: any; retryCount: number; + size: number; + sizeError: any; } diff --git a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html index 3ad1e5cb8..93bc210c0 100644 --- a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html +++ b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html @@ -35,6 +35,7 @@
{ - if (this.uploadService.files.length > 0) { - // keep only errors - this.uploadService.files = this.uploadService.files.filter((file) => !file.completed || file.error); - if (this.uploadService.files.length === 0) { - this.closeDialog(); - } + // keep only errors + this.uploadService.files = this.uploadService.files.filter((file) => !file.completed || file.error); + if (this.uploadService.files.length === 0) { + this.closeDialog(); } }, 2500); } diff --git a/apps/red-ui/src/app/utils/file-drop-utils.ts b/apps/red-ui/src/app/utils/file-drop-utils.ts index 2114846b6..d75abb418 100644 --- a/apps/red-ui/src/app/utils/file-drop-utils.ts +++ b/apps/red-ui/src/app/utils/file-drop-utils.ts @@ -4,8 +4,8 @@ export function handleFileDrop(event: DragEvent, uploadFiles: (files: FileUpload event.preventDefault(); event.stopPropagation(); const { dataTransfer } = event; + let files: any = []; if (dataTransfer.items) { - const files = []; for (let i = 0; i < dataTransfer.items.length; i++) { // If dropped items aren't files, reject them if (dataTransfer.items[i].kind === 'file') { @@ -13,16 +13,20 @@ export function handleFileDrop(event: DragEvent, uploadFiles: (files: FileUpload } } dataTransfer.items.clear(); - uploadFiles(convertFiles(files)); } else { - const files = dataTransfer.files; + files = dataTransfer.files; dataTransfer.clearData(); uploadFiles(convertFiles(files)); } + + const convertedFiles = convertFiles(files); + if (convertedFiles.length > 0) { + uploadFiles(convertedFiles); + } } export function convertFiles(files: FileList | File[]): FileUploadModel[] { - const uploadFiles: FileUploadModel[] = []; + let uploadFiles: FileUploadModel[] = []; for (let i = 0; i < files.length; i++) { const file = files[i]; uploadFiles.push({ @@ -30,8 +34,12 @@ export function convertFiles(files: FileList | File[]): FileUploadModel[] { progress: 0, completed: false, error: null, - retryCount: 0 + retryCount: 0, + size: file.size }); } + + uploadFiles = uploadFiles.filter((file) => file.file.type?.toLowerCase() === 'application/pdf' || file.file.name.toLowerCase().endsWith('.pdf')); + uploadFiles.sort((a, b) => a.size - b.size); return uploadFiles; } diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index bfcb40971..d447e7e9e 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://timo-redaction-dev.iqser.cloud" + "API_URL": "https://redapi-staging.iqser.cloud" } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 06390f38f..41f9758fd 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -9,6 +9,10 @@ "app-name": "DDA-R", "dev-mode": "[ DEV MODE ]", "upload-status": { + "error": { + "file-size": "File to large. Limit is {{size}}MB.", + "generic": "Failed to upload file ... " + }, "dialog": { "title": "File Upload", "actions": { diff --git a/docker/red-ui/docker-entrypoint.sh b/docker/red-ui/docker-entrypoint.sh index 00d3db9f0..1dd13c886 100755 --- a/docker/red-ui/docker-entrypoint.sh +++ b/docker/red-ui/docker-entrypoint.sh @@ -6,6 +6,7 @@ API_URL="${API_URL:-}" ADMIN_CONTACT_NAME="${ADMIN_CONTACT_NAME:-}" ADMIN_CONTACT_URL="${ADMIN_CONTACT_URL:-}" AUTO_READ_TIME="${AUTO_READ_TIME:-1.5}" +MAX_FILE_SIZE_MB="${MAX_FILE_SIZE_MB:-50}" echo '{ diff --git a/libs/red-ui-http/src/lib/api/reanalysisController.service.ts b/libs/red-ui-http/src/lib/api/reanalysisController.service.ts index 91bc8f812..7ade1b6de 100644 --- a/libs/red-ui-http/src/lib/api/reanalysisController.service.ts +++ b/libs/red-ui-http/src/lib/api/reanalysisController.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'; @@ -24,11 +25,7 @@ export class ReanalysisControllerService { 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,61 +43,32 @@ export class ReanalysisControllerService { * @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 reanalyzeFile( - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public reanalyzeFile(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; - public reanalyzeFile( - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public reanalyzeFile(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public reanalyzeFile( - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public reanalyzeFile(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public reanalyzeFile( - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public reanalyzeFile(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 reanalyzeFile.' - ); + throw new Error('Required parameter projectId was null or undefined when calling reanalyzeFile.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling reanalyzeFile.' - ); + throw new Error('Required parameter fileId was null or undefined when calling reanalyzeFile.'); } 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); } @@ -110,9 +78,7 @@ export class ReanalysisControllerService { return this.httpClient.request( 'post', - `${this.basePath}/reanalyze/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/reanalyze/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -123,57 +89,94 @@ export class ReanalysisControllerService { } /** - * Reanalyze all files of the project. + * Reanalyze multiple files for a project * None + * @param body fileIds * @param projectId projectId * @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 reanalyzeProject( - projectId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; + public reanalyzeFilesForProject(body: Array, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - public reanalyzeProject( - projectId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; + public reanalyzeFilesForProject(body: Array, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public reanalyzeProject( - projectId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; + public reanalyzeFilesForProject(body: Array, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public reanalyzeFilesForProject(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 reanalyzeFilesForProject.'); + } - public reanalyzeProject( - 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 reanalyzeProject.' - ); + throw new Error('Required parameter projectId was null or undefined when calling reanalyzeFilesForProject.'); } 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); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('post', `${this.basePath}/reanalyze/${encodeURIComponent(String(projectId))}/bulk`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Reanalyze all files of the project. + * None + * @param projectId projectId + * @param force force + * @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 reanalyzeProject(projectId: string, force?: boolean, observe?: 'body', reportProgress?: boolean): Observable; + + public reanalyzeProject(projectId: string, force?: boolean, observe?: 'response', reportProgress?: boolean): Observable>; + + public reanalyzeProject(projectId: string, force?: boolean, observe?: 'events', reportProgress?: boolean): Observable>; + + public reanalyzeProject(projectId: string, force?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable { + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling reanalyzeProject.'); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (force !== undefined && force !== null) { + queryParameters = queryParameters.set('force', force); + } + + 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); } @@ -181,16 +184,13 @@ export class ReanalysisControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request( - 'post', - `${this.basePath}/reanalyze/${encodeURIComponent(String(projectId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); + return this.httpClient.request('post', `${this.basePath}/reanalyze/${encodeURIComponent(String(projectId))}`, { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } /** diff --git a/libs/red-ui-http/src/lib/api/statusController.service.ts b/libs/red-ui-http/src/lib/api/statusController.service.ts index 8136b5625..038725634 100644 --- a/libs/red-ui-http/src/lib/api/statusController.service.ts +++ b/libs/red-ui-http/src/lib/api/statusController.service.ts @@ -22,15 +22,11 @@ import { Configuration } from '../configuration'; @Injectable() export class StatusControllerService { - 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,112 +36,6 @@ export class StatusControllerService { } } - /** - * @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; - } - - /** - * Assigns new owner to project. - * None - * @param projectId projectId - * @param fileId fileId - * @param reviewerId reviewerId - * @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 assignProjectOwner( - projectId: string, - fileId: string, - reviewerId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public assignProjectOwner( - projectId: string, - fileId: string, - reviewerId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public assignProjectOwner( - projectId: string, - fileId: string, - reviewerId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public assignProjectOwner( - projectId: string, - fileId: string, - reviewerId: 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 assignProjectOwner.' - ); - } - - if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling assignProjectOwner.' - ); - } - - if (reviewerId === null || reviewerId === undefined) { - throw new Error( - 'Required parameter reviewerId was null or undefined when calling assignProjectOwner.' - ); - } - - 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( - 'post', - `${this.basePath}/status/${encodeURIComponent(String(projectId))}/${encodeURIComponent( - String(fileId) - )}/${encodeURIComponent(String(reviewerId))}`, - { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - /** * Gets the status for a file. * None @@ -154,58 +44,32 @@ export class StatusControllerService { * @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 getFileStatus( - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public getFileStatus( - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public getFileStatus( - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public getFileStatus( - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public getFileStatus(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public getFileStatus(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public getFileStatus(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public getFileStatus(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 getFileStatus.' - ); + throw new Error('Required parameter projectId was null or undefined when calling getFileStatus.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling getFileStatus.' - ); + throw new Error('Required parameter fileId was null or undefined when calling getFileStatus.'); } 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); } @@ -215,9 +79,7 @@ export class StatusControllerService { return this.httpClient.request( 'get', - `${this.basePath}/status/${encodeURIComponent(String(projectId))}/${encodeURIComponent( - String(fileId) - )}`, + `${this.basePath}/status/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -228,54 +90,91 @@ export class StatusControllerService { } /** - * Gets the status for all files in a project. + * Gets the status for all files of a list of projects. * None - * @param projectId The id of the project you want the status for. + * @param body projectIds * @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 getProjectStatus( - projectId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable>; - public getProjectStatus( - projectId: string, + public getFileStatusForProjects(body: Array, observe?: 'body', reportProgress?: boolean): Observable<{ [key: string]: Array }>; + + public getFileStatusForProjects( + body: Array, observe?: 'response', reportProgress?: boolean - ): Observable>>; - public getProjectStatus( - projectId: string, + ): Observable }>>; + + public getFileStatusForProjects( + body: Array, observe?: 'events', reportProgress?: boolean - ): Observable>>; - public getProjectStatus( - 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 getProjectStatus.' - ); + ): Observable }>>; + + public getFileStatusForProjects(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 getFileStatusForProjects.'); } 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); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request<{ [key: string]: Array }>('post', `${this.basePath}/status`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Gets the status for all files in a project. + * None + * @param projectId The id of the project you want the status for. + * @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 getProjectStatus(projectId: string, observe?: 'body', reportProgress?: boolean): Observable>; + + public getProjectStatus(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>>; + + public getProjectStatus(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>>; + + public getProjectStatus(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 getProjectStatus.'); + } + + 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); } @@ -283,9 +182,69 @@ export class StatusControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request>( - 'get', - `${this.basePath}/status/${encodeURIComponent(String(projectId))}`, + return this.httpClient.request>('get', `${this.basePath}/status/${encodeURIComponent(String(projectId))}`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Assigns a reviewer for a file. + * None + * @param projectId projectId + * @param fileId fileId + * @param reviewerId reviewerId + * @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 setFileReviewer(projectId: string, fileId: string, reviewerId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setFileReviewer( + projectId: string, + fileId: string, + reviewerId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public setFileReviewer(projectId: string, fileId: string, reviewerId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setFileReviewer(projectId: string, fileId: string, reviewerId: 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 setFileReviewer.'); + } + + if (fileId === null || fileId === undefined) { + throw new Error('Required parameter fileId was null or undefined when calling setFileReviewer.'); + } + + if (reviewerId === null || reviewerId === undefined) { + throw new Error('Required parameter reviewerId was null or undefined when calling setFileReviewer.'); + } + + 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( + 'post', + `${this.basePath}/status/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}/${encodeURIComponent(String(reviewerId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -295,6 +254,87 @@ export class StatusControllerService { ); } + /** + * Assign a reviewer for a list of files. + * None + * @param body fileIds + * @param projectId projectId + * @param reviewerId reviewerId + * @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 setFileReviewerForList(body: Array, projectId: string, reviewerId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setFileReviewerForList( + body: Array, + projectId: string, + reviewerId: string, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + + public setFileReviewerForList( + body: Array, + projectId: string, + reviewerId: string, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + + public setFileReviewerForList( + body: Array, + projectId: string, + reviewerId: 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 setFileReviewerForList.'); + } + + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling setFileReviewerForList.'); + } + + if (reviewerId === null || reviewerId === undefined) { + throw new Error('Required parameter reviewerId was null or undefined when calling setFileReviewerForList.'); + } + + 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}/status/${encodeURIComponent(String(projectId))}/bulk/${encodeURIComponent(String(reviewerId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Sets the status APPROVED for a file. * None @@ -303,58 +343,32 @@ export class StatusControllerService { * @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 setStatusApproved( - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public setStatusApproved( - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public setStatusApproved( - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public setStatusApproved( - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public setStatusApproved(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setStatusApproved(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setStatusApproved(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setStatusApproved(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 setStatusApproved.' - ); + throw new Error('Required parameter projectId was null or undefined when calling setStatusApproved.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling setStatusApproved.' - ); + throw new Error('Required parameter fileId was null or undefined when calling setStatusApproved.'); } 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); } @@ -364,9 +378,7 @@ export class StatusControllerService { return this.httpClient.request( 'post', - `${this.basePath}/status/approved/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/status/approved/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -376,6 +388,60 @@ export class StatusControllerService { ); } + /** + * Sets the status APPROVED for a list of files. + * None + * @param body fileIds + * @param projectId projectId + * @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 setStatusApprovedForList(body: Array, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setStatusApprovedForList(body: Array, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setStatusApprovedForList(body: Array, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setStatusApprovedForList(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 setStatusApprovedForList.'); + } + + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling setStatusApprovedForList.'); + } + + 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}/status/approved/${encodeURIComponent(String(projectId))}/bulk`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + /** * Sets the status UNDER_APPROVAL for a file. * None @@ -384,58 +450,32 @@ export class StatusControllerService { * @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 setStatusUnderApproval( - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public setStatusUnderApproval( - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public setStatusUnderApproval( - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public setStatusUnderApproval( - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public setStatusUnderApproval(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setStatusUnderApproval(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setStatusUnderApproval(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setStatusUnderApproval(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 setStatusUnderApproval.' - ); + throw new Error('Required parameter projectId was null or undefined when calling setStatusUnderApproval.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling setStatusUnderApproval.' - ); + throw new Error('Required parameter fileId was null or undefined when calling setStatusUnderApproval.'); } 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); } @@ -445,9 +485,7 @@ export class StatusControllerService { return this.httpClient.request( 'post', - `${this.basePath}/status/underapproval/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/status/underapproval/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -457,6 +495,60 @@ export class StatusControllerService { ); } + /** + * Sets the status UNDER_APPROVAL for a list of files. + * None + * @param body fileIds + * @param projectId projectId + * @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 setStatusUnderApprovalForList(body: Array, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setStatusUnderApprovalForList(body: Array, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setStatusUnderApprovalForList(body: Array, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setStatusUnderApprovalForList(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 setStatusUnderApprovalForList.'); + } + + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling setStatusUnderApprovalForList.'); + } + + 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}/status/underapproval/${encodeURIComponent(String(projectId))}/bulk`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + /** * Sets the status UNDER_REVIEW for a file. * None @@ -465,58 +557,32 @@ export class StatusControllerService { * @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 setStatusUnderReview( - projectId: string, - fileId: string, - observe?: 'body', - reportProgress?: boolean - ): Observable; - public setStatusUnderReview( - projectId: string, - fileId: string, - observe?: 'response', - reportProgress?: boolean - ): Observable>; - public setStatusUnderReview( - projectId: string, - fileId: string, - observe?: 'events', - reportProgress?: boolean - ): Observable>; - public setStatusUnderReview( - projectId: string, - fileId: string, - observe: any = 'body', - reportProgress: boolean = false - ): Observable { + public setStatusUnderReview(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setStatusUnderReview(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setStatusUnderReview(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setStatusUnderReview(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 setStatusUnderReview.' - ); + throw new Error('Required parameter projectId was null or undefined when calling setStatusUnderReview.'); } if (fileId === null || fileId === undefined) { - throw new Error( - 'Required parameter fileId was null or undefined when calling setStatusUnderReview.' - ); + throw new Error('Required parameter fileId was null or undefined when calling setStatusUnderReview.'); } 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); } @@ -526,9 +592,7 @@ export class StatusControllerService { return this.httpClient.request( 'post', - `${this.basePath}/status/underreview/${encodeURIComponent( - String(projectId) - )}/${encodeURIComponent(String(fileId))}`, + `${this.basePath}/status/underreview/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -537,4 +601,72 @@ export class StatusControllerService { } ); } + + /** + * Sets the status UNDER_REVIEW for a list of files. + * None + * @param body fileIds + * @param projectId projectId + * @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 setStatusUnderReviewForList(body: Array, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + + public setStatusUnderReviewForList(body: Array, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + + public setStatusUnderReviewForList(body: Array, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + + public setStatusUnderReviewForList(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 setStatusUnderReviewForList.'); + } + + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling setStatusUnderReviewForList.'); + } + + 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}/status/underreview/${encodeURIComponent(String(projectId))}/bulk`, { + 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; + } }