1
//native
2
type Actimo = {
3
apiKey: string
4
}
5
6
export async function main(
7
auth: Actimo,
8
id: string,
9
itemId: string,
10
body: { hide?: false | true }
11
) {
12
const url = new URL(`https://actimo.com/api/v1/messages/${id}/feedback/${itemId}/toggleHide`)
13
14
const response = await fetch(url, {
15
method: 'PUT',
16
headers: {
17
'api-key': auth.apiKey,
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