Files
stephen schuresko bd40b4f850 Add darktable REST API implementation
- Introduced a new Lua-based REST API for darktable, allowing external applications to interact with the darktable library.
- Implemented core functionalities including image listing, retrieval, and preview serving.
- Added support for OAuth 2.0 authentication with token generation.
- Created a simple HTTP router to handle API requests.
- Included JSON encoding/decoding utilities for API responses.
- Developed a script to launch the API server alongside darktable, ensuring seamless integration.
- Added necessary configuration and setup for the API server, including CORS support and error handling.
2026-06-10 15:02:19 -04:00

73 lines
1.6 KiB
Plaintext

meta {
name: Get Image
type: http
seq: 2
}
get {
url: {{baseUrl}}/api/v1/images/{{imageId}}
body: none
auth: bearer
}
auth:bearer {
token: {{accessToken}}
}
script:post-response {
if (res.status === 200) {
// Store this image's ID for use by preview / refresh requests
bru.setVar("imageId", res.body.id);
}
}
tests {
test("returns 200", function() {
expect(res.status).to.equal(200);
});
test("has correct id", function() {
expect(res.body.id).to.equal(Number(bru.getVar("imageId")));
});
test("has filename", function() {
expect(res.body.filename).to.be.a("string");
expect(res.body.filename.length).to.be.above(0);
});
test("has path", function() {
expect(res.body.path).to.be.a("string");
});
test("has rating in valid range", function() {
expect(res.body.rating).to.be.at.least(-1);
expect(res.body.rating).to.be.at.most(5);
});
test("has tags array", function() {
expect(res.body.tags).to.be.an("array");
});
test("has color_labels array", function() {
expect(res.body.color_labels).to.be.an("array");
});
test("has metadata object", function() {
expect(res.body.metadata).to.be.an("object");
});
test("has boolean flags", function() {
expect(res.body.is_raw).to.be.a("boolean");
expect(res.body.is_hdr).to.be.a("boolean");
expect(res.body.is_ldr).to.be.a("boolean");
});
}
docs {
## Get Image
Returns full detail for a single image including tags, color labels, and metadata.
Set `{{imageId}}` in the environment (or pick up from "List Images" run).
}