//native
type Clerk = {
apiKey: string;
};
/**
* Remove a member from an organization
* Removes the given membership from the organization
*/
export async function main(
auth: Clerk,
organization_id: string,
user_id: string,
) {
const url = new URL(
`https://api.clerk.com/v1/organizations/${organization_id}/memberships/${user_id}`,
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago