Skip to main content

BookmarkRepository

In-memory storage for bookmarks, tags, and collections. All mutation methods persist immediately (since this is in-memory). For a real database you'd add transaction support here.

Constructor

Signature

def BookmarkRepository(self) -> None: ...

Methods


save_bookmark()

def save_bookmark(self, bookmark: Bookmark) -> None: ...

Insert or update a bookmark.

Parameters

NameTypeDescription
bookmark[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_bookmark)The bookmark object to be saved or updated.

Returns

TypeDescription
None

get_bookmark()

def get_bookmark(self, bookmark_id: str) -> Optional[Bookmark]: ...

Retrieve a bookmark by ID, or None.

Parameters

NameTypeDescription
bookmark_idstrThe unique identifier of the bookmark to retrieve.

Returns

TypeDescription
Optional[[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_bookmark)]The Bookmark object if found, otherwise None.

delete_bookmark()

def delete_bookmark(self, bookmark_id: str) -> bool: ...

Hard-delete a bookmark. Returns True if it existed.

Parameters

NameTypeDescription
bookmark_idstrThe unique identifier of the bookmark to delete.

Returns

TypeDescription
boolTrue if the bookmark was found and deleted, False otherwise.

list_bookmarks()

def list_bookmarks(
self,
page: int = 1,
per_page: int = 25,
status: Optional[str] = None,
) -> Tuple[List[Bookmark], int]: ...

Return a paginated slice of bookmarks.

Parameters

NameTypeDescription
pageint = 11-based page index.
per_pageint = 25Number of items per page.
statusOptional[str] = NoneOptional status filter string (active, archived, trashed).

Returns

TypeDescription
Tuple[List[[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_bookmark)], int]Tuple of (page_items, total_matching_count).

get_bookmarks_with_tag()

def get_bookmarks_with_tag(self, tag_id: str) -> List[Bookmark]: ...

Return all bookmarks that have a specific tag attached.

Parameters

NameTypeDescription
tag_idstrThe unique identifier of the tag to filter bookmarks by.

Returns

TypeDescription
List[[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_bookmark)]A list of Bookmark objects that are associated with the given tag ID.

save_tag()

def save_tag(self, tag: Tag) -> None: ...

Insert or update a tag.

Parameters

NameTypeDescription
tag[Tag](../../models/tag/tag.md?sid=app_models_tag_tag)The tag object to be saved or updated.

Returns

TypeDescription
None

get_tag()

def get_tag(self, tag_id: str) -> Optional[Tag]: ...

Retrieve a tag by ID, or None.

Parameters

NameTypeDescription
tag_idstrThe unique identifier of the tag to retrieve.

Returns

TypeDescription
Optional[[Tag](../../models/tag/tag.md?sid=app_models_tag_tag)]The Tag object if found, otherwise None.

delete_tag()

def delete_tag(self, tag_id: str) -> bool: ...

Hard-delete a tag.

Parameters

NameTypeDescription
tag_idstrThe unique identifier of the tag to delete.

Returns

TypeDescription
boolTrue if the tag was found and deleted, False otherwise.

list_tags()

def list_tags(self) -> List[Tag]: ...

Return all tags.

Returns

TypeDescription
List[[Tag](../../models/tag/tag.md?sid=app_models_tag_tag)]A list of all Tag objects currently stored.

save_collection()

def save_collection(self, collection: Collection) -> None: ...

Insert or update a collection.

Parameters

NameTypeDescription
collection[Collection](../../models/collection/collection.md?sid=app_models_collection_collection)The collection object to be saved or updated.

Returns

TypeDescription
None

get_collection()

def get_collection(self, collection_id: str) -> Optional[Collection]: ...

Retrieve a collection by ID, or None.

Parameters

NameTypeDescription
collection_idstrThe unique identifier of the collection to retrieve.

Returns

TypeDescription
Optional[[Collection](../../models/collection/collection.md?sid=app_models_collection_collection)]The Collection object if found, otherwise None.

delete_collection()

def delete_collection(self, collection_id: str) -> bool: ...

Hard-delete a collection.

Parameters

NameTypeDescription
collection_idstrThe unique identifier of the collection to delete.

Returns

TypeDescription
boolTrue if the collection was found and deleted, False otherwise.

list_collections()

def list_collections(self) -> List[Collection]: ...

Return all collections.

Returns

TypeDescription
List[[Collection](../../models/collection/collection.md?sid=app_models_collection_collection)]A list of all Collection objects currently stored.