type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Delete project asynchronously
* Deletes a project asynchronously.
This operation is:
* transactional, that is, if part of the delete fails the project is not deleted.
* [asynchronous](#async). Follow the `location` link in the response to determine the status of the task and use [Get task](#api-rest-api-2-task-taskId-get) to obtain subsequent updates.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(auth: Jira, projectIdOrKey: string) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/project/${projectIdOrKey}/delete`
);
const response = await fetch(url, {
method: "POST",
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 396 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Delete project asynchronously
* Deletes a project asynchronously.
This operation is:
* transactional, that is, if part of the delete fails the project is not deleted.
* [asynchronous](#async). Follow the `location` link in the response to determine the status of the task and use [Get task](#api-rest-api-2-task-taskId-get) to obtain subsequent updates.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(auth: Jira, projectIdOrKey: string) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/project/${projectIdOrKey}/delete`
);
const response = await fetch(url, {
method: "POST",
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 948 days ago