0

Get ping

by
Published Apr 8, 2025
Script recraft Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Recraft = {
3
	apiKey: string
4
}
5
/**
6
 * Get ping
7
 *
8
 */
9
export async function main(auth: Recraft) {
10
	const url = new URL(`https://external.api.recraft.ai/ping`)
11

12
	const response = await fetch(url, {
13
		method: 'GET',
14
		body: undefined
15
	})
16
	if (!response.ok) {
17
		const text = await response.text()
18
		throw new Error(`${response.status} ${text}`)
19
	}
20
	return await response.text()
21
}
22