From e8020d1ec67c3f6e2e645ba80039d30db45950a9 Mon Sep 17 00:00:00 2001 From: "Jakob L. Kreuze" Date: Sun, 14 Jun 2020 19:07:39 -0400 Subject: Update semantics for web API (query string vs tag list). --- README.md | 9 ++++----- src/birka-web.rs | 14 +++++++------- templates/image.hbs | 4 ++-- templates/index.hbs | 4 ++-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2476df6..99299ef 100644 --- a/README.md +++ b/README.md @@ -85,13 +85,12 @@ Suppose we denote the following shape of JSON object as a `ImageResult`. ``` The images in the tag database can be enumerated with the 'posts' endpoint, -which takes two parameters: `tags`, a comma-separated list of zero or more -strings, and `last`, which is the last `ImageResult` identifier which was seen. -This endpoint will return, at most, 50 entries, which is why the `last` -parameter is necessary. +which takes two parameters: `query`, a query string, and `last`, which is the +last `ImageResult` identifier which was seen. This endpoint will return, at +most, 50 entries, which is why the `last` parameter is necessary. ``` -GET /api/posts?last=number,tags=[string, ...] +GET /api/posts?last=number,query=string [zero or more ImageResult] ``` diff --git a/src/birka-web.rs b/src/birka-web.rs index 76a194f..e9bb81a 100644 --- a/src/birka-web.rs +++ b/src/birka-web.rs @@ -113,8 +113,8 @@ fn thumb_filename>(id: i64, path: T) -> String { } } -#[get("/posts?&")] -fn get_posts(conn: SiteState, tags: String, last: Option) -> Result>> { +#[get("/posts?&")] +fn get_posts(conn: SiteState, query: String, last: Option) -> Result>> { let tb = &conn .inner() .lock() @@ -132,7 +132,7 @@ fn get_posts(conn: SiteState, tags: String, last: Option) -> Result Template { Template::render("upload", None::<()>) } -#[get("/posts?&")] -fn display_posts(conn: SiteState, tags: String, last: Option) -> Result