//native
type Linode = {
token: string;
};
/**
* Update your account
* Updates contact and billing information related to your account.
*/
export async function main(
auth: Linode,
apiVersion: "v4" | "v4beta",
body: {
active_promotions?: {
credit_monthly_cap?: string;
credit_remaining?: string;
description?: string;
expire_dt?: string;
image_url?: string;
service_type?:
| "all"
| "backup"
| "blockstorage"
| "db_mysql"
| "ip_v4"
| "linode"
| "linode_disk"
| "linode_memory"
| "longview"
| "managed"
| "nodebalancer"
| "objectstorage"
| "placement_group"
| "transfer_tx";
summary?: string;
this_month_credit_remaining?: string;
}[];
active_since?: string;
address_1?: string;
address_2?: string;
balance?: number;
balance_uninvoiced?: number;
billing_source?: "linode" | "akamai";
capabilities?: string[];
city?: string;
company?: string;
country?: string;
credit_card?: { expiry?: string; last_four?: string };
email?: string;
euuid?: string;
first_name?: string;
last_name?: string;
phone?: string;
state?: string;
tax_id?: string;
zip?: string;
},
) {
const url = new URL(`https://api.linode.com/${apiVersion}/account`);
const response = await fetch(url, {
method: "PUT",
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