type Bitbucket = {
username: string;
password: string;
};
/**
* Remove the specific user from the project's default reviewers
* Removes a default reviewer from the project.
Example:
```
$ curl https://api.bitbucket.org/2.0/.../default-reviewers/%7Bf0e0e8e9-66c1-4b85-a784-44a9eb9ef1a6%7D
HTTP/1.1 204
```
*/
export async function main(
auth: Bitbucket,
project_key: string,
selected_user: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}/default-reviewers/${selected_user}`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 471 days ago