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() - > None
Methods
save_bookmark()
@classmethod
def save_bookmark(
bookmark: [Bookmark](../../models/bookmark/bookmark.md?sid=app_models_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 save. |
Returns
| Type | Description |
|---|
None | This method does not return a value. |
get_bookmark()
@classmethod
def get_bookmark(
bookmark_id: str
) - > Optional[[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_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()
@classmethod
def delete_bookmark(
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()
@classmethod
def list_bookmarks(
page: int = 1,
per_page: int = 25,
status: Optional[str] = None
) - > Tuple[List[[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_bookmark)], int]
Return a paginated slice of bookmarks, sorted by creation date in descending order. Filters by status if provided.
Parameters
| Name | Type | Description |
|---|
| page | int = 1 | The 1-based index of the page to retrieve. |
| per_page | int = 25 | The number of bookmarks to include per page. |
| status | Optional[str] = None | An optional status string (e.g., 'active', 'archived', 'trashed') to filter the bookmarks. |
Returns
| Type | Description |
|---|
Tuple[List[[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_bookmark)], int] | A tuple containing a list of bookmark objects for the requested page and the total count of bookmarks matching the filter criteria. |
get_bookmarks_with_tag()
@classmethod
def get_bookmarks_with_tag(
tag_id: str
) - > List[[Bookmark](../../models/bookmark/bookmark.md?sid=app_models_bookmark_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 associated with the given tag ID. |
save_tag()
@classmethod
def save_tag(
tag: [Tag](../../models/tag/tag.md?sid=app_models_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 save. |
Returns
| Type | Description |
|---|
None | This method does not return a value. |
get_tag()
@classmethod
def get_tag(
tag_id: str
) - > Optional[[Tag](../../models/tag/tag.md?sid=app_models_tag_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()
@classmethod
def delete_tag(
tag_id: str
) - > bool
Hard-delete a tag. Returns True if it existed.
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. |
@classmethod
def list_tags() - > List[[Tag](../../models/tag/tag.md?sid=app_models_tag_tag)]
Return all tags.
Returns
| Type | Description |
|---|
List[[Tag](../../models/tag/tag.md?sid=app_models_tag_tag)] | A list of all tag objects. |
save_collection()
@classmethod
def save_collection(
collection: [Collection](../../models/collection/collection.md?sid=app_models_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 save. |
Returns
| Type | Description |
|---|
None | This method does not return a value. |
get_collection()
@classmethod
def get_collection(
collection_id: str
) - > Optional[[Collection](../../models/collection/collection.md?sid=app_models_collection_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()
@classmethod
def delete_collection(
collection_id: str
) - > bool
Hard-delete a collection. Returns True if it existed.
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()
@classmethod
def list_collections() - > List[[Collection](../../models/collection/collection.md?sid=app_models_collection_collection)]
Return all collections.
Returns
| Type | Description |
|---|
List[[Collection](../../models/collection/collection.md?sid=app_models_collection_collection)] | A list of all collection objects. |