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>> { intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (!req.url.startsWith('/assets')) { if (!req.url.startsWith('/assets')) {
console.log(this._appConfigService);
const updatedRequest = req.clone({ const updatedRequest = req.clone({
url: this._appConfigService.getConfig(AppConfigKey.API_URL) + req.url url: this._appConfigService.getConfig(AppConfigKey.API_URL) + req.url
}); });
return next.handle(updatedRequest); return next.handle(updatedRequest);
} else { } 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); return next.handle(req);
} }
// }
} }
} }

View File

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

View File

@ -268,7 +268,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
} }
private _restoreViewerState() { private _restoreViewerState() {
console.log('emit'); console.log('emit viewer ready');
this.viewerReady.emit(this.instance); this.viewerReady.emit(this.instance);
this._restoreState(this._viewerState, 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 { forkJoin, Observable, of } from 'rxjs';
import { map, tap } from 'rxjs/operators'; import { map, tap } from 'rxjs/operators';
import { import {
FileStatus,
FileUploadControllerService, FileUploadControllerService,
ManualRedactionControllerService, ManualRedactionControllerService,
RedactionLogControllerService, RedactionLogControllerService,
@ -30,7 +31,7 @@ export class FileDownloadService {
} }
public loadActiveFileData(): Observable<FileDataModel> { 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 reactionLogObs = this._redactionLogControllerService.getRedactionLog(this._appStateService.activeFileId);
const manualRedactionsObs = this._manualRedactionControllerService.getManualRedaction( const manualRedactionsObs = this._manualRedactionControllerService.getManualRedaction(
this._appStateService.activeProjectId, this._appStateService.activeProjectId,
@ -40,14 +41,15 @@ export class FileDownloadService {
return forkJoin([annotatedObs, reactionLogObs, manualRedactionsObs, viewedPagesObs]).pipe( return forkJoin([annotatedObs, reactionLogObs, manualRedactionsObs, viewedPagesObs]).pipe(
map((data) => { map((data) => {
const fileData = new FileDataModel(this._appStateService.activeFile, ...data); return new FileDataModel(this._appStateService.activeFile, ...data);
// lazy load redacted data
this.loadFile('REDACTED', this._appStateService.activeFileId).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData));
return fileData;
}) })
); );
} }
public loadRedactedView(fileData: FileDataModel) {
this.loadFile('REDACTED', fileData.fileStatus).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData));
}
getViewedPagesForActiveFile() { getViewedPagesForActiveFile() {
if (this._permissionsService.canMarkPagesAsViewed()) { if (this._permissionsService.canMarkPagesAsViewed()) {
return this._viewedPagesControllerService.getViewedPages(this._appStateService.activeProjectId, this._appStateService.activeFileId); return this._viewedPagesControllerService.getViewedPages(this._appStateService.activeProjectId, this._appStateService.activeFileId);
@ -55,13 +57,13 @@ export class FileDownloadService {
return of({ pages: [] }); 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>; let fileObs$: Observable<any>;
switch (fileType) { switch (fileType) {
case FileType.ANNOTATED: case FileType.ANNOTATED:
fileObs$ = fetch() fileObs$ = fetch()
? of(fetch()) ? of(fetch())
: this._fileUploadControllerService.downloadAnnotatedFile(fileId, true, 'body').pipe( : this._fileUploadControllerService.downloadAnnotatedFile(fileStatus.fileId, true, fileStatus.lastProcessed, 'body').pipe(
tap((data) => { tap((data) => {
saveTo(data); saveTo(data);
}) })
@ -70,7 +72,7 @@ export class FileDownloadService {
case FileType.REDACTED: case FileType.REDACTED:
fileObs$ = fetch() fileObs$ = fetch()
? of(fetch()) ? of(fetch())
: this._fileUploadControllerService.downloadRedactedFile(fileId, true, 'body').pipe( : this._fileUploadControllerService.downloadRedactedFile(fileStatus.fileId, true, fileStatus.lastProcessed, 'body').pipe(
tap((data) => { tap((data) => {
saveTo(data); saveTo(data);
}) })
@ -80,7 +82,7 @@ export class FileDownloadService {
default: default:
fileObs$ = fetch() fileObs$ = fetch()
? of(fetch()) ? of(fetch())
: this._fileUploadControllerService.downloadOriginalFile(fileId, true, 'body').pipe( : this._fileUploadControllerService.downloadOriginalFile(fileStatus.fileId, true, fileStatus.added, 'body').pipe(
tap((data) => { tap((data) => {
saveTo(data); saveTo(data);
}) })

View File

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

View File

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