Skip to content

Commit cba4bd8

Browse files
authored
Merge pull request #7 from bugout-dev/enum-fix
Enum fix
2 parents 01e02f4 + 6698595 commit cba4bd8

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

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.0.8"
10+
__version__ = "0.0.9"
1111

1212
__all__ = (
1313
"__author__",

bugout/journal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def delete_journal_scopes(
9191
) -> BugoutJournalScopeSpecs:
9292
journal_scopes_path = f"journals/{journal_id}/scopes"
9393
json = {
94-
"holder_type": holder_type,
95-
"holder_id": holder_id,
94+
"holder_type": holder_type.value,
95+
"holder_id": str(holder_id),
9696
"permission_list": permission_list,
9797
}
9898
headers = {

bugout/user.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,9 @@ def update_token(
176176
raise TokenInvalidParameters(
177177
"In order to update token, at least one of token_type, or token_note must be specified"
178178
)
179-
if token_type is not None and token_type not in TokenType.__members__:
180-
raise TokenInvalidParameters(
181-
"Incorrect token type provided, check types at get_token_types()"
182-
)
183179
data: Dict[str, Any] = {"access_token": token}
184180
if token_type is not None:
185-
data.update({"token_type": token_type})
181+
data.update({"token_type": token_type.value})
186182
if token_note is not None:
187183
data.update({"token_note": token_note})
188184

@@ -209,16 +205,12 @@ def get_user_tokens(
209205
headers = {
210206
"Authorization": f"Bearer {token}",
211207
}
212-
if token_type is not None and token_type not in TokenType.__members__:
213-
raise TokenInvalidParameters(
214-
"Incorrect token type provided, check types at get_token_types()"
215-
)
216208
if active is not None and token_type is None:
217209
get_user_tokens_path += f"?active={active}"
218210
elif active is None and token_type is not None:
219-
get_user_tokens_path += f"?token_type={token_type}"
211+
get_user_tokens_path += f"?token_type={token_type.value}"
220212
elif active is not None and token_type is not None:
221-
get_user_tokens_path += f"?active={active}&token_type={token_type}"
213+
get_user_tokens_path += f"?active={active}&token_type={token_type.value}"
222214
result = self._call(
223215
method=Method.get, path=get_user_tokens_path, headers=headers
224216
)

0 commit comments

Comments
 (0)