0
Create Feature Request
One script reply has been approved by the moderators Verified

Use this endpoint to create a new feature request on your account.

Created by hugo697 2 days ago Viewed 161 times
0
Submitted by hugo697 Bun
Verified 2 days ago
1
//native
2
type Beamer = {
3
	apiKey: string
4
}
5

6
export async function main(
7
	resource: Beamer,
8
	body: {
9
		title: string[]
10
		content?: string[]
11
		visible?: boolean
12
		category?: string
13
		status?: string
14
		notes?: string
15
		filters?: string
16
		votesCount?: number
17
		date?: string
18
		language?: string[]
19
		internalUserEmail?: string
20
		userId?: string
21
		userEmail?: string
22
		userFirstname?: string
23
		userLastname?: string
24
	}
25
) {
26
	const url = new URL(`https://api.getbeamer.com/v0/requests`)
27

28
	const response = await fetch(url, {
29
		method: 'POST',
30
		headers: {
31
			'Beamer-Api-Key': resource.apiKey,
32
			'Content-Type': 'application/json'
33
		},
34
		body: JSON.stringify(body)
35
	})
36

37
	if (!response.ok) {
38
		const text = await response.text()
39
		throw new Error(`HTTP error! status: ${response.status} - ${text}`)
40
	}
41

42
	const data = await response.json()
43

44
	return data
45
}
46