|
5 | 5 | __all__ = ['KeyMint', 'KeyMintApiError', '__version__'] |
6 | 6 |
|
7 | 7 | class KeyMint: |
8 | | - def __init__(self, access_token: str, base_url: str = "https://api.keymint.dev"): |
9 | | - if not access_token: |
10 | | - raise ValueError("Access token is required to initialize the SDK.") |
| 8 | + def __init__(self, api_key: str, base_url: str = "https://api.keymint.dev"): |
| 9 | + if not api_key: |
| 10 | + raise ValueError("API key is required to initialize the SDK.") |
11 | 11 |
|
12 | | - self.access_token = access_token |
| 12 | + self.api_key = api_key |
13 | 13 | self.base_url = base_url |
14 | 14 | self.headers = { |
15 | | - 'Authorization': f'Bearer {self.access_token}', |
| 15 | + 'Authorization': f'Bearer {self.api_key}', |
16 | 16 | 'Content-Type': 'application/json' |
17 | 17 | } |
18 | 18 |
|
@@ -79,6 +79,30 @@ def deactivate_key(self, params: DeactivateKeyParams) -> DeactivateKeyResponse: |
79 | 79 | """ |
80 | 80 | return self._handle_request('POST', '/key/deactivate', params) |
81 | 81 |
|
| 82 | + def floating_checkout(self, params: FloatingCheckoutParams) -> FloatingCheckoutResponse: |
| 83 | + """ |
| 84 | + Checks out a floating license seat. |
| 85 | + :param params: Parameters for checking out the license. |
| 86 | + :returns: The checkout response containing sessionId and sessionSecret. |
| 87 | + """ |
| 88 | + return self._handle_request('POST', '/key/checkout', params) |
| 89 | + |
| 90 | + def floating_heartbeat(self, params: FloatingHeartbeatParams) -> FloatingHeartbeatResponse: |
| 91 | + """ |
| 92 | + Sends a heartbeat to keep a floating license session alive. |
| 93 | + :param params: Parameters for the heartbeat (includes rotating signature). |
| 94 | + :returns: The heartbeat response with extended expiry and new nonce. |
| 95 | + """ |
| 96 | + return self._handle_request('POST', '/key/heartbeat', params) |
| 97 | + |
| 98 | + def floating_checkin(self, params: FloatingCheckinParams) -> FloatingCheckinResponse: |
| 99 | + """ |
| 100 | + Checks in a floating license session, releasing the seat. |
| 101 | + :param params: Parameters for checking in the license (includes rotating signature). |
| 102 | + :returns: The checkin confirmation. |
| 103 | + """ |
| 104 | + return self._handle_request('POST', '/key/checkin', params) |
| 105 | + |
82 | 106 | def get_key(self, params: GetKeyParams) -> GetKeyResponse: |
83 | 107 | """ |
84 | 108 | Retrieves detailed information about a specific license key. |
|
0 commit comments