mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-17 07:10:37 +00:00
feat(api): OpenAPI spec update via Stainless API (#1095)
This commit is contained in:
parent
bbc5c47f99
commit
1bb16681ac
11 changed files with 5 additions and 991 deletions
|
|
@ -1,2 +1,2 @@
|
|||
configured_endpoints: 1356
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-62c3b16f6d836d9cc7bca2f54e83f7ed99fbe325b4b6cfec72a71fc7ceee58a6.yml
|
||||
configured_endpoints: 1353
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e79cc9a74089de5aec2c720b1e3023ea27869883f43c8b0167198f5967128636.yml
|
||||
|
|
|
|||
27
api.md
27
api.md
|
|
@ -7886,37 +7886,12 @@ Methods:
|
|||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.ai_gateway import LogListResponse, LogGetResponse
|
||||
from cloudflare.types.ai_gateway import LogListResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <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>
|
||||
- <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>
|
||||
|
||||
### Request
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.ai_gateway.logs import RequestGetResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <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>
|
||||
|
||||
### Response
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from cloudflare.types.ai_gateway.logs import ResponseGetResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <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>
|
||||
|
||||
# IAM
|
||||
|
||||
|
|
|
|||
|
|
@ -8,36 +8,8 @@ from .logs import (
|
|||
LogsResourceWithStreamingResponse,
|
||||
AsyncLogsResourceWithStreamingResponse,
|
||||
)
|
||||
from .request import (
|
||||
RequestResource,
|
||||
AsyncRequestResource,
|
||||
RequestResourceWithRawResponse,
|
||||
AsyncRequestResourceWithRawResponse,
|
||||
RequestResourceWithStreamingResponse,
|
||||
AsyncRequestResourceWithStreamingResponse,
|
||||
)
|
||||
from .response import (
|
||||
ResponseResource,
|
||||
AsyncResponseResource,
|
||||
ResponseResourceWithRawResponse,
|
||||
AsyncResponseResourceWithRawResponse,
|
||||
ResponseResourceWithStreamingResponse,
|
||||
AsyncResponseResourceWithStreamingResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"RequestResource",
|
||||
"AsyncRequestResource",
|
||||
"RequestResourceWithRawResponse",
|
||||
"AsyncRequestResourceWithRawResponse",
|
||||
"RequestResourceWithStreamingResponse",
|
||||
"AsyncRequestResourceWithStreamingResponse",
|
||||
"ResponseResource",
|
||||
"AsyncResponseResource",
|
||||
"ResponseResourceWithRawResponse",
|
||||
"AsyncResponseResourceWithRawResponse",
|
||||
"ResponseResourceWithStreamingResponse",
|
||||
"AsyncResponseResourceWithStreamingResponse",
|
||||
"LogsResource",
|
||||
"AsyncLogsResource",
|
||||
"LogsResourceWithRawResponse",
|
||||
|
|
|
|||
|
|
@ -2,28 +2,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type, Union, cast
|
||||
from typing import Union
|
||||
from datetime import datetime
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from .request import (
|
||||
RequestResource,
|
||||
AsyncRequestResource,
|
||||
RequestResourceWithRawResponse,
|
||||
AsyncRequestResourceWithRawResponse,
|
||||
RequestResourceWithStreamingResponse,
|
||||
AsyncRequestResourceWithStreamingResponse,
|
||||
)
|
||||
from .response import (
|
||||
ResponseResource,
|
||||
AsyncResponseResource,
|
||||
ResponseResourceWithRawResponse,
|
||||
AsyncResponseResourceWithRawResponse,
|
||||
ResponseResourceWithStreamingResponse,
|
||||
AsyncResponseResourceWithStreamingResponse,
|
||||
)
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._utils import maybe_transform
|
||||
from ...._compat import cached_property
|
||||
|
|
@ -34,28 +18,18 @@ from ...._response import (
|
|||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._wrappers import ResultWrapper
|
||||
from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
|
||||
from ...._base_client import (
|
||||
AsyncPaginator,
|
||||
make_request_options,
|
||||
)
|
||||
from ....types.ai_gateway import log_list_params
|
||||
from ....types.ai_gateway.log_get_response import LogGetResponse
|
||||
from ....types.ai_gateway.log_list_response import LogListResponse
|
||||
|
||||
__all__ = ["LogsResource", "AsyncLogsResource"]
|
||||
|
||||
|
||||
class LogsResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def request(self) -> RequestResource:
|
||||
return RequestResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> ResponseResource:
|
||||
return ResponseResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> LogsResourceWithRawResponse:
|
||||
return LogsResourceWithRawResponse(self)
|
||||
|
|
@ -129,61 +103,8 @@ class LogsResource(SyncAPIResource):
|
|||
model=LogListResponse,
|
||||
)
|
||||
|
||||
def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> LogGetResponse:
|
||||
"""
|
||||
Get Gateway Log Detail
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[LogGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LogGetResponse], ResultWrapper[LogGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class AsyncLogsResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def request(self) -> AsyncRequestResource:
|
||||
return AsyncRequestResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> AsyncResponseResource:
|
||||
return AsyncResponseResource(self._client)
|
||||
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncLogsResourceWithRawResponse:
|
||||
return AsyncLogsResourceWithRawResponse(self)
|
||||
|
|
@ -257,51 +178,6 @@ class AsyncLogsResource(AsyncAPIResource):
|
|||
model=LogListResponse,
|
||||
)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> LogGetResponse:
|
||||
"""
|
||||
Get Gateway Log Detail
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
post_parser=ResultWrapper[LogGetResponse]._unwrapper,
|
||||
),
|
||||
cast_to=cast(Type[LogGetResponse], ResultWrapper[LogGetResponse]),
|
||||
)
|
||||
|
||||
|
||||
class LogsResourceWithRawResponse:
|
||||
def __init__(self, logs: LogsResource) -> None:
|
||||
|
|
@ -310,17 +186,6 @@ class LogsResourceWithRawResponse:
|
|||
self.list = to_raw_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = to_raw_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> RequestResourceWithRawResponse:
|
||||
return RequestResourceWithRawResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> ResponseResourceWithRawResponse:
|
||||
return ResponseResourceWithRawResponse(self._logs.response)
|
||||
|
||||
|
||||
class AsyncLogsResourceWithRawResponse:
|
||||
|
|
@ -330,17 +195,6 @@ class AsyncLogsResourceWithRawResponse:
|
|||
self.list = async_to_raw_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> AsyncRequestResourceWithRawResponse:
|
||||
return AsyncRequestResourceWithRawResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> AsyncResponseResourceWithRawResponse:
|
||||
return AsyncResponseResourceWithRawResponse(self._logs.response)
|
||||
|
||||
|
||||
class LogsResourceWithStreamingResponse:
|
||||
|
|
@ -350,17 +204,6 @@ class LogsResourceWithStreamingResponse:
|
|||
self.list = to_streamed_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = to_streamed_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> RequestResourceWithStreamingResponse:
|
||||
return RequestResourceWithStreamingResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> ResponseResourceWithStreamingResponse:
|
||||
return ResponseResourceWithStreamingResponse(self._logs.response)
|
||||
|
||||
|
||||
class AsyncLogsResourceWithStreamingResponse:
|
||||
|
|
@ -370,14 +213,3 @@ class AsyncLogsResourceWithStreamingResponse:
|
|||
self.list = async_to_streamed_response_wrapper(
|
||||
logs.list,
|
||||
)
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
logs.get,
|
||||
)
|
||||
|
||||
@cached_property
|
||||
def request(self) -> AsyncRequestResourceWithStreamingResponse:
|
||||
return AsyncRequestResourceWithStreamingResponse(self._logs.request)
|
||||
|
||||
@cached_property
|
||||
def response(self) -> AsyncResponseResourceWithStreamingResponse:
|
||||
return AsyncResponseResourceWithStreamingResponse(self._logs.response)
|
||||
|
|
|
|||
|
|
@ -1,158 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
|
||||
__all__ = ["RequestResource", "AsyncRequestResource"]
|
||||
|
||||
|
||||
class RequestResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> RequestResourceWithRawResponse:
|
||||
return RequestResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> RequestResourceWithStreamingResponse:
|
||||
return RequestResourceWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Request
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/request",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRequestResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncRequestResourceWithRawResponse:
|
||||
return AsyncRequestResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncRequestResourceWithStreamingResponse:
|
||||
return AsyncRequestResourceWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Request
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/request",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class RequestResourceWithRawResponse:
|
||||
def __init__(self, request: RequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRequestResourceWithRawResponse:
|
||||
def __init__(self, request: AsyncRequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
|
||||
|
||||
class RequestResourceWithStreamingResponse:
|
||||
def __init__(self, request: RequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncRequestResourceWithStreamingResponse:
|
||||
def __init__(self, request: AsyncRequestResource) -> None:
|
||||
self._request = request
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
request.get,
|
||||
)
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import httpx
|
||||
|
||||
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ...._compat import cached_property
|
||||
from ...._resource import SyncAPIResource, AsyncAPIResource
|
||||
from ...._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from ...._base_client import (
|
||||
make_request_options,
|
||||
)
|
||||
|
||||
__all__ = ["ResponseResource", "AsyncResponseResource"]
|
||||
|
||||
|
||||
class ResponseResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> ResponseResourceWithRawResponse:
|
||||
return ResponseResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> ResponseResourceWithStreamingResponse:
|
||||
return ResponseResourceWithStreamingResponse(self)
|
||||
|
||||
def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Response
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/response",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class AsyncResponseResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncResponseResourceWithRawResponse:
|
||||
return AsyncResponseResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncResponseResourceWithStreamingResponse:
|
||||
return AsyncResponseResourceWithStreamingResponse(self)
|
||||
|
||||
async def get(
|
||||
self,
|
||||
log_id: str,
|
||||
*,
|
||||
account_id: str,
|
||||
id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> object:
|
||||
"""
|
||||
Get Gateway Log Response
|
||||
|
||||
Args:
|
||||
id: gateway id
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not id:
|
||||
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
||||
if not log_id:
|
||||
raise ValueError(f"Expected a non-empty value for `log_id` but received {log_id!r}")
|
||||
return await self._get(
|
||||
f"/accounts/{account_id}/ai-gateway/gateways/{id}/logs/{log_id}/response",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=object,
|
||||
)
|
||||
|
||||
|
||||
class ResponseResourceWithRawResponse:
|
||||
def __init__(self, response: ResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = to_raw_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncResponseResourceWithRawResponse:
|
||||
def __init__(self, response: AsyncResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = async_to_raw_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
||||
|
||||
class ResponseResourceWithStreamingResponse:
|
||||
def __init__(self, response: ResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = to_streamed_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
||||
|
||||
class AsyncResponseResourceWithStreamingResponse:
|
||||
def __init__(self, response: AsyncResponseResource) -> None:
|
||||
self._response = response
|
||||
|
||||
self.get = async_to_streamed_response_wrapper(
|
||||
response.get,
|
||||
)
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from .log_list_params import LogListParams as LogListParams
|
||||
from .log_get_response import LogGetResponse as LogGetResponse
|
||||
from .log_list_response import LogListResponse as LogListResponse
|
||||
from .ai_gateway_list_params import AIGatewayListParams as AIGatewayListParams
|
||||
from .ai_gateway_get_response import AIGatewayGetResponse as AIGatewayGetResponse
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["LogGetResponse"]
|
||||
|
||||
|
||||
class LogGetResponse(BaseModel):
|
||||
id: str
|
||||
|
||||
cached: bool
|
||||
|
||||
created_at: datetime
|
||||
|
||||
duration: int
|
||||
|
||||
model: str
|
||||
|
||||
path: str
|
||||
|
||||
provider: str
|
||||
|
||||
request: str
|
||||
|
||||
response: str
|
||||
|
||||
success: bool
|
||||
|
||||
tokens_in: int
|
||||
|
||||
tokens_out: int
|
||||
|
||||
metadata: Optional[str] = None
|
||||
|
||||
request_content_type: Optional[str] = None
|
||||
|
||||
request_type: Optional[str] = None
|
||||
|
||||
response_content_type: Optional[str] = None
|
||||
|
||||
status_code: Optional[int] = None
|
||||
|
||||
step: Optional[int] = None
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestRequest:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
request = client.ai_gateway.logs.request.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
request = response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.ai_gateway.logs.request.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
request = response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncRequest:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
request = await async_client.ai_gateway.logs.request.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
request = await response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.ai_gateway.logs.request.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
request = await response.parse()
|
||||
assert_matches_type(object, request, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.request.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from cloudflare import Cloudflare, AsyncCloudflare
|
||||
from tests.utils import assert_matches_type
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestResponse:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
response = client.ai_gateway.logs.response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
http_response = client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert http_response.is_closed is True
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
response = http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.ai_gateway.logs.response.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as http_response:
|
||||
assert not http_response.is_closed
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
response = http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
assert cast(Any, http_response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncResponse:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.ai_gateway.logs.response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
http_response = await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert http_response.is_closed is True
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
response = await http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.ai_gateway.logs.response.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as http_response:
|
||||
assert not http_response.is_closed
|
||||
assert http_response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
response = await http_response.parse()
|
||||
assert_matches_type(object, response, path=["response"])
|
||||
|
||||
assert cast(Any, http_response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.response.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
|
@ -11,7 +11,7 @@ from cloudflare import Cloudflare, AsyncCloudflare
|
|||
from tests.utils import assert_matches_type
|
||||
from cloudflare._utils import parse_datetime
|
||||
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
|
||||
from cloudflare.types.ai_gateway import LogGetResponse, LogListResponse
|
||||
from cloudflare.types.ai_gateway import LogListResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
|
@ -84,66 +84,6 @@ class TestLogs:
|
|||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
def test_method_get(self, client: Cloudflare) -> None:
|
||||
log = client.ai_gateway.logs.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_raw_response_get(self, client: Cloudflare) -> None:
|
||||
response = client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
log = response.parse()
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
def test_streaming_response_get(self, client: Cloudflare) -> None:
|
||||
with client.ai_gateway.logs.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
log = response.parse()
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
def test_path_params_get(self, client: Cloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
client.ai_gateway.logs.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
|
||||
class TestAsyncLogs:
|
||||
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
|
@ -212,63 +152,3 @@ class TestAsyncLogs:
|
|||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
)
|
||||
|
||||
@parametrize
|
||||
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
|
||||
log = await async_client.ai_gateway.logs.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
response = await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
log = await response.parse()
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
@parametrize
|
||||
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
|
||||
async with async_client.ai_gateway.logs.with_streaming_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
log = await response.parse()
|
||||
assert_matches_type(LogGetResponse, log, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@parametrize
|
||||
async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"string",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match=r"Expected a non-empty value for `log_id` but received ''"):
|
||||
await async_client.ai_gateway.logs.with_raw_response.get(
|
||||
"",
|
||||
account_id="0d37909e38d3e99c29fa2cd343ac421a",
|
||||
id="my-gateway",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue