//native
type Supabase = {
token: string;
};
/**
* Applies project addon
*
*/
export async function main(
auth: Supabase,
ref: string,
body: {
addon_variant:
| "ci_micro"
| "ci_small"
| "ci_medium"
| "ci_large"
| "ci_xlarge"
| "ci_2xlarge"
| "ci_4xlarge"
| "ci_8xlarge"
| "ci_12xlarge"
| "ci_16xlarge"
| "ci_24xlarge"
| "ci_24xlarge_optimized_cpu"
| "ci_24xlarge_optimized_memory"
| "ci_24xlarge_high_memory"
| "ci_48xlarge"
| "ci_48xlarge_optimized_cpu"
| "ci_48xlarge_optimized_memory"
| "ci_48xlarge_high_memory"
| "cd_default"
| "pitr_7"
| "pitr_14"
| "pitr_28"
| "ipv4_default";
addon_type:
| "custom_domain"
| "compute_instance"
| "pitr"
| "ipv4"
| "auth_mfa_phone"
| "auth_mfa_web_authn"
| "log_drain";
},
) {
const url = new URL(`https://api.supabase.com/v1/projects/${ref}/billing/addons`);
const response = await fetch(url, {
method: "PATCH",
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.text();
}
Submitted by hugo697 151 days ago