Skip to content

Commit

Permalink
feat(api): api update (#2171)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 19, 2024
1 parent bfd27f8 commit f704605
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1411
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d8a11058191753bacee9c070940904a1318942d364a2420ad1e253bd450b2bcf.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-79262f52aa0305d7e45a8aca559302bac22ba83027c7957ffa65d80834bd50dd.yml
60 changes: 60 additions & 0 deletions src/cloudflare/resources/radar/http/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,22 @@ def timeseries(
*,
agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN,
asn: List[str] | NotGiven = NOT_GIVEN,
bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN,
continent: List[str] | NotGiven = NOT_GIVEN,
date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
date_range: List[str] | NotGiven = NOT_GIVEN,
date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
device_type: List[Literal["DESKTOP", "MOBILE", "OTHER"]] | NotGiven = NOT_GIVEN,
format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN,
http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN,
ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN,
location: List[str] | NotGiven = NOT_GIVEN,
name: List[str] | NotGiven = NOT_GIVEN,
normalization: Literal["PERCENTAGE_CHANGE", "MIN0_MAX"] | NotGiven = NOT_GIVEN,
os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]]
| NotGiven = NOT_GIVEN,
tls_version: List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]] | 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,
Expand All @@ -143,6 +151,9 @@ def timeseries(
For example, `-174, 3356` excludes results from AS174, but includes results from
AS3356.
bot_class: Filter for bot class. Refer to
[Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/).
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.
Expand All @@ -155,8 +166,16 @@ def timeseries(
date_start: Array of datetimes to filter the start of a series.
device_type: Filter for device type.
format: Format results are returned in.
http_protocol: Filter for http protocol.
http_version: Filter for http version.
ip_version: Filter for ip version.
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.
Expand All @@ -166,6 +185,10 @@ def timeseries(
normalization: Normalization method applied. Refer to
[Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
os: Filter for os name.
tls_version: Filter for tls version.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -185,14 +208,21 @@ def timeseries(
{
"agg_interval": agg_interval,
"asn": asn,
"bot_class": bot_class,
"continent": continent,
"date_end": date_end,
"date_range": date_range,
"date_start": date_start,
"device_type": device_type,
"format": format,
"http_protocol": http_protocol,
"http_version": http_version,
"ip_version": ip_version,
"location": location,
"name": name,
"normalization": normalization,
"os": os,
"tls_version": tls_version,
},
http_timeseries_params.HTTPTimeseriesParams,
),
Expand Down Expand Up @@ -247,14 +277,22 @@ async def timeseries(
*,
agg_interval: Literal["15m", "1h", "1d", "1w"] | NotGiven = NOT_GIVEN,
asn: List[str] | NotGiven = NOT_GIVEN,
bot_class: List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]] | NotGiven = NOT_GIVEN,
continent: List[str] | NotGiven = NOT_GIVEN,
date_end: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
date_range: List[str] | NotGiven = NOT_GIVEN,
date_start: List[Union[str, datetime]] | NotGiven = NOT_GIVEN,
device_type: List[Literal["DESKTOP", "MOBILE", "OTHER"]] | NotGiven = NOT_GIVEN,
format: Literal["JSON", "CSV"] | NotGiven = NOT_GIVEN,
http_protocol: List[Literal["HTTP", "HTTPS"]] | NotGiven = NOT_GIVEN,
http_version: List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]] | NotGiven = NOT_GIVEN,
ip_version: List[Literal["IPv4", "IPv6"]] | NotGiven = NOT_GIVEN,
location: List[str] | NotGiven = NOT_GIVEN,
name: List[str] | NotGiven = NOT_GIVEN,
normalization: Literal["PERCENTAGE_CHANGE", "MIN0_MAX"] | NotGiven = NOT_GIVEN,
os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]]
| NotGiven = NOT_GIVEN,
tls_version: List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]] | 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,
Expand All @@ -274,6 +312,9 @@ async def timeseries(
For example, `-174, 3356` excludes results from AS174, but includes results from
AS3356.
bot_class: Filter for bot class. Refer to
[Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/).
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.
Expand All @@ -286,8 +327,16 @@ async def timeseries(
date_start: Array of datetimes to filter the start of a series.
device_type: Filter for device type.
format: Format results are returned in.
http_protocol: Filter for http protocol.
http_version: Filter for http version.
ip_version: Filter for ip version.
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.
Expand All @@ -297,6 +346,10 @@ async def timeseries(
normalization: Normalization method applied. Refer to
[Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
os: Filter for os name.
tls_version: Filter for tls version.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -316,14 +369,21 @@ async def timeseries(
{
"agg_interval": agg_interval,
"asn": asn,
"bot_class": bot_class,
"continent": continent,
"date_end": date_end,
"date_range": date_range,
"date_start": date_start,
"device_type": device_type,
"format": format,
"http_protocol": http_protocol,
"http_version": http_version,
"ip_version": ip_version,
"location": location,
"name": name,
"normalization": normalization,
"os": os,
"tls_version": tls_version,
},
http_timeseries_params.HTTPTimeseriesParams,
),
Expand Down
27 changes: 27 additions & 0 deletions src/cloudflare/types/radar/http_timeseries_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ class HTTPTimeseriesParams(TypedDict, total=False):
AS3356.
"""

bot_class: Annotated[List[Literal["LIKELY_AUTOMATED", "LIKELY_HUMAN"]], PropertyInfo(alias="botClass")]
"""Filter for bot class.
Refer to
[Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/).
"""

continent: List[str]
"""Array of comma separated list of continents (alpha-2 continent codes).
Expand All @@ -46,9 +53,21 @@ class HTTPTimeseriesParams(TypedDict, total=False):
date_start: Annotated[List[Union[str, datetime]], PropertyInfo(alias="dateStart", format="iso8601")]
"""Array of datetimes to filter the start of a series."""

device_type: Annotated[List[Literal["DESKTOP", "MOBILE", "OTHER"]], PropertyInfo(alias="deviceType")]
"""Filter for device type."""

format: Literal["JSON", "CSV"]
"""Format results are returned in."""

http_protocol: Annotated[List[Literal["HTTP", "HTTPS"]], PropertyInfo(alias="httpProtocol")]
"""Filter for http protocol."""

http_version: Annotated[List[Literal["HTTPv1", "HTTPv2", "HTTPv3"]], PropertyInfo(alias="httpVersion")]
"""Filter for http version."""

ip_version: Annotated[List[Literal["IPv4", "IPv6"]], PropertyInfo(alias="ipVersion")]
"""Filter for ip version."""

location: List[str]
"""Array of comma separated list of locations (alpha-2 country codes).
Expand All @@ -65,3 +84,11 @@ class HTTPTimeseriesParams(TypedDict, total=False):
Refer to
[Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/).
"""

os: List[Literal["WINDOWS", "MACOSX", "IOS", "ANDROID", "CHROMEOS", "LINUX", "SMART_TV"]]
"""Filter for os name."""

tls_version: Annotated[
List[Literal["TLSv1_0", "TLSv1_1", "TLSv1_2", "TLSv1_3", "TLSvQUIC"]], PropertyInfo(alias="tlsVersion")
]
"""Filter for tls version."""
14 changes: 14 additions & 0 deletions tests/api_resources/radar/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,21 @@ def test_method_timeseries_with_all_params(self, client: Cloudflare) -> None:
http = client.radar.http.timeseries(
agg_interval="15m",
asn=["string"],
bot_class=["LIKELY_AUTOMATED"],
continent=["string"],
date_end=[parse_datetime("2019-12-27T18:11:19.117Z")],
date_range=["7d"],
date_start=[parse_datetime("2019-12-27T18:11:19.117Z")],
device_type=["DESKTOP"],
format="JSON",
http_protocol=["HTTP"],
http_version=["HTTPv1"],
ip_version=["IPv4"],
location=["string"],
name=["string"],
normalization="PERCENTAGE_CHANGE",
os=["WINDOWS"],
tls_version=["TLSv1_0"],
)
assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])

Expand Down Expand Up @@ -73,14 +80,21 @@ async def test_method_timeseries_with_all_params(self, async_client: AsyncCloudf
http = await async_client.radar.http.timeseries(
agg_interval="15m",
asn=["string"],
bot_class=["LIKELY_AUTOMATED"],
continent=["string"],
date_end=[parse_datetime("2019-12-27T18:11:19.117Z")],
date_range=["7d"],
date_start=[parse_datetime("2019-12-27T18:11:19.117Z")],
device_type=["DESKTOP"],
format="JSON",
http_protocol=["HTTP"],
http_version=["HTTPv1"],
ip_version=["IPv4"],
location=["string"],
name=["string"],
normalization="PERCENTAGE_CHANGE",
os=["WINDOWS"],
tls_version=["TLSv1_0"],
)
assert_matches_type(HTTPTimeseriesResponse, http, path=["response"])

Expand Down

0 comments on commit f704605

Please sign in to comment.