1 | |
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 |
|