Skip to main content

Bookmark

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

Attributes

AttributeTypeDescription
urlstringThe bookmarked URL.
titlestringHuman-readable title.
descriptionstringOptional longer description.
tagsList[string] = []List of tag IDs associated with this bookmark.
status[BookmarkStatus](bookmarkstatus.md?sid=app_models_bookmark_bookmarkstatus) = BookmarkStatus.ACTIVECurrent visibility status.
idstring = uuid.uuid4().hex[:12]Unique identifier.
created_atdatetime = datetime.utcnowTimestamp of creation.
updated_atdatetime = datetime.utcnowTimestamp of last modification.
metadataDict[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

NameTypeDescription
urlstrThe bookmarked URL.
titlestrHuman-readable title.
descriptionstr = ""Optional 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.

Methods


archive()

@classmethod
def archive() - > null

Move the bookmark to the archive.

Returns

TypeDescription
nullNothing

trash()

@classmethod
def trash() - > null

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

Returns

TypeDescription
nullNothing

restore()

@classmethod
def restore() - > null

Restore a trashed or archived bookmark to active status.

Returns

TypeDescription
nullNothing

add_tag()

@classmethod
def add_tag(
tag_id: string
) - > boolean

Attach a tag. Returns False if already present.

Parameters

NameTypeDescription
tag_idstringThe unique identifier of the tag to be associated with this bookmark

Returns

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

NameTypeDescription
tag_idstringThe unique identifier of the tag to be removed from this bookmark

Returns

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

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

NameTypeDescription
dataobjectDictionary with bookmark fields such as url, title, description, and tags

Returns

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