diff --git a/.stats.yml b/.stats.yml
index ba2298a7015..c10a59bb098 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 1335
+configured_endpoints: 1338
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-563da3da7347fb7ce5676737cc6a457de5da7c96aa7d44098a9db3b2fb8d6599.yml
diff --git a/api.md b/api.md
index 14aaae3917c..330a480993e 100644
--- a/api.md
+++ b/api.md
@@ -2655,7 +2655,21 @@ from cloudflare.types.workers import AIRunResponse
Methods:
-- client.workers.ai.run(model_name, \*, account_id, \*\*params) -> Optional
+- client.workers.ai.run(model_name, \*, account_id, \*\*params) -> Optional
+
+### Models
+
+#### Schema
+
+Types:
+
+```python
+from cloudflare.types.workers.ai.models import SchemaGetResponse
+```
+
+Methods:
+
+- client.workers.ai.models.schema.get(\*, account_id, \*\*params) -> object
## Scripts
@@ -6494,11 +6508,17 @@ Methods:
Types:
```python
-from cloudflare.types.radar.bgp import RouteMoasResponse, RoutePfx2asResponse, RouteStatsResponse
+from cloudflare.types.radar.bgp import (
+ RouteAsesResponse,
+ RouteMoasResponse,
+ RoutePfx2asResponse,
+ RouteStatsResponse,
+)
```
Methods:
+- client.radar.bgp.routes.ases(\*\*params) -> RouteAsesResponse
- client.radar.bgp.routes.moas(\*\*params) -> RouteMoasResponse
- client.radar.bgp.routes.pfx2as(\*\*params) -> RoutePfx2asResponse
- client.radar.bgp.routes.stats(\*\*params) -> RouteStatsResponse
@@ -7113,6 +7133,16 @@ Methods:
## HTTP
+Types:
+
+```python
+from cloudflare.types.radar import HTTPTimeseriesResponse
+```
+
+Methods:
+
+- client.radar.http.timeseries(\*\*params) -> HTTPTimeseriesResponse
+
### Top
Types:
diff --git a/src/cloudflare/resources/radar/bgp/routes.py b/src/cloudflare/resources/radar/bgp/routes.py
index 4f993e592f5..104c66fdd4d 100644
--- a/src/cloudflare/resources/radar/bgp/routes.py
+++ b/src/cloudflare/resources/radar/bgp/routes.py
@@ -24,7 +24,8 @@
from ...._base_client import (
make_request_options,
)
-from ....types.radar.bgp import route_moas_params, route_stats_params, route_pfx2as_params
+from ....types.radar.bgp import route_ases_params, route_moas_params, route_stats_params, route_pfx2as_params
+from ....types.radar.bgp.route_ases_response import RouteAsesResponse
from ....types.radar.bgp.route_moas_response import RouteMoasResponse
from ....types.radar.bgp.route_stats_response import RouteStatsResponse
from ....types.radar.bgp.route_pfx2as_response import RoutePfx2asResponse
@@ -41,6 +42,66 @@ def with_raw_response(self) -> RoutesResourceWithRawResponse:
def with_streaming_response(self) -> RoutesResourceWithStreamingResponse:
return RoutesResourceWithStreamingResponse(self)
+ def ases(
+ self,
+ *,
+ format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
+ limit: int | NotGiven = NOT_GIVEN,
+ location: str | NotGiven = NOT_GIVEN,
+ sort_by: Literal["cone", "pfxs", "ipv4", "ipv6", "rpki_valid", "rpki_invalid", "rpki_unknown"]
+ | NotGiven = NOT_GIVEN,
+ sort_order: Literal["asc", "desc"] | 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,
+ ) -> RouteAsesResponse:
+ """
+ List all ASes on current global routing tables with routing statistics
+
+ Args:
+ format: Format results are returned in.
+
+ limit: Limit the number of objects in the response.
+
+ location: Location Alpha2 code.
+
+ sort_by: Return order results by given type
+
+ sort_order: Sort by value ascending or descending
+
+ 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
+ """
+ return self._get(
+ "/radar/bgp/routes/ases",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "format": format,
+ "limit": limit,
+ "location": location,
+ "sort_by": sort_by,
+ "sort_order": sort_order,
+ },
+ route_ases_params.RouteAsesParams,
+ ),
+ post_parser=ResultWrapper[RouteAsesResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[RouteAsesResponse], ResultWrapper[RouteAsesResponse]),
+ )
+
def moas(
self,
*,
@@ -217,6 +278,66 @@ def with_raw_response(self) -> AsyncRoutesResourceWithRawResponse:
def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse:
return AsyncRoutesResourceWithStreamingResponse(self)
+ async def ases(
+ self,
+ *,
+ format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
+ limit: int | NotGiven = NOT_GIVEN,
+ location: str | NotGiven = NOT_GIVEN,
+ sort_by: Literal["cone", "pfxs", "ipv4", "ipv6", "rpki_valid", "rpki_invalid", "rpki_unknown"]
+ | NotGiven = NOT_GIVEN,
+ sort_order: Literal["asc", "desc"] | 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,
+ ) -> RouteAsesResponse:
+ """
+ List all ASes on current global routing tables with routing statistics
+
+ Args:
+ format: Format results are returned in.
+
+ limit: Limit the number of objects in the response.
+
+ location: Location Alpha2 code.
+
+ sort_by: Return order results by given type
+
+ sort_order: Sort by value ascending or descending
+
+ 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
+ """
+ return await self._get(
+ "/radar/bgp/routes/ases",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "format": format,
+ "limit": limit,
+ "location": location,
+ "sort_by": sort_by,
+ "sort_order": sort_order,
+ },
+ route_ases_params.RouteAsesParams,
+ ),
+ post_parser=ResultWrapper[RouteAsesResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[RouteAsesResponse], ResultWrapper[RouteAsesResponse]),
+ )
+
async def moas(
self,
*,
@@ -388,6 +509,9 @@ class RoutesResourceWithRawResponse:
def __init__(self, routes: RoutesResource) -> None:
self._routes = routes
+ self.ases = to_raw_response_wrapper(
+ routes.ases,
+ )
self.moas = to_raw_response_wrapper(
routes.moas,
)
@@ -403,6 +527,9 @@ class AsyncRoutesResourceWithRawResponse:
def __init__(self, routes: AsyncRoutesResource) -> None:
self._routes = routes
+ self.ases = async_to_raw_response_wrapper(
+ routes.ases,
+ )
self.moas = async_to_raw_response_wrapper(
routes.moas,
)
@@ -418,6 +545,9 @@ class RoutesResourceWithStreamingResponse:
def __init__(self, routes: RoutesResource) -> None:
self._routes = routes
+ self.ases = to_streamed_response_wrapper(
+ routes.ases,
+ )
self.moas = to_streamed_response_wrapper(
routes.moas,
)
@@ -433,6 +563,9 @@ class AsyncRoutesResourceWithStreamingResponse:
def __init__(self, routes: AsyncRoutesResource) -> None:
self._routes = routes
+ self.ases = async_to_streamed_response_wrapper(
+ routes.ases,
+ )
self.moas = async_to_streamed_response_wrapper(
routes.moas,
)
diff --git a/src/cloudflare/resources/radar/http/http.py b/src/cloudflare/resources/radar/http/http.py
index b8a704fd14d..9f32cbdd054 100644
--- a/src/cloudflare/resources/radar/http/http.py
+++ b/src/cloudflare/resources/radar/http/http.py
@@ -2,6 +2,12 @@
from __future__ import annotations
+from typing import List, Type, Union, cast
+from datetime import datetime
+from typing_extensions import Literal
+
+import httpx
+
from .top import (
TopResource,
AsyncTopResource,
@@ -26,6 +32,11 @@
SummaryResourceWithStreamingResponse,
AsyncSummaryResourceWithStreamingResponse,
)
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
from .ases.ases import AsesResource, AsyncAsesResource
from .locations import (
LocationsResource,
@@ -37,6 +48,17 @@
)
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 ....types.radar import http_timeseries_params
+from ...._base_client import (
+ make_request_options,
+)
from .timeseries_groups import (
TimeseriesGroupsResource,
AsyncTimeseriesGroupsResource,
@@ -46,6 +68,7 @@
AsyncTimeseriesGroupsResourceWithStreamingResponse,
)
from .locations.locations import LocationsResource, AsyncLocationsResource
+from ....types.radar.http_timeseries_response import HTTPTimeseriesResponse
__all__ = ["HTTPResource", "AsyncHTTPResource"]
@@ -79,6 +102,110 @@ def with_raw_response(self) -> HTTPResourceWithRawResponse:
def with_streaming_response(self) -> HTTPResourceWithStreamingResponse:
return HTTPResourceWithStreamingResponse(self)
+ def timeseries(
+ self,
+ *,
+ agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN,
+ asn: List[str] | NotGiven = NOT_GIVEN,
+ continent: List[str] | NotGiven = NOT_GIVEN,
+ date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
+ date_range: List[
+ Literal[
+ "1d",
+ "2d",
+ "7d",
+ "14d",
+ "28d",
+ "12w",
+ "24w",
+ "52w",
+ "1dControl",
+ "2dControl",
+ "7dControl",
+ "14dControl",
+ "28dControl",
+ "12wControl",
+ "24wControl",
+ ]
+ ]
+ | NotGiven = NOT_GIVEN,
+ date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
+ format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
+ location: List[str] | NotGiven = NOT_GIVEN,
+ name: List[str] | 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,
+ ) -> HTTPTimeseriesResponse:
+ """
+ Get HTTP requests over time.
+
+ Args:
+ agg_interval: Aggregation interval results should be returned in (for example, in 15 minutes
+ or 1 hour intervals). Refer to
+ [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/).
+
+ asn: Array of comma separated list of ASNs, start with `-` to exclude from results.
+ For example, `-174, 3356` excludes results from AS174, but includes results from
+ AS3356.
+
+ continent: Array of comma separated list of continents (alpha-2 continent codes). Start
+ with `-` to exclude from results. For example, `-EU,NA` excludes results from
+ Europe, but includes results from North America.
+
+ date_end: End of the date range (inclusive).
+
+ date_range: For example, use `7d` and `7dControl` to compare this week with the previous
+ week. Use this parameter or set specific start and end dates (`dateStart` and
+ `dateEnd` parameters).
+
+ date_start: Array of datetimes to filter the start of a series.
+
+ format: Format results are returned in.
+
+ location: Array of comma separated list of locations (alpha-2 country codes). Start with
+ `-` to exclude from results. For example, `-US,PT` excludes results from the US,
+ but includes results from PT.
+
+ name: Array of names that will be used to name the series in responses.
+
+ 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
+ """
+ return self._get(
+ "/radar/http/timeseries",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "agg_interval": agg_interval,
+ "asn": asn,
+ "continent": continent,
+ "date_end": date_end,
+ "date_range": date_range,
+ "date_start": date_start,
+ "format": format,
+ "location": location,
+ "name": name,
+ },
+ http_timeseries_params.HTTPTimeseriesParams,
+ ),
+ post_parser=ResultWrapper[HTTPTimeseriesResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[HTTPTimeseriesResponse], ResultWrapper[HTTPTimeseriesResponse]),
+ )
+
class AsyncHTTPResource(AsyncAPIResource):
@cached_property
@@ -109,11 +236,119 @@ def with_raw_response(self) -> AsyncHTTPResourceWithRawResponse:
def with_streaming_response(self) -> AsyncHTTPResourceWithStreamingResponse:
return AsyncHTTPResourceWithStreamingResponse(self)
+ async def timeseries(
+ self,
+ *,
+ agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN,
+ asn: List[str] | NotGiven = NOT_GIVEN,
+ continent: List[str] | NotGiven = NOT_GIVEN,
+ date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
+ date_range: List[
+ Literal[
+ "1d",
+ "2d",
+ "7d",
+ "14d",
+ "28d",
+ "12w",
+ "24w",
+ "52w",
+ "1dControl",
+ "2dControl",
+ "7dControl",
+ "14dControl",
+ "28dControl",
+ "12wControl",
+ "24wControl",
+ ]
+ ]
+ | NotGiven = NOT_GIVEN,
+ date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
+ format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
+ location: List[str] | NotGiven = NOT_GIVEN,
+ name: List[str] | 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,
+ ) -> HTTPTimeseriesResponse:
+ """
+ Get HTTP requests over time.
+
+ Args:
+ agg_interval: Aggregation interval results should be returned in (for example, in 15 minutes
+ or 1 hour intervals). Refer to
+ [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/).
+
+ asn: Array of comma separated list of ASNs, start with `-` to exclude from results.
+ For example, `-174, 3356` excludes results from AS174, but includes results from
+ AS3356.
+
+ continent: Array of comma separated list of continents (alpha-2 continent codes). Start
+ with `-` to exclude from results. For example, `-EU,NA` excludes results from
+ Europe, but includes results from North America.
+
+ date_end: End of the date range (inclusive).
+
+ date_range: For example, use `7d` and `7dControl` to compare this week with the previous
+ week. Use this parameter or set specific start and end dates (`dateStart` and
+ `dateEnd` parameters).
+
+ date_start: Array of datetimes to filter the start of a series.
+
+ format: Format results are returned in.
+
+ location: Array of comma separated list of locations (alpha-2 country codes). Start with
+ `-` to exclude from results. For example, `-US,PT` excludes results from the US,
+ but includes results from PT.
+
+ name: Array of names that will be used to name the series in responses.
+
+ 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
+ """
+ return await self._get(
+ "/radar/http/timeseries",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "agg_interval": agg_interval,
+ "asn": asn,
+ "continent": continent,
+ "date_end": date_end,
+ "date_range": date_range,
+ "date_start": date_start,
+ "format": format,
+ "location": location,
+ "name": name,
+ },
+ http_timeseries_params.HTTPTimeseriesParams,
+ ),
+ post_parser=ResultWrapper[HTTPTimeseriesResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[HTTPTimeseriesResponse], ResultWrapper[HTTPTimeseriesResponse]),
+ )
+
class HTTPResourceWithRawResponse:
def __init__(self, http: HTTPResource) -> None:
self._http = http
+ self.timeseries = to_raw_response_wrapper(
+ http.timeseries,
+ )
+
@cached_property
def top(self) -> TopResourceWithRawResponse:
return TopResourceWithRawResponse(self._http.top)
@@ -139,6 +374,10 @@ class AsyncHTTPResourceWithRawResponse:
def __init__(self, http: AsyncHTTPResource) -> None:
self._http = http
+ self.timeseries = async_to_raw_response_wrapper(
+ http.timeseries,
+ )
+
@cached_property
def top(self) -> AsyncTopResourceWithRawResponse:
return AsyncTopResourceWithRawResponse(self._http.top)
@@ -164,6 +403,10 @@ class HTTPResourceWithStreamingResponse:
def __init__(self, http: HTTPResource) -> None:
self._http = http
+ self.timeseries = to_streamed_response_wrapper(
+ http.timeseries,
+ )
+
@cached_property
def top(self) -> TopResourceWithStreamingResponse:
return TopResourceWithStreamingResponse(self._http.top)
@@ -189,6 +432,10 @@ class AsyncHTTPResourceWithStreamingResponse:
def __init__(self, http: AsyncHTTPResource) -> None:
self._http = http
+ self.timeseries = async_to_streamed_response_wrapper(
+ http.timeseries,
+ )
+
@cached_property
def top(self) -> AsyncTopResourceWithStreamingResponse:
return AsyncTopResourceWithStreamingResponse(self._http.top)
diff --git a/src/cloudflare/resources/workers/ai/__init__.py b/src/cloudflare/resources/workers/ai/__init__.py
new file mode 100644
index 00000000000..4921cf245a4
--- /dev/null
+++ b/src/cloudflare/resources/workers/ai/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .ai import (
+ AIResource,
+ AsyncAIResource,
+ AIResourceWithRawResponse,
+ AsyncAIResourceWithRawResponse,
+ AIResourceWithStreamingResponse,
+ AsyncAIResourceWithStreamingResponse,
+)
+from .models import (
+ ModelsResource,
+ AsyncModelsResource,
+ ModelsResourceWithRawResponse,
+ AsyncModelsResourceWithRawResponse,
+ ModelsResourceWithStreamingResponse,
+ AsyncModelsResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "ModelsResource",
+ "AsyncModelsResource",
+ "ModelsResourceWithRawResponse",
+ "AsyncModelsResourceWithRawResponse",
+ "ModelsResourceWithStreamingResponse",
+ "AsyncModelsResourceWithStreamingResponse",
+ "AIResource",
+ "AsyncAIResource",
+ "AIResourceWithRawResponse",
+ "AsyncAIResourceWithRawResponse",
+ "AIResourceWithStreamingResponse",
+ "AsyncAIResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/workers/ai.py b/src/cloudflare/resources/workers/ai/ai.py
similarity index 96%
rename from src/cloudflare/resources/workers/ai.py
rename to src/cloudflare/resources/workers/ai/ai.py
index 4c1f83aed9a..86d294ec5fa 100644
--- a/src/cloudflare/resources/workers/ai.py
+++ b/src/cloudflare/resources/workers/ai/ai.py
@@ -6,31 +6,44 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from ..._utils import (
+from .models import (
+ ModelsResource,
+ AsyncModelsResource,
+ ModelsResourceWithRawResponse,
+ AsyncModelsResourceWithRawResponse,
+ ModelsResourceWithStreamingResponse,
+ AsyncModelsResourceWithStreamingResponse,
+)
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
required_args,
maybe_transform,
async_maybe_transform,
)
-from ..._compat import cached_property
-from ..._resource import SyncAPIResource, AsyncAPIResource
-from ..._response import (
+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 (
+from ...._wrappers import ResultWrapper
+from .models.models import ModelsResource, AsyncModelsResource
+from ...._base_client import (
make_request_options,
)
-from ...types.workers import ai_run_params
-from ...types.workers.ai_run_response import AIRunResponse
+from ....types.workers import ai_run_params
+from ....types.workers.ai_run_response import AIRunResponse
__all__ = ["AIResource", "AsyncAIResource"]
class AIResource(SyncAPIResource):
+ @cached_property
+ def models(self) -> ModelsResource:
+ return ModelsResource(self._client)
+
@cached_property
def with_raw_response(self) -> AIResourceWithRawResponse:
return AIResourceWithRawResponse(self)
@@ -544,6 +557,10 @@ def run(
class AsyncAIResource(AsyncAPIResource):
+ @cached_property
+ def models(self) -> AsyncModelsResource:
+ return AsyncModelsResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncAIResourceWithRawResponse:
return AsyncAIResourceWithRawResponse(self)
@@ -1064,6 +1081,10 @@ def __init__(self, ai: AIResource) -> None:
ai.run,
)
+ @cached_property
+ def models(self) -> ModelsResourceWithRawResponse:
+ return ModelsResourceWithRawResponse(self._ai.models)
+
class AsyncAIResourceWithRawResponse:
def __init__(self, ai: AsyncAIResource) -> None:
@@ -1073,6 +1094,10 @@ def __init__(self, ai: AsyncAIResource) -> None:
ai.run,
)
+ @cached_property
+ def models(self) -> AsyncModelsResourceWithRawResponse:
+ return AsyncModelsResourceWithRawResponse(self._ai.models)
+
class AIResourceWithStreamingResponse:
def __init__(self, ai: AIResource) -> None:
@@ -1082,6 +1107,10 @@ def __init__(self, ai: AIResource) -> None:
ai.run,
)
+ @cached_property
+ def models(self) -> ModelsResourceWithStreamingResponse:
+ return ModelsResourceWithStreamingResponse(self._ai.models)
+
class AsyncAIResourceWithStreamingResponse:
def __init__(self, ai: AsyncAIResource) -> None:
@@ -1090,3 +1119,7 @@ def __init__(self, ai: AsyncAIResource) -> None:
self.run = async_to_streamed_response_wrapper(
ai.run,
)
+
+ @cached_property
+ def models(self) -> AsyncModelsResourceWithStreamingResponse:
+ return AsyncModelsResourceWithStreamingResponse(self._ai.models)
diff --git a/src/cloudflare/resources/workers/ai/models/__init__.py b/src/cloudflare/resources/workers/ai/models/__init__.py
new file mode 100644
index 00000000000..9ccd4fa07fb
--- /dev/null
+++ b/src/cloudflare/resources/workers/ai/models/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .models import (
+ ModelsResource,
+ AsyncModelsResource,
+ ModelsResourceWithRawResponse,
+ AsyncModelsResourceWithRawResponse,
+ ModelsResourceWithStreamingResponse,
+ AsyncModelsResourceWithStreamingResponse,
+)
+from .schema import (
+ SchemaResource,
+ AsyncSchemaResource,
+ SchemaResourceWithRawResponse,
+ AsyncSchemaResourceWithRawResponse,
+ SchemaResourceWithStreamingResponse,
+ AsyncSchemaResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "SchemaResource",
+ "AsyncSchemaResource",
+ "SchemaResourceWithRawResponse",
+ "AsyncSchemaResourceWithRawResponse",
+ "SchemaResourceWithStreamingResponse",
+ "AsyncSchemaResourceWithStreamingResponse",
+ "ModelsResource",
+ "AsyncModelsResource",
+ "ModelsResourceWithRawResponse",
+ "AsyncModelsResourceWithRawResponse",
+ "ModelsResourceWithStreamingResponse",
+ "AsyncModelsResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/workers/ai/models/models.py b/src/cloudflare/resources/workers/ai/models/models.py
new file mode 100644
index 00000000000..8f90eb7304d
--- /dev/null
+++ b/src/cloudflare/resources/workers/ai/models/models.py
@@ -0,0 +1,80 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .schema import (
+ SchemaResource,
+ AsyncSchemaResource,
+ SchemaResourceWithRawResponse,
+ AsyncSchemaResourceWithRawResponse,
+ SchemaResourceWithStreamingResponse,
+ AsyncSchemaResourceWithStreamingResponse,
+)
+from ....._compat import cached_property
+from ....._resource import SyncAPIResource, AsyncAPIResource
+
+__all__ = ["ModelsResource", "AsyncModelsResource"]
+
+
+class ModelsResource(SyncAPIResource):
+ @cached_property
+ def schema(self) -> SchemaResource:
+ return SchemaResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> ModelsResourceWithRawResponse:
+ return ModelsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ModelsResourceWithStreamingResponse:
+ return ModelsResourceWithStreamingResponse(self)
+
+
+class AsyncModelsResource(AsyncAPIResource):
+ @cached_property
+ def schema(self) -> AsyncSchemaResource:
+ return AsyncSchemaResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncModelsResourceWithRawResponse:
+ return AsyncModelsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse:
+ return AsyncModelsResourceWithStreamingResponse(self)
+
+
+class ModelsResourceWithRawResponse:
+ def __init__(self, models: ModelsResource) -> None:
+ self._models = models
+
+ @cached_property
+ def schema(self) -> SchemaResourceWithRawResponse:
+ return SchemaResourceWithRawResponse(self._models.schema)
+
+
+class AsyncModelsResourceWithRawResponse:
+ def __init__(self, models: AsyncModelsResource) -> None:
+ self._models = models
+
+ @cached_property
+ def schema(self) -> AsyncSchemaResourceWithRawResponse:
+ return AsyncSchemaResourceWithRawResponse(self._models.schema)
+
+
+class ModelsResourceWithStreamingResponse:
+ def __init__(self, models: ModelsResource) -> None:
+ self._models = models
+
+ @cached_property
+ def schema(self) -> SchemaResourceWithStreamingResponse:
+ return SchemaResourceWithStreamingResponse(self._models.schema)
+
+
+class AsyncModelsResourceWithStreamingResponse:
+ def __init__(self, models: AsyncModelsResource) -> None:
+ self._models = models
+
+ @cached_property
+ def schema(self) -> AsyncSchemaResourceWithStreamingResponse:
+ return AsyncSchemaResourceWithStreamingResponse(self._models.schema)
diff --git a/src/cloudflare/resources/workers/ai/models/schema.py b/src/cloudflare/resources/workers/ai/models/schema.py
new file mode 100644
index 00000000000..934b517b989
--- /dev/null
+++ b/src/cloudflare/resources/workers/ai/models/schema.py
@@ -0,0 +1,166 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ....._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ....._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.workers.ai.models import schema_get_params
+
+__all__ = ["SchemaResource", "AsyncSchemaResource"]
+
+
+class SchemaResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> SchemaResourceWithRawResponse:
+ return SchemaResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> SchemaResourceWithStreamingResponse:
+ return SchemaResourceWithStreamingResponse(self)
+
+ def get(
+ self,
+ *,
+ account_id: str,
+ model: str,
+ # 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,
+ ) -> object:
+ """
+ Get Model Schema
+
+ Args:
+ model: Model Name
+
+ 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_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai/models/schema",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform({"model": model}, schema_get_params.SchemaGetParams),
+ post_parser=ResultWrapper[object]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class AsyncSchemaResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncSchemaResourceWithRawResponse:
+ return AsyncSchemaResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncSchemaResourceWithStreamingResponse:
+ return AsyncSchemaResourceWithStreamingResponse(self)
+
+ async def get(
+ self,
+ *,
+ account_id: str,
+ model: str,
+ # 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,
+ ) -> object:
+ """
+ Get Model Schema
+
+ Args:
+ model: Model Name
+
+ 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_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai/models/schema",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform({"model": model}, schema_get_params.SchemaGetParams),
+ post_parser=ResultWrapper[object]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class SchemaResourceWithRawResponse:
+ def __init__(self, schema: SchemaResource) -> None:
+ self._schema = schema
+
+ self.get = to_raw_response_wrapper(
+ schema.get,
+ )
+
+
+class AsyncSchemaResourceWithRawResponse:
+ def __init__(self, schema: AsyncSchemaResource) -> None:
+ self._schema = schema
+
+ self.get = async_to_raw_response_wrapper(
+ schema.get,
+ )
+
+
+class SchemaResourceWithStreamingResponse:
+ def __init__(self, schema: SchemaResource) -> None:
+ self._schema = schema
+
+ self.get = to_streamed_response_wrapper(
+ schema.get,
+ )
+
+
+class AsyncSchemaResourceWithStreamingResponse:
+ def __init__(self, schema: AsyncSchemaResource) -> None:
+ self._schema = schema
+
+ self.get = async_to_streamed_response_wrapper(
+ schema.get,
+ )
diff --git a/src/cloudflare/resources/workers/workers.py b/src/cloudflare/resources/workers/workers.py
index 195b4a21670..55326950c01 100644
--- a/src/cloudflare/resources/workers/workers.py
+++ b/src/cloudflare/resources/workers/workers.py
@@ -10,6 +10,7 @@
AIResourceWithStreamingResponse,
AsyncAIResourceWithStreamingResponse,
)
+from .ai.ai import AIResource, AsyncAIResource
from .domains import (
DomainsResource,
AsyncDomainsResource,
diff --git a/src/cloudflare/types/radar/__init__.py b/src/cloudflare/types/radar/__init__.py
index cacf1e11ece..cab083c87f6 100644
--- a/src/cloudflare/types/radar/__init__.py
+++ b/src/cloudflare/types/radar/__init__.py
@@ -14,10 +14,12 @@
from .search_global_params import SearchGlobalParams as SearchGlobalParams
from .bgp_timeseries_params import BGPTimeseriesParams as BGPTimeseriesParams
from .dataset_list_response import DatasetListResponse as DatasetListResponse
+from .http_timeseries_params import HTTPTimeseriesParams as HTTPTimeseriesParams
from .search_global_response import SearchGlobalResponse as SearchGlobalResponse
from .as112_timeseries_params import AS112TimeseriesParams as AS112TimeseriesParams
from .bgp_timeseries_response import BGPTimeseriesResponse as BGPTimeseriesResponse
from .dataset_download_params import DatasetDownloadParams as DatasetDownloadParams
+from .http_timeseries_response import HTTPTimeseriesResponse as HTTPTimeseriesResponse
from .as112_timeseries_response import AS112TimeseriesResponse as AS112TimeseriesResponse
from .dataset_download_response import DatasetDownloadResponse as DatasetDownloadResponse
from .netflow_timeseries_params import NetflowTimeseriesParams as NetflowTimeseriesParams
diff --git a/src/cloudflare/types/radar/bgp/__init__.py b/src/cloudflare/types/radar/bgp/__init__.py
index abf4e584e4d..fdbf378f666 100644
--- a/src/cloudflare/types/radar/bgp/__init__.py
+++ b/src/cloudflare/types/radar/bgp/__init__.py
@@ -2,8 +2,10 @@
from __future__ import annotations
+from .route_ases_params import RouteAsesParams as RouteAsesParams
from .route_moas_params import RouteMoasParams as RouteMoasParams
from .route_stats_params import RouteStatsParams as RouteStatsParams
+from .route_ases_response import RouteAsesResponse as RouteAsesResponse
from .route_moas_response import RouteMoasResponse as RouteMoasResponse
from .route_pfx2as_params import RoutePfx2asParams as RoutePfx2asParams
from .top_prefixes_params import TopPrefixesParams as TopPrefixesParams
diff --git a/src/cloudflare/types/radar/bgp/route_ases_params.py b/src/cloudflare/types/radar/bgp/route_ases_params.py
new file mode 100644
index 00000000000..734a74168f0
--- /dev/null
+++ b/src/cloudflare/types/radar/bgp/route_ases_params.py
@@ -0,0 +1,29 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Annotated, TypedDict
+
+from ...._utils import PropertyInfo
+
+__all__ = ["RouteAsesParams"]
+
+
+class RouteAsesParams(TypedDict, total=False):
+ format: Literal["JSON", "CSV"]
+ """Format results are returned in."""
+
+ limit: int
+ """Limit the number of objects in the response."""
+
+ location: str
+ """Location Alpha2 code."""
+
+ sort_by: Annotated[
+ Literal["cone", "pfxs", "ipv4", "ipv6", "rpki_valid", "rpki_invalid", "rpki_unknown"],
+ PropertyInfo(alias="sortBy"),
+ ]
+ """Return order results by given type"""
+
+ sort_order: Annotated[Literal["asc", "desc"], PropertyInfo(alias="sortOrder")]
+ """Sort by value ascending or descending"""
diff --git a/src/cloudflare/types/radar/bgp/route_ases_response.py b/src/cloudflare/types/radar/bgp/route_ases_response.py
new file mode 100644
index 00000000000..56e851baf3d
--- /dev/null
+++ b/src/cloudflare/types/radar/bgp/route_ases_response.py
@@ -0,0 +1,57 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+
+from pydantic import Field as FieldInfo
+
+from ...._models import BaseModel
+
+__all__ = ["RouteAsesResponse", "ASN", "Meta"]
+
+
+class ASN(BaseModel):
+ asn: int
+
+ cone_size: int = FieldInfo(alias="coneSize")
+ """AS's customer cone size"""
+
+ country: str
+ """2-letter country code for the AS's registration country"""
+
+ ipv4_count: int = FieldInfo(alias="ipv4Count")
+ """number of IPv4 addresses originated by the AS"""
+
+ ipv6_count: str = FieldInfo(alias="ipv6Count")
+ """number of IPv6 addresses originated by the AS"""
+
+ name: str
+ """name of the AS"""
+
+ pfxs_count: int = FieldInfo(alias="pfxsCount")
+ """number of total IP prefixes originated by the AS"""
+
+ rpki_invalid: int = FieldInfo(alias="rpkiInvalid")
+ """number of RPKI invalid prefixes originated by the AS"""
+
+ rpki_unknown: int = FieldInfo(alias="rpkiUnknown")
+ """number of RPKI unknown prefixes originated by the AS"""
+
+ rpki_valid: int = FieldInfo(alias="rpkiValid")
+ """number of RPKI valid prefixes originated by the AS"""
+
+
+class Meta(BaseModel):
+ data_time: str = FieldInfo(alias="dataTime")
+ """the timestamp of when the data is generated"""
+
+ query_time: str = FieldInfo(alias="queryTime")
+ """the timestamp of the query"""
+
+ total_peers: int = FieldInfo(alias="totalPeers")
+ """total number of route collector peers used to generate this data"""
+
+
+class RouteAsesResponse(BaseModel):
+ asns: List[ASN]
+
+ meta: Meta
diff --git a/src/cloudflare/types/radar/http_timeseries_params.py b/src/cloudflare/types/radar/http_timeseries_params.py
new file mode 100644
index 00000000000..a11c86f05f2
--- /dev/null
+++ b/src/cloudflare/types/radar/http_timeseries_params.py
@@ -0,0 +1,81 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Union
+from datetime import datetime
+from typing_extensions import Literal, Annotated, TypedDict
+
+from ..._utils import PropertyInfo
+
+__all__ = ["HTTPTimeseriesParams"]
+
+
+class HTTPTimeseriesParams(TypedDict, total=False):
+ agg_interval: Annotated[Literal["15m", "1h", "1d", "1w"], PropertyInfo(alias="aggInterval")]
+ """
+ Aggregation interval results should be returned in (for example, in 15 minutes
+ or 1 hour intervals). Refer to
+ [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/).
+ """
+
+ asn: List[str]
+ """Array of comma separated list of ASNs, start with `-` to exclude from results.
+
+ For example, `-174, 3356` excludes results from AS174, but includes results from
+ AS3356.
+ """
+
+ continent: List[str]
+ """Array of comma separated list of continents (alpha-2 continent codes).
+
+ Start with `-` to exclude from results. For example, `-EU,NA` excludes results
+ from Europe, but includes results from North America.
+ """
+
+ date_end: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateEnd", format="iso8601")]
+ """End of the date range (inclusive)."""
+
+ date_range: Annotated[
+ List[
+ Literal[
+ "1d",
+ "2d",
+ "7d",
+ "14d",
+ "28d",
+ "12w",
+ "24w",
+ "52w",
+ "1dControl",
+ "2dControl",
+ "7dControl",
+ "14dControl",
+ "28dControl",
+ "12wControl",
+ "24wControl",
+ ]
+ ],
+ PropertyInfo(alias="dateRange"),
+ ]
+ """
+ For example, use `7d` and `7dControl` to compare this week with the previous
+ week. Use this parameter or set specific start and end dates (`dateStart` and
+ `dateEnd` parameters).
+ """
+
+ date_start: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateStart", format="iso8601")]
+ """Array of datetimes to filter the start of a series."""
+
+ format: Literal["JSON", "CSV"]
+ """Format results are returned in."""
+
+ location: List[str]
+ """Array of comma separated list of locations (alpha-2 country codes).
+
+ Start with `-` to exclude from results. For example, `-US,PT` excludes results
+ from the US, but includes results from PT.
+ """
+
+ name: List[str]
+ """Array of names that will be used to name the series in responses."""
diff --git a/src/cloudflare/types/radar/http_timeseries_response.py b/src/cloudflare/types/radar/http_timeseries_response.py
new file mode 100644
index 00000000000..00d0b8dada4
--- /dev/null
+++ b/src/cloudflare/types/radar/http_timeseries_response.py
@@ -0,0 +1,69 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+
+from pydantic import Field as FieldInfo
+
+from ..._models import BaseModel
+
+__all__ = [
+ "HTTPTimeseriesResponse",
+ "Meta",
+ "MetaDateRange",
+ "MetaConfidenceInfo",
+ "MetaConfidenceInfoAnnotation",
+ "Serie0",
+]
+
+
+class MetaDateRange(BaseModel):
+ end_time: datetime = FieldInfo(alias="endTime")
+ """Adjusted end of date range."""
+
+ start_time: datetime = FieldInfo(alias="startTime")
+ """Adjusted start of date range."""
+
+
+class MetaConfidenceInfoAnnotation(BaseModel):
+ data_source: str = FieldInfo(alias="dataSource")
+
+ description: str
+
+ event_type: str = FieldInfo(alias="eventType")
+
+ is_instantaneous: object = FieldInfo(alias="isInstantaneous")
+
+ end_time: Optional[datetime] = FieldInfo(alias="endTime", default=None)
+
+ linked_url: Optional[str] = FieldInfo(alias="linkedUrl", default=None)
+
+ start_time: Optional[datetime] = FieldInfo(alias="startTime", default=None)
+
+
+class MetaConfidenceInfo(BaseModel):
+ annotations: Optional[List[MetaConfidenceInfoAnnotation]] = None
+
+ level: Optional[int] = None
+
+
+class Meta(BaseModel):
+ agg_interval: str = FieldInfo(alias="aggInterval")
+
+ date_range: List[MetaDateRange] = FieldInfo(alias="dateRange")
+
+ last_updated: datetime = FieldInfo(alias="lastUpdated")
+
+ confidence_info: Optional[MetaConfidenceInfo] = FieldInfo(alias="confidenceInfo", default=None)
+
+
+class Serie0(BaseModel):
+ timestamps: List[datetime]
+
+ values: List[str]
+
+
+class HTTPTimeseriesResponse(BaseModel):
+ meta: Meta
+
+ serie_0: Serie0
diff --git a/src/cloudflare/types/workers/ai/__init__.py b/src/cloudflare/types/workers/ai/__init__.py
new file mode 100644
index 00000000000..f8ee8b14b1c
--- /dev/null
+++ b/src/cloudflare/types/workers/ai/__init__.py
@@ -0,0 +1,3 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
diff --git a/src/cloudflare/types/workers/ai/models/__init__.py b/src/cloudflare/types/workers/ai/models/__init__.py
new file mode 100644
index 00000000000..64ed676cee2
--- /dev/null
+++ b/src/cloudflare/types/workers/ai/models/__init__.py
@@ -0,0 +1,5 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .schema_get_params import SchemaGetParams as SchemaGetParams
diff --git a/src/cloudflare/types/workers/ai/models/schema_get_params.py b/src/cloudflare/types/workers/ai/models/schema_get_params.py
new file mode 100644
index 00000000000..92d676194ab
--- /dev/null
+++ b/src/cloudflare/types/workers/ai/models/schema_get_params.py
@@ -0,0 +1,14 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["SchemaGetParams"]
+
+
+class SchemaGetParams(TypedDict, total=False):
+ account_id: Required[str]
+
+ model: Required[str]
+ """Model Name"""
diff --git a/tests/api_resources/radar/bgp/test_routes.py b/tests/api_resources/radar/bgp/test_routes.py
index fc506877a1b..bcb74fee056 100644
--- a/tests/api_resources/radar/bgp/test_routes.py
+++ b/tests/api_resources/radar/bgp/test_routes.py
@@ -10,6 +10,7 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.types.radar.bgp import (
+ RouteAsesResponse,
RouteMoasResponse,
RouteStatsResponse,
RoutePfx2asResponse,
@@ -21,6 +22,42 @@
class TestRoutes:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+ @parametrize
+ def test_method_ases(self, client: Cloudflare) -> None:
+ route = client.radar.bgp.routes.ases()
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ @parametrize
+ def test_method_ases_with_all_params(self, client: Cloudflare) -> None:
+ route = client.radar.bgp.routes.ases(
+ format="JSON",
+ limit=5,
+ location="US",
+ sort_by="ipv4",
+ sort_order="desc",
+ )
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ @parametrize
+ def test_raw_response_ases(self, client: Cloudflare) -> None:
+ response = client.radar.bgp.routes.with_raw_response.ases()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ route = response.parse()
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ @parametrize
+ def test_streaming_response_ases(self, client: Cloudflare) -> None:
+ with client.radar.bgp.routes.with_streaming_response.ases() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ route = response.parse()
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@parametrize
def test_method_moas(self, client: Cloudflare) -> None:
route = client.radar.bgp.routes.moas()
@@ -130,6 +167,42 @@ def test_streaming_response_stats(self, client: Cloudflare) -> None:
class TestAsyncRoutes:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+ @parametrize
+ async def test_method_ases(self, async_client: AsyncCloudflare) -> None:
+ route = await async_client.radar.bgp.routes.ases()
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ @parametrize
+ async def test_method_ases_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ route = await async_client.radar.bgp.routes.ases(
+ format="JSON",
+ limit=5,
+ location="US",
+ sort_by="ipv4",
+ sort_order="desc",
+ )
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ @parametrize
+ async def test_raw_response_ases(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.radar.bgp.routes.with_raw_response.ases()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ route = await response.parse()
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_ases(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.radar.bgp.routes.with_streaming_response.ases() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ route = await response.parse()
+ assert_matches_type(RouteAsesResponse, route, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@parametrize
async def test_method_moas(self, async_client: AsyncCloudflare) -> None:
route = await async_client.radar.bgp.routes.moas()
diff --git a/tests/api_resources/radar/test_http.py b/tests/api_resources/radar/test_http.py
new file mode 100644
index 00000000000..4828f727a4f
--- /dev/null
+++ b/tests/api_resources/radar/test_http.py
@@ -0,0 +1,119 @@
+# 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.radar import HTTPTimeseriesResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestHTTP:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_timeseries(self, client: Cloudflare) -> None:
+ http = client.radar.http.timeseries()
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ @parametrize
+ def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None:
+ http = client.radar.http.timeseries(
+ agg_interval="1h",
+ asn=["string", "string", "string"],
+ continent=["string", "string", "string"],
+ date_end=[
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ ],
+ date_range=["1d", "2d", "7d"],
+ date_start=[
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ ],
+ format="JSON",
+ location=["string", "string", "string"],
+ name=["string", "string", "string"],
+ )
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ @parametrize
+ def test_raw_response_timeseries(self, client: Cloudflare) -> None:
+ response = client.radar.http.with_raw_response.timeseries()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ http = response.parse()
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ @parametrize
+ def test_streaming_response_timeseries(self, client: Cloudflare) -> None:
+ with client.radar.http.with_streaming_response.timeseries() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ http = response.parse()
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncHTTP:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_timeseries(self, async_client: AsyncCloudflare) -> None:
+ http = await async_client.radar.http.timeseries()
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ @parametrize
+ async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ http = await async_client.radar.http.timeseries(
+ agg_interval="1h",
+ asn=["string", "string", "string"],
+ continent=["string", "string", "string"],
+ date_end=[
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ ],
+ date_range=["1d", "2d", "7d"],
+ date_start=[
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ parse_datetime("2019-12-27T18:11:19.117Z"),
+ ],
+ format="JSON",
+ location=["string", "string", "string"],
+ name=["string", "string", "string"],
+ )
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ @parametrize
+ async def test_raw_response_timeseries(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.radar.http.with_raw_response.timeseries()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ http = await response.parse()
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_timeseries(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.radar.http.with_streaming_response.timeseries() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ http = await response.parse()
+ assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/workers/ai/__init__.py b/tests/api_resources/workers/ai/__init__.py
new file mode 100644
index 00000000000..fd8019a9a1a
--- /dev/null
+++ b/tests/api_resources/workers/ai/__init__.py
@@ -0,0 +1 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/workers/ai/models/__init__.py b/tests/api_resources/workers/ai/models/__init__.py
new file mode 100644
index 00000000000..fd8019a9a1a
--- /dev/null
+++ b/tests/api_resources/workers/ai/models/__init__.py
@@ -0,0 +1 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/workers/ai/models/test_schema.py b/tests/api_resources/workers/ai/models/test_schema.py
new file mode 100644
index 00000000000..5937cee8a64
--- /dev/null
+++ b/tests/api_resources/workers/ai/models/test_schema.py
@@ -0,0 +1,105 @@
+# 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
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestSchema:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ schema = client.workers.ai.models.schema.get(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ model="string",
+ )
+ assert_matches_type(object, schema, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.workers.ai.models.schema.with_raw_response.get(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ model="string",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ schema = response.parse()
+ assert_matches_type(object, schema, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.workers.ai.models.schema.with_streaming_response.get(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ model="string",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ schema = response.parse()
+ assert_matches_type(object, schema, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_get(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.workers.ai.models.schema.with_raw_response.get(
+ account_id="",
+ model="string",
+ )
+
+
+class TestAsyncSchema:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ schema = await async_client.workers.ai.models.schema.get(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ model="string",
+ )
+ assert_matches_type(object, schema, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.workers.ai.models.schema.with_raw_response.get(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ model="string",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ schema = await response.parse()
+ assert_matches_type(object, schema, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.workers.ai.models.schema.with_streaming_response.get(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ model="string",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ schema = await response.parse()
+ assert_matches_type(object, schema, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.workers.ai.models.schema.with_raw_response.get(
+ account_id="",
+ model="string",
+ )