Skip to content

Commit

Permalink
feat(api): automatic updates (#2432)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Feb 6, 2025
1 parent 00bf7de commit abef92d
Show file tree
Hide file tree
Showing 16 changed files with 347 additions and 354 deletions.
12 changes: 6 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,12 +624,12 @@ Methods:
Types:

```python
from cloudflare.types.load_balancers import SearchGetResponse
from cloudflare.types.load_balancers import SearchListResponse
```

Methods:

- <code title="get /accounts/{account_id}/load_balancers/search">client.load_balancers.searches.<a href="./src/cloudflare/resources/load_balancers/searches.py">get</a>(\*, account_id, \*\*<a href="src/cloudflare/types/load_balancers/search_get_params.py">params</a>) -> <a href="./src/cloudflare/types/load_balancers/search_get_response.py">SearchGetResponse</a></code>
- <code title="get /accounts/{account_id}/load_balancers/search">client.load_balancers.searches.<a href="./src/cloudflare/resources/load_balancers/searches.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/load_balancers/search_list_params.py">params</a>) -> <a href="./src/cloudflare/types/load_balancers/search_list_response.py">SyncV4PagePagination[SearchListResponse]</a></code>

# Cache

Expand Down Expand Up @@ -8236,12 +8236,12 @@ Methods:
Types:

```python
from cloudflare.types.ai_gateway import EvaluationTypeGetResponse
from cloudflare.types.ai_gateway import EvaluationTypeListResponse
```

Methods:

- <code title="get /accounts/{account_id}/ai-gateway/evaluation-types">client.ai_gateway.evaluation_types.<a href="./src/cloudflare/resources/ai_gateway/evaluation_types.py">get</a>(\*, account_id, \*\*<a href="src/cloudflare/types/ai_gateway/evaluation_type_get_params.py">params</a>) -> <a href="./src/cloudflare/types/ai_gateway/evaluation_type_get_response.py">EvaluationTypeGetResponse</a></code>
- <code title="get /accounts/{account_id}/ai-gateway/evaluation-types">client.ai_gateway.evaluation_types.<a href="./src/cloudflare/resources/ai_gateway/evaluation_types.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/ai_gateway/evaluation_type_list_params.py">params</a>) -> <a href="./src/cloudflare/types/ai_gateway/evaluation_type_list_response.py">SyncV4PagePaginationArray[EvaluationTypeListResponse]</a></code>

## Logs

Expand Down Expand Up @@ -8732,13 +8732,13 @@ Methods:
Types:

```python
from cloudflare.types.security_center import InsightDismissResponse, InsightGetResponse
from cloudflare.types.security_center import InsightListResponse, InsightDismissResponse
```

Methods:

- <code title="get /{account_or_zone}/{account_or_zone_id}/security-center/insights">client.security_center.insights.<a href="./src/cloudflare/resources/security_center/insights/insights.py">list</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/security_center/insight_list_params.py">params</a>) -> <a href="./src/cloudflare/types/security_center/insight_list_response.py">SyncV4PagePagination[Optional[InsightListResponse]]</a></code>
- <code title="put /{account_or_zone}/{account_or_zone_id}/security-center/insights/{issue_id}/dismiss">client.security_center.insights.<a href="./src/cloudflare/resources/security_center/insights/insights.py">dismiss</a>(issue_id, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/security_center/insight_dismiss_params.py">params</a>) -> <a href="./src/cloudflare/types/security_center/insight_dismiss_response.py">InsightDismissResponse</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/security-center/insights">client.security_center.insights.<a href="./src/cloudflare/resources/security_center/insights/insights.py">get</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/security_center/insight_get_params.py">params</a>) -> <a href="./src/cloudflare/types/security_center/insight_get_response.py">Optional[InsightGetResponse]</a></code>

### Class

Expand Down
56 changes: 26 additions & 30 deletions src/cloudflare/resources/ai_gateway/evaluation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

from __future__ import annotations

from typing import Type, cast
from typing_extensions import Literal

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
maybe_transform,
async_maybe_transform,
)
from ..._utils import maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
Expand All @@ -20,10 +16,10 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ..._base_client import make_request_options
from ...types.ai_gateway import evaluation_type_get_params
from ...types.ai_gateway.evaluation_type_get_response import EvaluationTypeGetResponse
from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ..._base_client import AsyncPaginator, make_request_options
from ...types.ai_gateway import evaluation_type_list_params
from ...types.ai_gateway.evaluation_type_list_response import EvaluationTypeListResponse

__all__ = ["EvaluationTypesResource", "AsyncEvaluationTypesResource"]

Expand All @@ -48,7 +44,7 @@ def with_streaming_response(self) -> EvaluationTypesResourceWithStreamingRespons
"""
return EvaluationTypesResourceWithStreamingResponse(self)

def get(
def list(
self,
*,
account_id: str,
Expand All @@ -62,7 +58,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> EvaluationTypeGetResponse:
) -> SyncV4PagePaginationArray[EvaluationTypeListResponse]:
"""
List Evaluators
Expand All @@ -77,8 +73,9 @@ def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get(
return self._get_api_list(
f"/accounts/{account_id}/ai-gateway/evaluation-types",
page=SyncV4PagePaginationArray[EvaluationTypeListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -91,11 +88,10 @@ def get(
"page": page,
"per_page": per_page,
},
evaluation_type_get_params.EvaluationTypeGetParams,
evaluation_type_list_params.EvaluationTypeListParams,
),
post_parser=ResultWrapper[EvaluationTypeGetResponse]._unwrapper,
),
cast_to=cast(Type[EvaluationTypeGetResponse], ResultWrapper[EvaluationTypeGetResponse]),
model=EvaluationTypeListResponse,
)


Expand All @@ -119,7 +115,7 @@ def with_streaming_response(self) -> AsyncEvaluationTypesResourceWithStreamingRe
"""
return AsyncEvaluationTypesResourceWithStreamingResponse(self)

async def get(
def list(
self,
*,
account_id: str,
Expand All @@ -133,7 +129,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> EvaluationTypeGetResponse:
) -> AsyncPaginator[EvaluationTypeListResponse, AsyncV4PagePaginationArray[EvaluationTypeListResponse]]:
"""
List Evaluators
Expand All @@ -148,59 +144,59 @@ async def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._get(
return self._get_api_list(
f"/accounts/{account_id}/ai-gateway/evaluation-types",
page=AsyncV4PagePaginationArray[EvaluationTypeListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
query=maybe_transform(
{
"order_by": order_by,
"order_by_direction": order_by_direction,
"page": page,
"per_page": per_page,
},
evaluation_type_get_params.EvaluationTypeGetParams,
evaluation_type_list_params.EvaluationTypeListParams,
),
post_parser=ResultWrapper[EvaluationTypeGetResponse]._unwrapper,
),
cast_to=cast(Type[EvaluationTypeGetResponse], ResultWrapper[EvaluationTypeGetResponse]),
model=EvaluationTypeListResponse,
)


class EvaluationTypesResourceWithRawResponse:
def __init__(self, evaluation_types: EvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types

self.get = to_raw_response_wrapper(
evaluation_types.get,
self.list = to_raw_response_wrapper(
evaluation_types.list,
)


class AsyncEvaluationTypesResourceWithRawResponse:
def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types

self.get = async_to_raw_response_wrapper(
evaluation_types.get,
self.list = async_to_raw_response_wrapper(
evaluation_types.list,
)


class EvaluationTypesResourceWithStreamingResponse:
def __init__(self, evaluation_types: EvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types

self.get = to_streamed_response_wrapper(
evaluation_types.get,
self.list = to_streamed_response_wrapper(
evaluation_types.list,
)


class AsyncEvaluationTypesResourceWithStreamingResponse:
def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types

self.get = async_to_streamed_response_wrapper(
evaluation_types.get,
self.list = async_to_streamed_response_wrapper(
evaluation_types.list,
)
61 changes: 28 additions & 33 deletions src/cloudflare/resources/load_balancers/searches.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@

from __future__ import annotations

from typing import Type, cast

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
maybe_transform,
async_maybe_transform,
)
from ..._utils import maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
Expand All @@ -19,10 +14,10 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ..._base_client import make_request_options
from ...types.load_balancers import search_get_params
from ...types.load_balancers.search_get_response import SearchGetResponse
from ...pagination import SyncV4PagePagination, AsyncV4PagePagination
from ..._base_client import AsyncPaginator, make_request_options
from ...types.load_balancers import search_list_params
from ...types.load_balancers.search_list_response import SearchListResponse

__all__ = ["SearchesResource", "AsyncSearchesResource"]

Expand All @@ -47,20 +42,20 @@ def with_streaming_response(self) -> SearchesResourceWithStreamingResponse:
"""
return SearchesResourceWithStreamingResponse(self)

def get(
def list(
self,
*,
account_id: str,
page: float | NotGiven = NOT_GIVEN,
per_page: float | NotGiven = NOT_GIVEN,
search_params: search_get_params.SearchParams | NotGiven = NOT_GIVEN,
search_params: search_list_params.SearchParams | NotGiven = NOT_GIVEN,
# 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,
) -> SearchGetResponse:
) -> SyncV4PagePagination[SearchListResponse]:
"""
Search for Load Balancing resources.
Expand All @@ -77,8 +72,9 @@ def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get(
return self._get_api_list(
f"/accounts/{account_id}/load_balancers/search",
page=SyncV4PagePagination[SearchListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -90,11 +86,10 @@ def get(
"per_page": per_page,
"search_params": search_params,
},
search_get_params.SearchGetParams,
search_list_params.SearchListParams,
),
post_parser=ResultWrapper[SearchGetResponse]._unwrapper,
),
cast_to=cast(Type[SearchGetResponse], ResultWrapper[SearchGetResponse]),
model=SearchListResponse,
)


Expand All @@ -118,20 +113,20 @@ def with_streaming_response(self) -> AsyncSearchesResourceWithStreamingResponse:
"""
return AsyncSearchesResourceWithStreamingResponse(self)

async def get(
def list(
self,
*,
account_id: str,
page: float | NotGiven = NOT_GIVEN,
per_page: float | NotGiven = NOT_GIVEN,
search_params: search_get_params.SearchParams | NotGiven = NOT_GIVEN,
search_params: search_list_params.SearchParams | NotGiven = NOT_GIVEN,
# 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,
) -> SearchGetResponse:
) -> AsyncPaginator[SearchListResponse, AsyncV4PagePagination[SearchListResponse]]:
"""
Search for Load Balancing resources.
Expand All @@ -148,58 +143,58 @@ async def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._get(
return self._get_api_list(
f"/accounts/{account_id}/load_balancers/search",
page=AsyncV4PagePagination[SearchListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
query=maybe_transform(
{
"page": page,
"per_page": per_page,
"search_params": search_params,
},
search_get_params.SearchGetParams,
search_list_params.SearchListParams,
),
post_parser=ResultWrapper[SearchGetResponse]._unwrapper,
),
cast_to=cast(Type[SearchGetResponse], ResultWrapper[SearchGetResponse]),
model=SearchListResponse,
)


class SearchesResourceWithRawResponse:
def __init__(self, searches: SearchesResource) -> None:
self._searches = searches

self.get = to_raw_response_wrapper(
searches.get,
self.list = to_raw_response_wrapper(
searches.list,
)


class AsyncSearchesResourceWithRawResponse:
def __init__(self, searches: AsyncSearchesResource) -> None:
self._searches = searches

self.get = async_to_raw_response_wrapper(
searches.get,
self.list = async_to_raw_response_wrapper(
searches.list,
)


class SearchesResourceWithStreamingResponse:
def __init__(self, searches: SearchesResource) -> None:
self._searches = searches

self.get = to_streamed_response_wrapper(
searches.get,
self.list = to_streamed_response_wrapper(
searches.list,
)


class AsyncSearchesResourceWithStreamingResponse:
def __init__(self, searches: AsyncSearchesResource) -> None:
self._searches = searches

self.get = async_to_streamed_response_wrapper(
searches.get,
self.list = async_to_streamed_response_wrapper(
searches.list,
)
Loading

0 comments on commit abef92d

Please sign in to comment.