//native
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 hugo989 6 days ago