Skip to content

Commit 97a4a6e

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#1096)
1 parent 1bb1668 commit 97a4a6e

File tree

11 files changed

+991
-5
lines changed

11 files changed

+991
-5
lines changed

.stats.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 1353
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e79cc9a74089de5aec2c720b1e3023ea27869883f43c8b0167198f5967128636.yml
1+
configured_endpoints: 1356
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-62c3b16f6d836d9cc7bca2f54e83f7ed99fbe325b4b6cfec72a71fc7ceee58a6.yml

api.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -7886,12 +7886,37 @@ Methods:
78867886
Types:
78877887

78887888
```python
7889-
from cloudflare.types.ai_gateway import LogListResponse
7889+
from cloudflare.types.ai_gateway import LogListResponse, LogGetResponse
78907890
```
78917891

78927892
Methods:
78937893

78947894
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs">client.ai_gateway.logs.<a href="./src/cloudflare/resources/ai_gateway/logs/logs.py">list</a>(id, \*, account_id, \*\*<a href="src/cloudflare/types/ai_gateway/log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/ai_gateway/log_list_response.py">SyncV4PagePaginationArray[LogListResponse]</a></code>
7895+
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs/{logId}">client.ai_gateway.logs.<a href="./src/cloudflare/resources/ai_gateway/logs/logs.py">get</a>(log_id, \*, account_id, id) -> <a href="./src/cloudflare/types/ai_gateway/log_get_response.py">LogGetResponse</a></code>
7896+
7897+
### Request
7898+
7899+
Types:
7900+
7901+
```python
7902+
from cloudflare.types.ai_gateway.logs import RequestGetResponse
7903+
```
7904+
7905+
Methods:
7906+
7907+
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs/{logId}/request">client.ai_gateway.logs.request.<a href="./src/cloudflare/resources/ai_gateway/logs/request.py">get</a>(log_id, \*, account_id, id) -> <a href="./src/cloudflare/types/ai_gateway/logs/request_get_response.py">object</a></code>
7908+
7909+
### Response
7910+
7911+
Types:
7912+
7913+
```python
7914+
from cloudflare.types.ai_gateway.logs import ResponseGetResponse
7915+
```
7916+
7917+
Methods:
7918+
7919+
- <code title="get /accounts/{account_id}/ai-gateway/gateways/{id}/logs/{logId}/response">client.ai_gateway.logs.response.<a href="./src/cloudflare/resources/ai_gateway/logs/response.py">get</a>(log_id, \*, account_id, id) -> <a href="./src/cloudflare/types/ai_gateway/logs/response_get_response.py">object</a></code>
78957920

78967921
# IAM
78977922

src/cloudflare/resources/ai_gateway/logs/__init__.py

+28
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,36 @@
88
LogsResourceWithStreamingResponse,
99
AsyncLogsResourceWithStreamingResponse,
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+
)
1127

1228
__all__ = [
29+
"RequestResource",
30+
"AsyncRequestResource",
31+
"RequestResourceWithRawResponse",
32+
"AsyncRequestResourceWithRawResponse",
33+
"RequestResourceWithStreamingResponse",
34+
"AsyncRequestResourceWithStreamingResponse",
35+
"ResponseResource",
36+
"AsyncResponseResource",
37+
"ResponseResourceWithRawResponse",
38+
"AsyncResponseResourceWithRawResponse",
39+
"ResponseResourceWithStreamingResponse",
40+
"AsyncResponseResourceWithStreamingResponse",
1341
"LogsResource",
1442
"AsyncLogsResource",
1543
"LogsResourceWithRawResponse",

src/cloudflare/resources/ai_gateway/logs/logs.py

+169-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,28 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Type, Union, cast
66
from datetime import datetime
77
from typing_extensions import Literal
88

99
import 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+
)
1127
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1228
from ...._utils import maybe_transform
1329
from ...._compat import cached_property
@@ -18,18 +34,28 @@
1834
async_to_raw_response_wrapper,
1935
async_to_streamed_response_wrapper,
2036
)
37+
from ...._wrappers import ResultWrapper
2138
from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
2239
from ...._base_client import (
2340
AsyncPaginator,
2441
make_request_options,
2542
)
2643
from ....types.ai_gateway import log_list_params
44+
from ....types.ai_gateway.log_get_response import LogGetResponse
2745
from ....types.ai_gateway.log_list_response import LogListResponse
2846

2947
__all__ = ["LogsResource", "AsyncLogsResource"]
3048

3149

3250
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+
3359
@cached_property
3460
def with_raw_response(self) -> LogsResourceWithRawResponse:
3561
return LogsResourceWithRawResponse(self)
@@ -103,8 +129,61 @@ def list(
103129
model=LogListResponse,
104130
)
105131

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+
106177

107178
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+
108187
@cached_property
109188
def with_raw_response(self) -> AsyncLogsResourceWithRawResponse:
110189
return AsyncLogsResourceWithRawResponse(self)
@@ -178,6 +257,51 @@ def list(
178257
model=LogListResponse,
179258
)
180259

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+
181305

182306
class LogsResourceWithRawResponse:
183307
def __init__(self, logs: LogsResource) -> None:
@@ -186,6 +310,17 @@ def __init__(self, logs: LogsResource) -> None:
186310
self.list = to_raw_response_wrapper(
187311
logs.list,
188312
)
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)
189324

190325

191326
class AsyncLogsResourceWithRawResponse:
@@ -195,6 +330,17 @@ def __init__(self, logs: AsyncLogsResource) -> None:
195330
self.list = async_to_raw_response_wrapper(
196331
logs.list,
197332
)
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)
198344

199345

200346
class LogsResourceWithStreamingResponse:
@@ -204,6 +350,17 @@ def __init__(self, logs: LogsResource) -> None:
204350
self.list = to_streamed_response_wrapper(
205351
logs.list,
206352
)
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)
207364

208365

209366
class AsyncLogsResourceWithStreamingResponse:
@@ -213,3 +370,14 @@ def __init__(self, logs: AsyncLogsResource) -> None:
213370
self.list = async_to_streamed_response_wrapper(
214371
logs.list,
215372
)
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

Comments
 (0)