From f313a3b99294af80773802c9b8f47e0c0aae231e Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 22 Dec 2023 15:03:19 -0500 Subject: [PATCH] fix: fixed endpoint for get_invites --- pyzipline/zipline.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/pyzipline/zipline.py b/pyzipline/zipline.py index 97aa588..fc301a3 100644 --- a/pyzipline/zipline.py +++ b/pyzipline/zipline.py @@ -164,6 +164,38 @@ class ZiplineApi: raise ValueError('username not provided') 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: """Get the EXIF data for a file @@ -241,7 +273,7 @@ class ZiplineApi: Returns: 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: invites = [] for invite in result.data: