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,
metadata: Dict[str, Any] = {}
) - > null

Parameters

NameTypeDescription
urlstrThe bookmarked URL.
titlestrHuman-readable title for the bookmark.
descriptionstrOptional longer description of the bookmark.
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.
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 associate with this bookmark

Returns

TypeDescription
booleanTrue if the tag was successfully added, False if the tag ID already exists in the tags 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 remove from this bookmark

Returns

TypeDescription
booleanTrue if the tag was successfully removed, False if the tag ID was not found in the tags list

to_dict()

@classmethod
def to_dict() - > object

Serialise to a plain dictionary for JSON responses.

Returns

TypeDescription
objectA dictionary containing the bookmark's attributes, including serialized timestamps and status values

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.

Returns

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