import {APIService} from "./api"; import {IndexRequest, SearchRequest, SearchResponse, Terms} from "../models/search"; export class SearchService { constructor(private api: APIService, private baseURL: string) {} /** * Creates search indexes for the terms passed in order to be able to search for it in the future * @param consultUUID * @param terms the search terms to be indexed */ public index( consultUUID: string, terms: Terms ): Promise { return this.api.post( `${this.baseURL}/v1/index`, { consultUUID, terms } ) } /** * Searches for the consultations corresponding to the search terms entered in the query * @param terms array of search terms */ public search( terms: Terms ): Promise { return this.api.post( `${this.baseURL}/v1/search`, { terms } ) } }