Skip to content

Open source CapCut alternative.

TypeScript

site/donkeyvision: add cURL request sample to API reference

David Lef852a86cd7ef
diff --git a/site/src/app/donkeyvision/apiContract.ts b/site/src/app/donkeyvision/apiContract.ts
index 3d0c6c0d..6c2e37db 100644
--- a/site/src/app/donkeyvision/apiContract.ts
+++ b/site/src/app/donkeyvision/apiContract.ts
@@ -73,6 +73,21 @@ let (data, _) = try await URLSession.shared.data(for: request)
let result = try JSONDecoder().decode(VisionResponse.self, from: data)
print(result.target?.point) // { x, y } — ready to click`,
},
+ {
+ key: "curl",
+ label: "cURL",
+ code: `# image is base64 png/jpeg/webp, no "data:" prefix
+curl "${url}" \\
+ -H "Authorization: Bearer $DONKEY_API_KEY" \\
+ -H "Content-Type: application/json" \\
+ -d '{
+ "image": "iVBORw0KGgo...",
+ "instruction": "click the play button",
+ "returnElements": true
+ }'
+
+# target.point in the response is { x, y } — ready to click`,
+ },
];
export const RESPONSE_SAMPLE = `{
diff --git a/site/src/app/donkeyvision/codeHighlight.tsx b/site/src/app/donkeyvision/codeHighlight.tsx
index 49114377..0590bcb0 100644
--- a/site/src/app/donkeyvision/codeHighlight.tsx
+++ b/site/src/app/donkeyvision/codeHighlight.tsx
@@ -1,7 +1,7 @@
import type { ReactNode } from "react";
// Lightweight, language-agnostic syntax highlighter for the API reference code
-// samples (TypeScript, Swift, Python) and the JSON response. It is not a full
+// samples (TypeScript, Swift, Python, cURL) and the JSON response. It is not a full
// grammar — it tokenizes the shapes these snippets share (comments, strings,
// numbers, keywords, JSON keys, calls) and paints them with editor-style
// colors, which is enough to read like a code editor without a dependency.