red-ui/libs/red-ui-http/src/lib/api/fileManagementController.service.ts
2021-09-29 08:58:29 +03:00

469 lines
18 KiB
TypeScript

/**
* 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<any>;
public deleteFile(dossierId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deleteFile(dossierId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deleteFile(dossierId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
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<any>(
'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<string>, dossierId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deleteFiles(
body: Array<string>,
dossierId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public deleteFiles(body: Array<string>, dossierId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deleteFiles(body: Array<string>, dossierId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
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<any>('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 \&quot;inline\&quot; 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<any>;
public downloadAnnotatedFile(
dossierId: string,
fileId: string,
inline?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public downloadAnnotatedFile(
dossierId: string,
fileId: string,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public downloadAnnotatedFile(
dossierId: string,
fileId: string,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
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', <any>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<any>(
'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 \&quot;inline\&quot; 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<any>;
public downloadOriginalFile(
dossierId: string,
fileId: string,
inline?: boolean,
indicator?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public downloadOriginalFile(
dossierId: string,
fileId: string,
inline?: boolean,
indicator?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public downloadOriginalFile(
dossierId: string,
fileId: string,
inline?: boolean,
indicator?: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
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', <any>inline);
}
if (indicator !== undefined && indicator !== null) {
queryParameters = queryParameters.set('indicator', <any>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<string>, observe?: 'body', reportProgress?: boolean): Observable<any>;
public hardDeleteFile(
dossierId: string,
fileIds: Array<string>,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public hardDeleteFile(
dossierId: string,
fileIds: Array<string>,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public hardDeleteFile(
dossierId: string,
fileIds: Array<string>,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
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', <any>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<any>('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<string>, dossierId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public restoreFiles(
body: Array<string>,
dossierId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public restoreFiles(body: Array<string>, dossierId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public restoreFiles(body: Array<string>, dossierId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
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<any>('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;
}
}