From 9f3a5e7f010ab9e8544ac8132ce7fff857b72b59 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 13:56:24 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#148) --- .stats.yml | 2 +- api.md | 40 --- src/cloudflare/resources/dns/__init__.py | 14 - .../resources/dns/analytics/__init__.py | 33 -- .../resources/dns/analytics/analytics.py | 81 ----- .../dns/analytics/reports/__init__.py | 33 -- .../dns/analytics/reports/bytimes.py | 250 ---------------- .../dns/analytics/reports/reports.py | 271 ----------------- src/cloudflare/resources/dns/dns.py | 33 -- .../resources/dns/firewall/__init__.py | 14 - .../dns/firewall/analytics/__init__.py | 33 -- .../dns/firewall/analytics/analytics.py | 81 ----- .../firewall/analytics/reports/__init__.py | 33 -- .../dns/firewall/analytics/reports/bytimes.py | 261 ---------------- .../dns/firewall/analytics/reports/reports.py | 282 ------------------ .../resources/dns/firewall/firewall.py | 33 -- .../types/dns/analytics/__init__.py | 3 - .../analytics/dns_dns_analytics_api_report.py | 79 ----- .../types/dns/analytics/report_get_params.py | 37 --- .../types/dns/analytics/reports/__init__.py | 3 - .../analytics/reports/bytime_get_params.py | 40 --- .../dns_dns_analytics_api_report_bytime.py | 93 ------ .../types/dns/firewall/analytics/__init__.py | 2 - .../firewall/analytics/report_get_params.py | 40 --- .../firewall/analytics/reports/__init__.py | 2 - .../analytics/reports/bytime_get_params.py | 43 --- .../dns/analytics/reports/test_bytimes.py | 139 --------- .../dns/analytics/test_reports.py | 137 --------- .../analytics/reports/test_bytimes.py | 161 ---------- .../dns/firewall/analytics/test_reports.py | 159 ---------- 30 files changed, 1 insertion(+), 2431 deletions(-) delete mode 100644 src/cloudflare/resources/dns/analytics/__init__.py delete mode 100644 src/cloudflare/resources/dns/analytics/analytics.py delete mode 100644 src/cloudflare/resources/dns/analytics/reports/__init__.py delete mode 100644 src/cloudflare/resources/dns/analytics/reports/bytimes.py delete mode 100644 src/cloudflare/resources/dns/analytics/reports/reports.py delete mode 100644 src/cloudflare/resources/dns/firewall/analytics/__init__.py delete mode 100644 src/cloudflare/resources/dns/firewall/analytics/analytics.py delete mode 100644 src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py delete mode 100644 src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py delete mode 100644 src/cloudflare/resources/dns/firewall/analytics/reports/reports.py delete mode 100644 src/cloudflare/types/dns/analytics/dns_dns_analytics_api_report.py delete mode 100644 src/cloudflare/types/dns/analytics/report_get_params.py delete mode 100644 src/cloudflare/types/dns/analytics/reports/bytime_get_params.py delete mode 100644 src/cloudflare/types/dns/analytics/reports/dns_dns_analytics_api_report_bytime.py delete mode 100644 src/cloudflare/types/dns/firewall/analytics/report_get_params.py delete mode 100644 src/cloudflare/types/dns/firewall/analytics/reports/bytime_get_params.py delete mode 100644 tests/api_resources/dns/analytics/reports/test_bytimes.py delete mode 100644 tests/api_resources/dns/analytics/test_reports.py delete mode 100644 tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py delete mode 100644 tests/api_resources/dns/firewall/analytics/test_reports.py diff --git a/.stats.yml b/.stats.yml index cb1412e7ab3..35e5522baf1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 1288 +configured_endpoints: 1284 diff --git a/api.md b/api.md index e898ed3f6c8..e10b255f7d6 100644 --- a/api.md +++ b/api.md @@ -1688,32 +1688,6 @@ Methods: - client.dns.records.import\_(\*, zone_id, \*\*params) -> RecordImportResponse - client.dns.records.scan(\*, zone_id) -> RecordScanResponse -## Analytics - -### Reports - -Types: - -```python -from cloudflare.types.dns.analytics import DNSDNSAnalyticsAPIReport -``` - -Methods: - -- client.dns.analytics.reports.get(identifier, \*\*params) -> DNSDNSAnalyticsAPIReport - -#### Bytimes - -Types: - -```python -from cloudflare.types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime -``` - -Methods: - -- client.dns.analytics.reports.bytimes.get(identifier, \*\*params) -> DNSDNSAnalyticsAPIReportBytime - ## Firewall Types: @@ -1730,20 +1704,6 @@ Methods: - client.dns.firewall.edit(dns_firewall_id, \*, account_id, \*\*params) -> DNSFirewallDNSFirewall - client.dns.firewall.get(dns_firewall_id, \*, account_id) -> DNSFirewallDNSFirewall -### Analytics - -#### Reports - -Methods: - -- client.dns.firewall.analytics.reports.get(identifier, \*, account_identifier, \*\*params) -> DNSDNSAnalyticsAPIReport - -##### Bytimes - -Methods: - -- client.dns.firewall.analytics.reports.bytimes.get(identifier, \*, account_identifier, \*\*params) -> DNSDNSAnalyticsAPIReportBytime - # DNSSEC Types: diff --git a/src/cloudflare/resources/dns/__init__.py b/src/cloudflare/resources/dns/__init__.py index bec5b418f44..a7bcb514c50 100644 --- a/src/cloudflare/resources/dns/__init__.py +++ b/src/cloudflare/resources/dns/__init__.py @@ -24,14 +24,6 @@ FirewallWithStreamingResponse, AsyncFirewallWithStreamingResponse, ) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) __all__ = [ "Records", @@ -40,12 +32,6 @@ "AsyncRecordsWithRawResponse", "RecordsWithStreamingResponse", "AsyncRecordsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", "Firewall", "AsyncFirewall", "FirewallWithRawResponse", diff --git a/src/cloudflare/resources/dns/analytics/__init__.py b/src/cloudflare/resources/dns/analytics/__init__.py deleted file mode 100644 index 15d7a4bfd5f..00000000000 --- a/src/cloudflare/resources/dns/analytics/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, -) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) - -__all__ = [ - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/dns/analytics/analytics.py b/src/cloudflare/resources/dns/analytics/analytics.py deleted file mode 100644 index 58181bd95e1..00000000000 --- a/src/cloudflare/resources/dns/analytics/analytics.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, -) -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from .reports.reports import Reports, AsyncReports - -__all__ = ["Analytics", "AsyncAnalytics"] - - -class Analytics(SyncAPIResource): - @cached_property - def reports(self) -> Reports: - return Reports(self._client) - - @cached_property - def with_raw_response(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self) - - -class AsyncAnalytics(AsyncAPIResource): - @cached_property - def reports(self) -> AsyncReports: - return AsyncReports(self._client) - - @cached_property - def with_raw_response(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self) - - -class AnalyticsWithRawResponse: - def __init__(self, analytics: Analytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self._analytics.reports) - - -class AsyncAnalyticsWithRawResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self._analytics.reports) - - -class AnalyticsWithStreamingResponse: - def __init__(self, analytics: Analytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self._analytics.reports) - - -class AsyncAnalyticsWithStreamingResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self._analytics.reports) diff --git a/src/cloudflare/resources/dns/analytics/reports/__init__.py b/src/cloudflare/resources/dns/analytics/reports/__init__.py deleted file mode 100644 index 863e89438cf..00000000000 --- a/src/cloudflare/resources/dns/analytics/reports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, -) -from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, -) - -__all__ = [ - "Bytimes", - "AsyncBytimes", - "BytimesWithRawResponse", - "AsyncBytimesWithRawResponse", - "BytimesWithStreamingResponse", - "AsyncBytimesWithStreamingResponse", - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/dns/analytics/reports/bytimes.py b/src/cloudflare/resources/dns/analytics/reports/bytimes.py deleted file mode 100644 index 09b725b6e6f..00000000000 --- a/src/cloudflare/resources/dns/analytics/reports/bytimes.py +++ /dev/null @@ -1,250 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Union, cast -from datetime import datetime -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 ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from ....._base_client import ( - make_request_options, -) -from .....types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime, bytime_get_params - -__all__ = ["Bytimes", "AsyncBytimes"] - - -class Bytimes(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self) - - def get( - self, - identifier: str, - *, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReportBytime: - """ - Retrieves a list of aggregate metrics grouped by time interval. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - time_delta: Unit of time to group data by. - - until: End date and time of requesting data period in ISO 8601 format. - - 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 identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/zones/{identifier}/dns_analytics/report/bytime", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "time_delta": time_delta, - "until": until, - }, - bytime_get_params.BytimeGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]), - ) - - -class AsyncBytimes(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self) - - async def get( - self, - identifier: str, - *, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReportBytime: - """ - Retrieves a list of aggregate metrics grouped by time interval. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - time_delta: Unit of time to group data by. - - until: End date and time of requesting data period in ISO 8601 format. - - 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 identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/zones/{identifier}/dns_analytics/report/bytime", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "time_delta": time_delta, - "until": until, - }, - bytime_get_params.BytimeGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]), - ) - - -class BytimesWithRawResponse: - def __init__(self, bytimes: Bytimes) -> None: - self._bytimes = bytimes - - self.get = to_raw_response_wrapper( - bytimes.get, - ) - - -class AsyncBytimesWithRawResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: - self._bytimes = bytimes - - self.get = async_to_raw_response_wrapper( - bytimes.get, - ) - - -class BytimesWithStreamingResponse: - def __init__(self, bytimes: Bytimes) -> None: - self._bytimes = bytimes - - self.get = to_streamed_response_wrapper( - bytimes.get, - ) - - -class AsyncBytimesWithStreamingResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: - self._bytimes = bytimes - - self.get = async_to_streamed_response_wrapper( - bytimes.get, - ) diff --git a/src/cloudflare/resources/dns/analytics/reports/reports.py b/src/cloudflare/resources/dns/analytics/reports/reports.py deleted file mode 100644 index 5a6766d0162..00000000000 --- a/src/cloudflare/resources/dns/analytics/reports/reports.py +++ /dev/null @@ -1,271 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Union, cast -from datetime import datetime - -import httpx - -from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, -) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( - maybe_transform, - async_maybe_transform, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from ....._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....._wrappers import ResultWrapper -from ....._base_client import ( - make_request_options, -) -from .....types.dns.analytics import DNSDNSAnalyticsAPIReport, report_get_params - -__all__ = ["Reports", "AsyncReports"] - - -class Reports(SyncAPIResource): - @cached_property - def bytimes(self) -> Bytimes: - return Bytimes(self._client) - - @cached_property - def with_raw_response(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self) - - def get( - self, - identifier: str, - *, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReport: - """ - Retrieves a list of summarised aggregate metrics over a given time period. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - until: End date and time of requesting data period in ISO 8601 format. - - 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 identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/zones/{identifier}/dns_analytics/report", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "until": until, - }, - report_get_params.ReportGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]), - ) - - -class AsyncReports(AsyncAPIResource): - @cached_property - def bytimes(self) -> AsyncBytimes: - return AsyncBytimes(self._client) - - @cached_property - def with_raw_response(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self) - - async def get( - self, - identifier: str, - *, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReport: - """ - Retrieves a list of summarised aggregate metrics over a given time period. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - until: End date and time of requesting data period in ISO 8601 format. - - 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 identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/zones/{identifier}/dns_analytics/report", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "until": until, - }, - report_get_params.ReportGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]), - ) - - -class ReportsWithRawResponse: - def __init__(self, reports: Reports) -> None: - self._reports = reports - - self.get = to_raw_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self._reports.bytimes) - - -class AsyncReportsWithRawResponse: - def __init__(self, reports: AsyncReports) -> None: - self._reports = reports - - self.get = async_to_raw_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self._reports.bytimes) - - -class ReportsWithStreamingResponse: - def __init__(self, reports: Reports) -> None: - self._reports = reports - - self.get = to_streamed_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self._reports.bytimes) - - -class AsyncReportsWithStreamingResponse: - def __init__(self, reports: AsyncReports) -> None: - self._reports = reports - - self.get = async_to_streamed_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self._reports.bytimes) diff --git a/src/cloudflare/resources/dns/dns.py b/src/cloudflare/resources/dns/dns.py index 9107057d3d0..65d86fb1f4b 100644 --- a/src/cloudflare/resources/dns/dns.py +++ b/src/cloudflare/resources/dns/dns.py @@ -19,17 +19,8 @@ AsyncFirewallWithStreamingResponse, ) from ..._compat import cached_property -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) from ..._resource import SyncAPIResource, AsyncAPIResource from .firewall.firewall import Firewall, AsyncFirewall -from .analytics.analytics import Analytics, AsyncAnalytics __all__ = ["DNS", "AsyncDNS"] @@ -39,10 +30,6 @@ class DNS(SyncAPIResource): def records(self) -> Records: return Records(self._client) - @cached_property - def analytics(self) -> Analytics: - return Analytics(self._client) - @cached_property def firewall(self) -> Firewall: return Firewall(self._client) @@ -61,10 +48,6 @@ class AsyncDNS(AsyncAPIResource): def records(self) -> AsyncRecords: return AsyncRecords(self._client) - @cached_property - def analytics(self) -> AsyncAnalytics: - return AsyncAnalytics(self._client) - @cached_property def firewall(self) -> AsyncFirewall: return AsyncFirewall(self._client) @@ -86,10 +69,6 @@ def __init__(self, dns: DNS) -> None: def records(self) -> RecordsWithRawResponse: return RecordsWithRawResponse(self._dns.records) - @cached_property - def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._dns.analytics) - @cached_property def firewall(self) -> FirewallWithRawResponse: return FirewallWithRawResponse(self._dns.firewall) @@ -103,10 +82,6 @@ def __init__(self, dns: AsyncDNS) -> None: def records(self) -> AsyncRecordsWithRawResponse: return AsyncRecordsWithRawResponse(self._dns.records) - @cached_property - def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._dns.analytics) - @cached_property def firewall(self) -> AsyncFirewallWithRawResponse: return AsyncFirewallWithRawResponse(self._dns.firewall) @@ -120,10 +95,6 @@ def __init__(self, dns: DNS) -> None: def records(self) -> RecordsWithStreamingResponse: return RecordsWithStreamingResponse(self._dns.records) - @cached_property - def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._dns.analytics) - @cached_property def firewall(self) -> FirewallWithStreamingResponse: return FirewallWithStreamingResponse(self._dns.firewall) @@ -137,10 +108,6 @@ def __init__(self, dns: AsyncDNS) -> None: def records(self) -> AsyncRecordsWithStreamingResponse: return AsyncRecordsWithStreamingResponse(self._dns.records) - @cached_property - def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._dns.analytics) - @cached_property def firewall(self) -> AsyncFirewallWithStreamingResponse: return AsyncFirewallWithStreamingResponse(self._dns.firewall) diff --git a/src/cloudflare/resources/dns/firewall/__init__.py b/src/cloudflare/resources/dns/firewall/__init__.py index f2d282ba943..5aae845c03f 100644 --- a/src/cloudflare/resources/dns/firewall/__init__.py +++ b/src/cloudflare/resources/dns/firewall/__init__.py @@ -8,22 +8,8 @@ FirewallWithStreamingResponse, AsyncFirewallWithStreamingResponse, ) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) __all__ = [ - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", "Firewall", "AsyncFirewall", "FirewallWithRawResponse", diff --git a/src/cloudflare/resources/dns/firewall/analytics/__init__.py b/src/cloudflare/resources/dns/firewall/analytics/__init__.py deleted file mode 100644 index 15d7a4bfd5f..00000000000 --- a/src/cloudflare/resources/dns/firewall/analytics/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, -) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) - -__all__ = [ - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", - "Analytics", - "AsyncAnalytics", - "AnalyticsWithRawResponse", - "AsyncAnalyticsWithRawResponse", - "AnalyticsWithStreamingResponse", - "AsyncAnalyticsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/dns/firewall/analytics/analytics.py b/src/cloudflare/resources/dns/firewall/analytics/analytics.py deleted file mode 100644 index 4b98a9d710d..00000000000 --- a/src/cloudflare/resources/dns/firewall/analytics/analytics.py +++ /dev/null @@ -1,81 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, -) -from ....._compat import cached_property -from ....._resource import SyncAPIResource, AsyncAPIResource -from .reports.reports import Reports, AsyncReports - -__all__ = ["Analytics", "AsyncAnalytics"] - - -class Analytics(SyncAPIResource): - @cached_property - def reports(self) -> Reports: - return Reports(self._client) - - @cached_property - def with_raw_response(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self) - - -class AsyncAnalytics(AsyncAPIResource): - @cached_property - def reports(self) -> AsyncReports: - return AsyncReports(self._client) - - @cached_property - def with_raw_response(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self) - - -class AnalyticsWithRawResponse: - def __init__(self, analytics: Analytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self._analytics.reports) - - -class AsyncAnalyticsWithRawResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self._analytics.reports) - - -class AnalyticsWithStreamingResponse: - def __init__(self, analytics: Analytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self._analytics.reports) - - -class AsyncAnalyticsWithStreamingResponse: - def __init__(self, analytics: AsyncAnalytics) -> None: - self._analytics = analytics - - @cached_property - def reports(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self._analytics.reports) diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py b/src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py deleted file mode 100644 index 863e89438cf..00000000000 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, -) -from .reports import ( - Reports, - AsyncReports, - ReportsWithRawResponse, - AsyncReportsWithRawResponse, - ReportsWithStreamingResponse, - AsyncReportsWithStreamingResponse, -) - -__all__ = [ - "Bytimes", - "AsyncBytimes", - "BytimesWithRawResponse", - "AsyncBytimesWithRawResponse", - "BytimesWithStreamingResponse", - "AsyncBytimesWithStreamingResponse", - "Reports", - "AsyncReports", - "ReportsWithRawResponse", - "AsyncReportsWithRawResponse", - "ReportsWithStreamingResponse", - "AsyncReportsWithStreamingResponse", -] diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py b/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py deleted file mode 100644 index de2031daef4..00000000000 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/bytimes.py +++ /dev/null @@ -1,261 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Union, cast -from datetime import datetime -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 ......_compat import cached_property -from ......_resource import SyncAPIResource, AsyncAPIResource -from ......_response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ......_wrappers import ResultWrapper -from ......_base_client import ( - make_request_options, -) -from ......types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime -from ......types.dns.firewall.analytics.reports import bytime_get_params - -__all__ = ["Bytimes", "AsyncBytimes"] - - -class Bytimes(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self) - - def get( - self, - identifier: str, - *, - account_identifier: str, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReportBytime: - """ - Retrieves a list of aggregate metrics grouped by time interval. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - account_identifier: Identifier - - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - time_delta: Unit of time to group data by. - - until: End date and time of requesting data period in ISO 8601 format. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report/bytime", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "time_delta": time_delta, - "until": until, - }, - bytime_get_params.BytimeGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]), - ) - - -class AsyncBytimes(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self) - - async def get( - self, - identifier: str, - *, - account_identifier: str, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReportBytime: - """ - Retrieves a list of aggregate metrics grouped by time interval. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - account_identifier: Identifier - - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - time_delta: Unit of time to group data by. - - until: End date and time of requesting data period in ISO 8601 format. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report/bytime", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "time_delta": time_delta, - "until": until, - }, - bytime_get_params.BytimeGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReportBytime], ResultWrapper[DNSDNSAnalyticsAPIReportBytime]), - ) - - -class BytimesWithRawResponse: - def __init__(self, bytimes: Bytimes) -> None: - self._bytimes = bytimes - - self.get = to_raw_response_wrapper( - bytimes.get, - ) - - -class AsyncBytimesWithRawResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: - self._bytimes = bytimes - - self.get = async_to_raw_response_wrapper( - bytimes.get, - ) - - -class BytimesWithStreamingResponse: - def __init__(self, bytimes: Bytimes) -> None: - self._bytimes = bytimes - - self.get = to_streamed_response_wrapper( - bytimes.get, - ) - - -class AsyncBytimesWithStreamingResponse: - def __init__(self, bytimes: AsyncBytimes) -> None: - self._bytimes = bytimes - - self.get = async_to_streamed_response_wrapper( - bytimes.get, - ) diff --git a/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py b/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py deleted file mode 100644 index 277ace9fadd..00000000000 --- a/src/cloudflare/resources/dns/firewall/analytics/reports/reports.py +++ /dev/null @@ -1,282 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, Union, cast -from datetime import datetime - -import httpx - -from .bytimes import ( - Bytimes, - AsyncBytimes, - BytimesWithRawResponse, - AsyncBytimesWithRawResponse, - BytimesWithStreamingResponse, - AsyncBytimesWithStreamingResponse, -) -from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ......_utils import ( - maybe_transform, - async_maybe_transform, -) -from ......_compat import cached_property -from ......_resource import SyncAPIResource, AsyncAPIResource -from ......_response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ......_wrappers import ResultWrapper -from ......_base_client import ( - make_request_options, -) -from ......types.dns.analytics import DNSDNSAnalyticsAPIReport -from ......types.dns.firewall.analytics import report_get_params - -__all__ = ["Reports", "AsyncReports"] - - -class Reports(SyncAPIResource): - @cached_property - def bytimes(self) -> Bytimes: - return Bytimes(self._client) - - @cached_property - def with_raw_response(self) -> ReportsWithRawResponse: - return ReportsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ReportsWithStreamingResponse: - return ReportsWithStreamingResponse(self) - - def get( - self, - identifier: str, - *, - account_identifier: str, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReport: - """ - Retrieves a list of summarised aggregate metrics over a given time period. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - account_identifier: Identifier - - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - until: End date and time of requesting data period in ISO 8601 format. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( - f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "until": until, - }, - report_get_params.ReportGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]), - ) - - -class AsyncReports(AsyncAPIResource): - @cached_property - def bytimes(self) -> AsyncBytimes: - return AsyncBytimes(self._client) - - @cached_property - def with_raw_response(self) -> AsyncReportsWithRawResponse: - return AsyncReportsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncReportsWithStreamingResponse: - return AsyncReportsWithStreamingResponse(self) - - async def get( - self, - identifier: str, - *, - account_identifier: str, - dimensions: str | NotGiven = NOT_GIVEN, - filters: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - metrics: str | NotGiven = NOT_GIVEN, - since: Union[str, datetime] | NotGiven = NOT_GIVEN, - sort: str | NotGiven = NOT_GIVEN, - until: Union[str, datetime] | 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, - ) -> DNSDNSAnalyticsAPIReport: - """ - Retrieves a list of summarised aggregate metrics over a given time period. - - See - [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) - for detailed information about the available query parameters. - - Args: - account_identifier: Identifier - - identifier: Identifier - - dimensions: A comma-separated list of dimensions to group results by. - - filters: Segmentation filter in 'attribute operator value' format. - - limit: Limit number of returned metrics. - - metrics: A comma-separated list of metrics to query. - - since: Start date and time of requesting data period in ISO 8601 format. - - sort: A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - - until: End date and time of requesting data period in ISO 8601 format. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_identifier: - raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - if not identifier: - raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( - f"/accounts/{account_identifier}/dns_firewall/{identifier}/dns_analytics/report", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "dimensions": dimensions, - "filters": filters, - "limit": limit, - "metrics": metrics, - "since": since, - "sort": sort, - "until": until, - }, - report_get_params.ReportGetParams, - ), - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast(Type[DNSDNSAnalyticsAPIReport], ResultWrapper[DNSDNSAnalyticsAPIReport]), - ) - - -class ReportsWithRawResponse: - def __init__(self, reports: Reports) -> None: - self._reports = reports - - self.get = to_raw_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> BytimesWithRawResponse: - return BytimesWithRawResponse(self._reports.bytimes) - - -class AsyncReportsWithRawResponse: - def __init__(self, reports: AsyncReports) -> None: - self._reports = reports - - self.get = async_to_raw_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> AsyncBytimesWithRawResponse: - return AsyncBytimesWithRawResponse(self._reports.bytimes) - - -class ReportsWithStreamingResponse: - def __init__(self, reports: Reports) -> None: - self._reports = reports - - self.get = to_streamed_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> BytimesWithStreamingResponse: - return BytimesWithStreamingResponse(self._reports.bytimes) - - -class AsyncReportsWithStreamingResponse: - def __init__(self, reports: AsyncReports) -> None: - self._reports = reports - - self.get = async_to_streamed_response_wrapper( - reports.get, - ) - - @cached_property - def bytimes(self) -> AsyncBytimesWithStreamingResponse: - return AsyncBytimesWithStreamingResponse(self._reports.bytimes) diff --git a/src/cloudflare/resources/dns/firewall/firewall.py b/src/cloudflare/resources/dns/firewall/firewall.py index 4071da419ee..0351532d9d5 100644 --- a/src/cloudflare/resources/dns/firewall/firewall.py +++ b/src/cloudflare/resources/dns/firewall/firewall.py @@ -11,14 +11,6 @@ maybe_transform, async_maybe_transform, ) -from .analytics import ( - Analytics, - AsyncAnalytics, - AnalyticsWithRawResponse, - AsyncAnalyticsWithRawResponse, - AnalyticsWithStreamingResponse, - AsyncAnalyticsWithStreamingResponse, -) from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -40,16 +32,11 @@ AsyncPaginator, make_request_options, ) -from .analytics.analytics import Analytics, AsyncAnalytics __all__ = ["Firewall", "AsyncFirewall"] class Firewall(SyncAPIResource): - @cached_property - def analytics(self) -> Analytics: - return Analytics(self._client) - @cached_property def with_raw_response(self) -> FirewallWithRawResponse: return FirewallWithRawResponse(self) @@ -383,10 +370,6 @@ def get( class AsyncFirewall(AsyncAPIResource): - @cached_property - def analytics(self) -> AsyncAnalytics: - return AsyncAnalytics(self._client) - @cached_property def with_raw_response(self) -> AsyncFirewallWithRawResponse: return AsyncFirewallWithRawResponse(self) @@ -739,10 +722,6 @@ def __init__(self, firewall: Firewall) -> None: firewall.get, ) - @cached_property - def analytics(self) -> AnalyticsWithRawResponse: - return AnalyticsWithRawResponse(self._firewall.analytics) - class AsyncFirewallWithRawResponse: def __init__(self, firewall: AsyncFirewall) -> None: @@ -764,10 +743,6 @@ def __init__(self, firewall: AsyncFirewall) -> None: firewall.get, ) - @cached_property - def analytics(self) -> AsyncAnalyticsWithRawResponse: - return AsyncAnalyticsWithRawResponse(self._firewall.analytics) - class FirewallWithStreamingResponse: def __init__(self, firewall: Firewall) -> None: @@ -789,10 +764,6 @@ def __init__(self, firewall: Firewall) -> None: firewall.get, ) - @cached_property - def analytics(self) -> AnalyticsWithStreamingResponse: - return AnalyticsWithStreamingResponse(self._firewall.analytics) - class AsyncFirewallWithStreamingResponse: def __init__(self, firewall: AsyncFirewall) -> None: @@ -813,7 +784,3 @@ def __init__(self, firewall: AsyncFirewall) -> None: self.get = async_to_streamed_response_wrapper( firewall.get, ) - - @cached_property - def analytics(self) -> AsyncAnalyticsWithStreamingResponse: - return AsyncAnalyticsWithStreamingResponse(self._firewall.analytics) diff --git a/src/cloudflare/types/dns/analytics/__init__.py b/src/cloudflare/types/dns/analytics/__init__.py index a8e1c2d94e4..f8ee8b14b1c 100644 --- a/src/cloudflare/types/dns/analytics/__init__.py +++ b/src/cloudflare/types/dns/analytics/__init__.py @@ -1,6 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .report_get_params import ReportGetParams as ReportGetParams -from .dns_dns_analytics_api_report import DNSDNSAnalyticsAPIReport as DNSDNSAnalyticsAPIReport diff --git a/src/cloudflare/types/dns/analytics/dns_dns_analytics_api_report.py b/src/cloudflare/types/dns/analytics/dns_dns_analytics_api_report.py deleted file mode 100644 index 17e9ca38361..00000000000 --- a/src/cloudflare/types/dns/analytics/dns_dns_analytics_api_report.py +++ /dev/null @@ -1,79 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["DNSDNSAnalyticsAPIReport", "Data", "Query"] - - -class Data(BaseModel): - dimensions: List[str] - """ - Array of dimension values, representing the combination of dimension values - corresponding to this row. - """ - - metrics: List[float] - """Array with one item per requested metric. Each item is a single value.""" - - -class Query(BaseModel): - dimensions: List[str] - """Array of dimension names.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: List[str] - """Array of metric names.""" - - since: datetime - """Start date and time of requesting data period in ISO 8601 format.""" - - until: datetime - """End date and time of requesting data period in ISO 8601 format.""" - - filters: Optional[str] = None - """Segmentation filter in 'attribute operator value' format.""" - - sort: Optional[List[str]] = None - """ - Array of dimensions to sort by, where each dimension may be prefixed by - - (descending) or + (ascending). - """ - - -class DNSDNSAnalyticsAPIReport(BaseModel): - data: List[Data] - """Array with one row per combination of dimension values.""" - - data_lag: float - """ - Number of seconds between current time and last processed event, in another - words how many seconds of data could be missing. - """ - - max: object - """Maximum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - min: object - """Minimum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - query: Query - - rows: float - """Total number of rows in the result.""" - - totals: object - """ - Total results for metrics across all data (object mapping metric names to - values). - """ diff --git a/src/cloudflare/types/dns/analytics/report_get_params.py b/src/cloudflare/types/dns/analytics/report_get_params.py deleted file mode 100644 index 2aa18983628..00000000000 --- a/src/cloudflare/types/dns/analytics/report_get_params.py +++ /dev/null @@ -1,37 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Annotated, TypedDict - -from ...._utils import PropertyInfo - -__all__ = ["ReportGetParams"] - - -class ReportGetParams(TypedDict, total=False): - dimensions: str - """A comma-separated list of dimensions to group results by.""" - - filters: str - """Segmentation filter in 'attribute operator value' format.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: str - """A comma-separated list of metrics to query.""" - - since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Start date and time of requesting data period in ISO 8601 format.""" - - sort: str - """ - A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - """ - - until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """End date and time of requesting data period in ISO 8601 format.""" diff --git a/src/cloudflare/types/dns/analytics/reports/__init__.py b/src/cloudflare/types/dns/analytics/reports/__init__.py index 8d0bea62f39..f8ee8b14b1c 100644 --- a/src/cloudflare/types/dns/analytics/reports/__init__.py +++ b/src/cloudflare/types/dns/analytics/reports/__init__.py @@ -1,6 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .bytime_get_params import BytimeGetParams as BytimeGetParams -from .dns_dns_analytics_api_report_bytime import DNSDNSAnalyticsAPIReportBytime as DNSDNSAnalyticsAPIReportBytime diff --git a/src/cloudflare/types/dns/analytics/reports/bytime_get_params.py b/src/cloudflare/types/dns/analytics/reports/bytime_get_params.py deleted file mode 100644 index 76a4e18ce2f..00000000000 --- a/src/cloudflare/types/dns/analytics/reports/bytime_get_params.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Literal, Annotated, TypedDict - -from ....._utils import PropertyInfo - -__all__ = ["BytimeGetParams"] - - -class BytimeGetParams(TypedDict, total=False): - dimensions: str - """A comma-separated list of dimensions to group results by.""" - - filters: str - """Segmentation filter in 'attribute operator value' format.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: str - """A comma-separated list of metrics to query.""" - - since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Start date and time of requesting data period in ISO 8601 format.""" - - sort: str - """ - A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - """ - - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - """Unit of time to group data by.""" - - until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """End date and time of requesting data period in ISO 8601 format.""" diff --git a/src/cloudflare/types/dns/analytics/reports/dns_dns_analytics_api_report_bytime.py b/src/cloudflare/types/dns/analytics/reports/dns_dns_analytics_api_report_bytime.py deleted file mode 100644 index 003873123d1..00000000000 --- a/src/cloudflare/types/dns/analytics/reports/dns_dns_analytics_api_report_bytime.py +++ /dev/null @@ -1,93 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ....._models import BaseModel - -__all__ = ["DNSDNSAnalyticsAPIReportBytime", "Data", "Query"] - - -class Data(BaseModel): - dimensions: List[str] - """ - Array of dimension values, representing the combination of dimension values - corresponding to this row. - """ - - metrics: List[List[object]] - """Array with one item per requested metric. - - Each item is an array of values, broken down by time interval. - """ - - -class Query(BaseModel): - dimensions: List[str] - """Array of dimension names.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: List[str] - """Array of metric names.""" - - since: datetime - """Start date and time of requesting data period in ISO 8601 format.""" - - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - """Unit of time to group data by.""" - - until: datetime - """End date and time of requesting data period in ISO 8601 format.""" - - filters: Optional[str] = None - """Segmentation filter in 'attribute operator value' format.""" - - sort: Optional[List[str]] = None - """ - Array of dimensions to sort by, where each dimension may be prefixed by - - (descending) or + (ascending). - """ - - -class DNSDNSAnalyticsAPIReportBytime(BaseModel): - data: List[Data] - """Array with one row per combination of dimension values.""" - - data_lag: float - """ - Number of seconds between current time and last processed event, in another - words how many seconds of data could be missing. - """ - - max: object - """Maximum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - min: object - """Minimum results for each metric (object mapping metric names to values). - - Currently always an empty object. - """ - - query: Query - - rows: float - """Total number of rows in the result.""" - - time_intervals: List[List[datetime]] - """Array of time intervals in the response data. - - Each interval is represented as an array containing two values: the start time, - and the end time. - """ - - totals: object - """ - Total results for metrics across all data (object mapping metric names to - values). - """ diff --git a/src/cloudflare/types/dns/firewall/analytics/__init__.py b/src/cloudflare/types/dns/firewall/analytics/__init__.py index 5702c7a172a..f8ee8b14b1c 100644 --- a/src/cloudflare/types/dns/firewall/analytics/__init__.py +++ b/src/cloudflare/types/dns/firewall/analytics/__init__.py @@ -1,5 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .report_get_params import ReportGetParams as ReportGetParams diff --git a/src/cloudflare/types/dns/firewall/analytics/report_get_params.py b/src/cloudflare/types/dns/firewall/analytics/report_get_params.py deleted file mode 100644 index d21845e985f..00000000000 --- a/src/cloudflare/types/dns/firewall/analytics/report_get_params.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict - -from ....._utils import PropertyInfo - -__all__ = ["ReportGetParams"] - - -class ReportGetParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - dimensions: str - """A comma-separated list of dimensions to group results by.""" - - filters: str - """Segmentation filter in 'attribute operator value' format.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: str - """A comma-separated list of metrics to query.""" - - since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Start date and time of requesting data period in ISO 8601 format.""" - - sort: str - """ - A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - """ - - until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """End date and time of requesting data period in ISO 8601 format.""" diff --git a/src/cloudflare/types/dns/firewall/analytics/reports/__init__.py b/src/cloudflare/types/dns/firewall/analytics/reports/__init__.py index e88c3f32e1f..f8ee8b14b1c 100644 --- a/src/cloudflare/types/dns/firewall/analytics/reports/__init__.py +++ b/src/cloudflare/types/dns/firewall/analytics/reports/__init__.py @@ -1,5 +1,3 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations - -from .bytime_get_params import BytimeGetParams as BytimeGetParams diff --git a/src/cloudflare/types/dns/firewall/analytics/reports/bytime_get_params.py b/src/cloudflare/types/dns/firewall/analytics/reports/bytime_get_params.py deleted file mode 100644 index 29cdd687495..00000000000 --- a/src/cloudflare/types/dns/firewall/analytics/reports/bytime_get_params.py +++ /dev/null @@ -1,43 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypedDict - -from ......_utils import PropertyInfo - -__all__ = ["BytimeGetParams"] - - -class BytimeGetParams(TypedDict, total=False): - account_identifier: Required[str] - """Identifier""" - - dimensions: str - """A comma-separated list of dimensions to group results by.""" - - filters: str - """Segmentation filter in 'attribute operator value' format.""" - - limit: int - """Limit number of returned metrics.""" - - metrics: str - """A comma-separated list of metrics to query.""" - - since: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """Start date and time of requesting data period in ISO 8601 format.""" - - sort: str - """ - A comma-separated list of dimensions to sort by, where each dimension may be - prefixed by - (descending) or + (ascending). - """ - - time_delta: Literal["all", "auto", "year", "quarter", "month", "week", "day", "hour", "dekaminute", "minute"] - """Unit of time to group data by.""" - - until: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """End date and time of requesting data period in ISO 8601 format.""" diff --git a/tests/api_resources/dns/analytics/reports/test_bytimes.py b/tests/api_resources/dns/analytics/reports/test_bytimes.py deleted file mode 100644 index 9fb77f08d29..00000000000 --- a/tests/api_resources/dns/analytics/reports/test_bytimes.py +++ /dev/null @@ -1,139 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime -from cloudflare.types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBytimes: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - bytime = client.dns.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - bytime = client.dns.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - time_delta="hour", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.dns.analytics.reports.bytimes.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bytime = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.dns.analytics.reports.bytimes.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bytime = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.dns.analytics.reports.bytimes.with_raw_response.get( - "", - ) - - -class TestAsyncBytimes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - bytime = await async_client.dns.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - bytime = await async_client.dns.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - time_delta="hour", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.dns.analytics.reports.bytimes.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bytime = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.dns.analytics.reports.bytimes.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bytime = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.dns.analytics.reports.bytimes.with_raw_response.get( - "", - ) diff --git a/tests/api_resources/dns/analytics/test_reports.py b/tests/api_resources/dns/analytics/test_reports.py deleted file mode 100644 index 20563f275e1..00000000000 --- a/tests/api_resources/dns/analytics/test_reports.py +++ /dev/null @@ -1,137 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime -from cloudflare.types.dns.analytics import DNSDNSAnalyticsAPIReport - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestReports: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - report = client.dns.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - report = client.dns.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.dns.analytics.reports.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - report = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.dns.analytics.reports.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - report = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.dns.analytics.reports.with_raw_response.get( - "", - ) - - -class TestAsyncReports: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - report = await async_client.dns.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - report = await async_client.dns.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.dns.analytics.reports.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - report = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.dns.analytics.reports.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - report = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.dns.analytics.reports.with_raw_response.get( - "", - ) diff --git a/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py b/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py deleted file mode 100644 index 60bbaa61e80..00000000000 --- a/tests/api_resources/dns/firewall/analytics/reports/test_bytimes.py +++ /dev/null @@ -1,161 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime -from cloudflare.types.dns.analytics.reports import DNSDNSAnalyticsAPIReportBytime - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBytimes: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - bytime = client.dns.firewall.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - bytime = client.dns.firewall.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - time_delta="hour", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.dns.firewall.analytics.reports.bytimes.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bytime = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.dns.firewall.analytics.reports.bytimes.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bytime = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.dns.firewall.analytics.reports.bytimes.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.dns.firewall.analytics.reports.bytimes.with_raw_response.get( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncBytimes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - bytime = await async_client.dns.firewall.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - bytime = await async_client.dns.firewall.analytics.reports.bytimes.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - time_delta="hour", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.dns.firewall.analytics.reports.bytimes.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bytime = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.dns.firewall.analytics.reports.bytimes.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - bytime = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReportBytime, bytime, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.dns.firewall.analytics.reports.bytimes.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.dns.firewall.analytics.reports.bytimes.with_raw_response.get( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) diff --git a/tests/api_resources/dns/firewall/analytics/test_reports.py b/tests/api_resources/dns/firewall/analytics/test_reports.py deleted file mode 100644 index 4cf08b8cd72..00000000000 --- a/tests/api_resources/dns/firewall/analytics/test_reports.py +++ /dev/null @@ -1,159 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from cloudflare import Cloudflare, AsyncCloudflare -from tests.utils import assert_matches_type -from cloudflare._utils import parse_datetime -from cloudflare.types.dns.analytics import DNSDNSAnalyticsAPIReport - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestReports: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - report = client.dns.firewall.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_method_get_with_all_params(self, client: Cloudflare) -> None: - report = client.dns.firewall.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.dns.firewall.analytics.reports.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - report = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.dns.firewall.analytics.reports.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - report = response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - client.dns.firewall.analytics.reports.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - client.dns.firewall.analytics.reports.with_raw_response.get( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - -class TestAsyncReports: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - report = await async_client.dns.firewall.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: - report = await async_client.dns.firewall.analytics.reports.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - dimensions="queryType", - filters="responseCode==NOERROR,queryType==A", - limit=100, - metrics="queryCount,uncachedCount", - since=parse_datetime("2023-11-11T12:00:00Z"), - sort="+responseCode,-queryName", - until=parse_datetime("2023-11-11T13:00:00Z"), - ) - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.dns.firewall.analytics.reports.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - report = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - @pytest.mark.skip() - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.dns.firewall.analytics.reports.with_streaming_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - report = await response.parse() - assert_matches_type(DNSDNSAnalyticsAPIReport, report, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip() - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_identifier` but received ''"): - await async_client.dns.firewall.analytics.reports.with_raw_response.get( - "023e105f4ecef8ad9ca31a8372d0c353", - account_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `identifier` but received ''"): - await async_client.dns.firewall.analytics.reports.with_raw_response.get( - "", - account_identifier="023e105f4ecef8ad9ca31a8372d0c353", - )