@do-kevin/pc-vn
Version:
Type-safe & simple utility library for searching and filtering Vietnam's localities.
77 lines (76 loc) • 2.07 kB
TypeScript
import { WardFunction } from '../types/ward';
/**
* Retrieve a list of all wards.
*/
export declare const getWards: () => {
code: string;
name: string;
unit: string;
district_code: string;
district_name: string;
province_code: string;
province_name: string; /**
* Retrieve a list of wards based on district code.
*
* @param districtCode - string value of district_code
* @returns Array of wards.
*
* @example
* `getWardsByDistrictCode('281')`
* ##### Result:
* ```
* [{
* code: '10357',
* name: 'Xã Viên An',
* unit: 'Xã',
* district_code: '281',
* district_name: 'Huyện Ứng Hòa',
* province_code: '01',
* province_name: 'Thành phố Hà Nội',
* full_name: 'Xã Viên An, Huyện Ứng Hòa, Thành phố Hà Nội'}, ...]
* ```
*/
full_name: string;
}[];
/**
* Retrieve a list of wards based on district code.
*
* @param districtCode - string value of district_code
* @returns Array of wards.
*
* @example
* `getWardsByDistrictCode('281')`
* ##### Result:
* ```
* [{
* code: '10357',
* name: 'Xã Viên An',
* unit: 'Xã',
* district_code: '281',
* district_name: 'Huyện Ứng Hòa',
* province_code: '01',
* province_name: 'Thành phố Hà Nội',
* full_name: 'Xã Viên An, Huyện Ứng Hòa, Thành phố Hà Nội'}, ...]
* ```
*/
export declare const getWardsByDistrictCode: WardFunction;
/**
* Retrieve a list of wards based on province code.
* @param provinceCode - string value of province_code
* @returns Array of wards
* @example
* `getDistrictsByProvinceCode('96')`
* ##### Result:
* ```
* [{
* code: '32242',
* name: 'Xã Viên An',
* unit: 'Xã',
* district_code: '973',
* district_name: 'Huyện Ngọc Hiển',
* province_code: '96',
* province_name: 'Tỉnh Cà Mau',
* full_name: 'Xã Viên An, Huyện Ngọc Hiển, Tỉnh Cà Mau'}, ...]
* ```
*/
export declare const getWardsByProvinceCode: WardFunction;