Gets an Aero Time for specified id.
One script reply has been approved by the moderators Verified
Created by hugo697 406 days ago
Submitted by hugo697 Bun
Verified 406 days ago
1
//native
2
type Aero_workflow = {
3
	apiKey: string
4
}
5

6
export async function main(
7
	auth: Aero_workflow,
8
	id: string,
9
	accountid: string,
10
	category: string,
11
	aeroid: string
12
) {
13
	const url = new URL(
14
		`https://api.aeroworkflow.com/api/${accountid}/v1/Aero${category}s/${aeroid}/AeroTimes/${id}`
15
	)
16

17
	const response = await fetch(url, {
18
		method: 'GET',
19
		headers: {
20
			apikey: auth.apiKey
21
		},
22
		body: undefined
23
	})
24

25
	if (!response.ok) {
26
		const text = await response.text()
27
		throw new Error(`${response.status} ${text}`)
28
	}
29

30
	return await response.json()
31
}
32