type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Bulk get statuses
* Returns a list of the statuses specified by one or more status IDs.
**[Permissions](#permissions) required:**
* *Administer projects* [project permission.](https://confluence.atlassian.com/x/yodKLg)
* *Administer Jira* [project permission.](https://confluence.atlassian.com/x/yodKLg)
*/
export async function main(
auth: Jira,
expand: string | undefined,
id: string | undefined
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/statuses`
);
for (const [k, v] of [
["expand", expand],
["id", id],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
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 396 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Bulk get statuses
* Returns a list of the statuses specified by one or more status IDs.
**[Permissions](#permissions) required:**
* *Administer projects* [project permission.](https://confluence.atlassian.com/x/yodKLg)
* *Administer Jira* [project permission.](https://confluence.atlassian.com/x/yodKLg)
*/
export async function main(
auth: Jira,
expand: string | undefined,
id: string | undefined
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/statuses`
);
for (const [k, v] of [
["expand", expand],
["id", id],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
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 948 days ago