<commit_before>import axios, { AxiosRequestConfig, AxiosInstance } from "axios";
import * as merge from "deepmerge";
import { version } from "./index";
import { HttpsAgent } from "agentkeepalive";
import {
  directions,
  DirectionsRequest,
  DirectionsResponse
} from "./directions";
import {
  distancematrix,
  DistanceMatrixRequest,
  DistanceMatrixResponse
} from "./distance";
import { elevation, ElevationRequest, ElevationResponse } from "./elevation";
import { geolocate, GeolocateRequest, GeolocateResponse } from "./geolocate";
import { timezone, TimeZoneRequest, TimeZoneResponse } from "./timezone";
import { geocode, GeocodeRequest, GeocodeResponse } from "./geocode/geocode";
import {
  reverseGeocode,
  ReverseGeocodeRequest,
  ReverseGeocodeResponse
} from "./geocode/reversegeocode";
import {
  placeAutocomplete,
  PlaceAutocompleteRequest,
  PlaceAutocompleteResponse
} from "./places/autocomplete";
import {
  placeDetails,
  PlaceDetailsRequest,
  PlaceDetailsResponse
} from "./places/details";
import {
  findPlaceFromText,
  FindPlaceFromTextRequest,
  FindPlaceFromTextResponse
} from "./places/findplacefromtext";
import {
  placePhoto,
  PlacePhotoRequest,
  PlacePhotoResponse
} from "./places/photo";
import {
  placesNearby,
  PlacesNearbyRequest,
  PlacesNearbyResponse
} from "./places/placesnearby";
import {
  placeQueryAutocomplete,
  PlaceQueryAutocompleteRequest,
  PlaceQueryAutocompleteResponse
} from "./places/queryautocomplete";
import {
  textSearch,
  TextSearchRequest,
  TextSearchResponse
} from "./places/textsearch";
import {
  nearestRoads,
  NearestRoadsRequest,
  NearestRoadsResponse
} from "./roads/nearestroads";
import {
  snapToRoads,
  SnapToRoadsRequest,
  SnapToRoadsResponse
} from "./roads/snaptoroads";

export const defaultHttpsAgent = new HttpsAgent({ keepAlive: true });
export const defaultTimeout = 10000;
export const userAgent = `google-maps-services-node-${version}`;
export const acceptEncoding = "gzip";
export const X_GOOG_MAPS_EXPERIENCE_ID = "X-GOOG-MAPS-EXPERIENCE-ID";

const defaultConfig = {
  timeout: defaultTimeout,
  httpsAgent: defaultHttpsAgent,
  headers: {
    "User-Agent": userAgent,
    "Accept-Encoding": acceptEncoding
  }
};

export const defaultAxiosInstance = axios.create(defaultConfig);

export interface ClientOptions {
  /** AxiosInstance to be used by client. Provide one of axiosInstance or config. */
  axiosInstance?: AxiosInstance;
  /** Config used to create AxiosInstance. Provide one of axiosInstance or config. */
  config?: AxiosRequestConfig;
  experienceId?: string[];
}

export class Client {
  private axiosInstance: AxiosInstance;
  private experienceId: string[];

  constructor({ axiosInstance, config, experienceId }: ClientOptions) {
    if (axiosInstance && config) {
      throw new Error("Provide one of axiosInstance or config.");
    }

    if (axiosInstance) {
      this.axiosInstance = axiosInstance;
      // Avoid changing this instance in any way that affects its behavior<commit_msg>fix: make ClientOptions optional in Client constructor (#354)<commit_after>import axios, { AxiosRequestConfig, AxiosInstance } from "axios";
import * as merge from "deepmerge";
import { version } from "./index";
import { HttpsAgent } from "agentkeepalive";
import {
  directions,
  DirectionsRequest,
  DirectionsResponse
} from "./directions";
import {
  distancematrix,
  DistanceMatrixRequest,
  DistanceMatrixResponse
} from "./distance";
import { elevation, ElevationRequest, ElevationResponse } from "./elevation";
import { geolocate, GeolocateRequest, GeolocateResponse } from "./geolocate";
import { timezone, TimeZoneRequest, TimeZoneResponse } from "./timezone";
import { geocode, GeocodeRequest, GeocodeResponse } from "./geocode/geocode";
import {
  reverseGeocode,
  ReverseGeocodeRequest,
  ReverseGeocodeResponse
} from "./geocode/reversegeocode";
import {
  placeAutocomplete,
  PlaceAutocompleteRequest,
  PlaceAutocompleteResponse
} from "./places/autocomplete";
import {
  placeDetails,
  PlaceDetailsRequest,
  PlaceDetailsResponse
} from "./places/details";
import {
  findPlaceFromText,
  FindPlaceFromTextRequest,
  FindPlaceFromTextResponse
} from "./places/findplacefromtext";
import {
  placePhoto,
  PlacePhotoRequest,
  PlacePhotoResponse
} from "./places/photo";
import {
  placesNearby,
  PlacesNearbyRequest,
  PlacesNearbyResponse
} from "./places/placesnearby";
import {
  placeQueryAutocomplete,
  PlaceQueryAutocompleteRequest,
  PlaceQueryAutocompleteResponse
} from "./places/queryautocomplete";
import {
  textSearch,
  TextSearchRequest,
  TextSearchResponse
} from "./places/textsearch";
import {
  nearestRoads,
  NearestRoadsRequest,
  NearestRoadsResponse
} from "./roads/nearestroads";
import {
  snapToRoads,
  SnapToRoadsRequest,
  SnapToRoadsResponse
} from "./roads/snaptoroads";

export const defaultHttpsAgent = new HttpsAgent({ keepAlive: true });
export const defaultTimeout = 10000;
export const userAgent = `google-maps-services-node-${version}`;
export const acceptEncoding = "gzip";
export const X_GOOG_MAPS_EXPERIENCE_ID = "X-GOOG-MAPS-EXPERIENCE-ID";

const defaultConfig = {
  timeout: defaultTimeout,
  httpsAgent: defaultHttpsAgent,
  headers: {
    "User-Agent": userAgent,
    "Accept-Encoding": acceptEncoding
  }
};

export const defaultAxiosInstance = axios.create(defaultConfig);

export interface ClientOptions {
  /** AxiosInstance to be used by client. Provide one of axiosInstance or config. */
  axiosInstance?: AxiosInstance;
  /** Config used to create AxiosInstance. Provide one of axiosInstance or config. */
  config?: AxiosRequestConfig;
  experienceId?: string[];
}

export class Client {
  private axiosInstance: AxiosInstance;
  private experienceId: string[];

  constructor({ axiosInstance, config, experienceId }: ClientOptions = {}) {
    if (axiosInstance && config) {
      throw new Error("Provide one of axiosInstance or config.");
    }

    if (axiosInstance) {
      this.axiosInstance = axiosInstance;
      // Avoid changing this instance in any way that affects its behavior
{'fraction_non_alphanumeric': 0.09975349219391948, 'fraction_numerical': 0.0021364009860312242, 'mean_word_length': 5.037698412698413, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1299623', 'n_tokens_mistral': 1864, 'n_tokens_neox': 1804, 'n_words': 456}