|
9 | 9 | ) |
10 | 10 | from macrocosmos.resources.gravity import AsyncGravity, SyncGravity |
11 | 11 | from macrocosmos.resources.web_search import AsyncWebSearch, SyncWebSearch |
| 12 | +from macrocosmos.resources.billing import AsyncBilling, SyncBilling |
12 | 13 | from macrocosmos.resources._client import BaseClient |
13 | 14 |
|
14 | 15 |
|
@@ -181,3 +182,86 @@ def __init__( |
181 | 182 | ) |
182 | 183 |
|
183 | 184 | self.gravity = SyncGravity(self) |
| 185 | + |
| 186 | + |
| 187 | +class AsyncBillingClient(BaseClient): |
| 188 | + """ |
| 189 | + Asynchronous client for the Billing API. |
| 190 | + """ |
| 191 | + |
| 192 | + def __init__( |
| 193 | + self, |
| 194 | + api_key: Optional[str] = None, |
| 195 | + base_url: Optional[str] = None, |
| 196 | + timeout: Optional[int] = None, |
| 197 | + max_retries: int = 0, |
| 198 | + compress: bool = True, |
| 199 | + secure: Optional[bool] = None, |
| 200 | + app_name: Optional[str] = None, |
| 201 | + ): |
| 202 | + """ |
| 203 | + Initialize the asynchronous Billing client. |
| 204 | +
|
| 205 | + Args: |
| 206 | + api_key: The API key. |
| 207 | + base_url: The base URL for the API. |
| 208 | + timeout: Time to wait for a response in seconds. (default: None) |
| 209 | + max_retries: The maximum number of retries. (default: 0) |
| 210 | + compress: Whether to compress the request using gzip (default: True). |
| 211 | + secure: Whether to use HTTPS (default: True). |
| 212 | + app_name: The name of the application using the client. |
| 213 | + """ |
| 214 | + if not api_key: |
| 215 | + api_key = os.environ.get("BILLING_API_KEY") |
| 216 | + |
| 217 | + super().__init__( |
| 218 | + api_key=api_key, |
| 219 | + base_url=base_url, |
| 220 | + timeout=timeout, |
| 221 | + max_retries=max_retries, |
| 222 | + secure=secure, |
| 223 | + compress=compress, |
| 224 | + app_name=app_name, |
| 225 | + ) |
| 226 | + |
| 227 | + self.billing = AsyncBilling(self) |
| 228 | + |
| 229 | + |
| 230 | +class BillingClient(BaseClient): |
| 231 | + """ |
| 232 | + Synchronous client for the Billing API. |
| 233 | + """ |
| 234 | + |
| 235 | + def __init__( |
| 236 | + self, |
| 237 | + api_key: Optional[str] = None, |
| 238 | + base_url: Optional[str] = None, |
| 239 | + timeout: Optional[int] = None, |
| 240 | + max_retries: int = 0, |
| 241 | + secure: Optional[bool] = None, |
| 242 | + app_name: Optional[str] = None, |
| 243 | + ): |
| 244 | + """ |
| 245 | + Initialize the synchronous Billing client. |
| 246 | +
|
| 247 | + Args: |
| 248 | + api_key: The API key. |
| 249 | + base_url: The base URL for the API. |
| 250 | + timeout: Time to wait for a response in seconds. (default: None) |
| 251 | + max_retries: The maximum number of retries. (default: 0) |
| 252 | + secure: Whether to use HTTPS (default: True). |
| 253 | + app_name: The name of the application using the client. |
| 254 | + """ |
| 255 | + if not api_key: |
| 256 | + api_key = os.environ.get("BILLING_API_KEY") |
| 257 | + |
| 258 | + super().__init__( |
| 259 | + api_key=api_key, |
| 260 | + base_url=base_url, |
| 261 | + timeout=timeout, |
| 262 | + max_retries=max_retries, |
| 263 | + secure=secure, |
| 264 | + app_name=app_name, |
| 265 | + ) |
| 266 | + |
| 267 | + self.billing = SyncBilling(self) |
0 commit comments