|
5 | 5 | from .data import ( |
6 | 6 | BugoutJournal, |
7 | 7 | BugoutJournals, |
| 8 | + BugoutJournalPermissions, |
8 | 9 | BugoutScopes, |
9 | 10 | BugoutJournalScopeSpecs, |
10 | 11 | BugoutJournalEntry, |
@@ -52,6 +53,29 @@ def list_scopes(self, token: Union[str, uuid.UUID], api: str) -> BugoutScopes: |
52 | 53 | ) |
53 | 54 | return BugoutScopes(**result) |
54 | 55 |
|
| 56 | + def get_journal_permissions( |
| 57 | + self, |
| 58 | + token: Union[str, uuid.UUID], |
| 59 | + journal_id: Union[str, uuid.UUID], |
| 60 | + holder_ids: Optional[List[Union[str, uuid.UUID]]] = None, |
| 61 | + ) -> BugoutJournalPermissions: |
| 62 | + journal_scopes_path = f"journals/{journal_id}/permissions" |
| 63 | + headers = { |
| 64 | + "Authorization": f"Bearer {token}", |
| 65 | + } |
| 66 | + query_params = {} |
| 67 | + if holder_ids is not None: |
| 68 | + holder_ids_string = [str(holder_id) for holder_id in holder_ids] |
| 69 | + holder_ids_param = ",".join(holder_ids_string) |
| 70 | + query_params = {"holder_ids": holder_ids_param} |
| 71 | + result = self._call( |
| 72 | + method=Method.get, |
| 73 | + path=journal_scopes_path, |
| 74 | + params=query_params, |
| 75 | + headers=headers, |
| 76 | + ) |
| 77 | + return BugoutJournalPermissions(**result) |
| 78 | + |
55 | 79 | def get_journal_scopes( |
56 | 80 | self, token: Union[str, uuid.UUID], journal_id: Union[str, uuid.UUID] |
57 | 81 | ) -> BugoutJournalScopeSpecs: |
@@ -401,3 +425,10 @@ def search( |
401 | 425 | method=Method.get, path=search_path, params=query_params, headers=headers |
402 | 426 | ) |
403 | 427 | return BugoutSearchResults(**result) |
| 428 | + |
| 429 | + # Public module |
| 430 | + def check_journal_public(self, journal_id: Union[str, uuid.UUID]) -> bool: |
| 431 | + journal_path = "public/check" |
| 432 | + query_params = {"journal_id": journal_id} |
| 433 | + result = self._call(method=Method.get, path=journal_path, params=query_params) |
| 434 | + return result |
0 commit comments