Skip to content

Commit c148b86

Browse files
committed
feat: add get_preauth and revoke_preauth methods
1 parent 8567914 commit c148b86

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/stackcoin/client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,18 @@ async def create_preauth(
169169
self._raise_for_error(resp)
170170
return resp.json()
171171

172+
async def get_preauth(self, preauth_id: int) -> dict:
173+
"""Get a single preauthorization with remaining budget."""
174+
resp = await self._http.get(f"/api/preauth/{preauth_id}")
175+
self._raise_for_error(resp)
176+
return resp.json()
177+
178+
async def revoke_preauth(self, preauth_id: int) -> dict:
179+
"""Revoke an active preauthorization."""
180+
resp = await self._http.post(f"/api/preauth/{preauth_id}/revoke")
181+
self._raise_for_error(resp)
182+
return resp.json()
183+
172184
async def get_preauths(self, *, user_id: int | None = None) -> list[dict]:
173185
"""List preauths for this bot, optionally filtered by user_id."""
174186
params: dict[str, Any] = {}

0 commit comments

Comments
 (0)