From 5d0328afe66f51c9fb900fbed0147bd991f30f55 Mon Sep 17 00:00:00 2001 From: BaljeetSinghaw Date: Sat, 13 Jul 2024 10:25:05 +0800 Subject: [PATCH] docs: add geocode example #454 (#734) --- src/client.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/client.ts b/src/client.ts index 41e40fd..4513a31 100644 --- a/src/client.ts +++ b/src/client.ts @@ -206,6 +206,25 @@ export class Client { geolocate(request: GeolocateRequest): Promise { return geolocate(request, this.axiosInstance); } + /** + * An example use of this function. + * + * ```javascript + * import { Client } from '@googlemaps/google-maps-services-js'; + * + * const args = { + * params: { + * key: '', + * address: 'Perth 4WD & Commercial Centre', + * } + * }; + * const client = new Client(); + * client.geocode(args).then(gcResponse => { + * const str = JSON.stringify(gcResponse.data.results[0]); + * console.log(`First result is: ${str}`);) + * }); + * ``` + */ geocode(request: GeocodeRequest): Promise { return geocode(request, this.axiosInstance); }