|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +from .usage import ( |
| 6 | + UsageResource, |
| 7 | + AsyncUsageResource, |
| 8 | + UsageResourceWithRawResponse, |
| 9 | + AsyncUsageResourceWithRawResponse, |
| 10 | + UsageResourceWithStreamingResponse, |
| 11 | + AsyncUsageResourceWithStreamingResponse, |
| 12 | +) |
| 13 | +from ...._compat import cached_property |
| 14 | +from ...._resource import SyncAPIResource, AsyncAPIResource |
| 15 | + |
| 16 | +__all__ = ["BillingResource", "AsyncBillingResource"] |
| 17 | + |
| 18 | + |
| 19 | +class BillingResource(SyncAPIResource): |
| 20 | + @cached_property |
| 21 | + def usage(self) -> UsageResource: |
| 22 | + return UsageResource(self._client) |
| 23 | + |
| 24 | + @cached_property |
| 25 | + def with_raw_response(self) -> BillingResourceWithRawResponse: |
| 26 | + """ |
| 27 | + This property can be used as a prefix for any HTTP method call to return |
| 28 | + the raw response object instead of the parsed content. |
| 29 | +
|
| 30 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers |
| 31 | + """ |
| 32 | + return BillingResourceWithRawResponse(self) |
| 33 | + |
| 34 | + @cached_property |
| 35 | + def with_streaming_response(self) -> BillingResourceWithStreamingResponse: |
| 36 | + """ |
| 37 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 38 | +
|
| 39 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response |
| 40 | + """ |
| 41 | + return BillingResourceWithStreamingResponse(self) |
| 42 | + |
| 43 | + |
| 44 | +class AsyncBillingResource(AsyncAPIResource): |
| 45 | + @cached_property |
| 46 | + def usage(self) -> AsyncUsageResource: |
| 47 | + return AsyncUsageResource(self._client) |
| 48 | + |
| 49 | + @cached_property |
| 50 | + def with_raw_response(self) -> AsyncBillingResourceWithRawResponse: |
| 51 | + """ |
| 52 | + This property can be used as a prefix for any HTTP method call to return |
| 53 | + the raw response object instead of the parsed content. |
| 54 | +
|
| 55 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers |
| 56 | + """ |
| 57 | + return AsyncBillingResourceWithRawResponse(self) |
| 58 | + |
| 59 | + @cached_property |
| 60 | + def with_streaming_response(self) -> AsyncBillingResourceWithStreamingResponse: |
| 61 | + """ |
| 62 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 63 | +
|
| 64 | + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response |
| 65 | + """ |
| 66 | + return AsyncBillingResourceWithStreamingResponse(self) |
| 67 | + |
| 68 | + |
| 69 | +class BillingResourceWithRawResponse: |
| 70 | + def __init__(self, billing: BillingResource) -> None: |
| 71 | + self._billing = billing |
| 72 | + |
| 73 | + @cached_property |
| 74 | + def usage(self) -> UsageResourceWithRawResponse: |
| 75 | + return UsageResourceWithRawResponse(self._billing.usage) |
| 76 | + |
| 77 | + |
| 78 | +class AsyncBillingResourceWithRawResponse: |
| 79 | + def __init__(self, billing: AsyncBillingResource) -> None: |
| 80 | + self._billing = billing |
| 81 | + |
| 82 | + @cached_property |
| 83 | + def usage(self) -> AsyncUsageResourceWithRawResponse: |
| 84 | + return AsyncUsageResourceWithRawResponse(self._billing.usage) |
| 85 | + |
| 86 | + |
| 87 | +class BillingResourceWithStreamingResponse: |
| 88 | + def __init__(self, billing: BillingResource) -> None: |
| 89 | + self._billing = billing |
| 90 | + |
| 91 | + @cached_property |
| 92 | + def usage(self) -> UsageResourceWithStreamingResponse: |
| 93 | + return UsageResourceWithStreamingResponse(self._billing.usage) |
| 94 | + |
| 95 | + |
| 96 | +class AsyncBillingResourceWithStreamingResponse: |
| 97 | + def __init__(self, billing: AsyncBillingResource) -> None: |
| 98 | + self._billing = billing |
| 99 | + |
| 100 | + @cached_property |
| 101 | + def usage(self) -> AsyncUsageResourceWithStreamingResponse: |
| 102 | + return AsyncUsageResourceWithStreamingResponse(self._billing.usage) |
0 commit comments