type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Create issue type
* Creates an issue type and adds it to the default issue type scheme.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
body: {
description?: string;
hierarchyLevel?: number;
name: string;
type?: "subtask" | "standard";
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issuetype`
);
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 327 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Create issue type
* Creates an issue type and adds it to the default issue type scheme.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
body: {
description?: string;
hierarchyLevel?: number;
name: string;
type?: "subtask" | "standard";
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issuetype`
);
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 879 days ago