From d0314813cb284cbe50101fcea32bf7126a59ba74 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 30 May 2016 22:07:44 +0200 Subject: [PATCH] server/general: move extra details to resources --- API.md | 67 ++++++++------- server/szurubooru/api/comment_api.py | 10 +-- server/szurubooru/api/post_api.py | 18 ++-- server/szurubooru/api/tag_api.py | 8 +- server/szurubooru/api/tag_category_api.py | 8 +- server/szurubooru/api/user_api.py | 8 +- server/szurubooru/func/comments.py | 27 +++--- server/szurubooru/func/posts.py | 85 ++++++++----------- server/szurubooru/func/tag_categories.py | 21 ++--- server/szurubooru/func/tags.py | 31 +++---- server/szurubooru/func/users.py | 44 +++++----- server/szurubooru/func/util.py | 8 ++ .../tests/api/test_comment_creating.py | 3 +- .../tests/api/test_comment_retrieving.py | 3 +- .../tests/api/test_post_creating.py | 20 ++--- .../tests/api/test_post_featuring.py | 10 +-- .../tests/api/test_post_retrieving.py | 4 +- .../tests/api/test_post_updating.py | 12 +-- .../tests/api/test_tag_category_creating.py | 3 +- .../tests/api/test_tag_category_retrieving.py | 2 +- .../tests/api/test_tag_category_updating.py | 3 +- .../szurubooru/tests/api/test_tag_creating.py | 3 +- .../szurubooru/tests/api/test_tag_merging.py | 3 +- .../tests/api/test_tag_retrieving.py | 2 +- .../szurubooru/tests/api/test_tag_updating.py | 3 +- .../tests/api/test_user_retrieving.py | 1 + server/szurubooru/tests/func/test_posts.py | 42 +++------ 27 files changed, 213 insertions(+), 236 deletions(-) diff --git a/API.md b/API.md index ab7a9b41..38aea695 100644 --- a/API.md +++ b/API.md @@ -1391,7 +1391,8 @@ A single user. - ``: the user name. - ``: the user email. It is available only if the request is authenticated by the same user, or the authenticated user can change the - email. + email. If it's unavailable, the server returns `false`. If the user hasn't + specified an email, the server returns `null`. - ``: the user rank, which effectively affects their privileges. Possible values: @@ -1444,7 +1445,12 @@ experience. "name": , "color": , "usages": - "default": + "default": , + "snapshots": [ + , + , + + ] } ``` @@ -1454,6 +1460,8 @@ experience. - ``: the category color. - ``: how many tags is the given category used with. - ``: whether the tag category is the default one. +- ``: a [snapshot resource](#snapshot) that contains the tag + category's earlier versions. ## Detailed tag category **Description** @@ -1465,19 +1473,12 @@ A tag category with extra information. ```json5 { "tagCategory": , - "snapshots": [ - , - , - - ] } ``` **Field meaning** - ``: a [tag category resource](#tag-category) -- ``: a [snapshot resource](#snapshot) that contains the tag - category's earlier versions. ## Tag **Description** @@ -1494,7 +1495,12 @@ A single tag. Tags are used to let users search for posts. "suggestions": , "creationTime": , "lastEditTime": , - "usages": + "usages": , + "snapshots": [ + , + , + + ] } ``` @@ -1510,6 +1516,8 @@ A single tag. Tags are used to let users search for posts. - ``: time the tag was created, formatted as per RFC 3339. - ``: time the tag was edited, formatted as per RFC 3339. - ``: the number of posts the tag was used in. +- ``: a [snapshot resource](#snapshot) that contains the tag's + earlier versions. ## Detailed tag **Description** @@ -1521,18 +1529,11 @@ A tag with extra information. ```json5 { "tag": , - "snapshots": [ - , - , - - ] } ``` **Field meaning** - ``: a [tag resource](#tag) -- ``: a [snapshot resource](#snapshot) that contains the tag's - earlier versions. ## Post **Description** @@ -1566,6 +1567,16 @@ One file together with its metadata posted to the site. "favoritedBy": , "hasCustomThumbnail": , "mimeType": + "snapshots": [ + , + , + + ], + "comments": { + , + , + + } } ``` @@ -1617,6 +1628,9 @@ One file together with its metadata posted to the site. - ``: whether the post uses custom thumbnail. - ``: subsidiary to ``, used to tell exact content format; useful for `