search api

This commit is contained in:
Timo 2021-07-19 15:01:21 +03:00
parent 92f9b822b3
commit 354d308067
6 changed files with 139 additions and 4 deletions

View File

@ -28,6 +28,7 @@ import { UserPreferenceControllerService } from './api/userPreferenceController.
import { VersionsControllerService } from './api/versionsController.service';
import { ViewedPagesControllerService } from './api/viewedPagesController.service';
import { WatermarkControllerService } from './api/watermarkController.service';
import { SearchControllerService } from './api/searchController.service';
@NgModule({
imports: [],
@ -59,7 +60,8 @@ import { WatermarkControllerService } from './api/watermarkController.service';
UserPreferenceControllerService,
VersionsControllerService,
ViewedPagesControllerService,
WatermarkControllerService
WatermarkControllerService,
SearchControllerService
]
})
export class ApiModule {
@ -69,8 +71,7 @@ export class ApiModule {
}
if (!http) {
throw new Error(
'You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575'
'You need to import the HttpClientModule in your AppModule! \n' + 'See also https://github.com/angular/angular/issues/20575'
);
}
}

View File

@ -25,6 +25,7 @@ import { ReportTemplateControllerService } from './reportTemplateController.serv
import { UploadControllerService } from './uploadController.service';
import { GeneralSettingsControllerService } from './generalSettingsController.service';
import { DossierAttributesControllerService } from './dossierAttributesController.service';
import { SearchControllerService } from './searchController.service';
export * from './auditController.service';
@ -80,6 +81,8 @@ export * from './generalSettingsController.service';
export * from './dossierAttributesController.service';
export * from './searchController.service';
export const APIS = [
AuditControllerService,
DebugControllerService,
@ -107,5 +110,6 @@ export const APIS = [
ReportTemplateControllerService,
UploadControllerService,
GeneralSettingsControllerService,
DossierAttributesControllerService
DossierAttributesControllerService,
SearchControllerService
];

View File

@ -0,0 +1,90 @@
/**
* 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 { SearchRequest } from '../model/searchRequest';
import { SearchResult } from '../model/searchResult';
import { BASE_PATH } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class SearchControllerService {
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;
}
}
/**
* Search for contents of documents
* None
* @param body searchRequest
* @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 search(body: SearchRequest, observe?: 'body', reportProgress?: boolean): Observable<SearchResult>;
public search(body: SearchRequest, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<SearchResult>>;
public search(body: SearchRequest, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<SearchResult>>;
public search(body: SearchRequest, 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 search.');
}
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
let 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<SearchResult>('post', `${this.basePath}/search`, {
body: body,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
});
}
}

View File

@ -76,3 +76,5 @@ export * from './watermarkModelReq';
export * from './watermarkModelRes';
export * from './legalBasisChangeRequest';
export * from './manualLegalBasisChange';
export * from './searchRequest';
export * from './searchResult';

View File

@ -0,0 +1,20 @@
/**
* 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 SearchRequest {
dossierId?: string;
fileId?: string;
from?: number;
queryString?: string;
returnSections?: boolean;
size?: number;
}

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.
*/
import { MatchedDocument } from './matchedDocument';
export interface SearchResult {
matchedDocuments?: Array<MatchedDocument>;
maxScore?: number;
total?: number;
}