2
2
3
3
from __future__ import annotations
4
4
5
- from typing import Type , Union , cast
5
+ from typing import Union
6
6
from datetime import datetime
7
7
from typing_extensions import Literal
8
8
9
9
import httpx
10
10
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
- )
27
11
from ...._types import NOT_GIVEN , Body , Query , Headers , NotGiven
28
12
from ...._utils import maybe_transform
29
13
from ...._compat import cached_property
34
18
async_to_raw_response_wrapper ,
35
19
async_to_streamed_response_wrapper ,
36
20
)
37
- from ...._wrappers import ResultWrapper
38
21
from ....pagination import SyncV4PagePaginationArray , AsyncV4PagePaginationArray
39
22
from ...._base_client import (
40
23
AsyncPaginator ,
41
24
make_request_options ,
42
25
)
43
26
from ....types .ai_gateway import log_list_params
44
- from ....types .ai_gateway .log_get_response import LogGetResponse
45
27
from ....types .ai_gateway .log_list_response import LogListResponse
46
28
47
29
__all__ = ["LogsResource" , "AsyncLogsResource" ]
48
30
49
31
50
32
class 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
-
59
33
@cached_property
60
34
def with_raw_response (self ) -> LogsResourceWithRawResponse :
61
35
return LogsResourceWithRawResponse (self )
@@ -129,61 +103,8 @@ def list(
129
103
model = LogListResponse ,
130
104
)
131
105
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
-
177
106
178
107
class 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
-
187
108
@cached_property
188
109
def with_raw_response (self ) -> AsyncLogsResourceWithRawResponse :
189
110
return AsyncLogsResourceWithRawResponse (self )
@@ -257,51 +178,6 @@ def list(
257
178
model = LogListResponse ,
258
179
)
259
180
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
-
305
181
306
182
class LogsResourceWithRawResponse :
307
183
def __init__ (self , logs : LogsResource ) -> None :
@@ -310,17 +186,6 @@ def __init__(self, logs: LogsResource) -> None:
310
186
self .list = to_raw_response_wrapper (
311
187
logs .list ,
312
188
)
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 )
324
189
325
190
326
191
class AsyncLogsResourceWithRawResponse :
@@ -330,17 +195,6 @@ def __init__(self, logs: AsyncLogsResource) -> None:
330
195
self .list = async_to_raw_response_wrapper (
331
196
logs .list ,
332
197
)
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 )
344
198
345
199
346
200
class LogsResourceWithStreamingResponse :
@@ -350,17 +204,6 @@ def __init__(self, logs: LogsResource) -> None:
350
204
self .list = to_streamed_response_wrapper (
351
205
logs .list ,
352
206
)
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 )
364
207
365
208
366
209
class AsyncLogsResourceWithStreamingResponse :
@@ -370,14 +213,3 @@ def __init__(self, logs: AsyncLogsResource) -> None:
370
213
self .list = async_to_streamed_response_wrapper (
371
214
logs .list ,
372
215
)
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