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
| Name | Type | Description |
|---|---|---|
| bookmark | [Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_bookmark) | The bookmark object to be saved or updated. |
Returns
| Type | Description |
|---|---|
None |
get_bookmark()
def get_bookmark(self, bookmark_id: str) -> Optional[Bookmark]: ...
Retrieve a bookmark by ID, or None.
Parameters
| Name | Type | Description |
|---|---|---|
| bookmark_id | str | The unique identifier of the bookmark to retrieve. |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| bookmark_id | str | The unique identifier of the bookmark to delete. |
Returns
| Type | Description |
|---|---|
bool | True 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
| Name | Type | Description |
|---|---|---|
| page | int = 1 | 1-based page index. |
| per_page | int = 25 | Number of items per page. |
| status | Optional[str] = None | Optional status filter string (active, archived, trashed). |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| tag_id | str | The unique identifier of the tag to filter bookmarks by. |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| tag | [Tag](../../models/tag/tag.md?sid=app_models_tag_tag) | The tag object to be saved or updated. |
Returns
| Type | Description |
|---|---|
None |
get_tag()
def get_tag(self, tag_id: str) -> Optional[Tag]: ...
Retrieve a tag by ID, or None.
Parameters
| Name | Type | Description |
|---|---|---|
| tag_id | str | The unique identifier of the tag to retrieve. |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| tag_id | str | The unique identifier of the tag to delete. |
Returns
| Type | Description |
|---|---|
bool | True if the tag was found and deleted, False otherwise. |
list_tags()
def list_tags(self) -> List[Tag]: ...
Return all tags.
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| collection | [Collection](../../models/collection/collection.md?sid=app_models_collection_collection) | The collection object to be saved or updated. |
Returns
| Type | Description |
|---|---|
None |
get_collection()
def get_collection(self, collection_id: str) -> Optional[Collection]: ...
Retrieve a collection by ID, or None.
Parameters
| Name | Type | Description |
|---|---|---|
| collection_id | str | The unique identifier of the collection to retrieve. |
Returns
| Type | Description |
|---|---|
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
| Name | Type | Description |
|---|---|---|
| collection_id | str | The unique identifier of the collection to delete. |
Returns
| Type | Description |
|---|---|
bool | True if the collection was found and deleted, False otherwise. |
list_collections()
def list_collections(self) -> List[Collection]: ...
Return all collections.
Returns
| Type | Description |
|---|---|
List[[Collection](../../models/collection/collection.md?sid=app_models_collection_collection)] | A list of all Collection objects currently stored. |