Skip to content

Commit 73fa1cb

Browse files
committed
Added JournalTypes to be able to specify humbug and default
1 parent cd913ae commit 73fa1cb

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

bugout/app.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,16 @@ def delete_journal_scopes(
348348

349349
# Journal handlers
350350
def create_journal(
351-
self, token: Union[str, uuid.UUID], name: str, timeout: float = REQUESTS_TIMEOUT
351+
self,
352+
token: Union[str, uuid.UUID],
353+
name: str,
354+
journal_type: Union[str, data.JournalTypes],
355+
timeout: float = REQUESTS_TIMEOUT,
352356
) -> data.BugoutJournal:
353357
self.journal.timeout = timeout
354-
return self.journal.create_journal(token=token, name=name)
358+
return self.journal.create_journal(
359+
token=token, name=name, journal_type=data.JournalTypes(journal_type)
360+
)
355361

356362
def list_journals(
357363
self, token: Union[str, uuid.UUID], timeout: float = REQUESTS_TIMEOUT

bugout/data.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class HolderType(Enum):
3333
group = "group"
3434

3535

36+
class JournalTypes(Enum):
37+
DEFAULT = "default"
38+
HUMBUG = "humbug"
39+
40+
3641
class BugoutUser(BaseModel):
3742
id: uuid.UUID = Field(alias="user_id")
3843
username: str

bugout/journal.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
BugoutSearchResults,
1515
HolderType,
1616
Method,
17+
JournalTypes,
1718
)
1819
from .settings import REQUESTS_TIMEOUT
1920

@@ -107,11 +108,14 @@ def delete_journal_scopes(
107108
return BugoutJournalScopeSpecs(**result)
108109

109110
# Journal module
110-
def create_journal(self, token: Union[str, uuid.UUID], name: str) -> BugoutJournal:
111+
def create_journal(
112+
self,
113+
token: Union[str, uuid.UUID],
114+
name: str,
115+
journal_type: JournalTypes = JournalTypes.DEFAULT,
116+
) -> BugoutJournal:
111117
journal_path = "journals/"
112-
json = {
113-
"name": name,
114-
}
118+
json = {"name": name, "journal_type": journal_type.value}
115119
headers = {
116120
"Authorization": f"Bearer {token}",
117121
}

0 commit comments

Comments
 (0)