type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Restore deleted or archived project
* Restores a project that has been archived or placed in the Jira recycle bin.
**[Permissions](#permissions) required:**
* *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg)for Company managed projects.
* *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) or *Administer projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project for Team managed projects.
*/
export async function main(auth: Jira, projectIdOrKey: string) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/project/${projectIdOrKey}/restore`
);
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.json();
}
Submitted by hugo697 396 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Restore deleted or archived project
* Restores a project that has been archived or placed in the Jira recycle bin.
**[Permissions](#permissions) required:**
* *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg)for Company managed projects.
* *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) or *Administer projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project for Team managed projects.
*/
export async function main(auth: Jira, projectIdOrKey: string) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/project/${projectIdOrKey}/restore`
);
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.json();
}
Submitted by hugo697 948 days ago