From ed1fc6de683b95050e9ba0b55731f799e120042b Mon Sep 17 00:00:00 2001 From: martindonadieu Date: Thu, 14 Jul 2022 12:32:00 +0100 Subject: [PATCH] fix: definition --- src/definitions.ts | 54 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/src/definitions.ts b/src/definitions.ts index 432f7fa..cbd88f9 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -1,6 +1,6 @@ export interface Adress { - latitude: string - longitude: string + latitude: number + longitude: number countryCode: string postalCode: string administrativeArea: string @@ -13,22 +13,56 @@ export interface Adress { formatted_address: string } -export interface ForwardOptions { - addressString: string +export interface baseOption { + /* + * Localise the results to the given locale. + */ useLocale?: boolean + /* + * locale is a string in the format of language_country, for example en_US. + */ defaultLocale?: string + /* + * Max number of results to return. + */ maxResults?: number + /* + * Only used for web platform to use google api + */ apiKey?: string } -export interface reverseOptions { - latitude: number +export interface ForwardOptions extends baseOption { + /* + * address is a string of the address to be geocoded. + */ + addressString: string +} +export interface reverseOptions extends baseOption { + /* + * latitude is a number representing the latitude of the location. + */ + latitude: number + /* + * longitude is a number representing the longitude of the location. + */ longitude: number - useLocale?: boolean - defaultLocale?: string - maxResults?: number - apiKey?: string } export interface NativeGeocoderPlugin { + /* + * Convert latitude and longitude to an address + * + * @param id The bundle id to delete (note, this is the bundle id, NOT the version name) + * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults + * @throws An error if the something went wrong + * @since 0.0.1 + */ reverseGeocode(options: reverseOptions): Promise<{ addresses: Adress[] }>; + /* + * Convert an address to latitude and longitude + * + * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults + * @throws An error if the something went wrong + * @since 0.0.1 + */ forwardGeocode(options: ForwardOptions): Promise<{ addresses: Adress[] }>; }