0
Toggle hide feedback for message
One script reply has been approved by the moderators Verified
Created by hugo697 185 days ago Viewed 12694 times
0
Submitted by hugo697 Bun
Verified 185 days ago
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