1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
"""
Module for collection of dataclasses that map Szurubooru objects to python classes
"""
from pydantic.dataclasses import dataclass
from dataclasses import field
from typing import List, Optional
@dataclass
class Tag:
"""A single tag. Tags are used to let users search for posts.
The Szurubooru structure:
.. code-block:: JSON
{
"version": <version>,
"names": <names>,
"category": <category>,
"implications": <implications>,
"suggestions": <suggestions>,
"creationTime": <creation-time>,
"lastEditTime": <last-edit-time>,
"usages": <usage-count>,
"description": <description>
}
**Field meaning**
- `<version>`: resource version.
- `<names>`: a list of tag names (aliases). Tagging a post with any name will
automatically assign the first name from this list.
- `<category>`: the name of the category the given tag belongs to.
- `<implications>`: a list of implied tags, serialized as micro tag resource.
- `<suggestions>`: a list of suggested tags, serialized as micro tag resource.
- `<creation-time>`: time the tag was created, formatted as per RFC 3339.
- `<last-edit-time>`: time the tag was edited, formatted as per RFC 3339.
- `<usage-count>`: the number of posts the tag was used in.
- `<description>`: 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)
|