//native
/**
* Count Issues Using JQL
* Return the approximate number of issues matching a bounded JQL query, without fetching them.
*/
export async function main(auth: RT.Jira, jql: string) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/3/search/approximate-count`
)
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Basic ${btoa(`${auth.username}:${auth.password}`)}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ jql }),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago