Skip to content

Commit 754adcf

Browse files
committed
Journal entry scopes update and delete endpoints support auth_type
1 parent 1965827 commit 754adcf

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

bugout/app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ def update_journal_scopes(
453453
holder_id: Union[str, uuid.UUID],
454454
permission_list: List[str],
455455
timeout: float = REQUESTS_TIMEOUT,
456+
auth_type: str = data.AuthType.bearer.name,
457+
**kwargs: Dict[str, Any],
456458
) -> data.BugoutJournalScopeSpecs:
457459
self.journal.timeout = timeout
458460
return self.journal.update_journal_scopes(
@@ -461,6 +463,8 @@ def update_journal_scopes(
461463
holder_type=data.HolderType(holder_type),
462464
holder_id=holder_id,
463465
permission_list=permission_list,
466+
auth_type=data.AuthType[auth_type],
467+
**kwargs,
464468
)
465469

466470
def delete_journal_scopes(
@@ -471,6 +475,8 @@ def delete_journal_scopes(
471475
holder_id: Union[str, uuid.UUID],
472476
permission_list: List[str],
473477
timeout: float = REQUESTS_TIMEOUT,
478+
auth_type: str = data.AuthType.bearer.name,
479+
**kwargs: Dict[str, Any],
474480
) -> data.BugoutJournalScopeSpecs:
475481
self.journal.timeout = timeout
476482
return self.journal.delete_journal_scopes(
@@ -479,6 +485,8 @@ def delete_journal_scopes(
479485
holder_type=data.HolderType(holder_type),
480486
holder_id=holder_id,
481487
permission_list=permission_list,
488+
auth_type=data.AuthType[auth_type],
489+
**kwargs,
482490
)
483491

484492
# Journal handlers

bugout/journal.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def update_journal_scopes(
122122
holder_type: HolderType,
123123
holder_id: Union[str, uuid.UUID],
124124
permission_list: List[str],
125+
auth_type: AuthType = AuthType.bearer,
126+
**kwargs: Dict[str, Any],
125127
) -> BugoutJournalScopeSpecs:
126128
journal_scopes_path = f"journals/{journal_id}/scopes"
127129
json = {
@@ -130,8 +132,10 @@ def update_journal_scopes(
130132
"permission_list": permission_list,
131133
}
132134
headers = {
133-
"Authorization": f"Bearer {token}",
135+
"Authorization": f"{auth_type.value} {token}",
134136
}
137+
if "headers" in kwargs.keys():
138+
headers.update(kwargs["headers"])
135139
result = self._call(
136140
method=Method.post, path=journal_scopes_path, headers=headers, json=json
137141
)
@@ -144,6 +148,8 @@ def delete_journal_scopes(
144148
holder_type: HolderType,
145149
holder_id: Union[str, uuid.UUID],
146150
permission_list: List[str],
151+
auth_type: AuthType = AuthType.bearer,
152+
**kwargs: Dict[str, Any],
147153
) -> BugoutJournalScopeSpecs:
148154
journal_scopes_path = f"journals/{journal_id}/scopes"
149155
json = {
@@ -152,8 +158,10 @@ def delete_journal_scopes(
152158
"permission_list": permission_list,
153159
}
154160
headers = {
155-
"Authorization": f"Bearer {token}",
161+
"Authorization": f"{auth_type.value} {token}",
156162
}
163+
if "headers" in kwargs.keys():
164+
headers.update(kwargs["headers"])
157165
result = self._call(
158166
method=Method.delete, path=journal_scopes_path, headers=headers, json=json
159167
)

0 commit comments

Comments
 (0)