Return a replay recording segment.
1
//native
2
/**
3
* Retrieve a recording segment
4
* Return a replay recording segment.
5
*/
6
export async function main(
7
auth: RT.Sentry,
8
project_id_or_slug: string,
9
replay_id: string,
10
segment_id: string
11
) {
12
const url = new URL(
13
`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/replays/${replay_id}/recording-segments/${segment_id}/`
14
)
15
16
const response = await fetch(url, {
17
method: 'GET',
18
headers: {
19
Authorization: 'Bearer ' + auth.token
20
},
21
body: undefined
22
})
23
if (!response.ok) {
24
const text = await response.text()
25
throw new Error(`${response.status} ${text}`)
26
}
27
return await response.json()
28
29