forked from dullage/flatnotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.py
More file actions
42 lines (34 loc) · 1.05 KB
/
base.py
File metadata and controls
42 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from abc import ABC, abstractmethod
from typing import Literal
from .models import Note, NoteCreate, NoteUpdate, SearchResult
class BaseNotes(ABC):
@abstractmethod
def create(self, data: NoteCreate) -> Note:
"""Create a new note."""
pass
@abstractmethod
def get(self, title: str) -> Note:
"""Get a specific note."""
pass
@abstractmethod
def update(self, title: str, new_data: NoteUpdate) -> Note:
"""Update a specific note."""
pass
@abstractmethod
def delete(self, title: str) -> None:
"""Delete a specific note.""" ""
pass
@abstractmethod
def search(
self,
term: str,
sort: Literal["score", "title", "last_modified"] = "score",
order: Literal["asc", "desc"] = "desc",
limit: int = None,
) -> list[SearchResult]:
"""Search for notes."""
pass
@abstractmethod
def get_tags(self) -> list[str]:
"""Get a list of all indexed tags."""
pass