1
//native
2
type Aero_workflow = {
3
apiKey: string
4
}
5
6
export async function main(
7
auth: Aero_workflow,
8
accountId: string,
9
body: { key?: string; query?: string; validKey?: false | true }
10
) {
11
const url = new URL(`https://api.aeroworkflow.com/api/${accountId}/Sql/Select`)
12
13
const response = await fetch(url, {
14
method: 'POST',
15
headers: {
16
'Content-Type': 'application/json',
17
apikey: auth.apiKey
18
},
19
body: JSON.stringify(body)
20
})
21
22
if (!response.ok) {
23
const text = await response.text()
24
throw new Error(`${response.status} ${text}`)
25
26
27
return await response.json()
28
29