Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 18x 18x 18x 18x 2x 2x 2x | import { HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { SuggestTerm } from 'ish-core/models/suggest-term/suggest-term.model';
import { ApiService, unpackEnvelope } from 'ish-core/services/api/api.service';
/**
* The Suggest Service handles the interaction with the 'suggest' REST API.
*/
@Injectable({ providedIn: 'root' })
export class SuggestService {
constructor(private apiService: ApiService) {}
/**
* Returns a list of suggested search terms matching the given search term.
*
* @param searchTerm The search term to get suggestions for.
* @returns List of suggested search terms.
*/
search(searchTerm: string): Observable<SuggestTerm[]> {
const params = new HttpParams().set('SearchTerm', searchTerm);
return this.apiService.get('suggest', { params }).pipe(unpackEnvelope<SuggestTerm>());
}
}
|