//native
type Greip = {
apiKey: string;
};
/**
* Retrieve the IP address of your visitors or users without the need for an account or API key in Greip
* This method allows you to retrieve the IP address of your visitors or users without the need for an account or API key in Greip.
It’s a quick and easy way to access IP information, making it ideal for basic integrations or when you need to capture user IPs with minimal setup.
*/
export async function main(auth: Greip) {
const url = new URL(`https://greipapi.com/ip`);
const response = await fetch(url, {
method: "GET",
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago