From c61d6fc80d7c20f580ad111db59352b8eae7b7da Mon Sep 17 00:00:00 2001 From: Colin Wilk Date: Mon, 9 Oct 2023 11:52:05 +0200 Subject: Rename booru-sync to szuruboorupy Initially the project was intended as a script repository containing scripts for managing my szurubooru instance. Since most of my work was actually writing an API client, I decided to rename this repository to an API client and do the script repository later on separately. Signed-off-by: Colin Wilk --- szuruboorupy/dataclasses.py | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 szuruboorupy/dataclasses.py (limited to 'szuruboorupy/dataclasses.py') diff --git a/szuruboorupy/dataclasses.py b/szuruboorupy/dataclasses.py new file mode 100644 index 0000000..350a876 --- /dev/null +++ b/szuruboorupy/dataclasses.py @@ -0,0 +1,48 @@ +""" +Module for collection of dataclasses that map Szurubooru r. +""" + + +from dataclasses import field +from typing import List, Optional + +from pydantic.dataclasses import dataclass + + +@dataclass +class Tag: + """A single tag. Tags are used to let users search for posts. + + The Szurubooru structure: + .. code-block:: JSON + { + "version": , + "names": , + "category": , + "implications": , + "suggestions": , + "creationTime": , + "lastEditTime": , + "usages": , + "description": + } + + **Field meaning** + - ``: resource version. + - ``: a list of tag names (aliases). Tagging a post with any name will + automatically assign the first name from this list. + - ``: the name of the category the given tag belongs to. + - ``: a list of implied tags, serialized as micro tag resource. + - ``: a list of suggested tags, serialized as micro tag resource. + - ``: 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. + - ``: the tag description (instructions how to use, history etc.) + """ + + name: str + version: int = -1 + description: Optional[str] = "" + category: str = "General" + implications: List[str] = field(default_factory=list) + suggestions: List[str] = field(default_factory=list) -- cgit v1.2.3