Bookmark
A saved URL with metadata, tags, and full-text content.
Attributes
| Attribute | Type | Description |
|---|---|---|
| id | string = uuid.uuid4().hex[:12] | Unique identifier. |
| url | string | The bookmarked URL. |
| title | string | Human-readable title. |
| description | string = "" | Optional longer description. |
| tags | List[str] = list | List of tag IDs associated with this bookmark. |
| status | [BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVE | Current visibility status. |
| created_at | datetime = datetime.utcnow | Timestamp of creation. |
| updated_at | datetime = datetime.utcnow | Timestamp of last modification. |
| metadata | Dict[str, Any] = dict | Arbitrary key/value pairs for extensibility. |
Constructor
Signature
def Bookmark(
data: Dict[str, Any]
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| data | Dict[str, Any] | Dictionary with bookmark fields. |
Methods
archive()
@classmethod
def archive() - > None
Move the bookmark to the archive by setting its status to ARCHIVED.
Returns
| Type | Description |
|---|---|
None | This method does not return a value. |
trash()
@classmethod
def trash() - > None
Soft-delete the bookmark by moving it to the trash by setting its status to TRASHED.
Returns
| Type | Description |
|---|---|
None | This method does not return a value. |
restore()
@classmethod
def restore() - > None
Restore a trashed or archived bookmark to active status by setting its status to ACTIVE.
Returns
| Type | Description |
|---|---|
None | This method does not return a value. |
add_tag()
@classmethod
def add_tag(
tag_id: string
) - > bool
Attach a tag to the bookmark. Returns False if the tag is already present.
Parameters
| Name | Type | Description |
|---|---|---|
| tag_id | string | The unique identifier of the tag to attach. |
Returns
| Type | Description |
|---|---|
bool | True if the tag was successfully added, False if the tag was already present. |
remove_tag()
@classmethod
def remove_tag(
tag_id: string
) - > bool
Detach a tag from the bookmark. Returns False if the tag is not found.
Parameters
| Name | Type | Description |
|---|---|---|
| tag_id | string | The unique identifier of the tag to detach. |
Returns
| Type | Description |
|---|---|
bool | True if the tag was successfully removed, False if the tag was not found. |
to_dict()
@classmethod
def to_dict() - > Dict[str, Any]
Serialise the bookmark object into a plain dictionary, suitable for JSON responses.
Returns
| Type | Description |
|---|---|
Dict[str, Any] | A dictionary representation of the bookmark object. |
from_dict()
@classmethod
def from_dict(
data: Dict[str, Any]
) - > [Bookmark](bookmark.md?sid=app_models_bookmark_bookmark)
Construct a Bookmark instance from a dictionary, typically from a JSON request body. Raises KeyError if required fields are missing.
Parameters
| Name | Type | Description |
|---|---|---|
| data | Dict[str, Any] | A dictionary containing the bookmark fields. |
Returns
| Type | Description |
|---|---|
[Bookmark](bookmark.md?sid=app_models_bookmark_bookmark) | A new Bookmark instance constructed from the provided data. |