//native
type Digitalocean = {
token: string;
};
/**
* Update Subscription Tier
* After creating your registry, you can switch to a different subscription tier to better suit your needs. To do this, send a POST request to `/v2/registry/subscription`.
*/
export async function main(
auth: Digitalocean,
body: { tier_slug?: "starter" | "basic" | "professional" },
) {
const url = new URL(`https://api.digitalocean.com/v2/registry/subscription`);
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 536 days ago