diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 9a1f5c93..37921947 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -10,6 +10,7 @@ api/iNSEAccountService.service.ts api/iNSEService.service.ts api/institutions.service.ts api/items.service.ts +api/keywords.service.ts api/news.service.ts api/patents.service.ts api/personNetwork.service.ts @@ -66,6 +67,8 @@ model/euCordisProjectResponse.ts model/euOrganizationProjectSummary.ts model/euOrganizationProjectSummaryPage.ts model/euProjectData.ts +model/extractedKeywords.ts +model/extractedKeywordsResponse.ts model/filterInformation.ts model/filterProperties.ts model/fp7EurosciVoc.ts @@ -116,7 +119,9 @@ model/ipcClassification.ts model/item.ts model/itemCreate.ts model/itemPage.ts +model/keywordEntry.ts model/keywords.ts +model/keywordsRequest.ts model/latitude.ts model/location.ts model/longitude.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 7f47efcd..39dc1b80 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -10,6 +10,8 @@ export * from './institutions.service'; import { InstitutionsService } from './institutions.service'; export * from './items.service'; import { ItemsService } from './items.service'; +import { KeywordsService } from './keywords.service'; +export * from './keywords.service'; export * from './news.service'; import { NewsService } from './news.service'; export * from './patents.service'; @@ -31,6 +33,7 @@ export const APIS = [ INSEServiceService, InstitutionsService, ItemsService, + KeywordsService, NewsService, PatentsService, PersonNetworkService, diff --git a/webapp/src/app/api/api/keywords.service.ts b/webapp/src/app/api/api/keywords.service.ts new file mode 100644 index 00000000..172d077c --- /dev/null +++ b/webapp/src/app/api/api/keywords.service.ts @@ -0,0 +1,162 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * 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, + HttpParameterCodec, + HttpContext, +} from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse'; +// @ts-ignore +import { HTTPValidationError } from '../model/hTTPValidationError'; +// @ts-ignore +import { KeywordsRequest } from '../model/keywordsRequest'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + +@Injectable({ + providedIn: 'root', +}) +export class KeywordsService extends BaseService { + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + } + + /** + * Extracts keywords from text. + * @endpoint post /api/inse-service/keywords/extract + * @param keywordsRequest + * @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 extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (keywordsRequest === null || keywordsRequest === undefined) { + throw new Error( + 'Required parameter keywordsRequest was null or undefined when calling extractKeywords.', + ); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + // to determine the Content-Type header + const consumes: string[] = ['application/json']; + const httpContentTypeSelected: string | undefined = + this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Content-Type', + httpContentTypeSelected, + ); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/keywords/extract`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'post', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } +} diff --git a/webapp/src/app/api/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts new file mode 100644 index 00000000..29e27a45 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywords.ts @@ -0,0 +1,31 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { KeywordEntry } from './keywordEntry'; + + +export interface ExtractedKeywords { + /** + * The extracted broad keywords from text. + */ + broad_keywords: Array; + /** + * The extracted coarse-grained keywords from text. + */ + coarse_grained: Array; + /** + * The extracted fine-grained keywords from text. + */ + fine_grained: Array; + /** + * The source of the extracted keywords, e.g., \'text\', \'url\' + */ + source: string; +} + diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts new file mode 100644 index 00000000..fb156a70 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywordsResponse.ts @@ -0,0 +1,28 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { ExtractedKeywords } from './extractedKeywords'; + + +export interface ExtractedKeywordsResponse { + /** + * The extracted keywords from the input text. + */ + results: ExtractedKeywords; + /** + * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. + */ + source: string; + source_url?: string | null; + /** + * The actual content from which keywords were extracted. + */ + source_content: string; +} + diff --git a/webapp/src/app/api/model/keywordsRequest.ts b/webapp/src/app/api/model/keywordsRequest.ts new file mode 100644 index 00000000..b430dd08 --- /dev/null +++ b/webapp/src/app/api/model/keywordsRequest.ts @@ -0,0 +1,26 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface KeywordsRequest { + /** + * The input text from which to extract keywords. + */ + query: string; + /** + * The mode of keyword extraction, e.g., \'url\', \'text\', or \'keywords\'. + */ + mode: string; + /** + * The maximum number of keywords to extract. + */ + limit?: number; +} +