// import * as wmill from 'https://deno.land/x/windmill/index.ts'
type Ipinfo {
token: string
}
export async function main(ipinfo?: Ipinfo, ip?:string) {
/**
* Makes an API call to IPinfo to get IP address geolocation data and other IP data.
* @param {string} token - Your IPinfo.io access token. This param is optional.
* @param {string} ip - The IP address to lookup. This param is optional if you want to lookup your current IP.
* @returns {object} - An object with the status and the payload.
*/
const ipAddressInformation = await fetch(`https://ipinfo.io${ip ? '/' + ip : '' }/json?token=${ipinfo?.token || ""}`)
return {
status: ipAddressInformation.status,
payload: await ipAddressInformation.json(),
};
}
Submitted by rubenfiszel 676 days ago
// import * as wmill from 'https://deno.land/x/windmill/index.ts'
export async function main(token?: string, ip?:string) {
/**
* Makes an API call to IPinfo to get IP address geolocation data and other IP data.
* @param {string} token - Your IPinfo.io access token. This param is optional.
* @param {string} ip - The IP address to lookup. This param is optional if you want to lookup your current IP.
* @returns {object} - An object with the status and the payload.
*/
const ipAddressInformation = await fetch(`https://ipinfo.io${ip ? '/' + ip : '' }/json?token=${token || ""}`)
return {
status: ipAddressInformation.status,
payload: await ipAddressInformation.json(),
};
}
Submitted by devrel.ipinfo250 676 days ago