This commit is contained in:
Timo Bejan 2020-11-12 22:05:28 +02:00
parent cf69267bdc
commit 6a15e5e041
6 changed files with 114 additions and 298 deletions

View File

@ -9,20 +9,12 @@ export class ApiPathInterceptorService implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (!req.url.startsWith('/assets')) {
console.log(this._appConfigService);
const updatedRequest = req.clone({
url: this._appConfigService.getConfig(AppConfigKey.API_URL) + req.url
});
return next.handle(updatedRequest);
} else {
// if (!req.url.startsWith('/assets')) {
// const updatedRequest = req.clone({
// url: this._appConfigService.getConfig(AppConfigKey.API_URL) + req.url
// })
// return next.handle(updatedRequest);
// } else {
return next.handle(req);
}
// }
}
}

View File

@ -371,6 +371,9 @@ export class FilePreviewScreenComponent implements OnInit {
}
private _cleanupAndRedrawManualAnnotations(annotationIdToDraw?: string) {
if (!annotationIdToDraw) {
this._fileDownloadService.loadRedactedView(this.fileData);
}
this._fileDownloadService.loadActiveFileManualAnnotations().subscribe((manualRedactions) => {
this.fileData.manualRedactions = manualRedactions;
this._rebuildFilters();

View File

@ -268,7 +268,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
}
private _restoreViewerState() {
console.log('emit');
console.log('emit viewer ready');
this.viewerReady.emit(this.instance);
this._restoreState(this._viewerState, this.instance);
}

View File

@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { forkJoin, Observable, of } from 'rxjs';
import { map, tap } from 'rxjs/operators';
import {
FileStatus,
FileUploadControllerService,
ManualRedactionControllerService,
RedactionLogControllerService,
@ -30,7 +31,7 @@ export class FileDownloadService {
}
public loadActiveFileData(): Observable<FileDataModel> {
const annotatedObs = this.loadFile('ORIGINAL', this._appStateService.activeFileId);
const annotatedObs = this.loadFile('ORIGINAL', this._appStateService.activeFile);
const reactionLogObs = this._redactionLogControllerService.getRedactionLog(this._appStateService.activeFileId);
const manualRedactionsObs = this._manualRedactionControllerService.getManualRedaction(
this._appStateService.activeProjectId,
@ -40,14 +41,15 @@ export class FileDownloadService {
return forkJoin([annotatedObs, reactionLogObs, manualRedactionsObs, viewedPagesObs]).pipe(
map((data) => {
const fileData = new FileDataModel(this._appStateService.activeFile, ...data);
// lazy load redacted data
this.loadFile('REDACTED', this._appStateService.activeFileId).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData));
return fileData;
return new FileDataModel(this._appStateService.activeFile, ...data);
})
);
}
public loadRedactedView(fileData: FileDataModel) {
this.loadFile('REDACTED', fileData.fileStatus).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData));
}
getViewedPagesForActiveFile() {
if (this._permissionsService.canMarkPagesAsViewed()) {
return this._viewedPagesControllerService.getViewedPages(this._appStateService.activeProjectId, this._appStateService.activeFileId);
@ -55,13 +57,13 @@ export class FileDownloadService {
return of({ pages: [] });
}
loadFile(fileType: FileType | string, fileId: string, saveTo: (fileData) => void = () => null, fetch: () => any = () => null): Observable<any> {
loadFile(fileType: FileType | string, fileStatus: FileStatus, saveTo: (fileData) => void = () => null, fetch: () => any = () => null): Observable<any> {
let fileObs$: Observable<any>;
switch (fileType) {
case FileType.ANNOTATED:
fileObs$ = fetch()
? of(fetch())
: this._fileUploadControllerService.downloadAnnotatedFile(fileId, true, 'body').pipe(
: this._fileUploadControllerService.downloadAnnotatedFile(fileStatus.fileId, true, fileStatus.lastProcessed, 'body').pipe(
tap((data) => {
saveTo(data);
})
@ -70,7 +72,7 @@ export class FileDownloadService {
case FileType.REDACTED:
fileObs$ = fetch()
? of(fetch())
: this._fileUploadControllerService.downloadRedactedFile(fileId, true, 'body').pipe(
: this._fileUploadControllerService.downloadRedactedFile(fileStatus.fileId, true, fileStatus.lastProcessed, 'body').pipe(
tap((data) => {
saveTo(data);
})
@ -80,7 +82,7 @@ export class FileDownloadService {
default:
fileObs$ = fetch()
? of(fetch())
: this._fileUploadControllerService.downloadOriginalFile(fileId, true, 'body').pipe(
: this._fileUploadControllerService.downloadOriginalFile(fileStatus.fileId, true, fileStatus.added, 'body').pipe(
tap((data) => {
saveTo(data);
})

View File

@ -10,7 +10,7 @@ export const DYNAMIC_CACHES = [
},
{
urls: ['/download/original'],
urls: ['/download'],
name: 'files',
maxAge: 3600 * 24 * 7,
maxSize: 1000,

View File

@ -28,11 +28,7 @@ export class FileUploadControllerService {
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;
}
@ -50,61 +46,32 @@ export class FileUploadControllerService {
* @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(
projectId: string,
fileId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public deleteFile(projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deleteFile(
projectId: string,
fileId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public deleteFile(projectId: string, fileId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deleteFile(
projectId: string,
fileId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public deleteFile(projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deleteFile(
projectId: string,
fileId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public deleteFile(projectId: string, fileId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (projectId === null || projectId === undefined) {
throw new Error(
'Required parameter projectId was null or undefined when calling deleteFile.'
);
throw new Error('Required parameter projectId 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.'
);
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;
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);
}
@ -114,9 +81,7 @@ export class FileUploadControllerService {
return this.httpClient.request<any>(
'delete',
`${this.basePath}/delete/${encodeURIComponent(String(projectId))}/${encodeURIComponent(
String(fileId)
)}`,
`${this.basePath}/delete/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@ -134,16 +99,12 @@ export class FileUploadControllerService {
* @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(
fileId: string,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public downloadAnnotatedFile(fileId: string, inline?: boolean, indicator?: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public downloadAnnotatedFile(
fileId: string,
inline?: boolean,
indicator?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
@ -151,6 +112,7 @@ export class FileUploadControllerService {
public downloadAnnotatedFile(
fileId: string,
inline?: boolean,
indicator?: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
@ -158,13 +120,12 @@ export class FileUploadControllerService {
public downloadAnnotatedFile(
fileId: string,
inline?: boolean,
indicator?: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
if (fileId === null || fileId === undefined) {
throw new Error(
'Required parameter fileId was null or undefined when calling downloadAnnotatedFile.'
);
throw new Error('Required parameter fileId was null or undefined when calling downloadAnnotatedFile.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
@ -176,18 +137,13 @@ export class FileUploadControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -195,18 +151,14 @@ export class FileUploadControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request(
'get',
`${this.basePath}/download/annotated/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
return this.httpClient.request('get', `${this.basePath}/download/annotated/${encodeURIComponent(String(fileId))}`, {
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
@ -217,60 +169,41 @@ export class FileUploadControllerService {
* @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(
fileId: string,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public downloadOriginalFile(fileId: string, inline?: boolean, indicator?: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public downloadOriginalFile(
fileId: string,
inline?: boolean,
indicator?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public downloadOriginalFile(
fileId: string,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public downloadOriginalFile(fileId: string, inline?: boolean, indicator?: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public downloadOriginalFile(
fileId: string,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public downloadOriginalFile(fileId: string, inline?: boolean, indicator?: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (fileId === null || fileId === undefined) {
throw new Error(
'Required parameter fileId was null or undefined when calling downloadOriginalFile.'
);
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;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -278,18 +211,14 @@ export class FileUploadControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request(
'get',
`${this.basePath}/download/original/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
return this.httpClient.request('get', `${this.basePath}/download/original/${encodeURIComponent(String(fileId))}`, {
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
@ -300,60 +229,42 @@ export class FileUploadControllerService {
* @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 downloadRedactedFile(
fileId: string,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public downloadRedactedFile(fileId: string, inline?: boolean, indicator?: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public downloadRedactedFile(
fileId: string,
inline?: boolean,
indicator?: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public downloadRedactedFile(
fileId: string,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public downloadRedactedFile(fileId: string, inline?: boolean, indicator?: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public downloadRedactedFile(
fileId: string,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public downloadRedactedFile(fileId: string, inline?: boolean, indicator?: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (fileId === null || fileId === undefined) {
throw new Error(
'Required parameter fileId was null or undefined when calling downloadRedactedFile.'
);
throw new Error('Required parameter fileId was null or undefined when calling downloadRedactedFile.');
}
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;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -361,18 +272,14 @@ export class FileUploadControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request(
'get',
`${this.basePath}/download/redacted/${encodeURIComponent(String(fileId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
return this.httpClient.request('get', `${this.basePath}/download/redacted/${encodeURIComponent(String(fileId))}`, {
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
@ -383,37 +290,15 @@ export class FileUploadControllerService {
* @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 downloadRedactionReport(
body: FileIds,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public downloadRedactionReport(body: FileIds, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
public downloadRedactionReport(
body: FileIds,
inline?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public downloadRedactionReport(body: FileIds, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public downloadRedactionReport(
body: FileIds,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public downloadRedactionReport(body: FileIds, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public downloadRedactionReport(
body: FileIds,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public downloadRedactionReport(body: FileIds, inline?: boolean, 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 downloadRedactionReport.'
);
throw new Error('Required parameter body was null or undefined when calling downloadRedactionReport.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
@ -425,27 +310,20 @@ export class FileUploadControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = ['application/json'];
const httpContentTypeSelected:
| string
| undefined = this.configuration.selectHeaderContentType(consumes);
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
@ -469,12 +347,7 @@ export class FileUploadControllerService {
* @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 downloadRedactionReportForProject(
projectId: string,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public downloadRedactionReportForProject(projectId: string, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
public downloadRedactionReportForProject(
projectId: string,
@ -483,23 +356,11 @@ export class FileUploadControllerService {
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public downloadRedactionReportForProject(
projectId: string,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public downloadRedactionReportForProject(projectId: string, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public downloadRedactionReportForProject(
projectId: string,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public downloadRedactionReportForProject(projectId: string, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (projectId === null || projectId === undefined) {
throw new Error(
'Required parameter projectId was null or undefined when calling downloadRedactionReportForProject.'
);
throw new Error('Required parameter projectId was null or undefined when calling downloadRedactionReportForProject.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
@ -511,18 +372,13 @@ export class FileUploadControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -530,18 +386,14 @@ export class FileUploadControllerService {
// to determine the Content-Type header
const consumes: string[] = [];
return this.httpClient.request(
'get',
`${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`,
{
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
return this.httpClient.request('get', `${this.basePath}/download/report/${encodeURIComponent(String(projectId))}`, {
responseType: 'blob',
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
@ -552,61 +404,32 @@ export class FileUploadControllerService {
* @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 uploadFileForm(
file: Blob,
projectId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<FileUploadResult>;
public uploadFileForm(file: Blob, projectId: string, observe?: 'body', reportProgress?: boolean): Observable<FileUploadResult>;
public uploadFileForm(
file: Blob,
projectId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<FileUploadResult>>;
public uploadFileForm(file: Blob, projectId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<FileUploadResult>>;
public uploadFileForm(
file: Blob,
projectId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<FileUploadResult>>;
public uploadFileForm(file: Blob, projectId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<FileUploadResult>>;
public uploadFileForm(
file: Blob,
projectId: string,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public uploadFileForm(file: Blob, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (file === null || file === undefined) {
throw new Error(
'Required parameter file was null or undefined when calling uploadFile.'
);
throw new Error('Required parameter file was null or undefined when calling uploadFile.');
}
if (projectId === null || projectId === undefined) {
throw new Error(
'Required parameter projectId was null or undefined when calling uploadFile.'
);
throw new Error('Required parameter projectId was null or undefined when calling uploadFile.');
}
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);
}
@ -632,17 +455,13 @@ export class FileUploadControllerService {
formParams = (formParams.append('file', <any>file) as any) || formParams;
}
return this.httpClient.request<FileUploadResult>(
'post',
`${this.basePath}/upload/${encodeURIComponent(String(projectId))}`,
{
body: convertFormParamsToString ? formParams.toString() : formParams,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
return this.httpClient.request<FileUploadResult>('post', `${this.basePath}/upload/${encodeURIComponent(String(projectId))}`, {
body: convertFormParamsToString ? formParams.toString() : formParams,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**