|
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 |
|
|
14 | 14 | NotGiven,
|
15 | 15 | )
|
16 | 16 | from ...._utils import maybe_transform
|
| 17 | +from ...._compat import cached_property |
17 | 18 | from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse
|
18 | 19 | from ...._resource import SyncAPIResource, AsyncAPIResource
|
19 | 20 | from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper
|
|
33 | 34 | make_request_options,
|
34 | 35 | )
|
35 | 36 |
|
36 |
| -if TYPE_CHECKING: |
37 |
| - from ...._client import Finch, AsyncFinch |
38 |
| - |
39 | 37 | __all__ = ["Benefits", "AsyncBenefits"]
|
40 | 38 |
|
41 | 39 |
|
42 | 40 | class Benefits(SyncAPIResource):
|
43 |
| - individuals: Individuals |
44 |
| - with_raw_response: BenefitsWithRawResponse |
| 41 | + @cached_property |
| 42 | + def individuals(self) -> Individuals: |
| 43 | + return Individuals(self._client) |
45 | 44 |
|
46 |
| - def __init__(self, client: Finch) -> None: |
47 |
| - super().__init__(client) |
48 |
| - self.individuals = Individuals(client) |
49 |
| - self.with_raw_response = BenefitsWithRawResponse(self) |
| 45 | + @cached_property |
| 46 | + def with_raw_response(self) -> BenefitsWithRawResponse: |
| 47 | + return BenefitsWithRawResponse(self) |
50 | 48 |
|
51 | 49 | def create(
|
52 | 50 | self,
|
@@ -215,13 +213,13 @@ def list_supported_benefits(
|
215 | 213 |
|
216 | 214 |
|
217 | 215 | class AsyncBenefits(AsyncAPIResource):
|
218 |
| - individuals: AsyncIndividuals |
219 |
| - with_raw_response: AsyncBenefitsWithRawResponse |
| 216 | + @cached_property |
| 217 | + def individuals(self) -> AsyncIndividuals: |
| 218 | + return AsyncIndividuals(self._client) |
220 | 219 |
|
221 |
| - def __init__(self, client: AsyncFinch) -> None: |
222 |
| - super().__init__(client) |
223 |
| - self.individuals = AsyncIndividuals(client) |
224 |
| - self.with_raw_response = AsyncBenefitsWithRawResponse(self) |
| 220 | + @cached_property |
| 221 | + def with_raw_response(self) -> AsyncBenefitsWithRawResponse: |
| 222 | + return AsyncBenefitsWithRawResponse(self) |
225 | 223 |
|
226 | 224 | async def create(
|
227 | 225 | self,
|
|
0 commit comments