( endpoint: string, sessionId: string, annotation: Annotation )
| 61 | * Returns the annotation with any server-assigned fields. |
| 62 | */ |
| 63 | export async function syncAnnotation( |
| 64 | endpoint: string, |
| 65 | sessionId: string, |
| 66 | annotation: Annotation |
| 67 | ): Promise<Annotation> { |
| 68 | const response = await fetch(`${endpoint}/sessions/${sessionId}/annotations`, { |
| 69 | method: "POST", |
| 70 | headers: { "Content-Type": "application/json" }, |
| 71 | body: JSON.stringify(annotation), |
| 72 | }); |
| 73 | |
| 74 | if (!response.ok) { |
| 75 | throw new Error(`Failed to sync annotation: ${response.status}`); |
| 76 | } |
| 77 | |
| 78 | return response.json(); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Update an annotation on the server. |
no outgoing calls
no test coverage detected
searching dependent graphs…