/** * API Documentation for Redaction Gateway * Description for redaction * * OpenAPI spec version: 1.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http'; import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs'; import { BASE_PATH } from '../variables'; import { Configuration } from '../configuration'; @Injectable() export class FileManagementControllerService { public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); protected basePath = ''; constructor( protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration ) { if (basePath) { this.basePath = basePath; } if (configuration) { this.configuration = configuration; this.basePath = basePath || configuration.basePath || this.basePath; } } /** * Deletes a file for a given dossierId and FileId * None * @param dossierId dossierId * @param fileId fileId * @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 deleteFile(dossierId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable; public deleteFile(dossierId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable>; public deleteFile(dossierId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable>; public deleteFile(dossierId: string, fileId: 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 deleteFile.'); } if (fileId === null || fileId === undefined) { throw new Error('Required parameter fileId was null or undefined when calling deleteFile.'); } 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( 'delete', `${this.basePath}/delete/${encodeURIComponent(String(dossierId))}/${encodeURIComponent(String(fileId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Deletes a a list of files for a given dossierId * None * @param body fileIds * @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 deleteFiles(body: Array, dossierId: string, observe?: 'body', reportProgress?: boolean): Observable; public deleteFiles( body: Array, dossierId: string, observe?: 'response', reportProgress?: boolean ): Observable>; public deleteFiles(body: Array, dossierId: string, observe?: 'events', reportProgress?: boolean): Observable>; public deleteFiles(body: Array, 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 deleteFiles.'); } if (dossierId === null || dossierId === undefined) { throw new Error('Required parameter dossierId was null or undefined when calling deleteFiles.'); } 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}/delete/${encodeURIComponent(String(dossierId))}`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress }); } /** * Returns a downloadable byte stream of the annotated file with the specified fileId * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. * @param dossierId dossierId * @param fileId fileId * @param inline inline * @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 downloadAnnotatedFile( dossierId: string, fileId: string, inline?: boolean, observe?: 'body', reportProgress?: boolean ): Observable; public downloadAnnotatedFile( dossierId: string, fileId: string, inline?: boolean, observe?: 'response', reportProgress?: boolean ): Observable>; public downloadAnnotatedFile( dossierId: string, fileId: string, inline?: boolean, observe?: 'events', reportProgress?: boolean ): Observable>; public downloadAnnotatedFile( dossierId: string, fileId: string, inline?: boolean, observe: any = 'body', reportProgress: boolean = false ): Observable { if (dossierId === null || dossierId === undefined) { throw new Error('Required parameter dossierId was null or undefined when calling downloadAnnotatedFile.'); } if (fileId === null || fileId === undefined) { throw new Error('Required parameter fileId was null or undefined when calling downloadAnnotatedFile.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); if (inline !== undefined && inline !== null) { queryParameters = queryParameters.set('inline', inline); } 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}/download/annotated/${encodeURIComponent(String(dossierId))}/${encodeURIComponent(String(fileId))}`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Returns a downloadable byte stream of the original file with the specified fileId * Use the optional \"inline\" request parameter to select, if this downloadAnnotated will be opened in the browser. * @param dossierId dossierId * @param fileId fileId * @param inline inline * @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 downloadOriginalFile( dossierId: string, fileId: string, inline?: boolean, indicator?: string, observe?: 'body', reportProgress?: boolean ): Observable; public downloadOriginalFile( dossierId: string, fileId: string, inline?: boolean, indicator?: string, observe?: 'response', reportProgress?: boolean ): Observable>; public downloadOriginalFile( dossierId: string, fileId: string, inline?: boolean, indicator?: string, observe?: 'events', reportProgress?: boolean ): Observable>; public downloadOriginalFile( dossierId: string, fileId: string, inline?: boolean, indicator?: 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 downloadOriginalFile.'); } if (fileId === null || fileId === undefined) { throw new Error('Required parameter fileId was null or undefined when calling downloadOriginalFile.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); if (inline !== undefined && inline !== null) { queryParameters = queryParameters.set('inline', inline); } if (indicator !== undefined && indicator !== null) { queryParameters = queryParameters.set('indicator', indicator); } 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}/download/original/${encodeURIComponent(String(dossierId))}/${encodeURIComponent(String(fileId))}`, { responseType: 'blob', params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Hard deletes an uploaded file. * None * @param dossierId dossierId * @param fileIds fileIds * @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 hardDeleteFile(dossierId: string, fileIds: Array, observe?: 'body', reportProgress?: boolean): Observable; public hardDeleteFile( dossierId: string, fileIds: Array, observe?: 'response', reportProgress?: boolean ): Observable>; public hardDeleteFile( dossierId: string, fileIds: Array, observe?: 'events', reportProgress?: boolean ): Observable>; public hardDeleteFile( dossierId: string, fileIds: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { if (dossierId === null || dossierId === undefined) { throw new Error('Required parameter dossierId was null or undefined when calling hardDeleteFile.'); } if (fileIds === null || fileIds === undefined) { throw new Error('Required parameter fileIds was null or undefined when calling hardDeleteFile.'); } let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); if (fileIds) { fileIds.forEach(element => { queryParameters = queryParameters.append('fileIds', element); }); } let headers = this.defaultHeaders; // authentication (RED-OAUTH) required if (this.configuration.accessToken) { const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; headers = headers.set('Authorization', 'Bearer ' + accessToken); } // to determine the Accept header const httpHeaderAccepts: string[] = []; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } return this.httpClient.request('delete', `${this.basePath}/delete/hard-delete/${encodeURIComponent(String(dossierId))}`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress }); } /** * Restores an deleted file. * None * @param body fileIds * @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 restoreFiles(body: Array, dossierId: string, observe?: 'body', reportProgress?: boolean): Observable; public restoreFiles( body: Array, dossierId: string, observe?: 'response', reportProgress?: boolean ): Observable>; public restoreFiles(body: Array, dossierId: string, observe?: 'events', reportProgress?: boolean): Observable>; public restoreFiles(body: Array, 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 restoreFiles.'); } if (dossierId === null || dossierId === undefined) { throw new Error('Required parameter dossierId was null or undefined when calling restoreFiles.'); } 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}/delete/restore/${encodeURIComponent(String(dossierId))}`, { 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; } }