Tag
A label that can be attached to one or more bookmarks.
Attributes
| Attribute | Type | Description |
|---|---|---|
| name | str | Display name (must be unique per user). |
| color | [TagColor](tagcolor.md?sid=app_models_tag_tagcolor) = TagColor.GRAY | Visual colour for UI rendering. |
| description | str = "" | Optional description of what this tag represents. |
| id | str | Unique identifier. |
| usage_count | int = 0 | Number of bookmarks currently using this tag. |
Methods
rename()
def rename(self, new_name: str) -> None: ...
Rename the tag.
Parameters
| Name | Type | Description |
|---|---|---|
| new_name | str | The new display name. |
Returns
| Type | Description |
|---|---|
None |
increment_usage()
def increment_usage(self) -> int: ...
Record that a bookmark now uses this tag. Returns new count.
Returns
| Type | Description |
|---|---|
int |
decrement_usage()
def decrement_usage(self) -> int: ...
Record that a bookmark removed this tag. Returns new count.
Returns
| Type | Description |
|---|---|
int |
to_dict()
def to_dict(self) -> Dict[str, Any]: ...
Serialise to a JSON-safe dictionary.
Returns
| Type | Description |
|---|---|
Dict[str, Any] |
from_dict()
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "Tag": ...
Construct a Tag from a dictionary.
Parameters
| Name | Type | Description |
|---|---|---|
| data | Dict[str, Any] | The dictionary containing tag data. |
Returns
| Type | Description |
|---|---|
[Tag](tag.md?sid=app_models_tag_tag) |