//native
/**
* List Priorities
* List the account's incident priorities (e.g. P1–P5). Priorities are an account feature; an empty list means the feature is not enabled. Use the returned IDs as priority_id when creating or updating incidents.
*/
export async function main(
auth: RT.Pagerduty,
limit: number | undefined,
offset: number | undefined,
) {
const url = new URL("https://api.pagerduty.com/priorities")
if (limit !== undefined) url.searchParams.append("limit", String(limit))
if (offset !== undefined) url.searchParams.append("offset", String(offset))
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `Token token=${auth.token}`,
Accept: "application/vnd.pagerduty+json;version=2",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 days ago