UNPKG

pancake-client-sdk

Version:
85 lines (84 loc) 2.3 kB
import { Province, District, Commune, Location, LocationValidationResult, GeocodingResult } from '../types/geo'; import { BaseResource } from './base'; export declare class GeoResource extends BaseResource { /** * Get list of provinces */ listProvinces(params?: { country_code?: string; }): Promise<{ data: Province[]; }>; /** * Get province by ID */ getProvince(provinceId: string): Promise<Province>; /** * Get list of districts in a province */ listDistricts(provinceId: string): Promise<{ data: District[]; }>; /** * Get district by ID */ getDistrict(districtId: string): Promise<District>; /** * Get list of communes in a district */ listCommunes(districtId: string): Promise<{ data: Commune[]; }>; /** * Get commune by ID */ getCommune(communeId: string): Promise<Commune>; /** * Validate address */ validateLocation(location: Location): Promise<LocationValidationResult>; /** * Get full address details */ getFullLocation(params: { province_id?: string; district_id?: string; commune_id?: string; }): Promise<Location>; /** * Format address to standard format */ formatAddress(address: string, includePostalCode?: boolean): Promise<{ formatted_address: string; postal_code?: string; }>; /** * Get coordinates from address (forward geocoding) */ geocodeAddress(address: string): Promise<GeocodingResult[]>; /** * Get address from coordinates (reverse geocoding) */ reverseGeocode(latitude: number, longitude: number): Promise<GeocodingResult>; /** * Calculate distance between two locations */ calculateDistance(fromLocation: Location | { latitude: number; longitude: number; }, toLocation: Location | { latitude: number; longitude: number; }): Promise<{ distance_km: number; duration_minutes: number; }>; /** * Search locations by keyword */ searchLocations(keyword: string, params?: { country_code?: string; province_id?: string; limit?: number; }): Promise<Location[]>; }