Constructors

Properties

apiKey?: string
apiUrl?: string

If you don't want to use the classic fetch

import { ofetch } from "ofetch";
import { IPGeolocationService } from "../dist/types/client.js";
import IPGeolocationClient from "../dist/client.js";

// https://github.com/unjs/ofetch
const client = new IPGeolocationClient({
service: IPGeolocationService.freeipapi,
fetchFn: ofetch.native,
});

const result = await client.lookup("103.21.244.0");

console.log(result);
fetchOpts: Record<string, unknown>

Allows you to set specific values (e.g. proxy). When changing headers/body through this parameter, it is replaced entirely

headers: Record<string, unknown> = {}

Adds headers to the list of headers

provider: BaseProvider

The service used for ip geolocation

Methods

  • Change selected service to one of other

    Parameters

    Returns void