//native
type Netlify = {
token: string;
};
/**
* Create account
*
*/
export async function main(
auth: Netlify,
body: {
name: string;
type_id: string;
payment_method_id?: string;
period?: "monthly" | "yearly";
extra_seats_block?: number;
},
) {
const url = new URL(`https://api.netlify.com/api/v1/accounts`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago