|
| 1 | +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +import httpx |
| 6 | + |
| 7 | +from .. import _legacy_response |
| 8 | +from .._types import Body, Query, Headers, NotGiven, not_given |
| 9 | +from .._compat import cached_property |
| 10 | +from .._resource import SyncAPIResource, AsyncAPIResource |
| 11 | +from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper |
| 12 | +from .._base_client import make_request_options |
| 13 | +from ..types.ip_range_retrieve_response import IPRangeRetrieveResponse |
| 14 | + |
| 15 | +__all__ = ["IPRanges", "AsyncIPRanges"] |
| 16 | + |
| 17 | + |
| 18 | +class IPRanges(SyncAPIResource): |
| 19 | + @cached_property |
| 20 | + def with_raw_response(self) -> IPRangesWithRawResponse: |
| 21 | + """ |
| 22 | + This property can be used as a prefix for any HTTP method call to return |
| 23 | + the raw response object instead of the parsed content. |
| 24 | +
|
| 25 | + For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers |
| 26 | + """ |
| 27 | + return IPRangesWithRawResponse(self) |
| 28 | + |
| 29 | + @cached_property |
| 30 | + def with_streaming_response(self) -> IPRangesWithStreamingResponse: |
| 31 | + """ |
| 32 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 33 | +
|
| 34 | + For more information, see https://www.github.com/lithic-com/lithic-python#with_streaming_response |
| 35 | + """ |
| 36 | + return IPRangesWithStreamingResponse(self) |
| 37 | + |
| 38 | + def retrieve( |
| 39 | + self, |
| 40 | + *, |
| 41 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 42 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 43 | + extra_headers: Headers | None = None, |
| 44 | + extra_query: Query | None = None, |
| 45 | + extra_body: Body | None = None, |
| 46 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 47 | + ) -> IPRangeRetrieveResponse: |
| 48 | + """ |
| 49 | + Returns the IP addresses Lithic sends responder requests from (Auth Stream |
| 50 | + Access, 3DS decisioning, and tokenization decisioning), so you can allowlist |
| 51 | + them in your firewall. Each environment returns its own set of addresses. Lithic |
| 52 | + announces new addresses at least 30 days before sending traffic from them. Event |
| 53 | + webhooks are not sent from these addresses |
| 54 | + """ |
| 55 | + return self._get( |
| 56 | + "/v1/ip_ranges", |
| 57 | + options=make_request_options( |
| 58 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 59 | + ), |
| 60 | + cast_to=IPRangeRetrieveResponse, |
| 61 | + ) |
| 62 | + |
| 63 | + |
| 64 | +class AsyncIPRanges(AsyncAPIResource): |
| 65 | + @cached_property |
| 66 | + def with_raw_response(self) -> AsyncIPRangesWithRawResponse: |
| 67 | + """ |
| 68 | + This property can be used as a prefix for any HTTP method call to return |
| 69 | + the raw response object instead of the parsed content. |
| 70 | +
|
| 71 | + For more information, see https://www.github.com/lithic-com/lithic-python#accessing-raw-response-data-eg-headers |
| 72 | + """ |
| 73 | + return AsyncIPRangesWithRawResponse(self) |
| 74 | + |
| 75 | + @cached_property |
| 76 | + def with_streaming_response(self) -> AsyncIPRangesWithStreamingResponse: |
| 77 | + """ |
| 78 | + An alternative to `.with_raw_response` that doesn't eagerly read the response body. |
| 79 | +
|
| 80 | + For more information, see https://www.github.com/lithic-com/lithic-python#with_streaming_response |
| 81 | + """ |
| 82 | + return AsyncIPRangesWithStreamingResponse(self) |
| 83 | + |
| 84 | + async def retrieve( |
| 85 | + self, |
| 86 | + *, |
| 87 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 88 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 89 | + extra_headers: Headers | None = None, |
| 90 | + extra_query: Query | None = None, |
| 91 | + extra_body: Body | None = None, |
| 92 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 93 | + ) -> IPRangeRetrieveResponse: |
| 94 | + """ |
| 95 | + Returns the IP addresses Lithic sends responder requests from (Auth Stream |
| 96 | + Access, 3DS decisioning, and tokenization decisioning), so you can allowlist |
| 97 | + them in your firewall. Each environment returns its own set of addresses. Lithic |
| 98 | + announces new addresses at least 30 days before sending traffic from them. Event |
| 99 | + webhooks are not sent from these addresses |
| 100 | + """ |
| 101 | + return await self._get( |
| 102 | + "/v1/ip_ranges", |
| 103 | + options=make_request_options( |
| 104 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 105 | + ), |
| 106 | + cast_to=IPRangeRetrieveResponse, |
| 107 | + ) |
| 108 | + |
| 109 | + |
| 110 | +class IPRangesWithRawResponse: |
| 111 | + def __init__(self, ip_ranges: IPRanges) -> None: |
| 112 | + self._ip_ranges = ip_ranges |
| 113 | + |
| 114 | + self.retrieve = _legacy_response.to_raw_response_wrapper( |
| 115 | + ip_ranges.retrieve, |
| 116 | + ) |
| 117 | + |
| 118 | + |
| 119 | +class AsyncIPRangesWithRawResponse: |
| 120 | + def __init__(self, ip_ranges: AsyncIPRanges) -> None: |
| 121 | + self._ip_ranges = ip_ranges |
| 122 | + |
| 123 | + self.retrieve = _legacy_response.async_to_raw_response_wrapper( |
| 124 | + ip_ranges.retrieve, |
| 125 | + ) |
| 126 | + |
| 127 | + |
| 128 | +class IPRangesWithStreamingResponse: |
| 129 | + def __init__(self, ip_ranges: IPRanges) -> None: |
| 130 | + self._ip_ranges = ip_ranges |
| 131 | + |
| 132 | + self.retrieve = to_streamed_response_wrapper( |
| 133 | + ip_ranges.retrieve, |
| 134 | + ) |
| 135 | + |
| 136 | + |
| 137 | +class AsyncIPRangesWithStreamingResponse: |
| 138 | + def __init__(self, ip_ranges: AsyncIPRanges) -> None: |
| 139 | + self._ip_ranges = ip_ranges |
| 140 | + |
| 141 | + self.retrieve = async_to_streamed_response_wrapper( |
| 142 | + ip_ranges.retrieve, |
| 143 | + ) |
0 commit comments