1
//native
2
type Actimo = {
3
apiKey: string
4
}
5
6
export async function main(
7
auth: Actimo,
8
requestId: string,
9
native_app_key: string,
10
body: { code?: string }
11
) {
12
const url = new URL(`https://actimo.com/api/v1/device/${requestId}/verify`)
13
14
const response = await fetch(url, {
15
method: 'PUT',
16
headers: {
17
'native-app-key': native_app_key,
18
'Content-Type': 'application/json'
19
},
20
body: JSON.stringify(body)
21
})
22
23
if (!response.ok) {
24
const text = await response.text()
25
throw new Error(`${response.status} ${text}`)
26
27
28
return await response.json()
29
30