Client is a light wrapper around API methods providing shared configuration for Axios settings such as retry logic using the default retry-axios settings and gzip encoding.

Instantiate with defaults

const client = Client()

Instantiate with config

const client = Client({config})

Instantiate with axiosInstance Advanced

const axiosInstance = axios.create(config)
const client = Client({axiosInstance})

Constructors

Properties

axiosInstance: AxiosInstance
experienceId: string[]

Methods

  • An example use of this function.

    import { Client } from '@googlemaps/google-maps-services-js';

    const args = {
    params: {
    key: '<your-api-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}`);
    });

    Parameters

    Returns Promise<GeocodeResponse>

  • Parameters

    • Rest ...ids: string[]

    Returns void