22
33from __future__ import annotations
44
5- from typing import Type , Union , cast
5+ from typing import Union
66from datetime import datetime
77from typing_extensions import Literal
88
99import httpx
1010
11- from .request import (
12- RequestResource ,
13- AsyncRequestResource ,
14- RequestResourceWithRawResponse ,
15- AsyncRequestResourceWithRawResponse ,
16- RequestResourceWithStreamingResponse ,
17- AsyncRequestResourceWithStreamingResponse ,
18- )
19- from .response import (
20- ResponseResource ,
21- AsyncResponseResource ,
22- ResponseResourceWithRawResponse ,
23- AsyncResponseResourceWithRawResponse ,
24- ResponseResourceWithStreamingResponse ,
25- AsyncResponseResourceWithStreamingResponse ,
26- )
2711from ...._types import NOT_GIVEN , Body , Query , Headers , NotGiven
2812from ...._utils import maybe_transform
2913from ...._compat import cached_property
3418 async_to_raw_response_wrapper ,
3519 async_to_streamed_response_wrapper ,
3620)
37- from ...._wrappers import ResultWrapper
3821from ....pagination import SyncV4PagePaginationArray , AsyncV4PagePaginationArray
3922from ...._base_client import (
4023 AsyncPaginator ,
4124 make_request_options ,
4225)
4326from ....types .ai_gateway import log_list_params
44- from ....types .ai_gateway .log_get_response import LogGetResponse
4527from ....types .ai_gateway .log_list_response import LogListResponse
4628
4729__all__ = ["LogsResource" , "AsyncLogsResource" ]
4830
4931
5032class LogsResource (SyncAPIResource ):
51- @cached_property
52- def request (self ) -> RequestResource :
53- return RequestResource (self ._client )
54-
55- @cached_property
56- def response (self ) -> ResponseResource :
57- return ResponseResource (self ._client )
58-
5933 @cached_property
6034 def with_raw_response (self ) -> LogsResourceWithRawResponse :
6135 return LogsResourceWithRawResponse (self )
@@ -129,61 +103,8 @@ def list(
129103 model = LogListResponse ,
130104 )
131105
132- def get (
133- self ,
134- log_id : str ,
135- * ,
136- account_id : str ,
137- id : str ,
138- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
139- # The extra values given here take precedence over values defined on the client or passed to this method.
140- extra_headers : Headers | None = None ,
141- extra_query : Query | None = None ,
142- extra_body : Body | None = None ,
143- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
144- ) -> LogGetResponse :
145- """
146- Get Gateway Log Detail
147-
148- Args:
149- id: gateway id
150-
151- extra_headers: Send extra headers
152-
153- extra_query: Add additional query parameters to the request
154-
155- extra_body: Add additional JSON properties to the request
156-
157- timeout: Override the client-level default timeout for this request, in seconds
158- """
159- if not account_id :
160- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
161- if not id :
162- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
163- if not log_id :
164- raise ValueError (f"Expected a non-empty value for `log_id` but received { log_id !r} " )
165- return self ._get (
166- f"/accounts/{ account_id } /ai-gateway/gateways/{ id } /logs/{ log_id } " ,
167- options = make_request_options (
168- extra_headers = extra_headers ,
169- extra_query = extra_query ,
170- extra_body = extra_body ,
171- timeout = timeout ,
172- post_parser = ResultWrapper [LogGetResponse ]._unwrapper ,
173- ),
174- cast_to = cast (Type [LogGetResponse ], ResultWrapper [LogGetResponse ]),
175- )
176-
177106
178107class AsyncLogsResource (AsyncAPIResource ):
179- @cached_property
180- def request (self ) -> AsyncRequestResource :
181- return AsyncRequestResource (self ._client )
182-
183- @cached_property
184- def response (self ) -> AsyncResponseResource :
185- return AsyncResponseResource (self ._client )
186-
187108 @cached_property
188109 def with_raw_response (self ) -> AsyncLogsResourceWithRawResponse :
189110 return AsyncLogsResourceWithRawResponse (self )
@@ -257,51 +178,6 @@ def list(
257178 model = LogListResponse ,
258179 )
259180
260- async def get (
261- self ,
262- log_id : str ,
263- * ,
264- account_id : str ,
265- id : str ,
266- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
267- # The extra values given here take precedence over values defined on the client or passed to this method.
268- extra_headers : Headers | None = None ,
269- extra_query : Query | None = None ,
270- extra_body : Body | None = None ,
271- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
272- ) -> LogGetResponse :
273- """
274- Get Gateway Log Detail
275-
276- Args:
277- id: gateway id
278-
279- extra_headers: Send extra headers
280-
281- extra_query: Add additional query parameters to the request
282-
283- extra_body: Add additional JSON properties to the request
284-
285- timeout: Override the client-level default timeout for this request, in seconds
286- """
287- if not account_id :
288- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
289- if not id :
290- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
291- if not log_id :
292- raise ValueError (f"Expected a non-empty value for `log_id` but received { log_id !r} " )
293- return await self ._get (
294- f"/accounts/{ account_id } /ai-gateway/gateways/{ id } /logs/{ log_id } " ,
295- options = make_request_options (
296- extra_headers = extra_headers ,
297- extra_query = extra_query ,
298- extra_body = extra_body ,
299- timeout = timeout ,
300- post_parser = ResultWrapper [LogGetResponse ]._unwrapper ,
301- ),
302- cast_to = cast (Type [LogGetResponse ], ResultWrapper [LogGetResponse ]),
303- )
304-
305181
306182class LogsResourceWithRawResponse :
307183 def __init__ (self , logs : LogsResource ) -> None :
@@ -310,17 +186,6 @@ def __init__(self, logs: LogsResource) -> None:
310186 self .list = to_raw_response_wrapper (
311187 logs .list ,
312188 )
313- self .get = to_raw_response_wrapper (
314- logs .get ,
315- )
316-
317- @cached_property
318- def request (self ) -> RequestResourceWithRawResponse :
319- return RequestResourceWithRawResponse (self ._logs .request )
320-
321- @cached_property
322- def response (self ) -> ResponseResourceWithRawResponse :
323- return ResponseResourceWithRawResponse (self ._logs .response )
324189
325190
326191class AsyncLogsResourceWithRawResponse :
@@ -330,17 +195,6 @@ def __init__(self, logs: AsyncLogsResource) -> None:
330195 self .list = async_to_raw_response_wrapper (
331196 logs .list ,
332197 )
333- self .get = async_to_raw_response_wrapper (
334- logs .get ,
335- )
336-
337- @cached_property
338- def request (self ) -> AsyncRequestResourceWithRawResponse :
339- return AsyncRequestResourceWithRawResponse (self ._logs .request )
340-
341- @cached_property
342- def response (self ) -> AsyncResponseResourceWithRawResponse :
343- return AsyncResponseResourceWithRawResponse (self ._logs .response )
344198
345199
346200class LogsResourceWithStreamingResponse :
@@ -350,17 +204,6 @@ def __init__(self, logs: LogsResource) -> None:
350204 self .list = to_streamed_response_wrapper (
351205 logs .list ,
352206 )
353- self .get = to_streamed_response_wrapper (
354- logs .get ,
355- )
356-
357- @cached_property
358- def request (self ) -> RequestResourceWithStreamingResponse :
359- return RequestResourceWithStreamingResponse (self ._logs .request )
360-
361- @cached_property
362- def response (self ) -> ResponseResourceWithStreamingResponse :
363- return ResponseResourceWithStreamingResponse (self ._logs .response )
364207
365208
366209class AsyncLogsResourceWithStreamingResponse :
@@ -370,14 +213,3 @@ def __init__(self, logs: AsyncLogsResource) -> None:
370213 self .list = async_to_streamed_response_wrapper (
371214 logs .list ,
372215 )
373- self .get = async_to_streamed_response_wrapper (
374- logs .get ,
375- )
376-
377- @cached_property
378- def request (self ) -> AsyncRequestResourceWithStreamingResponse :
379- return AsyncRequestResourceWithStreamingResponse (self ._logs .request )
380-
381- @cached_property
382- def response (self ) -> AsyncResponseResourceWithStreamingResponse :
383- return AsyncResponseResourceWithStreamingResponse (self ._logs .response )
0 commit comments