pancake-client-sdk
Version:
Official TypeScript SDK for Pancake POS API
95 lines • 2.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeoResource = void 0;
const base_1 = require("./base");
class GeoResource extends base_1.BaseResource {
/**
* Get list of provinces
*/
async listProvinces(params) {
return this.client.get('/geo/provinces', params);
}
/**
* Get province by ID
*/
async getProvince(provinceId) {
return this.client.get(`/geo/provinces/${provinceId}`);
}
/**
* Get list of districts in a province
*/
async listDistricts(provinceId) {
return this.client.get('/geo/districts', { province_id: provinceId });
}
/**
* Get district by ID
*/
async getDistrict(districtId) {
return this.client.get(`/geo/districts/${districtId}`);
}
/**
* Get list of communes in a district
*/
async listCommunes(districtId) {
return this.client.get('/geo/communes', { district_id: districtId });
}
/**
* Get commune by ID
*/
async getCommune(communeId) {
return this.client.get(`/geo/communes/${communeId}`);
}
/**
* Validate address
*/
async validateLocation(location) {
return this.client.post('/geo/validate', location);
}
/**
* Get full address details
*/
async getFullLocation(params) {
return this.client.get('/geo/location', params);
}
/**
* Format address to standard format
*/
async formatAddress(address, includePostalCode) {
return this.client.post('/geo/format-address', {
address,
include_postal_code: includePostalCode
});
}
/**
* Get coordinates from address (forward geocoding)
*/
async geocodeAddress(address) {
return this.client.post('/geo/geocode', { address });
}
/**
* Get address from coordinates (reverse geocoding)
*/
async reverseGeocode(latitude, longitude) {
return this.client.get('/geo/reverse-geocode', { latitude, longitude });
}
/**
* Calculate distance between two locations
*/
async calculateDistance(fromLocation, toLocation) {
return this.client.post('/geo/calculate-distance', {
from: fromLocation,
to: toLocation
});
}
/**
* Search locations by keyword
*/
async searchLocations(keyword, params) {
return this.client.get('/geo/search', {
keyword,
...params
});
}
}
exports.GeoResource = GeoResource;
//# sourceMappingURL=geo.js.map