-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhitelist.py
More file actions
93 lines (73 loc) · 2.65 KB
/
whitelist.py
File metadata and controls
93 lines (73 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Add to lumino/api_sdk/models.py
from enum import Enum
from typing import Optional
from pydantic import BaseModel, EmailStr
class WhitelistRequestCreate(BaseModel):
"""
Request model for creating a new whitelist request.
"""
name: str
email: EmailStr
phone_number: str
class WhitelistRequestResponse(BaseModel):
"""
Response model for whitelist request data.
"""
id: str
user_id: str
name: str
email: EmailStr
phone_number: str
is_whitelisted: bool
has_signed_nda: bool
created_at: str
updated_at: str
class WhitelistClient:
"""
Client for whitelist operations.
"""
def __init__(self, http_client):
self.http_client = http_client
async def request_to_be_whitelisted(self, request: WhitelistRequestCreate) -> WhitelistRequestResponse:
"""
Submit a new whitelist request.
Args:
request: The whitelist request data.
Returns:
The created whitelist request.
"""
response = await self.http_client.post("/whitelist", request.dict())
return WhitelistRequestResponse(**response)
async def get_whitelist_status(self) -> WhitelistRequestResponse:
"""
Get the current user's whitelist status.
Returns:
The whitelist status.
"""
response = await self.http_client.get("/whitelist")
return WhitelistRequestResponse(**response)
async def add_computing_providers_batch(self, addresses: List[str]) -> Dict[str, Any]:
"""
Add multiple computing providers to the whitelist in a batch.
Args:
addresses: List of computing provider addresses to whitelist
Returns:
Dictionary with operation results including transaction hash
"""
payload = {"addresses": addresses}
response = await self.http_client.post("/whitelist/computing-providers/batch", payload)
return response
async def remove_computing_providers_batch(self, addresses: List[str]) -> Dict[str, Any]:
"""
Remove multiple computing providers from the whitelist in a batch.
Args:
addresses: List of computing provider addresses to remove
Returns:
Dictionary with operation results including transaction hash
"""
payload = {"addresses": addresses}
response = await self.http_client.delete("/whitelist/computing-providers/batch", json=payload)
return response
@property
def whitelist(self) -> WhitelistClient:
return WhitelistClient(self.http_client)