type Bitbucket = {
username: string;
password: string;
};
/**
* Get issue change object
* Returns the specified issue change object.
This resource is only available on repositories that have the issue
tracker enabled.
*/
export async function main(
auth: Bitbucket,
change_id: string,
issue_id: string,
repo_slug: string,
workspace: string
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/issues/${issue_id}/changes/${change_id}`
);
const response = await fetch(url, {
method: "GET",
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 394 days ago