//native
type Bitly = {
token: string;
};
/**
* Update a User
* Update fields in the user
*/
export async function main(
auth: Bitly,
body: { name?: string; default_group_guid?: string },
) {
const url = new URL(`https://api-ssl.bitly.com/v4/user`);
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.json();
}
Submitted by hugo697 428 days ago