Bookmark
A saved URL with metadata, tags, and full-text content.
Attributes
| Attribute | Type | Description |
|---|---|---|
| url | string | The bookmarked URL. |
| title | string | Human-readable title. |
| description | string | Optional longer description. |
| tags | List[string] = [] | List of tag IDs associated with this bookmark. |
| status | [BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVE | Current visibility status. |
| id | string = uuid.uuid4().hex[:12] | Unique identifier. |
| created_at | datetime = datetime.utcnow | Timestamp of creation. |
| updated_at | datetime = datetime.utcnow | Timestamp of last modification. |
| metadata | Dict[string, Any] = {} | Arbitrary key/value pairs for extensibility. |
Constructor
Signature
def Bookmark(
url: str,
title: str,
description: str = "",
tags: List[str] = [],
status: [BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVE,
id: str = uuid.uuid4().hex[:12],
created_at: datetime = datetime.utcnow,
updated_at: datetime = datetime.utcnow,
metadata: Dict[str, Any] = {}
)
Parameters
| Name | Type | Description |
|---|---|---|
| url | str | The bookmarked URL. |
| title | str | Human-readable title. |
| description | str = "" | Optional longer description. |
| tags | List[str] = [] | List of tag IDs associated with this bookmark. |
| status | [BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVE | Current visibility status. |
| id | str = uuid.uuid4().hex[:12] | Unique identifier. |
| created_at | datetime = datetime.utcnow | Timestamp of creation. |
| updated_at | datetime = datetime.utcnow | Timestamp of last modification. |
| metadata | Dict[str, Any] = {} | Arbitrary key/value pairs for extensibility. |
Methods
archive()
@classmethod
def archive() - > null
Move the bookmark to the archive.
Returns
| Type | Description |
|---|---|
null | Nothing |
trash()
@classmethod
def trash() - > null
Soft-delete the bookmark by moving it to the trash.
Returns
| Type | Description |
|---|---|
null | Nothing |
restore()
@classmethod
def restore() - > null
Restore a trashed or archived bookmark to active status.
Returns
| Type | Description |
|---|---|
null | Nothing |
add_tag()
@classmethod
def add_tag(
tag_id: string
) - > boolean
Attach a tag. Returns False if already present.
Parameters
| Name | Type | Description |
|---|---|---|
| tag_id | string | The unique identifier of the tag to be associated with this bookmark |
Returns
| Type | Description |
|---|---|
boolean | True if the tag was successfully added, False if the tag already exists in the bookmark's tag list |
remove_tag()
@classmethod
def remove_tag(
tag_id: string
) - > boolean
Detach a tag. Returns False if not found.
Parameters
| Name | Type | Description |
|---|---|---|
| tag_id | string | The unique identifier of the tag to be removed from this bookmark |
Returns
| Type | Description |
|---|---|
boolean | True if the tag was successfully removed, False if the tag was not found in the bookmark's tag list |
to_dict()
@classmethod
def to_dict() - > object
Serialise to a plain dictionary for JSON responses.
Returns
| Type | Description |
|---|---|
object | A dictionary representation of the bookmark including its ID, URL, title, status, and timestamps |
from_dict()
@classmethod
def from_dict(
data: object
) - > [Bookmark](bookmark.md?sid=app_models_bookmark_bookmark)
Construct a Bookmark from a dictionary (e.g. JSON body).
Parameters
| Name | Type | Description |
|---|---|---|
| data | object | Dictionary with bookmark fields such as url, title, description, and tags |
Returns
| Type | Description |
|---|---|
[Bookmark](bookmark.md?sid=app_models_bookmark_bookmark) | A new Bookmark instance. |