( endpoint: string, url: string )
| 24 | * Create a new session on the server. |
| 25 | */ |
| 26 | export async function createSession( |
| 27 | endpoint: string, |
| 28 | url: string |
| 29 | ): Promise<Session> { |
| 30 | const response = await fetch(`${endpoint}/sessions`, { |
| 31 | method: "POST", |
| 32 | headers: { "Content-Type": "application/json" }, |
| 33 | body: JSON.stringify({ url }), |
| 34 | }); |
| 35 | |
| 36 | if (!response.ok) { |
| 37 | throw new Error(`Failed to create session: ${response.status}`); |
| 38 | } |
| 39 | |
| 40 | return response.json(); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get an existing session with its annotations. |
no outgoing calls
no test coverage detected
searching dependent graphs…