type Bitbucket = {
username: string;
password: string;
};
/**
* Delete a project for a workspace
* Deletes this project. This is an irreversible operation.
You cannot delete a project that still contains repositories.
To delete the project, delete
or transfer the repositories first.
Example:
```
$ curl -X DELETE https://api.bitbucket.org/2.0/workspaces/bbworkspace1/projects/PROJ
```
*/
export async function main(
auth: Bitbucket,
project_key: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}`
);
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 154 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Delete a project for a workspace
* Deletes this project. This is an irreversible operation.
You cannot delete a project that still contains repositories.
To delete the project, [delete](/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-delete)
or transfer the repositories first.
Example:
```
$ curl -X DELETE https://api.bitbucket.org/2.0/workspaces/bbworkspace1/projects/PROJ
```
*/
export async function main(
auth: Bitbucket,
project_key: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/workspaces/${workspace}/projects/${project_key}`
);
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 209 days ago