From abef92d8a61dcb6e0c17cbde7ee23119081d321e Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 6 Feb 2025 04:29:50 +0000
Subject: [PATCH] feat(api): automatic updates (#2432)
---
api.md | 12 +-
.../resources/ai_gateway/evaluation_types.py | 56 ++---
.../resources/load_balancers/searches.py | 61 +++--
.../security_center/insights/insights.py | 238 +++++++++---------
src/cloudflare/types/ai_gateway/__init__.py | 4 +-
...rams.py => evaluation_type_list_params.py} | 4 +-
...se.py => evaluation_type_list_response.py} | 9 +-
.../types/load_balancers/__init__.py | 4 +-
...ch_get_params.py => search_list_params.py} | 4 +-
...et_response.py => search_list_response.py} | 4 +-
.../types/security_center/__init__.py | 4 +-
...t_get_params.py => insight_list_params.py} | 4 +-
...t_response.py => insight_list_response.py} | 4 +-
.../ai_gateway/test_evaluation_types.py | 63 ++---
.../load_balancers/test_searches.py | 59 ++---
.../security_center/test_insights.py | 171 ++++++-------
16 files changed, 347 insertions(+), 354 deletions(-)
rename src/cloudflare/types/ai_gateway/{evaluation_type_get_params.py => evaluation_type_list_params.py} (76%)
rename src/cloudflare/types/ai_gateway/{evaluation_type_get_response.py => evaluation_type_list_response.py} (54%)
rename src/cloudflare/types/load_balancers/{search_get_params.py => search_list_params.py} (84%)
rename src/cloudflare/types/load_balancers/{search_get_response.py => search_list_response.py} (91%)
rename src/cloudflare/types/security_center/{insight_get_params.py => insight_list_params.py} (94%)
rename src/cloudflare/types/security_center/{insight_get_response.py => insight_list_response.py} (92%)
diff --git a/api.md b/api.md
index 740efcac5ba..5da34f5a0ea 100644
--- a/api.md
+++ b/api.md
@@ -624,12 +624,12 @@ Methods:
Types:
```python
-from cloudflare.types.load_balancers import SearchGetResponse
+from cloudflare.types.load_balancers import SearchListResponse
```
Methods:
-- client.load_balancers.searches.get(\*, account_id, \*\*params) -> SearchGetResponse
+- client.load_balancers.searches.list(\*, account_id, \*\*params) -> SyncV4PagePagination[SearchListResponse]
# Cache
@@ -8236,12 +8236,12 @@ Methods:
Types:
```python
-from cloudflare.types.ai_gateway import EvaluationTypeGetResponse
+from cloudflare.types.ai_gateway import EvaluationTypeListResponse
```
Methods:
-- client.ai_gateway.evaluation_types.get(\*, account_id, \*\*params) -> EvaluationTypeGetResponse
+- client.ai_gateway.evaluation_types.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[EvaluationTypeListResponse]
## Logs
@@ -8732,13 +8732,13 @@ Methods:
Types:
```python
-from cloudflare.types.security_center import InsightDismissResponse, InsightGetResponse
+from cloudflare.types.security_center import InsightListResponse, InsightDismissResponse
```
Methods:
+- client.security_center.insights.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePagination[Optional[InsightListResponse]]
- client.security_center.insights.dismiss(issue_id, \*, account_id, zone_id, \*\*params) -> InsightDismissResponse
-- client.security_center.insights.get(\*, account_id, zone_id, \*\*params) -> Optional[InsightGetResponse]
### Class
diff --git a/src/cloudflare/resources/ai_gateway/evaluation_types.py b/src/cloudflare/resources/ai_gateway/evaluation_types.py
index 80f322466ff..047c5936dec 100644
--- a/src/cloudflare/resources/ai_gateway/evaluation_types.py
+++ b/src/cloudflare/resources/ai_gateway/evaluation_types.py
@@ -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 (
@@ -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"]
@@ -48,7 +44,7 @@ def with_streaming_response(self) -> EvaluationTypesResourceWithStreamingRespons
"""
return EvaluationTypesResourceWithStreamingResponse(self)
- def get(
+ def list(
self,
*,
account_id: str,
@@ -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
@@ -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,
@@ -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,
)
@@ -119,7 +115,7 @@ def with_streaming_response(self) -> AsyncEvaluationTypesResourceWithStreamingRe
"""
return AsyncEvaluationTypesResourceWithStreamingResponse(self)
- async def get(
+ def list(
self,
*,
account_id: str,
@@ -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
@@ -148,25 +144,25 @@ 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,
)
@@ -174,8 +170,8 @@ 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,
)
@@ -183,8 +179,8 @@ 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,
)
@@ -192,8 +188,8 @@ 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,
)
@@ -201,6 +197,6 @@ 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,
)
diff --git a/src/cloudflare/resources/load_balancers/searches.py b/src/cloudflare/resources/load_balancers/searches.py
index cc09d14445d..33f25038c18 100644
--- a/src/cloudflare/resources/load_balancers/searches.py
+++ b/src/cloudflare/resources/load_balancers/searches.py
@@ -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 (
@@ -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"]
@@ -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.
@@ -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,
@@ -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,
)
@@ -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.
@@ -148,24 +143,24 @@ 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,
)
@@ -173,8 +168,8 @@ 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,
)
@@ -182,8 +177,8 @@ 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,
)
@@ -191,8 +186,8 @@ 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,
)
@@ -200,6 +195,6 @@ 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,
)
diff --git a/src/cloudflare/resources/security_center/insights/insights.py b/src/cloudflare/resources/security_center/insights/insights.py
index 223c538d59d..582ed0197fe 100644
--- a/src/cloudflare/resources/security_center/insights/insights.py
+++ b/src/cloudflare/resources/security_center/insights/insights.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import List, Type, Optional, cast
+from typing import List, Optional
import httpx
@@ -43,10 +43,10 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from ...._wrappers import ResultWrapper
-from ...._base_client import make_request_options
-from ....types.security_center import insight_get_params, insight_dismiss_params
-from ....types.security_center.insight_get_response import InsightGetResponse
+from ....pagination import SyncV4PagePagination, AsyncV4PagePagination
+from ...._base_client import AsyncPaginator, make_request_options
+from ....types.security_center import insight_list_params, insight_dismiss_params
+from ....types.security_center.insight_list_response import InsightListResponse
from ....types.intel.attack_surface_report.issue_type import IssueType
from ....types.security_center.insight_dismiss_response import InsightDismissResponse
from ....types.intel.attack_surface_report.severity_query_param import SeverityQueryParam
@@ -86,60 +86,7 @@ def with_streaming_response(self) -> InsightsResourceWithStreamingResponse:
"""
return InsightsResourceWithStreamingResponse(self)
- def dismiss(
- self,
- issue_id: str,
- *,
- account_id: str | NotGiven = NOT_GIVEN,
- zone_id: str | NotGiven = NOT_GIVEN,
- dismiss: bool | 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,
- ) -> InsightDismissResponse:
- """
- Archive Security Center Insight
-
- Args:
- account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
-
- zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account 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 issue_id:
- raise ValueError(f"Expected a non-empty value for `issue_id` but received {issue_id!r}")
- if account_id and zone_id:
- raise ValueError("You cannot provide both account_id and zone_id")
-
- if account_id:
- account_or_zone = "accounts"
- account_or_zone_id = account_id
- else:
- if not zone_id:
- raise ValueError("You must provide either account_id or zone_id")
-
- account_or_zone = "zones"
- account_or_zone_id = zone_id
- return self._put(
- f"/{account_or_zone}/{account_or_zone_id}/security-center/insights/{issue_id}/dismiss",
- body=maybe_transform({"dismiss": dismiss}, insight_dismiss_params.InsightDismissParams),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=InsightDismissResponse,
- )
-
- def get(
+ def list(
self,
*,
account_id: str | NotGiven = NOT_GIVEN,
@@ -163,7 +110,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[InsightGetResponse]:
+ ) -> SyncV4PagePagination[Optional[InsightListResponse]]:
"""
Get Security Center Insights
@@ -196,8 +143,9 @@ def get(
account_or_zone = "zones"
account_or_zone_id = zone_id
- return self._get(
+ return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/security-center/insights",
+ page=SyncV4PagePagination[Optional[InsightListResponse]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -219,47 +167,13 @@ def get(
"subject": subject,
"subject_neq": subject_neq,
},
- insight_get_params.InsightGetParams,
+ insight_list_params.InsightListParams,
),
- post_parser=ResultWrapper[Optional[InsightGetResponse]]._unwrapper,
),
- cast_to=cast(Type[Optional[InsightGetResponse]], ResultWrapper[InsightGetResponse]),
+ model=InsightListResponse,
)
-
-class AsyncInsightsResource(AsyncAPIResource):
- @cached_property
- def class_(self) -> AsyncClassResource:
- return AsyncClassResource(self._client)
-
- @cached_property
- def severity(self) -> AsyncSeverityResource:
- return AsyncSeverityResource(self._client)
-
- @cached_property
- def type(self) -> AsyncTypeResource:
- return AsyncTypeResource(self._client)
-
- @cached_property
- def with_raw_response(self) -> AsyncInsightsResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
- """
- return AsyncInsightsResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncInsightsResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
- """
- return AsyncInsightsResourceWithStreamingResponse(self)
-
- async def dismiss(
+ def dismiss(
self,
issue_id: str,
*,
@@ -303,16 +217,49 @@ async def dismiss(
account_or_zone = "zones"
account_or_zone_id = zone_id
- return await self._put(
+ return self._put(
f"/{account_or_zone}/{account_or_zone_id}/security-center/insights/{issue_id}/dismiss",
- body=await async_maybe_transform({"dismiss": dismiss}, insight_dismiss_params.InsightDismissParams),
+ body=maybe_transform({"dismiss": dismiss}, insight_dismiss_params.InsightDismissParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=InsightDismissResponse,
)
- async def get(
+
+class AsyncInsightsResource(AsyncAPIResource):
+ @cached_property
+ def class_(self) -> AsyncClassResource:
+ return AsyncClassResource(self._client)
+
+ @cached_property
+ def severity(self) -> AsyncSeverityResource:
+ return AsyncSeverityResource(self._client)
+
+ @cached_property
+ def type(self) -> AsyncTypeResource:
+ return AsyncTypeResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncInsightsResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncInsightsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncInsightsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncInsightsResourceWithStreamingResponse(self)
+
+ def list(
self,
*,
account_id: str | NotGiven = NOT_GIVEN,
@@ -336,7 +283,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[InsightGetResponse]:
+ ) -> AsyncPaginator[Optional[InsightListResponse], AsyncV4PagePagination[Optional[InsightListResponse]]]:
"""
Get Security Center Insights
@@ -369,14 +316,15 @@ async def get(
account_or_zone = "zones"
account_or_zone_id = zone_id
- return await self._get(
+ return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/security-center/insights",
+ page=AsyncV4PagePagination[Optional[InsightListResponse]],
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(
{
"dismissed": dismissed,
"issue_class": issue_class,
@@ -392,11 +340,63 @@ async def get(
"subject": subject,
"subject_neq": subject_neq,
},
- insight_get_params.InsightGetParams,
+ insight_list_params.InsightListParams,
),
- post_parser=ResultWrapper[Optional[InsightGetResponse]]._unwrapper,
),
- cast_to=cast(Type[Optional[InsightGetResponse]], ResultWrapper[InsightGetResponse]),
+ model=InsightListResponse,
+ )
+
+ async def dismiss(
+ self,
+ issue_id: str,
+ *,
+ account_id: str | NotGiven = NOT_GIVEN,
+ zone_id: str | NotGiven = NOT_GIVEN,
+ dismiss: bool | 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,
+ ) -> InsightDismissResponse:
+ """
+ Archive Security Center Insight
+
+ Args:
+ account_id: The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.
+
+ zone_id: The Zone ID to use for this endpoint. Mutually exclusive with the Account 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 issue_id:
+ raise ValueError(f"Expected a non-empty value for `issue_id` but received {issue_id!r}")
+ if account_id and zone_id:
+ raise ValueError("You cannot provide both account_id and zone_id")
+
+ if account_id:
+ account_or_zone = "accounts"
+ account_or_zone_id = account_id
+ else:
+ if not zone_id:
+ raise ValueError("You must provide either account_id or zone_id")
+
+ account_or_zone = "zones"
+ account_or_zone_id = zone_id
+ return await self._put(
+ f"/{account_or_zone}/{account_or_zone_id}/security-center/insights/{issue_id}/dismiss",
+ body=await async_maybe_transform({"dismiss": dismiss}, insight_dismiss_params.InsightDismissParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=InsightDismissResponse,
)
@@ -404,12 +404,12 @@ class InsightsResourceWithRawResponse:
def __init__(self, insights: InsightsResource) -> None:
self._insights = insights
+ self.list = to_raw_response_wrapper(
+ insights.list,
+ )
self.dismiss = to_raw_response_wrapper(
insights.dismiss,
)
- self.get = to_raw_response_wrapper(
- insights.get,
- )
@cached_property
def class_(self) -> ClassResourceWithRawResponse:
@@ -428,12 +428,12 @@ class AsyncInsightsResourceWithRawResponse:
def __init__(self, insights: AsyncInsightsResource) -> None:
self._insights = insights
+ self.list = async_to_raw_response_wrapper(
+ insights.list,
+ )
self.dismiss = async_to_raw_response_wrapper(
insights.dismiss,
)
- self.get = async_to_raw_response_wrapper(
- insights.get,
- )
@cached_property
def class_(self) -> AsyncClassResourceWithRawResponse:
@@ -452,12 +452,12 @@ class InsightsResourceWithStreamingResponse:
def __init__(self, insights: InsightsResource) -> None:
self._insights = insights
+ self.list = to_streamed_response_wrapper(
+ insights.list,
+ )
self.dismiss = to_streamed_response_wrapper(
insights.dismiss,
)
- self.get = to_streamed_response_wrapper(
- insights.get,
- )
@cached_property
def class_(self) -> ClassResourceWithStreamingResponse:
@@ -476,12 +476,12 @@ class AsyncInsightsResourceWithStreamingResponse:
def __init__(self, insights: AsyncInsightsResource) -> None:
self._insights = insights
+ self.list = async_to_streamed_response_wrapper(
+ insights.list,
+ )
self.dismiss = async_to_streamed_response_wrapper(
insights.dismiss,
)
- self.get = async_to_streamed_response_wrapper(
- insights.get,
- )
@cached_property
def class_(self) -> AsyncClassResourceWithStreamingResponse:
diff --git a/src/cloudflare/types/ai_gateway/__init__.py b/src/cloudflare/types/ai_gateway/__init__.py
index fbb3b04fbd2..4aee571ef07 100644
--- a/src/cloudflare/types/ai_gateway/__init__.py
+++ b/src/cloudflare/types/ai_gateway/__init__.py
@@ -30,5 +30,5 @@
from .ai_gateway_update_response import AIGatewayUpdateResponse as AIGatewayUpdateResponse
from .evaluation_create_response import EvaluationCreateResponse as EvaluationCreateResponse
from .evaluation_delete_response import EvaluationDeleteResponse as EvaluationDeleteResponse
-from .evaluation_type_get_params import EvaluationTypeGetParams as EvaluationTypeGetParams
-from .evaluation_type_get_response import EvaluationTypeGetResponse as EvaluationTypeGetResponse
+from .evaluation_type_list_params import EvaluationTypeListParams as EvaluationTypeListParams
+from .evaluation_type_list_response import EvaluationTypeListResponse as EvaluationTypeListResponse
diff --git a/src/cloudflare/types/ai_gateway/evaluation_type_get_params.py b/src/cloudflare/types/ai_gateway/evaluation_type_list_params.py
similarity index 76%
rename from src/cloudflare/types/ai_gateway/evaluation_type_get_params.py
rename to src/cloudflare/types/ai_gateway/evaluation_type_list_params.py
index 99f3e376187..5a03c32439c 100644
--- a/src/cloudflare/types/ai_gateway/evaluation_type_get_params.py
+++ b/src/cloudflare/types/ai_gateway/evaluation_type_list_params.py
@@ -4,10 +4,10 @@
from typing_extensions import Literal, Required, TypedDict
-__all__ = ["EvaluationTypeGetParams"]
+__all__ = ["EvaluationTypeListParams"]
-class EvaluationTypeGetParams(TypedDict, total=False):
+class EvaluationTypeListParams(TypedDict, total=False):
account_id: Required[str]
order_by: str
diff --git a/src/cloudflare/types/ai_gateway/evaluation_type_get_response.py b/src/cloudflare/types/ai_gateway/evaluation_type_list_response.py
similarity index 54%
rename from src/cloudflare/types/ai_gateway/evaluation_type_get_response.py
rename to src/cloudflare/types/ai_gateway/evaluation_type_list_response.py
index 58f8832c954..428f484d00f 100644
--- a/src/cloudflare/types/ai_gateway/evaluation_type_get_response.py
+++ b/src/cloudflare/types/ai_gateway/evaluation_type_list_response.py
@@ -1,15 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List
from datetime import datetime
-from typing_extensions import TypeAlias
from ..._models import BaseModel
-__all__ = ["EvaluationTypeGetResponse", "EvaluationTypeGetResponseItem"]
+__all__ = ["EvaluationTypeListResponse"]
-class EvaluationTypeGetResponseItem(BaseModel):
+class EvaluationTypeListResponse(BaseModel):
id: str
created_at: datetime
@@ -25,6 +23,3 @@ class EvaluationTypeGetResponseItem(BaseModel):
name: str
type: str
-
-
-EvaluationTypeGetResponse: TypeAlias = List[EvaluationTypeGetResponseItem]
diff --git a/src/cloudflare/types/load_balancers/__init__.py b/src/cloudflare/types/load_balancers/__init__.py
index 5caf860663d..fcf247a12fb 100644
--- a/src/cloudflare/types/load_balancers/__init__.py
+++ b/src/cloudflare/types/load_balancers/__init__.py
@@ -24,19 +24,19 @@
from .pool_list_params import PoolListParams as PoolListParams
from .session_affinity import SessionAffinity as SessionAffinity
from .location_strategy import LocationStrategy as LocationStrategy
-from .search_get_params import SearchGetParams as SearchGetParams
from .pool_create_params import PoolCreateParams as PoolCreateParams
from .pool_update_params import PoolUpdateParams as PoolUpdateParams
from .region_list_params import RegionListParams as RegionListParams
+from .search_list_params import SearchListParams as SearchListParams
from .load_shedding_param import LoadSheddingParam as LoadSheddingParam
from .monitor_edit_params import MonitorEditParams as MonitorEditParams
from .notification_filter import NotificationFilter as NotificationFilter
from .region_get_response import RegionGetResponse as RegionGetResponse
-from .search_get_response import SearchGetResponse as SearchGetResponse
from .filter_options_param import FilterOptionsParam as FilterOptionsParam
from .pool_delete_response import PoolDeleteResponse as PoolDeleteResponse
from .preview_get_response import PreviewGetResponse as PreviewGetResponse
from .region_list_response import RegionListResponse as RegionListResponse
+from .search_list_response import SearchListResponse as SearchListResponse
from .monitor_create_params import MonitorCreateParams as MonitorCreateParams
from .monitor_update_params import MonitorUpdateParams as MonitorUpdateParams
from .origin_steering_param import OriginSteeringParam as OriginSteeringParam
diff --git a/src/cloudflare/types/load_balancers/search_get_params.py b/src/cloudflare/types/load_balancers/search_list_params.py
similarity index 84%
rename from src/cloudflare/types/load_balancers/search_get_params.py
rename to src/cloudflare/types/load_balancers/search_list_params.py
index 0bfe600047a..38396bdf885 100644
--- a/src/cloudflare/types/load_balancers/search_get_params.py
+++ b/src/cloudflare/types/load_balancers/search_list_params.py
@@ -4,10 +4,10 @@
from typing_extensions import Literal, Required, TypedDict
-__all__ = ["SearchGetParams", "SearchParams"]
+__all__ = ["SearchListParams", "SearchParams"]
-class SearchGetParams(TypedDict, total=False):
+class SearchListParams(TypedDict, total=False):
account_id: Required[str]
"""Identifier"""
diff --git a/src/cloudflare/types/load_balancers/search_get_response.py b/src/cloudflare/types/load_balancers/search_list_response.py
similarity index 91%
rename from src/cloudflare/types/load_balancers/search_get_response.py
rename to src/cloudflare/types/load_balancers/search_list_response.py
index 87d1af2b8cd..ac481f630e9 100644
--- a/src/cloudflare/types/load_balancers/search_get_response.py
+++ b/src/cloudflare/types/load_balancers/search_list_response.py
@@ -5,7 +5,7 @@
from ..._models import BaseModel
-__all__ = ["SearchGetResponse", "Resource"]
+__all__ = ["SearchListResponse", "Resource"]
class Resource(BaseModel):
@@ -24,6 +24,6 @@ class Resource(BaseModel):
"""The type of the resource."""
-class SearchGetResponse(BaseModel):
+class SearchListResponse(BaseModel):
resources: Optional[List[Resource]] = None
"""A list of resources matching the search query."""
diff --git a/src/cloudflare/types/security_center/__init__.py b/src/cloudflare/types/security_center/__init__.py
index 93cbbbdecc0..34e1627b271 100644
--- a/src/cloudflare/types/security_center/__init__.py
+++ b/src/cloudflare/types/security_center/__init__.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from .insight_get_params import InsightGetParams as InsightGetParams
-from .insight_get_response import InsightGetResponse as InsightGetResponse
+from .insight_list_params import InsightListParams as InsightListParams
+from .insight_list_response import InsightListResponse as InsightListResponse
from .insight_dismiss_params import InsightDismissParams as InsightDismissParams
from .insight_dismiss_response import InsightDismissResponse as InsightDismissResponse
diff --git a/src/cloudflare/types/security_center/insight_get_params.py b/src/cloudflare/types/security_center/insight_list_params.py
similarity index 94%
rename from src/cloudflare/types/security_center/insight_get_params.py
rename to src/cloudflare/types/security_center/insight_list_params.py
index be46b8d1bb8..d95706d144b 100644
--- a/src/cloudflare/types/security_center/insight_get_params.py
+++ b/src/cloudflare/types/security_center/insight_list_params.py
@@ -9,10 +9,10 @@
from ..intel.attack_surface_report.issue_type import IssueType
from ..intel.attack_surface_report.severity_query_param import SeverityQueryParam
-__all__ = ["InsightGetParams"]
+__all__ = ["InsightListParams"]
-class InsightGetParams(TypedDict, total=False):
+class InsightListParams(TypedDict, total=False):
account_id: str
"""The Account ID to use for this endpoint. Mutually exclusive with the Zone ID."""
diff --git a/src/cloudflare/types/security_center/insight_get_response.py b/src/cloudflare/types/security_center/insight_list_response.py
similarity index 92%
rename from src/cloudflare/types/security_center/insight_get_response.py
rename to src/cloudflare/types/security_center/insight_list_response.py
index 445c062edcc..499127ff06a 100644
--- a/src/cloudflare/types/security_center/insight_get_response.py
+++ b/src/cloudflare/types/security_center/insight_list_response.py
@@ -7,7 +7,7 @@
from ..._models import BaseModel
from ..intel.attack_surface_report.issue_type import IssueType
-__all__ = ["InsightGetResponse", "Issue"]
+__all__ = ["InsightListResponse", "Issue"]
class Issue(BaseModel):
@@ -34,7 +34,7 @@ class Issue(BaseModel):
timestamp: Optional[datetime] = None
-class InsightGetResponse(BaseModel):
+class InsightListResponse(BaseModel):
count: Optional[int] = None
"""Total number of results"""
diff --git a/tests/api_resources/ai_gateway/test_evaluation_types.py b/tests/api_resources/ai_gateway/test_evaluation_types.py
index 0b83a3809f8..d03554b8df8 100644
--- a/tests/api_resources/ai_gateway/test_evaluation_types.py
+++ b/tests/api_resources/ai_gateway/test_evaluation_types.py
@@ -9,7 +9,8 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types.ai_gateway import EvaluationTypeGetResponse
+from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from cloudflare.types.ai_gateway import EvaluationTypeListResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -18,51 +19,53 @@ class TestEvaluationTypes:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
- def test_method_get(self, client: Cloudflare) -> None:
- evaluation_type = client.ai_gateway.evaluation_types.get(
+ def test_method_list(self, client: Cloudflare) -> None:
+ evaluation_type = client.ai_gateway.evaluation_types.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
)
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(SyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"])
@parametrize
- def test_method_get_with_all_params(self, client: Cloudflare) -> None:
- evaluation_type = client.ai_gateway.evaluation_types.get(
+ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
+ evaluation_type = client.ai_gateway.evaluation_types.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
order_by="order_by",
order_by_direction="asc",
page=1,
per_page=5,
)
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(SyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"])
@parametrize
- def test_raw_response_get(self, client: Cloudflare) -> None:
- response = client.ai_gateway.evaluation_types.with_raw_response.get(
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.ai_gateway.evaluation_types.with_raw_response.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
evaluation_type = response.parse()
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(SyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"])
@parametrize
- def test_streaming_response_get(self, client: Cloudflare) -> None:
- with client.ai_gateway.evaluation_types.with_streaming_response.get(
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.ai_gateway.evaluation_types.with_streaming_response.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
evaluation_type = response.parse()
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(
+ SyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"]
+ )
assert cast(Any, response.is_closed) is True
@parametrize
- def test_path_params_get(self, client: Cloudflare) -> None:
+ def test_path_params_list(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
- client.ai_gateway.evaluation_types.with_raw_response.get(
+ client.ai_gateway.evaluation_types.with_raw_response.list(
account_id="",
)
@@ -71,50 +74,52 @@ class TestAsyncEvaluationTypes:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
- async def test_method_get(self, async_client: AsyncCloudflare) -> None:
- evaluation_type = await async_client.ai_gateway.evaluation_types.get(
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ evaluation_type = await async_client.ai_gateway.evaluation_types.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
)
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(AsyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"])
@parametrize
- async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
- evaluation_type = await async_client.ai_gateway.evaluation_types.get(
+ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ evaluation_type = await async_client.ai_gateway.evaluation_types.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
order_by="order_by",
order_by_direction="asc",
page=1,
per_page=5,
)
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(AsyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"])
@parametrize
- async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
- response = await async_client.ai_gateway.evaluation_types.with_raw_response.get(
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.ai_gateway.evaluation_types.with_raw_response.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
evaluation_type = await response.parse()
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(AsyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"])
@parametrize
- async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
- async with async_client.ai_gateway.evaluation_types.with_streaming_response.get(
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.ai_gateway.evaluation_types.with_streaming_response.list(
account_id="0d37909e38d3e99c29fa2cd343ac421a",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
evaluation_type = await response.parse()
- assert_matches_type(EvaluationTypeGetResponse, evaluation_type, path=["response"])
+ assert_matches_type(
+ AsyncV4PagePaginationArray[EvaluationTypeListResponse], evaluation_type, path=["response"]
+ )
assert cast(Any, response.is_closed) is True
@parametrize
- async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
+ async def test_path_params_list(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.evaluation_types.with_raw_response.get(
+ await async_client.ai_gateway.evaluation_types.with_raw_response.list(
account_id="",
)
diff --git a/tests/api_resources/load_balancers/test_searches.py b/tests/api_resources/load_balancers/test_searches.py
index 7ba156e3a88..d8d3ef9211f 100644
--- a/tests/api_resources/load_balancers/test_searches.py
+++ b/tests/api_resources/load_balancers/test_searches.py
@@ -9,7 +9,8 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types.load_balancers import SearchGetResponse
+from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination
+from cloudflare.types.load_balancers import SearchListResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -19,16 +20,16 @@ class TestSearches:
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_method_get(self, client: Cloudflare) -> None:
- search = client.load_balancers.searches.get(
+ def test_method_list(self, client: Cloudflare) -> None:
+ search = client.load_balancers.searches.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(SyncV4PagePagination[SearchListResponse], search, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_method_get_with_all_params(self, client: Cloudflare) -> None:
- search = client.load_balancers.searches.get(
+ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
+ search = client.load_balancers.searches.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
page=1,
per_page=1,
@@ -37,39 +38,39 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
"references": "",
},
)
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(SyncV4PagePagination[SearchListResponse], search, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_raw_response_get(self, client: Cloudflare) -> None:
- response = client.load_balancers.searches.with_raw_response.get(
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.load_balancers.searches.with_raw_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
search = response.parse()
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(SyncV4PagePagination[SearchListResponse], search, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_streaming_response_get(self, client: Cloudflare) -> None:
- with client.load_balancers.searches.with_streaming_response.get(
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.load_balancers.searches.with_streaming_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
search = response.parse()
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(SyncV4PagePagination[SearchListResponse], search, path=["response"])
assert cast(Any, response.is_closed) is True
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_path_params_get(self, client: Cloudflare) -> None:
+ def test_path_params_list(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
- client.load_balancers.searches.with_raw_response.get(
+ client.load_balancers.searches.with_raw_response.list(
account_id="",
)
@@ -79,16 +80,16 @@ class TestAsyncSearches:
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_method_get(self, async_client: AsyncCloudflare) -> None:
- search = await async_client.load_balancers.searches.get(
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ search = await async_client.load_balancers.searches.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(AsyncV4PagePagination[SearchListResponse], search, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
- search = await async_client.load_balancers.searches.get(
+ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ search = await async_client.load_balancers.searches.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
page=1,
per_page=1,
@@ -97,38 +98,38 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -
"references": "",
},
)
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(AsyncV4PagePagination[SearchListResponse], search, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
- response = await async_client.load_balancers.searches.with_raw_response.get(
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.load_balancers.searches.with_raw_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
search = await response.parse()
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(AsyncV4PagePagination[SearchListResponse], search, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
- async with async_client.load_balancers.searches.with_streaming_response.get(
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.load_balancers.searches.with_streaming_response.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
search = await response.parse()
- assert_matches_type(SearchGetResponse, search, path=["response"])
+ assert_matches_type(AsyncV4PagePagination[SearchListResponse], search, path=["response"])
assert cast(Any, response.is_closed) is True
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
- await async_client.load_balancers.searches.with_raw_response.get(
+ await async_client.load_balancers.searches.with_raw_response.list(
account_id="",
)
diff --git a/tests/api_resources/security_center/test_insights.py b/tests/api_resources/security_center/test_insights.py
index 531c0ba49dc..31edeb1e303 100644
--- a/tests/api_resources/security_center/test_insights.py
+++ b/tests/api_resources/security_center/test_insights.py
@@ -9,8 +9,9 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
+from cloudflare.pagination import SyncV4PagePagination, AsyncV4PagePagination
from cloudflare.types.security_center import (
- InsightGetResponse,
+ InsightListResponse,
InsightDismissResponse,
)
@@ -20,6 +21,69 @@
class TestInsights:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ insight = client.security_center.insights.list(
+ account_id="account_id",
+ )
+ assert_matches_type(SyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
+
+ @parametrize
+ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
+ insight = client.security_center.insights.list(
+ account_id="account_id",
+ dismissed=False,
+ issue_class=["a_record_dangling", "always_use_https_not_enabled"],
+ issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
+ issue_type=["compliance_violation", "email_security"],
+ issue_type_neq=["compliance_violation", "email_security"],
+ page=1,
+ per_page=25,
+ product=["access", "dns"],
+ product_neq=["access", "dns"],
+ severity=["low", "moderate"],
+ severity_neq=["low", "moderate"],
+ subject=["example.com"],
+ subject_neq=["example.com"],
+ )
+ assert_matches_type(SyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.security_center.insights.with_raw_response.list(
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ insight = response.parse()
+ assert_matches_type(SyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.security_center.insights.with_streaming_response.list(
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ insight = response.parse()
+ assert_matches_type(SyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"You must provide either account_id or zone_id"):
+ client.security_center.insights.with_raw_response.list(
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"You must provide either account_id or zone_id"):
+ client.security_center.insights.with_raw_response.list(
+ account_id="account_id",
+ )
+
@parametrize
def test_method_dismiss(self, client: Cloudflare) -> None:
insight = client.security_center.insights.dismiss(
@@ -83,16 +147,20 @@ def test_path_params_dismiss(self, client: Cloudflare) -> None:
account_id="account_id",
)
+
+class TestAsyncInsights:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
@parametrize
- def test_method_get(self, client: Cloudflare) -> None:
- insight = client.security_center.insights.get(
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ insight = await async_client.security_center.insights.list(
account_id="account_id",
)
- assert_matches_type(Optional[InsightGetResponse], insight, path=["response"])
+ assert_matches_type(AsyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
@parametrize
- def test_method_get_with_all_params(self, client: Cloudflare) -> None:
- insight = client.security_center.insights.get(
+ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ insight = await async_client.security_center.insights.list(
account_id="account_id",
dismissed=False,
issue_class=["a_record_dangling", "always_use_https_not_enabled"],
@@ -108,48 +176,44 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None:
subject=["example.com"],
subject_neq=["example.com"],
)
- assert_matches_type(Optional[InsightGetResponse], insight, path=["response"])
+ assert_matches_type(AsyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
@parametrize
- def test_raw_response_get(self, client: Cloudflare) -> None:
- response = client.security_center.insights.with_raw_response.get(
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.security_center.insights.with_raw_response.list(
account_id="account_id",
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- insight = response.parse()
- assert_matches_type(Optional[InsightGetResponse], insight, path=["response"])
+ insight = await response.parse()
+ assert_matches_type(AsyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
@parametrize
- def test_streaming_response_get(self, client: Cloudflare) -> None:
- with client.security_center.insights.with_streaming_response.get(
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.security_center.insights.with_streaming_response.list(
account_id="account_id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- insight = response.parse()
- assert_matches_type(Optional[InsightGetResponse], insight, path=["response"])
+ insight = await response.parse()
+ assert_matches_type(AsyncV4PagePagination[Optional[InsightListResponse]], insight, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
- def test_path_params_get(self, client: Cloudflare) -> None:
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"You must provide either account_id or zone_id"):
- client.security_center.insights.with_raw_response.get(
+ await async_client.security_center.insights.with_raw_response.list(
account_id="",
)
with pytest.raises(ValueError, match=r"You must provide either account_id or zone_id"):
- client.security_center.insights.with_raw_response.get(
+ await async_client.security_center.insights.with_raw_response.list(
account_id="account_id",
)
-
-class TestAsyncInsights:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
@parametrize
async def test_method_dismiss(self, async_client: AsyncCloudflare) -> None:
insight = await async_client.security_center.insights.dismiss(
@@ -212,66 +276,3 @@ async def test_path_params_dismiss(self, async_client: AsyncCloudflare) -> None:
issue_id="issue_id",
account_id="account_id",
)
-
- @parametrize
- async def test_method_get(self, async_client: AsyncCloudflare) -> None:
- insight = await async_client.security_center.insights.get(
- account_id="account_id",
- )
- assert_matches_type(Optional[InsightGetResponse], insight, path=["response"])
-
- @parametrize
- async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None:
- insight = await async_client.security_center.insights.get(
- account_id="account_id",
- dismissed=False,
- issue_class=["a_record_dangling", "always_use_https_not_enabled"],
- issue_class_neq=["a_record_dangling", "always_use_https_not_enabled"],
- issue_type=["compliance_violation", "email_security"],
- issue_type_neq=["compliance_violation", "email_security"],
- page=1,
- per_page=25,
- product=["access", "dns"],
- product_neq=["access", "dns"],
- severity=["low", "moderate"],
- severity_neq=["low", "moderate"],
- subject=["example.com"],
- subject_neq=["example.com"],
- )
- assert_matches_type(Optional[InsightGetResponse], insight, path=["response"])
-
- @parametrize
- async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
- response = await async_client.security_center.insights.with_raw_response.get(
- account_id="account_id",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- insight = await response.parse()
- assert_matches_type(Optional[InsightGetResponse], insight, path=["response"])
-
- @parametrize
- async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
- async with async_client.security_center.insights.with_streaming_response.get(
- account_id="account_id",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- insight = await response.parse()
- assert_matches_type(Optional[InsightGetResponse], insight, 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"You must provide either account_id or zone_id"):
- await async_client.security_center.insights.with_raw_response.get(
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"You must provide either account_id or zone_id"):
- await async_client.security_center.insights.with_raw_response.get(
- account_id="account_id",
- )