//native
/**
* Retrieve a count of replays for a given issue or transaction
* Return a count of replays for a list of issue or transaction IDs.
The `query` parameter is required. It is a search query that includes exactly one of `issue.id`, `transaction`, or `replay_id` (string or list of strings).
*/
export async function main(
auth: RT.Sentry,
environment?: string | undefined,
start?: string | undefined,
end?: string | undefined,
statsPeriod?: string | undefined,
project_id_or_slug?: string | undefined,
query?: string | undefined
) {
const url = new URL(
`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/replay-count/`
)
for (const [k, v] of [
['environment', environment],
['start', start],
['end', end],
['statsPeriod', statsPeriod],
['project_id_or_slug', project_id_or_slug],
['query', query]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + 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 235 days ago