2020-01-21 13:52:36 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { HttpClient, HttpParams } from "@angular/common/http";
|
|
|
|
import { AppConfig } from "../shared/app.config";
|
|
|
|
import { ICodeListItem } from '../models/code.list.item';
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root',
|
|
|
|
})
|
|
|
|
export class CodeListItemService {
|
|
|
|
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiEndpoint() {
|
|
|
|
return this.appConfig.getConfig("apiEndPoint");
|
|
|
|
}
|
|
|
|
|
2020-01-21 17:15:50 +00:00
|
|
|
getCodeListItems(codelist: string[], codegroup?: string, dataFilter?: any): Observable<ICodeListItem[]> {
|
2020-01-21 13:52:36 +00:00
|
|
|
var params = new HttpParams();
|
|
|
|
params = params.append("cl", codelist.join(","));
|
|
|
|
if (codegroup) params = params.append("g", codegroup);
|
|
|
|
if (dataFilter) params = params.append("df", dataFilter);
|
2020-01-22 09:05:03 +00:00
|
|
|
return this.httpClient.get<ICodeListItem[]>(`${this.ApiEndpoint()}/api/v1/codelistitems/`, { params: params });
|
2020-01-21 13:52:36 +00:00
|
|
|
}
|
|
|
|
}
|