//native
type Pinterest = {
token: string;
};
/**
* Update member's business role
* Update a member's business role within the business.
*/
export async function main(
auth: Pinterest,
business_id: string,
body: { business_role: "EMPLOYEE" | "BIZ_ADMIN"; member_id: string }[],
) {
const url = new URL(
`https://api.pinterest.com/v5/businesses/${business_id}/members`,
);
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 536 days ago