From ee85bf180b6b32b28ef05de2642c53a837721d3f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 08:59:40 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#788) --- .stats.yml | 2 +- api.md | 11 ++++--- .../resources/rulesets/phases/phases.py | 11 +------ .../resources/rulesets/phases/versions.py | 14 ++++---- src/cloudflare/resources/rulesets/rulesets.py | 14 ++++---- .../resources/rulesets/versions/versions.py | 14 ++++---- src/cloudflare/types/rulesets/__init__.py | 3 +- .../types/rulesets/phase_update_params.py | 4 --- .../types/rulesets/phases/__init__.py | 1 + .../rulesets/phases/version_list_response.py | 33 +++++++++++++++++++ .../{ruleset.py => ruleset_list_response.py} | 22 ++++++------- .../types/rulesets/version_list_response.py | 33 +++++++++++++++++++ .../rulesets/phases/test_versions.py | 19 +++++------ tests/api_resources/rulesets/test_phases.py | 2 -- tests/api_resources/rulesets/test_versions.py | 18 +++++----- tests/api_resources/test_rulesets.py | 18 +++++----- 16 files changed, 136 insertions(+), 83 deletions(-) create mode 100644 src/cloudflare/types/rulesets/phases/version_list_response.py rename src/cloudflare/types/rulesets/{ruleset.py => ruleset_list_response.py} (81%) create mode 100644 src/cloudflare/types/rulesets/version_list_response.py diff --git a/.stats.yml b/.stats.yml index 036bd6a320f..4d1193a3b2b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1335 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e83b5eb5706ca8b525141f506338cd1d465eb133815b9ddc53df612ea4a2ecef.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0be7a22d1cc24a2a63cf7c7d9324fa078990d35e80629e2cbd28b9838940d75d.yml diff --git a/api.md b/api.md index 26ae9445536..14aaae3917c 100644 --- a/api.md +++ b/api.md @@ -3165,6 +3165,7 @@ from cloudflare.types.rulesets import ( Ruleset, RulesetCreateResponse, RulesetUpdateResponse, + RulesetListResponse, RulesetGetResponse, ) ``` @@ -3173,7 +3174,7 @@ Methods: - client.rulesets.create(\*, account_id, zone_id, \*\*params) -> RulesetCreateResponse - client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> RulesetUpdateResponse -- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[Ruleset] +- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[RulesetListResponse] - client.rulesets.delete(ruleset_id, \*, account_id, zone_id) -> None - client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetGetResponse @@ -3195,12 +3196,12 @@ Methods: Types: ```python -from cloudflare.types.rulesets.phases import VersionGetResponse +from cloudflare.types.rulesets.phases import VersionListResponse, VersionGetResponse ``` Methods: -- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[Ruleset] +- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] - client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> VersionGetResponse ## Rules @@ -3244,12 +3245,12 @@ Methods: Types: ```python -from cloudflare.types.rulesets import VersionGetResponse +from cloudflare.types.rulesets import VersionListResponse, VersionGetResponse ``` Methods: -- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[Ruleset] +- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] - client.rulesets.versions.delete(ruleset_version, \*, ruleset_id, account_id, zone_id) -> None - client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> VersionGetResponse diff --git a/src/cloudflare/resources/rulesets/phases/phases.py b/src/cloudflare/resources/rulesets/phases/phases.py index 5cb0317d0fa..c95aafd532f 100644 --- a/src/cloudflare/resources/rulesets/phases/phases.py +++ b/src/cloudflare/resources/rulesets/phases/phases.py @@ -31,8 +31,7 @@ from ...._base_client import ( make_request_options, ) -from ....types.rulesets import Kind, Phase, phase_update_params -from ....types.rulesets.kind import Kind +from ....types.rulesets import Phase, phase_update_params from ....types.rulesets.phase import Phase from ....types.rulesets.phase_get_response import PhaseGetResponse from ....types.rulesets.phase_update_response import PhaseUpdateResponse @@ -61,7 +60,6 @@ def update( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - kind: Kind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, phase: Phase | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -85,8 +83,6 @@ def update( description: An informative description of the ruleset. - kind: The kind of the ruleset. - name: The human-readable name of the ruleset. phase: The phase of the ruleset. @@ -119,7 +115,6 @@ def update( { "rules": rules, "description": description, - "kind": kind, "name": name, "phase": phase, }, @@ -215,7 +210,6 @@ async def update( account_id: str | NotGiven = NOT_GIVEN, zone_id: str | NotGiven = NOT_GIVEN, description: str | NotGiven = NOT_GIVEN, - kind: Kind | NotGiven = NOT_GIVEN, name: str | NotGiven = NOT_GIVEN, phase: Phase | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -239,8 +233,6 @@ async def update( description: An informative description of the ruleset. - kind: The kind of the ruleset. - name: The human-readable name of the ruleset. phase: The phase of the ruleset. @@ -273,7 +265,6 @@ async def update( { "rules": rules, "description": description, - "kind": kind, "name": name, "phase": phase, }, diff --git a/src/cloudflare/resources/rulesets/phases/versions.py b/src/cloudflare/resources/rulesets/phases/versions.py index 60967a5872f..93fbc705d12 100644 --- a/src/cloudflare/resources/rulesets/phases/versions.py +++ b/src/cloudflare/resources/rulesets/phases/versions.py @@ -23,8 +23,8 @@ ) from ....types.rulesets import Phase from ....types.rulesets.phase import Phase -from ....types.rulesets.ruleset import Ruleset from ....types.rulesets.phases.version_get_response import VersionGetResponse +from ....types.rulesets.phases.version_list_response import VersionListResponse __all__ = ["VersionsResource", "AsyncVersionsResource"] @@ -50,7 +50,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Ruleset]: + ) -> SyncSinglePage[VersionListResponse]: """ Fetches the versions of an account or zone entry point ruleset. @@ -85,11 +85,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions", - page=SyncSinglePage[Ruleset], + page=SyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) def get( @@ -176,7 +176,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: + ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: """ Fetches the versions of an account or zone entry point ruleset. @@ -211,11 +211,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions", - page=AsyncSinglePage[Ruleset], + page=AsyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) async def get( diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py index f28542d39f5..7347798d5fd 100644 --- a/src/cloudflare/resources/rulesets/rulesets.py +++ b/src/cloudflare/resources/rulesets/rulesets.py @@ -54,8 +54,8 @@ from .versions.versions import VersionsResource, AsyncVersionsResource from ...types.rulesets.kind import Kind from ...types.rulesets.phase import Phase -from ...types.rulesets.ruleset import Ruleset from ...types.rulesets.ruleset_get_response import RulesetGetResponse +from ...types.rulesets.ruleset_list_response import RulesetListResponse from ...types.rulesets.ruleset_create_response import RulesetCreateResponse from ...types.rulesets.ruleset_update_response import RulesetUpdateResponse @@ -253,7 +253,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Ruleset]: + ) -> SyncSinglePage[RulesetListResponse]: """ Fetches all rulesets. @@ -284,11 +284,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", - page=SyncSinglePage[Ruleset], + page=SyncSinglePage[RulesetListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=RulesetListResponse, ) def delete( @@ -594,7 +594,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: + ) -> AsyncPaginator[RulesetListResponse, AsyncSinglePage[RulesetListResponse]]: """ Fetches all rulesets. @@ -625,11 +625,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", - page=AsyncSinglePage[Ruleset], + page=AsyncSinglePage[RulesetListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=RulesetListResponse, ) async def delete( diff --git a/src/cloudflare/resources/rulesets/versions/versions.py b/src/cloudflare/resources/rulesets/versions/versions.py index 134fb1882b9..d19afd50795 100644 --- a/src/cloudflare/resources/rulesets/versions/versions.py +++ b/src/cloudflare/resources/rulesets/versions/versions.py @@ -29,8 +29,8 @@ AsyncPaginator, make_request_options, ) -from ....types.rulesets.ruleset import Ruleset from ....types.rulesets.version_get_response import VersionGetResponse +from ....types.rulesets.version_list_response import VersionListResponse __all__ = ["VersionsResource", "AsyncVersionsResource"] @@ -60,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Ruleset]: + ) -> SyncSinglePage[VersionListResponse]: """ Fetches the versions of an account or zone ruleset. @@ -95,11 +95,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions", - page=SyncSinglePage[Ruleset], + page=SyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) def delete( @@ -249,7 +249,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]: + ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: """ Fetches the versions of an account or zone ruleset. @@ -284,11 +284,11 @@ def list( account_or_zone_id = zone_id return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions", - page=AsyncSinglePage[Ruleset], + page=AsyncSinglePage[VersionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Ruleset, + model=VersionListResponse, ) async def delete( diff --git a/src/cloudflare/types/rulesets/__init__.py b/src/cloudflare/types/rulesets/__init__.py index d5b6a67cb87..8b6885eb3fd 100644 --- a/src/cloudflare/types/rulesets/__init__.py +++ b/src/cloudflare/types/rulesets/__init__.py @@ -5,7 +5,6 @@ from .kind import Kind as Kind from .phase import Phase as Phase from .logging import Logging as Logging -from .ruleset import Ruleset as Ruleset from .log_rule import LogRule as LogRule from .skip_rule import SkipRule as SkipRule from .block_rule import BlockRule as BlockRule @@ -40,8 +39,10 @@ from .version_get_response import VersionGetResponse as VersionGetResponse from .phase_update_response import PhaseUpdateResponse as PhaseUpdateResponse from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams +from .ruleset_list_response import RulesetListResponse as RulesetListResponse from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams from .set_config_rule_param import SetConfigRuleParam as SetConfigRuleParam +from .version_list_response import VersionListResponse as VersionListResponse from .compress_response_rule import CompressResponseRule as CompressResponseRule from .managed_challenge_rule import ManagedChallengeRule as ManagedChallengeRule from .rewrite_uri_part_param import RewriteURIPartParam as RewriteURIPartParam diff --git a/src/cloudflare/types/rulesets/phase_update_params.py b/src/cloudflare/types/rulesets/phase_update_params.py index 27f4398d8c9..41cf834d9cf 100644 --- a/src/cloudflare/types/rulesets/phase_update_params.py +++ b/src/cloudflare/types/rulesets/phase_update_params.py @@ -5,7 +5,6 @@ from typing import Union, Iterable from typing_extensions import Literal, Required, TypedDict -from .kind import Kind from .phase import Phase from .logging_param import LoggingParam from .log_rule_param import LogRuleParam @@ -50,9 +49,6 @@ class PhaseUpdateParams(TypedDict, total=False): description: str """An informative description of the ruleset.""" - kind: Kind - """The kind of the ruleset.""" - name: str """The human-readable name of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/phases/__init__.py b/src/cloudflare/types/rulesets/phases/__init__.py index 398f2bd04ad..5a719b3e523 100644 --- a/src/cloudflare/types/rulesets/phases/__init__.py +++ b/src/cloudflare/types/rulesets/phases/__init__.py @@ -3,3 +3,4 @@ from __future__ import annotations from .version_get_response import VersionGetResponse as VersionGetResponse +from .version_list_response import VersionListResponse as VersionListResponse diff --git a/src/cloudflare/types/rulesets/phases/version_list_response.py b/src/cloudflare/types/rulesets/phases/version_list_response.py new file mode 100644 index 00000000000..921e1de8c40 --- /dev/null +++ b/src/cloudflare/types/rulesets/phases/version_list_response.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from ..kind import Kind +from ..phase import Phase +from ...._models import BaseModel + +__all__ = ["VersionListResponse"] + + +class VersionListResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Kind + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Phase + """The phase of the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/ruleset.py b/src/cloudflare/types/rulesets/ruleset_list_response.py similarity index 81% rename from src/cloudflare/types/rulesets/ruleset.py rename to src/cloudflare/types/rulesets/ruleset_list_response.py index a570fcc344d..582742290a7 100644 --- a/src/cloudflare/types/rulesets/ruleset.py +++ b/src/cloudflare/types/rulesets/ruleset_list_response.py @@ -7,27 +7,27 @@ from .phase import Phase from ..._models import BaseModel -__all__ = ["Ruleset"] +__all__ = ["RulesetListResponse"] -class Ruleset(BaseModel): +class RulesetListResponse(BaseModel): id: str """The unique ID of the ruleset.""" + kind: Kind + """The kind of the ruleset.""" + last_updated: datetime """The timestamp of when the ruleset was last modified.""" + name: str + """The human-readable name of the ruleset.""" + + phase: Phase + """The phase of the ruleset.""" + version: str """The version of the ruleset.""" description: Optional[str] = None """An informative description of the ruleset.""" - - kind: Optional[Kind] = None - """The kind of the ruleset.""" - - name: Optional[str] = None - """The human-readable name of the ruleset.""" - - phase: Optional[Phase] = None - """The phase of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/version_list_response.py b/src/cloudflare/types/rulesets/version_list_response.py new file mode 100644 index 00000000000..bfc8b80491c --- /dev/null +++ b/src/cloudflare/types/rulesets/version_list_response.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .kind import Kind +from .phase import Phase +from ..._models import BaseModel + +__all__ = ["VersionListResponse"] + + +class VersionListResponse(BaseModel): + id: str + """The unique ID of the ruleset.""" + + kind: Kind + """The kind of the ruleset.""" + + last_updated: datetime + """The timestamp of when the ruleset was last modified.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Phase + """The phase of the ruleset.""" + + version: str + """The version of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" diff --git a/tests/api_resources/rulesets/phases/test_versions.py b/tests/api_resources/rulesets/phases/test_versions.py index 7c88a7ef7f8..f763170399e 100644 --- a/tests/api_resources/rulesets/phases/test_versions.py +++ b/tests/api_resources/rulesets/phases/test_versions.py @@ -10,8 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.rulesets import Ruleset -from cloudflare.types.rulesets.phases import VersionGetResponse +from cloudflare.types.rulesets.phases import VersionGetResponse, VersionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "http_request_firewall_custom", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -35,7 +34,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "http_request_firewall_custom", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -48,7 +47,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -61,7 +60,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -165,7 +164,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "http_request_firewall_custom", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -174,7 +173,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "http_request_firewall_custom", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -187,7 +186,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -200,7 +199,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/test_phases.py b/tests/api_resources/rulesets/test_phases.py index 40462f29ea8..447be7922ae 100644 --- a/tests/api_resources/rulesets/test_phases.py +++ b/tests/api_resources/rulesets/test_phases.py @@ -84,7 +84,6 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: ], account_id="string", description="My ruleset to execute managed rulesets", - kind="root", name="My ruleset", phase="http_request_firewall_custom", ) @@ -269,7 +268,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare ], account_id="string", description="My ruleset to execute managed rulesets", - kind="root", name="My ruleset", phase="http_request_firewall_custom", ) diff --git a/tests/api_resources/rulesets/test_versions.py b/tests/api_resources/rulesets/test_versions.py index 1fd08c4b629..3106292143c 100644 --- a/tests/api_resources/rulesets/test_versions.py +++ b/tests/api_resources/rulesets/test_versions.py @@ -10,7 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.rulesets import Ruleset, VersionGetResponse +from cloudflare.types.rulesets import VersionGetResponse, VersionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -34,7 +34,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -47,7 +47,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -60,7 +60,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(SyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -258,7 +258,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -267,7 +267,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) "2f2feab2026849078ba485f918791bdc", account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -280,7 +280,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -293,7 +293,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(AsyncSinglePage[Ruleset], version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_rulesets.py b/tests/api_resources/test_rulesets.py index ae2f1c54dc7..97d3d27207e 100644 --- a/tests/api_resources/test_rulesets.py +++ b/tests/api_resources/test_rulesets.py @@ -11,8 +11,8 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.rulesets import ( - Ruleset, RulesetGetResponse, + RulesetListResponse, RulesetCreateResponse, RulesetUpdateResponse, ) @@ -285,7 +285,7 @@ def test_method_list(self, client: Cloudflare) -> None: ruleset = client.rulesets.list( account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -293,7 +293,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: ruleset = client.rulesets.list( account_id="string", ) - assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -305,7 +305,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -317,7 +317,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(SyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -734,7 +734,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: ruleset = await async_client.rulesets.list( account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -742,7 +742,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) ruleset = await async_client.rulesets.list( account_id="string", ) - assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -754,7 +754,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize @@ -766,7 +766,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(AsyncSinglePage[Ruleset], ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True