type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Get changelogs by IDs
* Returns changelogs for an issue specified by a list of changelog IDs.
This operation can be accessed anonymously.
**[Permissions](#permissions) required:**
* *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
* If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
*/
export async function main(
auth: Jira,
issueIdOrKey: string,
body: { changelogIds: number[] }
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issue/${issueIdOrKey}/changelog/list`
);
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 changelogs by IDs
* Returns changelogs for an issue specified by a list of changelog IDs.
This operation can be accessed anonymously.
**[Permissions](#permissions) required:**
* *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in.
* If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
*/
export async function main(
auth: Jira,
issueIdOrKey: string,
body: { changelogIds: number[] }
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issue/${issueIdOrKey}/changelog/list`
);
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