Skip to main content

Bookmark

A saved URL with metadata, tags, and full-text content.

Attributes​

AttributeTypeDescription
urlstrThe bookmarked URL.
titlestrHuman-readable title.
descriptionstrOptional longer description.
tagsList[str] = []List of tag IDs associated with this bookmark.
status[BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVECurrent visibility status.
idstr = uuid.uuid4().hex[:12]Unique identifier.
created_atdatetime = datetime.utcnowTimestamp of creation.
updated_atdatetime = datetime.utcnowTimestamp of last modification.
metadataDict[str, 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] = {}
) - > None

Parameters​

NameTypeDescription
urlstrThe bookmarked URL.
titlestrHuman-readable title for the bookmark.
descriptionstr = ""Optional longer description of the bookmark content.
tagsList[str] = []List of tag IDs associated with this bookmark.
status[BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVEThe initial visibility status of the bookmark.
idstr = uuid.uuid4().hex[:12]Unique identifier for the bookmark.
created_atdatetime = datetime.utcnowTimestamp of creation.
updated_atdatetime = datetime.utcnowTimestamp of last modification.
metadataDict[str, Any] = {}Arbitrary key/value pairs for extensibility.

Methods​


archive()​

@classmethod
def archive() - > None

Move the bookmark to the archive.

Returns​

TypeDescription
NoneNothing

trash()​

@classmethod
def trash() - > None

Soft-delete the bookmark by moving it to the trash.

Returns​

TypeDescription
NoneNothing

restore()​

@classmethod
def restore() - > None

Restore a trashed or archived bookmark to active status.

Returns​

TypeDescription
NoneNothing

add_tag()​

@classmethod
def add_tag(
tag_id: str
) - > bool

Attach a tag. Returns False if already present.

Parameters​

NameTypeDescription
tag_idstrThe unique identifier of the tag to associate with this bookmark

Returns​

TypeDescription
boolTrue if the tag was successfully added, False if the bookmark already contained the tag

remove_tag()​

@classmethod
def remove_tag(
tag_id: str
) - > bool

Detach a tag. Returns False if not found.

Parameters​

NameTypeDescription
tag_idstrThe unique identifier of the tag to remove from this bookmark

Returns​

TypeDescription
boolTrue 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() - > Dict[str, Any]

Serialise to a plain dictionary for JSON responses.

Returns​

TypeDescription
Dict[str, Any]A dictionary representation of the bookmark including its ID, URL, title, status, and timestamps

from_dict()​

@classmethod
def from_dict(
data: Dict[str, Any]
) - > [Bookmark](bookmark.md?sid=app_models_bookmark_bookmark)

Construct a Bookmark from a dictionary (e.g. JSON body).

Parameters​

NameTypeDescription
dataDict[str, Any]Dictionary with bookmark fields.

Returns​

TypeDescription
[Bookmark](bookmark.md?sid=app_models_bookmark_bookmark)A new Bookmark instance.