fix: fixed endpoint for get_invites
All checks were successful
Pylint / Pylint (3.12) (push) Successful in 35s
All checks were successful
Pylint / Pylint (3.12) (push) Successful in 35s
This commit is contained in:
parent
2384e8cb3b
commit
f313a3b992
1 changed files with 33 additions and 1 deletions
|
@ -164,6 +164,38 @@ class ZiplineApi:
|
||||||
raise ValueError('username not provided')
|
raise ValueError('username not provided')
|
||||||
raise PyZiplineError(f"{result.status_code}: {result.message}\n{result.data}")
|
raise PyZiplineError(f"{result.status_code}: {result.message}\n{result.data}")
|
||||||
|
|
||||||
|
def delete_invite(self, code: str) -> Invite:
|
||||||
|
"""Delete an invite code
|
||||||
|
|
||||||
|
/// admonition | Requires Authentication
|
||||||
|
type: warning
|
||||||
|
///
|
||||||
|
|
||||||
|
/// admonition | Requires Administrator
|
||||||
|
type: danger
|
||||||
|
///
|
||||||
|
|
||||||
|
Args:
|
||||||
|
code (str): Invite code to delete
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
Forbidden: Raised if the authenticated user is not an administrator
|
||||||
|
NotFound: Raised if the invite code does not exist
|
||||||
|
PyZiplineError: Raised if the API changes, causing a breaking change in this method
|
||||||
|
ValueError: Raised if the invite code is not provided
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Invite: An object containing the deleted invite
|
||||||
|
"""
|
||||||
|
result: Result = self._rest_adapter.delete(endpoint="auth/invite", params={'code': code})
|
||||||
|
if result.status_code == 200:
|
||||||
|
return Invite(**result.data)
|
||||||
|
if result.message == 'invite not found':
|
||||||
|
raise NotFound(result.message)
|
||||||
|
if result.message == 'no code':
|
||||||
|
raise ValueError('invite code not provided')
|
||||||
|
raise PyZiplineError(f"{result.status_code}: {result.message}\n{result.data}")
|
||||||
|
|
||||||
def get_exif(self, file_id: int) -> dict:
|
def get_exif(self, file_id: int) -> dict:
|
||||||
"""Get the EXIF data for a file
|
"""Get the EXIF data for a file
|
||||||
|
|
||||||
|
@ -241,7 +273,7 @@ class ZiplineApi:
|
||||||
Returns:
|
Returns:
|
||||||
Invite: List of invites
|
Invite: List of invites
|
||||||
"""
|
"""
|
||||||
result = self._rest_adapter.get(endpoint="user/invites")
|
result = self._rest_adapter.get(endpoint="auth/invite")
|
||||||
if result.status_code == 200:
|
if result.status_code == 200:
|
||||||
invites = []
|
invites = []
|
||||||
for invite in result.data:
|
for invite in result.data:
|
||||||
|
|
Loading…
Reference in a new issue