@@ -556,9 +556,110 @@ def search(
556556 )
557557 return BugoutSearchResults (** result )
558558
559- # Public module
560- def check_journal_public (self , journal_id : Union [str , uuid .UUID ]) -> bool :
561- journal_path = "public/check"
562- query_params = {"journal_id" : journal_id }
563- result = self ._call (method = Method .get , path = journal_path , params = query_params )
559+ # Public journals module
560+ def check_journal_public (
561+ self ,
562+ journal_id : Union [str , uuid .UUID ],
563+ ** kwargs : Dict [str , Any ],
564+ ) -> bool :
565+ check_path = f"public/{ journal_id } /check"
566+ headers = {}
567+ if "headers" in kwargs .keys ():
568+ headers .update (kwargs ["headers" ])
569+ result = self ._call (method = Method .get , path = check_path , headers = headers )
564570 return result
571+
572+ def list_public_journals (
573+ self ,
574+ user_id : Union [str , uuid .UUID ],
575+ ** kwargs : Dict [str , Any ],
576+ ) -> BugoutJournals :
577+ public_journals_path = "public"
578+ headers = {}
579+ if "headers" in kwargs .keys ():
580+ headers .update (kwargs ["headers" ])
581+ query_params = {"user_id" : user_id }
582+ result = self ._call (
583+ method = Method .get ,
584+ path = public_journals_path ,
585+ params = query_params ,
586+ headers = headers ,
587+ )
588+ return BugoutJournals (** result )
589+
590+ def get_public_journal (
591+ self ,
592+ journal_id : Union [str , uuid .UUID ],
593+ ** kwargs : Dict [str , Any ],
594+ ) -> BugoutJournal :
595+ public_journal_path = f"public/{ journal_id } "
596+ headers = {}
597+ if "headers" in kwargs .keys ():
598+ headers .update (kwargs ["headers" ])
599+ result = self ._call (
600+ method = Method .get ,
601+ path = public_journal_path ,
602+ headers = headers ,
603+ )
604+ return BugoutJournal (** result )
605+
606+ def get_public_journal_entries (
607+ self ,
608+ journal_id : Union [str , uuid .UUID ],
609+ ** kwargs : Dict [str , Any ],
610+ ) -> BugoutJournalEntries :
611+ public_journal_path = f"public/{ journal_id } /entries"
612+ headers = {}
613+ if "headers" in kwargs .keys ():
614+ headers .update (kwargs ["headers" ])
615+ result = self ._call (
616+ method = Method .get ,
617+ path = public_journal_path ,
618+ headers = headers ,
619+ )
620+ return BugoutJournalEntries (** result )
621+
622+ def get_public_journal_entry (
623+ self ,
624+ journal_id : Union [str , uuid .UUID ],
625+ entry_id : Union [str , uuid .UUID ],
626+ ** kwargs : Dict [str , Any ],
627+ ) -> BugoutJournalEntry :
628+ public_journal_path = f"public/{ journal_id } /entries/{ entry_id } "
629+ headers = {}
630+ if "headers" in kwargs .keys ():
631+ headers .update (kwargs ["headers" ])
632+ result = self ._call (
633+ method = Method .get ,
634+ path = public_journal_path ,
635+ headers = headers ,
636+ )
637+ return BugoutJournalEntry (** result )
638+
639+ def public_search (
640+ self ,
641+ journal_id : Union [str , uuid .UUID ],
642+ query : str ,
643+ filters : Optional [List [str ]] = None ,
644+ limit : int = 10 ,
645+ offset : int = 0 ,
646+ content : bool = True ,
647+ order : SearchOrder = SearchOrder .DESCENDING ,
648+ ** kwargs : Dict [str , Any ],
649+ ) -> BugoutSearchResults :
650+ search_path = f"public/{ journal_id } /search"
651+ headers = {}
652+ if "headers" in kwargs .keys ():
653+ headers .update (kwargs ["headers" ])
654+ query_params = {
655+ "q" : query ,
656+ "filters" : filters if filters is not None else [],
657+ "limit" : limit ,
658+ "offset" : offset ,
659+ "content" : content ,
660+ "order" : order .value ,
661+ }
662+ result = self ._call (
663+ method = Method .get , path = search_path , params = query_params , headers = headers
664+ )
665+ return BugoutSearchResults (** result )
0 commit comments