type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Associate security scheme to project
* Associates an issue security scheme with a project and remaps security levels of issues to the new levels, if provided.
This operation is [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,
body: {
oldToNewSecurityLevelMappings?: {
newLevelId: string;
oldLevelId: string;
}[];
projectId: string;
schemeId: string;
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issuesecurityschemes/project`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: JSON.stringify(body),
});
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;
};
/**
* Associate security scheme to project
* Associates an issue security scheme with a project and remaps security levels of issues to the new levels, if provided.
This operation is [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,
body: {
oldToNewSecurityLevelMappings?: {
newLevelId: string;
oldLevelId: string;
}[];
projectId: string;
schemeId: string;
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issuesecurityschemes/project`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 948 days ago