Sync types and clients with backend for social auth and agent assignments
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3c75c2296e
commit
1576447b4b
4 files changed
+46
-9
No files matched your search
@@ -42,7 +42,10 @@ from .types import (
|
||||
AuthRegisterResponse,
|
||||
AuthLoginResponse,
|
||||
GetMeResponse,
|
||||
IssueApiTokenResponse,
|
||||
RotateApiTokenResponse,
|
||||
IssueTokenResponse,
|
||||
RotateTokenResponse,
|
||||
HealthResponse,
|
||||
)
|
||||
|
||||
@@ -91,6 +94,9 @@ __all__ = [
|
||||
"AuthRegisterResponse",
|
||||
"AuthLoginResponse",
|
||||
"GetMeResponse",
|
||||
"IssueApiTokenResponse",
|
||||
"RotateApiTokenResponse",
|
||||
"IssueTokenResponse",
|
||||
"RotateTokenResponse",
|
||||
"HealthResponse",
|
||||
]
|
||||
+12
-3
@@ -23,7 +23,8 @@ from .types import (
|
||||
GetMeResponse,
|
||||
GetOperationResponse,
|
||||
HealthResponse,
|
||||
IssueTokenResponse,
|
||||
IssueApiTokenResponse,
|
||||
RotateApiTokenResponse,
|
||||
JWKSResponse,
|
||||
ListAgentsResponse,
|
||||
ListEpochsResponse,
|
||||
@@ -199,13 +200,21 @@ class AsyncElydoraClient:
|
||||
"""Get the current user's profile."""
|
||||
return await self._request("GET", "/v1/auth/me")
|
||||
|
||||
async def issue_token(self, ttl_seconds: Optional[int] = None) -> IssueTokenResponse:
|
||||
async def issue_api_token(self, ttl_seconds: Optional[int] = None) -> IssueApiTokenResponse:
|
||||
"""Issue an API token with an optional TTL."""
|
||||
body: Dict[str, Any] = {}
|
||||
if ttl_seconds is not None:
|
||||
body["ttl_seconds"] = ttl_seconds
|
||||
return await self._request("POST", "/v1/auth/token", json_body=body)
|
||||
|
||||
async def issue_token(self, ttl_seconds: Optional[int] = None) -> IssueApiTokenResponse:
|
||||
"""Deprecated: Use issue_api_token() instead."""
|
||||
return await self.issue_api_token(ttl_seconds=ttl_seconds)
|
||||
|
||||
async def rotate_api_token(self) -> RotateApiTokenResponse:
|
||||
"""Rotate the current API token and keep the old token in 24h grace."""
|
||||
return await self._request("POST", "/v1/auth/rotate", json_body={})
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Agent management
|
||||
# -----------------------------------------------------------------
|
||||
@@ -300,7 +309,7 @@ class AsyncElydoraClient:
|
||||
|
||||
async def verify_operation(self, operation_id: str) -> VerifyOperationResponse:
|
||||
"""Verify an operation's integrity."""
|
||||
return await self._request("POST", f"/v1/operations/{operation_id}/verify")
|
||||
return await self._request("POST", f"/v1/operations/{operation_id}/verify", json_body={})
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Audit
|
||||
|
||||
+12
-3
@@ -22,7 +22,8 @@ from .types import (
|
||||
GetMeResponse,
|
||||
GetOperationResponse,
|
||||
HealthResponse,
|
||||
IssueTokenResponse,
|
||||
IssueApiTokenResponse,
|
||||
RotateApiTokenResponse,
|
||||
JWKSResponse,
|
||||
ListAgentsResponse,
|
||||
ListEpochsResponse,
|
||||
@@ -190,13 +191,21 @@ class ElydoraClient:
|
||||
"""Get the current user's profile."""
|
||||
return self._request("GET", "/v1/auth/me")
|
||||
|
||||
def issue_token(self, ttl_seconds: Optional[int] = None) -> IssueTokenResponse:
|
||||
def issue_api_token(self, ttl_seconds: Optional[int] = None) -> IssueApiTokenResponse:
|
||||
"""Issue an API token with an optional TTL."""
|
||||
body: Dict[str, Any] = {}
|
||||
if ttl_seconds is not None:
|
||||
body["ttl_seconds"] = ttl_seconds
|
||||
return self._request("POST", "/v1/auth/token", json_body=body)
|
||||
|
||||
def issue_token(self, ttl_seconds: Optional[int] = None) -> IssueApiTokenResponse:
|
||||
"""Deprecated: Use issue_api_token() instead."""
|
||||
return self.issue_api_token(ttl_seconds=ttl_seconds)
|
||||
|
||||
def rotate_api_token(self) -> RotateApiTokenResponse:
|
||||
"""Rotate the current API token and keep the old token in 24h grace."""
|
||||
return self._request("POST", "/v1/auth/rotate", json_body={})
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Agent management
|
||||
# -----------------------------------------------------------------
|
||||
@@ -293,7 +302,7 @@ class ElydoraClient:
|
||||
|
||||
def verify_operation(self, operation_id: str) -> VerifyOperationResponse:
|
||||
"""Verify an operation's integrity."""
|
||||
return self._request("POST", f"/v1/operations/{operation_id}/verify")
|
||||
return self._request("POST", f"/v1/operations/{operation_id}/verify", json_body={})
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Audit
|
||||
|
||||
+16
-3
@@ -79,8 +79,8 @@ class Operation(TypedDict):
|
||||
issued_at: int
|
||||
ttl_ms: int
|
||||
nonce: str
|
||||
subject: Dict[str, Any]
|
||||
action: Dict[str, Any]
|
||||
subject: str
|
||||
action: str
|
||||
payload_hash: str
|
||||
prev_chain_hash: str
|
||||
chain_hash: str
|
||||
@@ -305,9 +305,22 @@ class GetMeResponse(TypedDict):
|
||||
user: User
|
||||
|
||||
|
||||
class IssueTokenResponse(TypedDict):
|
||||
class IssueApiTokenResponse(TypedDict):
|
||||
token: str
|
||||
expires_at: Optional[int]
|
||||
token_id: str
|
||||
|
||||
|
||||
class RotateApiTokenResponse(TypedDict):
|
||||
token: str
|
||||
expires_at: Optional[int]
|
||||
token_id: str
|
||||
previous_token_grace_until: int
|
||||
|
||||
|
||||
# Backward compatibility aliases (deprecated)
|
||||
IssueTokenResponse = IssueApiTokenResponse
|
||||
RotateTokenResponse = RotateApiTokenResponse
|
||||
|
||||
|
||||
class HealthResponse(TypedDict):
|
||||
|
||||
Reference in new issue
Block a user