added fileattribute service

This commit is contained in:
Timo 2021-03-18 21:56:30 +02:00
parent f70aa3bb71
commit 75bafe64ca
10 changed files with 380 additions and 3 deletions

View File

@ -7,7 +7,7 @@ To re-generate http rune swagger
YOu need swagger-codegen installed `brew install swagger-codegen`
```
BASE=https://redapi-staging.iqser.cloud/
BASE=http://redaction.redaction-timo-12027.178.63.47.73.xip.io/
URL="$BASE"v2/api-docs?group=redaction-gateway-v1
mkdir -p /tmp/swagger
swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger

View File

@ -21,6 +21,7 @@ import { RuleSetControllerService } from './api/ruleSetController.service';
import { DownloadControllerService } from './api/downloadController.service';
import { DigitalSignatureControllerService } from './api/digitalSignatureController.service';
import { AuditControllerService } from './api/auditController.service';
import { FileAttributesControllerService } from './api/fileAttributesController.service';
@NgModule({
imports: [],
@ -45,7 +46,8 @@ import { AuditControllerService } from './api/auditController.service';
LegalBasisMappingControllerService,
WatermarkControllerService,
DownloadControllerService,
DigitalSignatureControllerService
DigitalSignatureControllerService,
FileAttributesControllerService
]
})
export class ApiModule {

View File

@ -19,6 +19,7 @@ import { ViewedPagesControllerService } from './viewedPagesController.service';
import { WatermarkControllerService } from './watermarkController.service';
import { DownloadControllerService } from './downloadController.service';
import { DigitalSignatureControllerService } from './digitalSignatureController.service';
import { FileAttributesControllerService } from './fileAttributesController.service';
export * from './auditController.service';
@ -62,6 +63,8 @@ export * from './digitalSignatureController.service';
export * from './debugController.service';
export * from './fileAttributesController.service';
export const APIS = [
AuditControllerService,
DebugControllerService,
@ -83,5 +86,6 @@ export const APIS = [
ViewedPagesControllerService,
WatermarkControllerService,
DownloadControllerService,
DigitalSignatureControllerService
DigitalSignatureControllerService,
FileAttributesControllerService
];

View File

@ -0,0 +1,284 @@
/**
* 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, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { FileAttributes } from '../model/fileAttributes';
import { FileAttributesConfig } from '../model/fileAttributesConfig';
import { ImportCsvRequest } from '../model/importCsvRequest';
import { ImportCsvResponse } from '../model/importCsvResponse';
import { BASE_PATH } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class FileAttributesControllerService {
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;
}
/**
* Get the file attributes that can be used at importing csv.
* None
* @param ruleSetId ruleSetId
* @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 getFileAttributesConfiguration(ruleSetId: string, observe?: 'body', reportProgress?: boolean): Observable<FileAttributesConfig>;
public getFileAttributesConfiguration(ruleSetId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<FileAttributesConfig>>;
public getFileAttributesConfiguration(ruleSetId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<FileAttributesConfig>>;
public getFileAttributesConfiguration(ruleSetId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (ruleSetId === null || ruleSetId === undefined) {
throw new Error('Required parameter ruleSetId was null or undefined when calling getFileAttributesConfiguration.');
}
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<FileAttributesConfig>('get', `${this.basePath}/fileAttributes/config/${encodeURIComponent(String(ruleSetId))}`, {
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
* Import a csv file to set file attributes
* None
* @param body importCsvRequest
* @param projectId projectId
* @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 importCsv(body: ImportCsvRequest, projectId: string, observe?: 'body', reportProgress?: boolean): Observable<ImportCsvResponse>;
public importCsv(body: ImportCsvRequest, projectId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ImportCsvResponse>>;
public importCsv(body: ImportCsvRequest, projectId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ImportCsvResponse>>;
public importCsv(body: ImportCsvRequest, projectId: 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 importCsv.');
}
if (projectId === null || projectId === undefined) {
throw new Error('Required parameter projectId was null or undefined when calling importCsv.');
}
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<ImportCsvResponse>('post', `${this.basePath}/fileAttributes/csvImport/${encodeURIComponent(String(projectId))}`, {
body: body,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
/**
* Set file attributes to a existing file
* None
* @param body fileAttributes
* @param projectId projectId
* @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 setFileAttributes(body: FileAttributes, projectId: string, fileId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public setFileAttributes(
body: FileAttributes,
projectId: string,
fileId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public setFileAttributes(body: FileAttributes, projectId: string, fileId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public setFileAttributes(body: FileAttributes, projectId: string, fileId: 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 setFileAttributes.');
}
if (projectId === null || projectId === undefined) {
throw new Error('Required parameter projectId was null or undefined when calling setFileAttributes.');
}
if (fileId === null || fileId === undefined) {
throw new Error('Required parameter fileId was null or undefined when calling setFileAttributes.');
}
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}/fileAttributes/set/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(fileId))}`,
{
body: body,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Set the file attributes that can be used at importing csv.
* None
* @param body fileAttributes
* @param ruleSetId ruleSetId
* @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 setFileAttributesConfiguration(
body: FileAttributesConfig,
ruleSetId: string,
observe?: 'body',
reportProgress?: boolean
): Observable<FileAttributesConfig>;
public setFileAttributesConfiguration(
body: FileAttributesConfig,
ruleSetId: string,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<FileAttributesConfig>>;
public setFileAttributesConfiguration(
body: FileAttributesConfig,
ruleSetId: string,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<FileAttributesConfig>>;
public setFileAttributesConfiguration(
body: FileAttributesConfig,
ruleSetId: 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 setFileAttributesConfiguration.');
}
if (ruleSetId === null || ruleSetId === undefined) {
throw new Error('Required parameter ruleSetId was null or undefined when calling setFileAttributesConfiguration.');
}
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<FileAttributesConfig>('post', `${this.basePath}/fileAttributes/config/${encodeURIComponent(String(ruleSetId))}`, {
body: body,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
}

View 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.
*/
export interface FileAttribute {
editable?: boolean;
id?: string;
name?: string;
visible?: boolean;
}

View 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 FileAttributes {
attributeIdToValue?: any;
}

View 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 { FileAttribute } from './fileAttribute';
export interface FileAttributesConfig {
fileAttributes?: Array<FileAttribute>;
}

View 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.
*/
export interface ImportCsvRequest {
delimiter?: string;
fileStatusFilenameColumn?: number;
attributeIdToColumnMapping?: { [key: string]: number };
csvFile?: string;
}

View 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 ImportCsvResponse {
affectedFileIds?: Array<string>;
}

View File

@ -58,3 +58,8 @@ export * from './auditModel';
export * from './auditResponse';
export * from './auditSearchRequest';
export * from './categoryModel';
export * from './fileAttribute';
export * from './fileAttributes';
export * from './fileAttributesConfig';
export * from './importCsvRequest';
export * from './importCsvResponse';