|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
5 |
| -from typing import TYPE_CHECKING, Optional |
| 5 | +from typing import Optional |
6 | 6 |
|
7 | 7 | import httpx
|
8 | 8 |
|
|
15 | 15 | NotGiven,
|
16 | 16 | )
|
17 | 17 | from ..._utils import maybe_transform
|
| 18 | +from ..._compat import cached_property |
18 | 19 | from ..._resource import SyncAPIResource, AsyncAPIResource
|
19 | 20 | from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper
|
20 | 21 | from ...pagination import SyncPage, AsyncPage
|
|
29 | 30 | make_request_options,
|
30 | 31 | )
|
31 | 32 |
|
32 |
| -if TYPE_CHECKING: |
33 |
| - from ..._client import Orb, AsyncOrb |
34 |
| - |
35 | 33 | __all__ = ["Coupons", "AsyncCoupons"]
|
36 | 34 |
|
37 | 35 |
|
38 | 36 | class Coupons(SyncAPIResource):
|
39 |
| - subscriptions: Subscriptions |
40 |
| - with_raw_response: CouponsWithRawResponse |
| 37 | + @cached_property |
| 38 | + def subscriptions(self) -> Subscriptions: |
| 39 | + return Subscriptions(self._client) |
41 | 40 |
|
42 |
| - def __init__(self, client: Orb) -> None: |
43 |
| - super().__init__(client) |
44 |
| - self.subscriptions = Subscriptions(client) |
45 |
| - self.with_raw_response = CouponsWithRawResponse(self) |
| 41 | + @cached_property |
| 42 | + def with_raw_response(self) -> CouponsWithRawResponse: |
| 43 | + return CouponsWithRawResponse(self) |
46 | 44 |
|
47 | 45 | def create(
|
48 | 46 | self,
|
@@ -242,13 +240,13 @@ def fetch(
|
242 | 240 |
|
243 | 241 |
|
244 | 242 | class AsyncCoupons(AsyncAPIResource):
|
245 |
| - subscriptions: AsyncSubscriptions |
246 |
| - with_raw_response: AsyncCouponsWithRawResponse |
| 243 | + @cached_property |
| 244 | + def subscriptions(self) -> AsyncSubscriptions: |
| 245 | + return AsyncSubscriptions(self._client) |
247 | 246 |
|
248 |
| - def __init__(self, client: AsyncOrb) -> None: |
249 |
| - super().__init__(client) |
250 |
| - self.subscriptions = AsyncSubscriptions(client) |
251 |
| - self.with_raw_response = AsyncCouponsWithRawResponse(self) |
| 247 | + @cached_property |
| 248 | + def with_raw_response(self) -> AsyncCouponsWithRawResponse: |
| 249 | + return AsyncCouponsWithRawResponse(self) |
252 | 250 |
|
253 | 251 | async def create(
|
254 | 252 | self,
|
|
0 commit comments