type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Get required status mappings for workflow scheme update
* Gets the required status mappings for the desired changes to a workflow scheme. The results are provided per issue type and workflow. When updating a workflow scheme, status mappings can be provided per issue type, per workflow, or both.
**[Permissions](#permissions) required:**
* *Administer Jira* permission to update all, including global-scoped, workflow schemes.
* *Administer projects* project permission to update project-scoped workflow schemes.
*/
export async function main(
auth: Jira,
body: {
defaultWorkflowId?: string;
id: string;
workflowsForIssueTypes: { issueTypeIds: string[]; workflowId: string }[];
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/workflowscheme/update/mappings`
);
const response = await fetch(url, {
method: "POST",
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.json();
}
Submitted by hugo697 396 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Get required status mappings for workflow scheme update
* Gets the required status mappings for the desired changes to a workflow scheme. The results are provided per issue type and workflow. When updating a workflow scheme, status mappings can be provided per issue type, per workflow, or both.
**[Permissions](#permissions) required:**
* *Administer Jira* permission to update all, including global-scoped, workflow schemes.
* *Administer projects* project permission to update project-scoped workflow schemes.
*/
export async function main(
auth: Jira,
body: {
defaultWorkflowId?: string;
id: string;
workflowsForIssueTypes: { issueTypeIds: string[]; workflowId: string }[];
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/workflowscheme/update/mappings`
);
const response = await fetch(url, {
method: "POST",
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.json();
}
Submitted by hugo697 948 days ago