Skip to content

Commit 6395a48

Browse files
authored
Merge pull request #40 from bugout-dev/web3-for-journals
Support web3 auth for journals
2 parents d28278f + 56530f8 commit 6395a48

File tree

4 files changed

+108
-19
lines changed

4 files changed

+108
-19
lines changed

bugout/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
__email__ = "engineering@bugout.dev"
99
__license__ = "MIT"
10-
__version__ = "0.2.1"
10+
__version__ = "0.2.2"
1111

1212
__all__ = (
1313
"__author__",

bugout/app.py

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,31 +64,28 @@ def create_user(
6464
def get_user(
6565
self,
6666
token: Union[str, uuid.UUID],
67-
application_id: Optional[Union[str, uuid.UUID]] = None,
6867
timeout: float = REQUESTS_TIMEOUT,
6968
auth_type: str = data.AuthType.bearer.name,
69+
**kwargs: Dict[str, Any],
7070
) -> data.BugoutUser:
7171
self.user.timeout = timeout
7272
return self.user.get_user(
7373
token=token,
74-
application_id=application_id,
7574
auth_type=data.AuthType[auth_type],
75+
**kwargs,
7676
)
7777

7878
def get_user_by_id(
7979
self,
8080
token: Union[str, uuid.UUID],
8181
user_id: Union[str, uuid.UUID],
82-
application_id: Optional[Union[str, uuid.UUID]] = None,
8382
timeout: float = REQUESTS_TIMEOUT,
8483
auth_type: str = data.AuthType.bearer.name,
84+
**kwargs: Dict[str, Any],
8585
) -> data.BugoutUser:
8686
self.user.timeout = timeout
8787
return self.user.get_user_by_id(
88-
token=token,
89-
user_id=user_id,
90-
application_id=application_id,
91-
auth_type=data.AuthType[auth_type],
88+
token=token, user_id=user_id, auth_type=data.AuthType[auth_type], **kwargs
9289
)
9390

9491
def find_user(
@@ -486,6 +483,7 @@ def create_journal(
486483
journal_type: Optional[Union[str, data.JournalTypes]] = None,
487484
timeout: float = REQUESTS_TIMEOUT,
488485
auth_type: str = data.AuthType.bearer.name,
486+
**kwargs: Dict[str, Any],
489487
) -> data.BugoutJournal:
490488
self.journal.timeout = timeout
491489
if journal_type is None:
@@ -495,17 +493,19 @@ def create_journal(
495493
name=name,
496494
journal_type=data.JournalTypes(journal_type),
497495
auth_type=data.AuthType[auth_type],
496+
**kwargs,
498497
)
499498

500499
def list_journals(
501500
self,
502501
token: Union[str, uuid.UUID],
503502
timeout: float = REQUESTS_TIMEOUT,
504503
auth_type: str = data.AuthType.bearer.name,
504+
**kwargs: Dict[str, Any],
505505
) -> data.BugoutJournals:
506506
self.journal.timeout = timeout
507507
return self.journal.list_journals(
508-
token=token, auth_type=data.AuthType[auth_type]
508+
token=token, auth_type=data.AuthType[auth_type], **kwargs
509509
)
510510

511511
def get_journal(
@@ -514,10 +514,14 @@ def get_journal(
514514
journal_id: Union[str, uuid.UUID],
515515
timeout: float = REQUESTS_TIMEOUT,
516516
auth_type: str = data.AuthType.bearer.name,
517+
**kwargs: Dict[str, Any],
517518
) -> data.BugoutJournal:
518519
self.journal.timeout = timeout
519520
return self.journal.get_journal(
520-
token=token, journal_id=journal_id, auth_type=data.AuthType[auth_type]
521+
token=token,
522+
journal_id=journal_id,
523+
auth_type=data.AuthType[auth_type],
524+
**kwargs,
521525
)
522526

523527
def update_journal(
@@ -527,13 +531,15 @@ def update_journal(
527531
name: str,
528532
timeout: float = REQUESTS_TIMEOUT,
529533
auth_type: str = data.AuthType.bearer.name,
534+
**kwargs: Dict[str, Any],
530535
) -> data.BugoutJournal:
531536
self.journal.timeout = timeout
532537
return self.journal.update_journal(
533538
token=token,
534539
journal_id=journal_id,
535540
name=name,
536541
auth_type=data.AuthType[auth_type],
542+
**kwargs,
537543
)
538544

539545
def delete_journal(
@@ -542,10 +548,14 @@ def delete_journal(
542548
journal_id: Union[str, uuid.UUID],
543549
timeout: float = REQUESTS_TIMEOUT,
544550
auth_type: str = data.AuthType.bearer.name,
551+
**kwargs: Dict[str, Any],
545552
) -> data.BugoutJournal:
546553
self.journal.timeout = timeout
547554
return self.journal.delete_journal(
548-
token=token, journal_id=journal_id, auth_type=data.AuthType[auth_type]
555+
token=token,
556+
journal_id=journal_id,
557+
auth_type=data.AuthType[auth_type],
558+
**kwargs,
549559
)
550560

551561
# Journal entries
@@ -561,6 +571,7 @@ def create_entry(
561571
context_type: Optional[str] = None,
562572
timeout: float = REQUESTS_TIMEOUT,
563573
auth_type: str = data.AuthType.bearer.name,
574+
**kwargs: Dict[str, Any],
564575
) -> data.BugoutJournalEntry:
565576
self.journal.timeout = timeout
566577
return self.journal.create_entry(
@@ -573,6 +584,7 @@ def create_entry(
573584
context_id=context_id,
574585
context_type=context_type,
575586
auth_type=data.AuthType[auth_type],
587+
**kwargs,
576588
)
577589

578590
def create_entries_pack(
@@ -582,6 +594,7 @@ def create_entries_pack(
582594
entries: List[Dict[str, Any]],
583595
timeout: float = REQUESTS_TIMEOUT,
584596
auth_type: str = data.AuthType.bearer.name,
597+
**kwargs: Dict[str, Any],
585598
) -> data.BugoutJournalEntries:
586599
self.journal.timeout = timeout
587600
entries_obj = data.BugoutJournalEntriesRequest(
@@ -592,6 +605,7 @@ def create_entries_pack(
592605
journal_id=journal_id,
593606
entries=entries_obj,
594607
auth_type=data.AuthType[auth_type],
608+
**kwargs,
595609
)
596610

597611
def get_entry(
@@ -601,13 +615,15 @@ def get_entry(
601615
entry_id: Union[str, uuid.UUID],
602616
timeout: float = REQUESTS_TIMEOUT,
603617
auth_type: str = data.AuthType.bearer.name,
618+
**kwargs: Dict[str, Any],
604619
) -> data.BugoutJournalEntry:
605620
self.journal.timeout = timeout
606621
return self.journal.get_entry(
607622
token=token,
608623
journal_id=journal_id,
609624
entry_id=entry_id,
610625
auth_type=data.AuthType[auth_type],
626+
**kwargs,
611627
)
612628

613629
def get_entries(
@@ -616,10 +632,14 @@ def get_entries(
616632
journal_id: Union[str, uuid.UUID],
617633
timeout: float = REQUESTS_TIMEOUT,
618634
auth_type: str = data.AuthType.bearer.name,
635+
**kwargs: Dict[str, Any],
619636
) -> data.BugoutJournalEntries:
620637
self.journal.timeout = timeout
621638
return self.journal.get_entries(
622-
token=token, journal_id=journal_id, auth_type=data.AuthType[auth_type]
639+
token=token,
640+
journal_id=journal_id,
641+
auth_type=data.AuthType[auth_type],
642+
**kwargs,
623643
)
624644

625645
def get_entry_content(
@@ -629,13 +649,15 @@ def get_entry_content(
629649
entry_id: Union[str, uuid.UUID],
630650
timeout: float = REQUESTS_TIMEOUT,
631651
auth_type: str = data.AuthType.bearer.name,
652+
**kwargs: Dict[str, Any],
632653
) -> data.BugoutJournalEntryContent:
633654
self.journal.timeout = timeout
634655
return self.journal.get_entry_content(
635656
token=token,
636657
journal_id=journal_id,
637658
entry_id=entry_id,
638659
auth_type=data.AuthType[auth_type],
660+
**kwargs,
639661
)
640662

641663
def update_entry_content(
@@ -649,6 +671,7 @@ def update_entry_content(
649671
tags: Optional[List[str]] = None,
650672
tags_action: TagsAction = TagsAction.merge,
651673
auth_type: str = data.AuthType.bearer.name,
674+
**kwargs: Dict[str, Any],
652675
) -> data.BugoutJournalEntryContent:
653676
self.journal.timeout = timeout
654677
return self.journal.update_entry_content(
@@ -660,6 +683,7 @@ def update_entry_content(
660683
tags=tags,
661684
tags_action=tags_action,
662685
auth_type=data.AuthType[auth_type],
686+
**kwargs,
663687
)
664688

665689
def delete_entry(
@@ -669,13 +693,15 @@ def delete_entry(
669693
entry_id: Union[str, uuid.UUID],
670694
timeout: float = REQUESTS_TIMEOUT,
671695
auth_type: str = data.AuthType.bearer.name,
696+
**kwargs: Dict[str, Any],
672697
) -> data.BugoutJournalEntry:
673698
self.journal.timeout = timeout
674699
return self.journal.delete_entry(
675700
token=token,
676701
journal_id=journal_id,
677702
entry_id=entry_id,
678703
auth_type=data.AuthType[auth_type],
704+
**kwargs,
679705
)
680706

681707
# Tags
@@ -696,6 +722,7 @@ def create_tags(
696722
tags: List[str],
697723
timeout: float = REQUESTS_TIMEOUT,
698724
auth_type: str = data.AuthType.bearer.name,
725+
**kwargs: Dict[str, Any],
699726
) -> List[Any]:
700727
self.journal.timeout = timeout
701728
return self.journal.create_tags(
@@ -704,6 +731,7 @@ def create_tags(
704731
entry_id=entry_id,
705732
tags=tags,
706733
auth_type=data.AuthType[auth_type],
734+
**kwargs,
707735
)
708736

709737
def get_tags(
@@ -713,13 +741,15 @@ def get_tags(
713741
entry_id: Union[str, uuid.UUID],
714742
timeout: float = REQUESTS_TIMEOUT,
715743
auth_type: str = data.AuthType.bearer.name,
744+
**kwargs: Dict[str, Any],
716745
) -> data.BugoutJournalEntryTags:
717746
self.journal.timeout = timeout
718747
return self.journal.get_tags(
719748
token=token,
720749
journal_id=journal_id,
721750
entry_id=entry_id,
722751
auth_type=data.AuthType[auth_type],
752+
**kwargs,
723753
)
724754

725755
def update_tags(
@@ -730,6 +760,7 @@ def update_tags(
730760
tags: List[str],
731761
timeout: float = REQUESTS_TIMEOUT,
732762
auth_type: str = data.AuthType.bearer.name,
763+
**kwargs: Dict[str, Any],
733764
) -> List[Any]:
734765
self.journal.timeout = timeout
735766
return self.journal.update_tags(
@@ -738,6 +769,7 @@ def update_tags(
738769
entry_id=entry_id,
739770
tags=tags,
740771
auth_type=data.AuthType[auth_type],
772+
**kwargs,
741773
)
742774

743775
def delete_tag(
@@ -748,6 +780,7 @@ def delete_tag(
748780
tag: str,
749781
timeout: float = REQUESTS_TIMEOUT,
750782
auth_type: str = data.AuthType.bearer.name,
783+
**kwargs: Dict[str, Any],
751784
) -> data.BugoutJournalEntryTags:
752785
self.journal.timeout = timeout
753786
return self.journal.delete_tag(
@@ -756,6 +789,7 @@ def delete_tag(
756789
entry_id=entry_id,
757790
tag=tag,
758791
auth_type=data.AuthType[auth_type],
792+
**kwargs,
759793
)
760794

761795
# Search
@@ -771,6 +805,7 @@ def search(
771805
timeout: float = REQUESTS_TIMEOUT,
772806
order: SearchOrder = SearchOrder.DESCENDING,
773807
auth_type: str = data.AuthType.bearer.name,
808+
**kwargs: Dict[str, Any],
774809
) -> data.BugoutSearchResults:
775810
self.journal.timeout = timeout
776811
return self.journal.search(
@@ -783,6 +818,7 @@ def search(
783818
content,
784819
order=order,
785820
auth_type=data.AuthType[auth_type],
821+
**kwargs,
786822
)
787823

788824
# Public

0 commit comments

Comments
 (0)