From 45d403a408e1f4653fa66d9273b4976d7099e8cc Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Mon, 15 Apr 2024 20:45:04 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- api.md | 8 ++++---- .../resources/dns/analytics/reports/bytimes.py | 10 +++++----- .../resources/dns/analytics/reports/reports.py | 10 +++++----- .../dns/firewall/analytics/reports/bytimes.py | 10 +++++----- .../dns/firewall/analytics/reports/reports.py | 10 +++++----- .../dns/analytics/reports/test_bytimes.py | 18 +++++++++--------- .../dns/analytics/test_reports.py | 18 +++++++++--------- .../firewall/analytics/reports/test_bytimes.py | 18 +++++++++--------- .../dns/firewall/analytics/test_reports.py | 18 +++++++++--------- 9 files changed, 60 insertions(+), 60 deletions(-) diff --git a/api.md b/api.md index b46fe3eb4bc..4ae48b9e3f5 100644 --- a/api.md +++ b/api.md @@ -1647,7 +1647,7 @@ from cloudflare.types.dns.analytics import Report Methods: -- client.dns.analytics.reports.get(\*, zone_id, \*\*params) -> Report +- client.dns.analytics.reports.get(\*, zone_id, \*\*params) -> Optional #### Bytimes @@ -1659,7 +1659,7 @@ from cloudflare.types.dns.analytics.reports import ByTime Methods: -- client.dns.analytics.reports.bytimes.get(\*, zone_id, \*\*params) -> ByTime +- client.dns.analytics.reports.bytimes.get(\*, zone_id, \*\*params) -> Optional ## FirewallResource @@ -1689,13 +1689,13 @@ Methods: Methods: -- client.dns.firewall.analytics.reports.get(dns_firewall_id, \*, account_id, \*\*params) -> Report +- client.dns.firewall.analytics.reports.get(dns_firewall_id, \*, account_id, \*\*params) -> Optional ##### Bytimes Methods: -- client.dns.firewall.analytics.reports.bytimes.get(dns_firewall_id, \*, account_id, \*\*params) -> ByTime +- client.dns.firewall.analytics.reports.bytimes.get(dns_firewall_id, \*, account_id, \*\*params) -> Optional # DNSSECResource diff --git a/src/cloudflare/resources/dns/analytics/reports/bytimes.py b/src/cloudflare/resources/dns/analytics/reports/bytimes.py index e228c82e87d..423db9ce185 100644 --- a/src/cloudflare/resources/dns/analytics/reports/bytimes.py +++ b/src/cloudflare/resources/dns/analytics/reports/bytimes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -58,7 +58,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -118,7 +118,7 @@ def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ByTime], ResultWrapper[ByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) @@ -150,7 +150,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -210,7 +210,7 @@ async def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ByTime], ResultWrapper[ByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) diff --git a/src/cloudflare/resources/dns/analytics/reports/reports.py b/src/cloudflare/resources/dns/analytics/reports/reports.py index bd4f7e91bd7..dc56da7d19c 100644 --- a/src/cloudflare/resources/dns/analytics/reports/reports.py +++ b/src/cloudflare/resources/dns/analytics/reports/reports.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime import httpx @@ -67,7 +67,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Report: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -124,7 +124,7 @@ def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Report], ResultWrapper[Report]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) @@ -158,7 +158,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Report: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -215,7 +215,7 @@ async def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Report], ResultWrapper[Report]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py b/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py index 8f85b980eed..64fb6391f70 100644 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py +++ b/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime from typing_extensions import Literal @@ -60,7 +60,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -124,7 +124,7 @@ def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ByTime], ResultWrapper[ByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) @@ -157,7 +157,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ByTime: + ) -> Optional[ByTime]: """ Retrieves a list of aggregate metrics grouped by time interval. @@ -221,7 +221,7 @@ async def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[ByTime], ResultWrapper[ByTime]), + cast_to=cast(Type[Optional[ByTime]], ResultWrapper[ByTime]), ) diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py b/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py index 5dd9b793eb8..de4f5b5d806 100644 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py +++ b/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, cast +from typing import Type, Union, Optional, cast from datetime import datetime import httpx @@ -69,7 +69,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Report: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -130,7 +130,7 @@ def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Report], ResultWrapper[Report]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) @@ -165,7 +165,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Report: + ) -> Optional[Report]: """ Retrieves a list of summarised aggregate metrics over a given time period. @@ -226,7 +226,7 @@ async def get( ), post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Report], ResultWrapper[Report]), + cast_to=cast(Type[Optional[Report]], ResultWrapper[Report]), ) diff --git a/tests/api_resources/dns/analytics/reports/test_bytimes.py b/tests/api_resources/dns/analytics/reports/test_bytimes.py index b8511b80776..759ac8524ba 100644 --- a/tests/api_resources/dns/analytics/reports/test_bytimes.py +++ b/tests/api_resources/dns/analytics/reports/test_bytimes.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: bytime = client.dns.analytics.reports.bytimes.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -40,7 +40,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -52,7 +52,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +64,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +86,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: bytime = await async_client.dns.analytics.reports.bytimes.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +102,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -114,7 +114,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = await response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = await response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/analytics/test_reports.py b/tests/api_resources/dns/analytics/test_reports.py index de2a91d12a3..e91585a73ec 100644 --- a/tests/api_resources/dns/analytics/test_reports.py +++ b/tests/api_resources/dns/analytics/test_reports.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -24,7 +24,7 @@ def test_method_get(self, client: Cloudflare) -> None: report = client.dns.analytics.reports.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -39,7 +39,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -51,7 +51,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +85,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: report = await async_client.dns.analytics.reports.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = await response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -124,7 +124,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = await response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py b/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py index d12af1f3dfb..ba39224909a 100644 --- a/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py +++ b/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -42,7 +42,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +55,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +68,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +98,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +115,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - time_delta="hour", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -128,7 +128,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = await response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +141,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" bytime = await response.parse() - assert_matches_type(ByTime, bytime, path=["response"]) + assert_matches_type(Optional[ByTime], bytime, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/dns/firewall/analytics/test_reports.py b/tests/api_resources/dns/firewall/analytics/test_reports.py index 295c315f8b0..32369b249a7 100644 --- a/tests/api_resources/dns/firewall/analytics/test_reports.py +++ b/tests/api_resources/dns/firewall/analytics/test_reports.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -54,7 +54,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,7 +67,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True @@ -97,7 +97,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +113,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - sort="+responseCode,-queryName", until=parse_datetime("2023-11-11T13:00:00Z"), ) - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -126,7 +126,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = await response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +139,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" report = await response.parse() - assert_matches_type(Report, report, path=["response"]) + assert_matches_type(Optional[Report], report, path=["response"]) assert cast(Any, response.is_closed) is True