updated http client lib
This commit is contained in:
parent
0544c178a6
commit
2fbbd1d480
@ -5,7 +5,7 @@
|
||||
To regnerate http rune swaagger
|
||||
|
||||
```
|
||||
BASE=http://localhost:8080/
|
||||
BASE=https://timo-redaction-dev.iqser.cloud/
|
||||
URL="$BASE"v2/api-docs?group=redaction-gateway-v1
|
||||
mkdir -p /tmp/swagger
|
||||
swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger
|
||||
|
||||
@ -18,6 +18,7 @@ import { ViewedPagesControllerService } from './api/viewedPagesController.servic
|
||||
import { LegalBasisMappingControllerService } from './api/legalBasisMappingController.service';
|
||||
import { WatermarkControllerService } from './api/watermarkController.service';
|
||||
import { RuleSetControllerService } from './api/ruleSetController.service';
|
||||
import { DownloadControllerService } from './api/downloadController.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
@ -39,7 +40,8 @@ import { RuleSetControllerService } from './api/ruleSetController.service';
|
||||
VersionsControllerService,
|
||||
ViewedPagesControllerService,
|
||||
LegalBasisMappingControllerService,
|
||||
WatermarkControllerService
|
||||
WatermarkControllerService,
|
||||
DownloadControllerService
|
||||
]
|
||||
})
|
||||
export class ApiModule {
|
||||
|
||||
@ -17,6 +17,7 @@ import { UserPreferenceControllerService } from './userPreferenceController.serv
|
||||
import { VersionsControllerService } from './versionsController.service';
|
||||
import { ViewedPagesControllerService } from './viewedPagesController.service';
|
||||
import { WatermarkControllerService } from './watermarkController.service';
|
||||
import { DownloadControllerService } from './downloadController.service';
|
||||
|
||||
export * from './dictionaryController.service';
|
||||
|
||||
@ -52,6 +53,8 @@ export * from './viewedPagesController.service';
|
||||
|
||||
export * from './watermarkController.service';
|
||||
|
||||
export * from './downloadController.service';
|
||||
|
||||
export const APIS = [
|
||||
DebugControllerService,
|
||||
DictionaryControllerService,
|
||||
@ -70,5 +73,6 @@ export const APIS = [
|
||||
UserPreferenceControllerService,
|
||||
VersionsControllerService,
|
||||
ViewedPagesControllerService,
|
||||
WatermarkControllerService
|
||||
WatermarkControllerService,
|
||||
DownloadControllerService
|
||||
];
|
||||
|
||||
191
libs/red-ui-http/src/lib/api/downloadController.service.ts
Normal file
191
libs/red-ui-http/src/lib/api/downloadController.service.ts
Normal file
@ -0,0 +1,191 @@
|
||||
/**
|
||||
* 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, HttpHeaders, HttpParams, HttpResponse, HttpEvent } from '@angular/common/http';
|
||||
import { CustomHttpUrlEncodingCodec } from '../encoder';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { DownloadRequest } from '../model/downloadRequest';
|
||||
import { DownloadResponse } from '../model/downloadResponse';
|
||||
import { DownloadStatusResponse } from '../model/downloadStatusResponse';
|
||||
import { PrepareDownloadRequest } from '../model/prepareDownloadRequest';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
@Injectable()
|
||||
export class DownloadControllerService {
|
||||
protected basePath = '';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a downloadable byte stream of the requested file
|
||||
* Use the optional \"inline\" request parameter to select, if this report will be opened in the browser.
|
||||
* @param body downloadRequest
|
||||
* @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 downloadFile(body: DownloadRequest, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
||||
public downloadFile(body: DownloadRequest, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
||||
public downloadFile(body: DownloadRequest, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
||||
public downloadFile(body: DownloadRequest, 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 downloadFile.');
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// 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}/async/download/get`, {
|
||||
body: body,
|
||||
params: queryParameters,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets to download status for the current user
|
||||
* None
|
||||
* @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 getDownloadStatus(observe?: 'body', reportProgress?: boolean): Observable<DownloadStatusResponse>;
|
||||
public getDownloadStatus(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<DownloadStatusResponse>>;
|
||||
public getDownloadStatus(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<DownloadStatusResponse>>;
|
||||
public getDownloadStatus(observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (RED-OAUTH) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = ['application/json'];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [];
|
||||
|
||||
return this.httpClient.request<DownloadStatusResponse>('get', `${this.basePath}/async/download/status`, {
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a download for given fileIds and types
|
||||
* None
|
||||
* @param body request
|
||||
* @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 prepareDownload(body: PrepareDownloadRequest, observe?: 'body', reportProgress?: boolean): Observable<DownloadResponse>;
|
||||
public prepareDownload(body: PrepareDownloadRequest, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<DownloadResponse>>;
|
||||
public prepareDownload(body: PrepareDownloadRequest, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<DownloadResponse>>;
|
||||
public prepareDownload(body: PrepareDownloadRequest, 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 prepareDownload.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (RED-OAUTH) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = ['application/json'];
|
||||
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
// 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<DownloadResponse>('post', `${this.basePath}/async/download/prepare`, {
|
||||
body: body,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
});
|
||||
}
|
||||
}
|
||||
34
libs/red-ui-http/src/lib/model/downloadDetails.ts
Normal file
34
libs/red-ui-http/src/lib/model/downloadDetails.ts
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export interface DownloadDetails {
|
||||
downloadFileTypes?: Array<DownloadDetails.DownloadFileTypesEnum>;
|
||||
fileIds?: Array<string>;
|
||||
reportTypes?: Array<DownloadDetails.ReportTypesEnum>;
|
||||
}
|
||||
export namespace DownloadDetails {
|
||||
export type DownloadFileTypesEnum = 'ORIGINAL' | 'PREVIEW' | 'REDACTED' | 'ANNOTATED' | 'FLATTEN';
|
||||
export const DownloadFileTypesEnum = {
|
||||
ORIGINAL: 'ORIGINAL' as DownloadFileTypesEnum,
|
||||
PREVIEW: 'PREVIEW' as DownloadFileTypesEnum,
|
||||
REDACTED: 'REDACTED' as DownloadFileTypesEnum,
|
||||
ANNOTATED: 'ANNOTATED' as DownloadFileTypesEnum,
|
||||
FLATTEN: 'FLATTEN' as DownloadFileTypesEnum
|
||||
};
|
||||
export type ReportTypesEnum = 'SINGLE_FILE_EFSA_TEMPLATE' | 'SINGLE_FILE_SYNGENTA_TEMPLATE' | 'MULTI_FILE_EFSA_TEMPLATE' | 'MULTI_FILE_SYNGENTA_TEMPLATE';
|
||||
export const ReportTypesEnum = {
|
||||
SINGLEFILEEFSATEMPLATE: 'SINGLE_FILE_EFSA_TEMPLATE' as ReportTypesEnum,
|
||||
SINGLEFILESYNGENTATEMPLATE: 'SINGLE_FILE_SYNGENTA_TEMPLATE' as ReportTypesEnum,
|
||||
MULTIFILEEFSATEMPLATE: 'MULTI_FILE_EFSA_TEMPLATE' as ReportTypesEnum,
|
||||
MULTIFILESYNGENTATEMPLATE: 'MULTI_FILE_SYNGENTA_TEMPLATE' as ReportTypesEnum
|
||||
};
|
||||
}
|
||||
18
libs/red-ui-http/src/lib/model/downloadRequest.ts
Normal file
18
libs/red-ui-http/src/lib/model/downloadRequest.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object containing information on which prepared download should be downloaded.
|
||||
*/
|
||||
export interface DownloadRequest {
|
||||
storageId?: string;
|
||||
}
|
||||
15
libs/red-ui-http/src/lib/model/downloadResponse.ts
Normal file
15
libs/red-ui-http/src/lib/model/downloadResponse.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export interface DownloadResponse {
|
||||
storageId?: string;
|
||||
}
|
||||
33
libs/red-ui-http/src/lib/model/downloadStatus.ts
Normal file
33
libs/red-ui-http/src/lib/model/downloadStatus.ts
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { DownloadDetails } from './downloadDetails';
|
||||
|
||||
export interface DownloadStatus {
|
||||
creationDate?: string;
|
||||
downloadDetails?: DownloadDetails;
|
||||
filename?: string;
|
||||
lastDownload?: string;
|
||||
mimeType?: string;
|
||||
projectId?: string;
|
||||
status?: DownloadStatus.StatusEnum;
|
||||
storageId?: string;
|
||||
userId?: string;
|
||||
}
|
||||
export namespace DownloadStatus {
|
||||
export type StatusEnum = 'QUEUED' | 'GENERATING' | 'READY' | 'FAILED';
|
||||
export const StatusEnum = {
|
||||
QUEUED: 'QUEUED' as StatusEnum,
|
||||
GENERATING: 'GENERATING' as StatusEnum,
|
||||
READY: 'READY' as StatusEnum,
|
||||
FAILED: 'FAILED' as StatusEnum
|
||||
};
|
||||
}
|
||||
16
libs/red-ui-http/src/lib/model/downloadStatusResponse.ts
Normal file
16
libs/red-ui-http/src/lib/model/downloadStatusResponse.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { DownloadStatus } from './downloadStatus';
|
||||
|
||||
export interface DownloadStatusResponse {
|
||||
downloadStatus?: Array<DownloadStatus>;
|
||||
}
|
||||
@ -42,3 +42,9 @@ export * from './versionsResponse';
|
||||
export * from './viewedPages';
|
||||
export * from './viewedPagesRequest';
|
||||
export * from './watermarkModel';
|
||||
export * from './downloadDetails';
|
||||
export * from './downloadRequest';
|
||||
export * from './downloadResponse';
|
||||
export * from './downloadStatus';
|
||||
export * from './downloadStatusResponse';
|
||||
export * from './prepareDownloadRequest';
|
||||
|
||||
27
libs/red-ui-http/src/lib/model/prepareDownloadRequest.ts
Normal file
27
libs/red-ui-http/src/lib/model/prepareDownloadRequest.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object containing information on which file and report types should be included in the download.
|
||||
*/
|
||||
export interface PrepareDownloadRequest {
|
||||
/**
|
||||
* Which files should be included. Possible values are ORIGINAL, PREVIEW, REDACTED, ANNOTATED, FLATTEN
|
||||
*/
|
||||
downloadFileTypes?: Array<string>;
|
||||
projectId?: string;
|
||||
/**
|
||||
* Which reports should be included. Possible values are SINGLE_FILE_EFSA_TEMPLATE, SINGLE_FILE_SYNGENTA_TEMPLATE, MULTI_FILE_EFSA_TEMPLATE, MULTI_FILE_SYNGENTA_TEMPLATE
|
||||
*/
|
||||
reportTypes?: Array<string>;
|
||||
fileIds?: Array<string>;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user