//native
type Circleci = {
token: string
}
/**
* Retrieves the owner's decision audit log by given decisionID
* This endpoint will retrieve a decision for a given decision log ID
*/
export async function main(auth: Circleci, ownerID: string, context: string, decisionID: string) {
const url = new URL(
`https://circleci.com/api/v2/owner/${ownerID}/context/${context}/decision/${decisionID}`
)
const response = await fetch(url, {
method: 'GET',
headers: {
'Circle-Token': auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 536 days ago