- 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.
55 lines
1.0 KiB
Plaintext
55 lines
1.0 KiB
Plaintext
meta {
|
|
name: List Films
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
get {
|
|
url: {{baseUrl}}/api/v1/films
|
|
body: none
|
|
auth: bearer
|
|
}
|
|
|
|
auth:bearer {
|
|
token: {{accessToken}}
|
|
}
|
|
|
|
params:query {
|
|
limit: 50
|
|
offset: 0
|
|
~search: 2018
|
|
}
|
|
|
|
tests {
|
|
test("returns 200", function() {
|
|
expect(res.status).to.equal(200);
|
|
});
|
|
|
|
test("has items array", function() {
|
|
expect(res.body.items).to.be.an("array");
|
|
});
|
|
|
|
test("each film has id, folder, image_count", function() {
|
|
res.body.items.forEach(function(film) {
|
|
expect(film.id).to.be.a("number");
|
|
expect(film.folder).to.be.a("string");
|
|
expect(film.image_count).to.be.a("number");
|
|
});
|
|
});
|
|
|
|
test("image counts are positive", function() {
|
|
res.body.items.forEach(function(film) {
|
|
expect(film.image_count).to.be.above(0);
|
|
});
|
|
});
|
|
}
|
|
|
|
docs {
|
|
## List Films
|
|
|
|
Returns all film rolls (import folders) with their image counts, sorted by folder path.
|
|
|
|
Use `?search=` to filter by folder path substring.
|
|
Use `?limit` and `?offset` for pagination (max 2000 per page).
|
|
}
|