Options
All
  • Public
  • Public/Protected
  • All
Menu

Class representing the WebServiceClient

Hierarchy

  • WebServiceClient

Index

Constructors

constructor

  • new WebServiceClient(accountID: string, licenseKey: string, options?: number | Options): WebServiceClient
  • Instantiates a WebServiceClient

    Parameters

    • accountID: string

      The account ID

    • licenseKey: string

      The license key

    • Optional options: number | Options

      Additional option to use when connecting to the web service. If you pass a number as the third parameter, it will be treated as the timeout; however, passing in a number should be considered deprecated and may be removed in a future major version.

    Returns WebServiceClient

Properties

Private accountID

accountID: string

Private host

host: string = 'geoip.maxmind.com'

Private licenseKey

licenseKey: string

Private timeout

timeout: number = 3000

Methods

city

  • city(ipAddress: string): Promise<City>
  • Returns a Promise with the City Precision data for an IP address.

    Parameters

    • ipAddress: string

      The IP Address you want to query the City web service with

    Returns Promise<City>

country

  • country(ipAddress: string): Promise<Country>
  • Returns a Promise with the Country Precision data for an IP address.

    Parameters

    • ipAddress: string

      The IP Address you want to query the Country web service with

    Returns Promise<Country>

Private handleError

  • handleError(data: ResponseError, response: IncomingMessage, url: string): WebServiceClientError
  • Parameters

    • data: ResponseError
    • response: IncomingMessage
    • url: string

    Returns WebServiceClientError

insights

  • insights(ipAddress: string): Promise<Insights>
  • Returns a Promise with the Insights Precision data for an IP address.

    Insights is only supported by GeoIP2 Precision. It is not supported by the GeoLite2 web service.

    Parameters

    • ipAddress: string

      The IP Address you want to query the Insights web service with

    Returns Promise<Insights>

Private responseFor

  • responseFor<T>(path: servicePath, ipAddress: string, modelClass: any): Promise<T>
  • Type parameters

    • T

    Parameters

    • path: servicePath
    • ipAddress: string
    • modelClass: any

    Returns Promise<T>

Generated using TypeDoc