Skip to main content

Bookmark

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

Attributes

AttributeTypeDescription
idstring = uuid.uuid4().hex[:12]Unique identifier.
urlstringThe bookmarked URL.
titlestringHuman-readable title.
descriptionstring = ""Optional longer description.
tagsList[str] = listList of tag IDs associated with this bookmark.
status[BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVECurrent visibility status.
created_atdatetime = datetime.utcnowTimestamp of creation.
updated_atdatetime = datetime.utcnowTimestamp of last modification.
metadataDict[str, Any] = dictArbitrary key/value pairs for extensibility.

Constructor

Signature

def Bookmark(
data: Dict[str, Any]
) - > None

Parameters

NameTypeDescription
dataDict[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

TypeDescription
NoneThis 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

TypeDescription
NoneThis 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

TypeDescription
NoneThis 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

NameTypeDescription
tag_idstringThe unique identifier of the tag to attach.

Returns

TypeDescription
boolTrue 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

NameTypeDescription
tag_idstringThe unique identifier of the tag to detach.

Returns

TypeDescription
boolTrue 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

TypeDescription
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

NameTypeDescription
dataDict[str, Any]A dictionary containing the bookmark fields.

Returns

TypeDescription
[Bookmark](bookmark.md?sid=app_models_bookmark_bookmark)A new Bookmark instance constructed from the provided data.