|
66 | 66 | RETRY_MULTIPLIER = 2 |
67 | 67 |
|
68 | 68 |
|
69 | | -class _BaseWorkOS: |
| 69 | +class _BaseWorkOSClient: |
70 | 70 | """Shared WorkOS client implementation.""" |
71 | 71 |
|
72 | 72 | def __init__( |
@@ -140,7 +140,7 @@ def _calculate_retry_delay( |
140 | 140 | attempt: int, retry_after: Optional[str] = None |
141 | 141 | ) -> float: |
142 | 142 | """Calculate retry delay with exponential backoff and jitter.""" |
143 | | - parsed_retry_after = _BaseWorkOS._parse_retry_after(retry_after) |
| 143 | + parsed_retry_after = _BaseWorkOSClient._parse_retry_after(retry_after) |
144 | 144 | if parsed_retry_after is not None: |
145 | 145 | return parsed_retry_after |
146 | 146 | delay = min(INITIAL_RETRY_DELAY * (RETRY_MULTIPLIER**attempt), MAX_RETRY_DELAY) |
@@ -253,7 +253,7 @@ def _raise_error(response: httpx.Response) -> None: |
253 | 253 | error_class = STATUS_CODE_TO_ERROR.get(response.status_code) |
254 | 254 | if error_class: |
255 | 255 | if error_class is RateLimitExceededError: |
256 | | - retry_after = _BaseWorkOS._parse_retry_after( |
| 256 | + retry_after = _BaseWorkOSClient._parse_retry_after( |
257 | 257 | response.headers.get("Retry-After") |
258 | 258 | ) |
259 | 259 | raise RateLimitExceededError( |
@@ -320,7 +320,7 @@ def _raise_error(response: httpx.Response) -> None: |
320 | 320 | ) |
321 | 321 |
|
322 | 322 |
|
323 | | -class WorkOS(_BaseWorkOS): |
| 323 | +class WorkOSClient(_BaseWorkOSClient): |
324 | 324 | """Synchronous WorkOS API client.""" |
325 | 325 |
|
326 | 326 | def __init__( |
@@ -362,7 +362,7 @@ def close(self) -> None: |
362 | 362 | """Close the underlying HTTP client and release resources.""" |
363 | 363 | self._client.close() |
364 | 364 |
|
365 | | - def __enter__(self) -> "WorkOS": |
| 365 | + def __enter__(self) -> "WorkOSClient": |
366 | 366 | return self |
367 | 367 |
|
368 | 368 | def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: |
@@ -579,7 +579,7 @@ def _fetch(*, after: Optional[str] = None) -> SyncPage[D]: |
579 | 579 | return SyncPage(data=items, list_metadata=list_metadata, _fetch_page=_fetch) |
580 | 580 |
|
581 | 581 |
|
582 | | -class AsyncWorkOS(_BaseWorkOS): |
| 582 | +class AsyncWorkOSClient(_BaseWorkOSClient): |
583 | 583 | """Asynchronous WorkOS API client.""" |
584 | 584 |
|
585 | 585 | def __init__( |
@@ -621,7 +621,7 @@ async def close(self) -> None: |
621 | 621 | """Close the underlying HTTP client and release resources.""" |
622 | 622 | await self._client.aclose() |
623 | 623 |
|
624 | | - async def __aenter__(self) -> "AsyncWorkOS": |
| 624 | + async def __aenter__(self) -> "AsyncWorkOSClient": |
625 | 625 | return self |
626 | 626 |
|
627 | 627 | async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None: |
|
0 commit comments