- 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.
88 lines
2.2 KiB
Plaintext
88 lines
2.2 KiB
Plaintext
meta {
|
||
name: List Images
|
||
type: http
|
||
seq: 1
|
||
}
|
||
|
||
get {
|
||
url: {{baseUrl}}/api/v1/images
|
||
body: none
|
||
auth: bearer
|
||
}
|
||
|
||
auth:bearer {
|
||
token: {{accessToken}}
|
||
}
|
||
|
||
params:query {
|
||
limit: 10
|
||
offset: 0
|
||
sort_by: datetime_taken
|
||
sort_dir: desc
|
||
~rating_min: 1
|
||
~rating_max: 5
|
||
~rating: 3
|
||
~film_id: 1
|
||
~from: 2018-01-01
|
||
~to: 2018-12-31
|
||
~color_label: red
|
||
~is_raw: true
|
||
~is_hdr: false
|
||
~search: 500mm
|
||
~tag: realestate
|
||
}
|
||
|
||
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("has total count", function() {
|
||
expect(res.body.total).to.be.a("number");
|
||
expect(res.body.total).to.be.above(0);
|
||
});
|
||
|
||
test("has limit and offset", function() {
|
||
expect(res.body.limit).to.equal(10);
|
||
expect(res.body.offset).to.equal(0);
|
||
});
|
||
|
||
test("each image has required fields", function() {
|
||
res.body.items.forEach(function(img) {
|
||
expect(img.id).to.be.a("number");
|
||
expect(img.filename).to.be.a("string");
|
||
expect(img.path).to.be.a("string");
|
||
expect(img.rating).to.be.a("number");
|
||
});
|
||
});
|
||
}
|
||
|
||
docs {
|
||
## List Images
|
||
|
||
Returns a paginated list of images from the darktable catalog.
|
||
|
||
### Active query params (remove `~` prefix to enable)
|
||
| Param | Type | Description |
|
||
|---|---|---|
|
||
| `limit` | int | Results per page (max 500, default 50) |
|
||
| `offset` | int | Pagination offset |
|
||
| `sort_by` | string | `id`, `filename`, `datetime_taken`, `rating`, `focal_length`, `iso` |
|
||
| `sort_dir` | string | `asc` or `desc` |
|
||
| `rating_min` | int | Minimum star rating (−1=rejected, 0=unrated, 1–5=stars) |
|
||
| `rating_max` | int | Maximum star rating |
|
||
| `rating` | int | Exact rating |
|
||
| `film_id` | int | Filter by film roll ID |
|
||
| `from` | date | Earliest capture date (YYYY-MM-DD) |
|
||
| `to` | date | Latest capture date (YYYY-MM-DD) |
|
||
| `color_label` | string | `red`, `yellow`, `green`, `blue`, `purple` |
|
||
| `is_raw` | bool | `true` / `false` |
|
||
| `is_hdr` | bool | `true` / `false` |
|
||
| `search` | string | Free-text search in filename, maker, model, lens |
|
||
| `tag` | string | Filter by exact tag name |
|
||
}
|