moh-common-lib
Version:
A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).
30 lines (29 loc) • 1.16 kB
TypeScript
import { AbstractHttpService } from './abstract-api-service';
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
export interface GeoAddressResult {
/** String from the API that includes street, city, province, and country. */
fullAddress: string;
city: string;
street: string;
country: string;
province: string;
}
export declare class GeocoderService extends AbstractHttpService {
protected http: HttpClient;
protected _headers: HttpHeaders;
protected BASE_URL: string;
protected ADDRESS_URL: string;
constructor(http: HttpClient);
lookup(address: string): Observable<GeoAddressResult[]>;
/**
* Formats the response from ADDRESS_URL, trimming irrelevant fields.
*
* This works for other requests for the same API too, however it may error
* out on some items if matchPrecisionNot is not set.
*
* @param obj The response from ADDRESS_URL
*/
protected processResponse(obj: any): GeoAddressResult[];
protected handleError(error: HttpErrorResponse): Observable<never>;
}