0
Gets a list of Aero Steps.
One script reply has been approved by the moderators Verified
Created by hugo697 51 days ago Viewed 579 times
0
Submitted by hugo697 Bun
Verified 51 days ago
1
//native
2
type Aero_workflow = {
3
	apiKey: string
4
}
5

6
export async function main(
7
	auth: Aero_workflow,
8
	accountid: string,
9
	category: string,
10
	aeroId: string,
11
	body: {
12
		name: string
13
		actionLink?: string
14
		helpLink?: string
15
		order?: number
16
		procedureId?: number
17
		libraryProcedureId?: number
18
	}
19
) {
20
	const url = new URL(
21
		`https://api.aeroworkflow.com/api/${accountid}/v1/Aero${category}s/${aeroId}/AeroSteps`
22
	)
23

24
	const response = await fetch(url, {
25
		method: 'POST',
26
		headers: {
27
			'Content-Type': 'application/json',
28
			apikey: auth.apiKey
29
		},
30
		body: JSON.stringify(body)
31
	})
32

33
	if (!response.ok) {
34
		const text = await response.text()
35
		throw new Error(`${response.status} ${text}`)
36
	}
37

38
	return await response.json()
39
}
40