diff --git a/README.md b/README.md index 05b015d3d..abe0df64e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ ## Swagger Generated Code -To regnerate http rune swaagger +To re-generate http rune swagger + +YOu need swagger-codegen installed `brew install swagger-codegen` ``` BASE=https://redapi-staging.iqser.cloud/ diff --git a/libs/red-ui-http/src/lib/api.module.ts b/libs/red-ui-http/src/lib/api.module.ts index e30dc13b5..8f529ea69 100644 --- a/libs/red-ui-http/src/lib/api.module.ts +++ b/libs/red-ui-http/src/lib/api.module.ts @@ -26,6 +26,7 @@ import { DigitalSignatureControllerService } from './api/digitalSignatureControl declarations: [], exports: [], providers: [ + AuditControllerService, DebugControllerService, DictionaryControllerService, FileManagementControllerService, diff --git a/libs/red-ui-http/src/lib/api/api.ts b/libs/red-ui-http/src/lib/api/api.ts index fb8745716..1653d5ae1 100644 --- a/libs/red-ui-http/src/lib/api/api.ts +++ b/libs/red-ui-http/src/lib/api/api.ts @@ -1,3 +1,4 @@ +import { AuditControllerService } from './auditController.service'; import { DebugControllerService } from './debugController.service'; import { DictionaryControllerService } from './dictionaryController.service'; import { FileManagementControllerService } from './fileManagementController.service'; @@ -19,6 +20,8 @@ import { WatermarkControllerService } from './watermarkController.service'; import { DownloadControllerService } from './downloadController.service'; import { DigitalSignatureControllerService } from './digitalSignatureController.service'; +export * from './auditController.service'; + export * from './dictionaryController.service'; export * from './fileManagementController.service'; @@ -60,6 +63,7 @@ export * from './digitalSignatureController.service'; export * from './debugController.service'; export const APIS = [ + AuditControllerService, DebugControllerService, DictionaryControllerService, FileManagementControllerService, diff --git a/libs/red-ui-http/src/lib/api/auditController.service.ts b/libs/red-ui-http/src/lib/api/auditController.service.ts new file mode 100644 index 000000000..2b7fd032c --- /dev/null +++ b/libs/red-ui-http/src/lib/api/auditController.service.ts @@ -0,0 +1,136 @@ +/** + * 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 { AuditResponse } from '../model/auditResponse'; +import { AuditSearchRequest } from '../model/auditSearchRequest'; +import { CategoryModel } from '../model/categoryModel'; + +import { BASE_PATH } from '../variables'; +import { Configuration } from '../configuration'; + +@Injectable() +export class AuditControllerService { + 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 a list of available categories for the audit-log + * 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 getAuditCategories(observe?: 'body', reportProgress?: boolean): Observable>; + public getAuditCategories(observe?: 'response', reportProgress?: boolean): Observable>>; + public getAuditCategories(observe?: 'events', reportProgress?: boolean): Observable>>; + public getAuditCategories(observe: any = 'body', reportProgress: boolean = false): Observable { + 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>('get', `${this.basePath}/audit/categories`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Search the audit-log based on some entries the digital signature used to sign PDF's + * None + * @param body auditSearchRequest + * @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 searchAuditLog(body: AuditSearchRequest, observe?: 'body', reportProgress?: boolean): Observable; + public searchAuditLog(body: AuditSearchRequest, observe?: 'response', reportProgress?: boolean): Observable>; + public searchAuditLog(body: AuditSearchRequest, observe?: 'events', reportProgress?: boolean): Observable>; + public searchAuditLog(body: AuditSearchRequest, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling searchAuditLog.'); + } + + 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('post', `${this.basePath}/audit/search`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } +} diff --git a/libs/red-ui-http/src/lib/model/auditModel.ts b/libs/red-ui-http/src/lib/model/auditModel.ts new file mode 100644 index 000000000..8bef378ea --- /dev/null +++ b/libs/red-ui-http/src/lib/model/auditModel.ts @@ -0,0 +1,21 @@ +/** + * 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 AuditModel { + category?: string; + details?: any; + message?: string; + objectId?: string; + recordDate?: string; + recordId?: string; + userId?: string; +} diff --git a/libs/red-ui-http/src/lib/model/auditResponse.ts b/libs/red-ui-http/src/lib/model/auditResponse.ts new file mode 100644 index 000000000..33803a1aa --- /dev/null +++ b/libs/red-ui-http/src/lib/model/auditResponse.ts @@ -0,0 +1,19 @@ +/** + * 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 { AuditModel } from './auditModel'; + +export interface AuditResponse { + data?: Array; + page?: number; + pageSize?: number; + totalHits?: number; +} diff --git a/libs/red-ui-http/src/lib/model/auditSearchRequest.ts b/libs/red-ui-http/src/lib/model/auditSearchRequest.ts new file mode 100644 index 000000000..3dfbafe83 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/auditSearchRequest.ts @@ -0,0 +1,23 @@ +/** + * 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 AuditSearchRequest { + category?: string; + from?: string; + objectId?: string; + page?: number; + pageSize?: number; + requestingUserId?: string; + to?: string; + userId?: string; + withTotalHits?: boolean; +} diff --git a/libs/red-ui-http/src/lib/model/categoryModel.ts b/libs/red-ui-http/src/lib/model/categoryModel.ts new file mode 100644 index 000000000..501052aa8 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/categoryModel.ts @@ -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. + */ + +export interface CategoryModel { + category?: string; + recordCount?: number; +} diff --git a/libs/red-ui-http/src/lib/model/models.ts b/libs/red-ui-http/src/lib/model/models.ts index e1d6cb38c..98a0186d6 100644 --- a/libs/red-ui-http/src/lib/model/models.ts +++ b/libs/red-ui-http/src/lib/model/models.ts @@ -54,3 +54,7 @@ export * from './redactionChangeLog'; export * from './redactionChangeLogEntry'; export * from './forceRedactionRequest'; export * from './manualForceRedaction'; +export * from './auditModel'; +export * from './auditResponse'; +export * from './auditSearchRequest'; +export * from './categoryModel';