type Mailgun = {
api_key: string;
};
export async function main(
resource: Mailgun,
data: {
limit?: number;
skip?: number;
state?: "unverified" | "active" | "disabled";
sort?: string;
authority?: string;
search?: string;
}
) {
return (
await fetch(
`https://api.mailgun.net/v3/domains?limit=${data.limit ?? 100}&skip=${
data.skip ?? 0
}&state=${data.state ?? "active"}&sort=${data.sort ?? "name"}${
data.authority ?? "&authority"
}&search=${data.search ?? ""}`,
{
method: "GET",
headers: {
Authorization:
"Basic " +
Buffer.from(`api:${resource.api_key}`).toString("base64"),
},
}
)
).json();
}
Submitted by hugo697 229 days ago