Skip to content

Commit d0391a2

Browse files
feat(api): aggregated API specs update
1 parent 17d36a1 commit d0391a2

5 files changed

Lines changed: 108 additions & 69 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 645
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-24b39742987350e54c3a309a2a9befa3fa5baa2d0eb2ed61511dab58c4ae9ed2.yml
3-
openapi_spec_hash: b59285fd083fd6f39f9670071b09d035
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-ae604d09a1ce100f6fd1d87cbd55a2ec19894ed1cd3e69fa26a2dbe50d5ca363.yml
3+
openapi_spec_hash: 8785c579d5c735be99ba4a6e56504c1d
44
config_hash: 59388520da4ff5c0c55372621be2a8bb

src/gcore/resources/waap/domains/statistics.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ def get_requests_series(
407407
model=WaapRequestSummary,
408408
)
409409

410+
@typing_extensions.deprecated("deprecated")
410411
def get_traffic_series(
411412
self,
412413
domain_id: int,
@@ -421,10 +422,11 @@ def get_traffic_series(
421422
extra_body: Body | None = None,
422423
timeout: float | httpx.Timeout | None | NotGiven = not_given,
423424
) -> StatisticGetTrafficSeriesResponse:
424-
"""
425-
Retrieves a comprehensive report on a domain's traffic statistics based on
426-
Clickhouse. The report includes details such as API requests, blocked events,
427-
error counts, and many more traffic-related metrics.
425+
"""Deprecated.
426+
427+
Use
428+
[GET /v1/analytics/traffic](/docs/api-reference/waap/analytics/get-traffic-data)
429+
instead.
428430
429431
Args:
430432
domain_id: The domain ID
@@ -833,6 +835,7 @@ def get_requests_series(
833835
model=WaapRequestSummary,
834836
)
835837

838+
@typing_extensions.deprecated("deprecated")
836839
async def get_traffic_series(
837840
self,
838841
domain_id: int,
@@ -847,10 +850,11 @@ async def get_traffic_series(
847850
extra_body: Body | None = None,
848851
timeout: float | httpx.Timeout | None | NotGiven = not_given,
849852
) -> StatisticGetTrafficSeriesResponse:
850-
"""
851-
Retrieves a comprehensive report on a domain's traffic statistics based on
852-
Clickhouse. The report includes details such as API requests, blocked events,
853-
error counts, and many more traffic-related metrics.
853+
"""Deprecated.
854+
855+
Use
856+
[GET /v1/analytics/traffic](/docs/api-reference/waap/analytics/get-traffic-data)
857+
instead.
854858
855859
Args:
856860
domain_id: The domain ID
@@ -911,8 +915,10 @@ def __init__(self, statistics: StatisticsResource) -> None:
911915
statistics.get_requests_series, # pyright: ignore[reportDeprecated],
912916
)
913917
)
914-
self.get_traffic_series = to_raw_response_wrapper(
915-
statistics.get_traffic_series,
918+
self.get_traffic_series = ( # pyright: ignore[reportDeprecated]
919+
to_raw_response_wrapper(
920+
statistics.get_traffic_series, # pyright: ignore[reportDeprecated],
921+
)
916922
)
917923

918924

@@ -937,8 +943,10 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None:
937943
statistics.get_requests_series, # pyright: ignore[reportDeprecated],
938944
)
939945
)
940-
self.get_traffic_series = async_to_raw_response_wrapper(
941-
statistics.get_traffic_series,
946+
self.get_traffic_series = ( # pyright: ignore[reportDeprecated]
947+
async_to_raw_response_wrapper(
948+
statistics.get_traffic_series, # pyright: ignore[reportDeprecated],
949+
)
942950
)
943951

944952

@@ -963,8 +971,10 @@ def __init__(self, statistics: StatisticsResource) -> None:
963971
statistics.get_requests_series, # pyright: ignore[reportDeprecated],
964972
)
965973
)
966-
self.get_traffic_series = to_streamed_response_wrapper(
967-
statistics.get_traffic_series,
974+
self.get_traffic_series = ( # pyright: ignore[reportDeprecated]
975+
to_streamed_response_wrapper(
976+
statistics.get_traffic_series, # pyright: ignore[reportDeprecated],
977+
)
968978
)
969979

970980

@@ -989,6 +999,8 @@ def __init__(self, statistics: AsyncStatisticsResource) -> None:
989999
statistics.get_requests_series, # pyright: ignore[reportDeprecated],
9901000
)
9911001
)
992-
self.get_traffic_series = async_to_streamed_response_wrapper(
993-
statistics.get_traffic_series,
1002+
self.get_traffic_series = ( # pyright: ignore[reportDeprecated]
1003+
async_to_streamed_response_wrapper(
1004+
statistics.get_traffic_series, # pyright: ignore[reportDeprecated],
1005+
)
9941006
)

src/gcore/types/waap/domains/waap_request_details.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Dict, List
3+
from typing import Dict, List, Optional
44
from datetime import datetime
55
from typing_extensions import Literal
66

@@ -196,3 +196,9 @@ class WaapRequestDetails(BaseModel):
196196

197197
user_agent: UserAgent
198198
"""User agent"""
199+
200+
decision: Optional[Literal["passed", "allowed", "monitored", "blocked", ""]] = None
201+
"""The decision made for processing the request through the WAAP."""
202+
203+
optional_action: Optional[Literal["captcha", "challenge", ""]] = None
204+
"""An optional action that may be applied in addition to the primary decision."""

src/gcore/types/waap/domains/waap_request_summary.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,21 @@ class WaapRequestSummary(BaseModel):
2222
country: str
2323
"""Country code"""
2424

25+
decision: Literal["passed", "allowed", "monitored", "blocked", ""]
26+
"""The decision made for processing the request through the WAAP."""
27+
2528
domain: str
2629
"""Domain name"""
2730

31+
domain_id: int
32+
"""Domain ID"""
33+
2834
method: str
2935
"""HTTP method"""
3036

37+
optional_action: Literal["captcha", "challenge", ""]
38+
"""An optional action that may be applied in addition to the primary decision."""
39+
3140
organization: str
3241
"""Organization"""
3342

tests/api_resources/waap/domains/test_statistics.py

Lines changed: 62 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -270,30 +270,35 @@ def test_streaming_response_get_requests_series(self, client: Gcore) -> None:
270270

271271
@parametrize
272272
def test_method_get_traffic_series(self, client: Gcore) -> None:
273-
statistic = client.waap.domains.statistics.get_traffic_series(
274-
domain_id=1,
275-
resolution="daily",
276-
start="2024-04-13T00:00:00+01:00",
277-
)
273+
with pytest.warns(DeprecationWarning):
274+
statistic = client.waap.domains.statistics.get_traffic_series(
275+
domain_id=1,
276+
resolution="daily",
277+
start="2024-04-13T00:00:00+01:00",
278+
)
279+
278280
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
279281

280282
@parametrize
281283
def test_method_get_traffic_series_with_all_params(self, client: Gcore) -> None:
282-
statistic = client.waap.domains.statistics.get_traffic_series(
283-
domain_id=1,
284-
resolution="daily",
285-
start="2024-04-13T00:00:00+01:00",
286-
end="2024-04-14T12:00:00Z",
287-
)
284+
with pytest.warns(DeprecationWarning):
285+
statistic = client.waap.domains.statistics.get_traffic_series(
286+
domain_id=1,
287+
resolution="daily",
288+
start="2024-04-13T00:00:00+01:00",
289+
end="2024-04-14T12:00:00Z",
290+
)
291+
288292
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
289293

290294
@parametrize
291295
def test_raw_response_get_traffic_series(self, client: Gcore) -> None:
292-
response = client.waap.domains.statistics.with_raw_response.get_traffic_series(
293-
domain_id=1,
294-
resolution="daily",
295-
start="2024-04-13T00:00:00+01:00",
296-
)
296+
with pytest.warns(DeprecationWarning):
297+
response = client.waap.domains.statistics.with_raw_response.get_traffic_series(
298+
domain_id=1,
299+
resolution="daily",
300+
start="2024-04-13T00:00:00+01:00",
301+
)
297302

298303
assert response.is_closed is True
299304
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -302,16 +307,17 @@ def test_raw_response_get_traffic_series(self, client: Gcore) -> None:
302307

303308
@parametrize
304309
def test_streaming_response_get_traffic_series(self, client: Gcore) -> None:
305-
with client.waap.domains.statistics.with_streaming_response.get_traffic_series(
306-
domain_id=1,
307-
resolution="daily",
308-
start="2024-04-13T00:00:00+01:00",
309-
) as response:
310-
assert not response.is_closed
311-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
310+
with pytest.warns(DeprecationWarning):
311+
with client.waap.domains.statistics.with_streaming_response.get_traffic_series(
312+
domain_id=1,
313+
resolution="daily",
314+
start="2024-04-13T00:00:00+01:00",
315+
) as response:
316+
assert not response.is_closed
317+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
312318

313-
statistic = response.parse()
314-
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
319+
statistic = response.parse()
320+
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
315321

316322
assert cast(Any, response.is_closed) is True
317323

@@ -563,30 +569,35 @@ async def test_streaming_response_get_requests_series(self, async_client: AsyncG
563569

564570
@parametrize
565571
async def test_method_get_traffic_series(self, async_client: AsyncGcore) -> None:
566-
statistic = await async_client.waap.domains.statistics.get_traffic_series(
567-
domain_id=1,
568-
resolution="daily",
569-
start="2024-04-13T00:00:00+01:00",
570-
)
572+
with pytest.warns(DeprecationWarning):
573+
statistic = await async_client.waap.domains.statistics.get_traffic_series(
574+
domain_id=1,
575+
resolution="daily",
576+
start="2024-04-13T00:00:00+01:00",
577+
)
578+
571579
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
572580

573581
@parametrize
574582
async def test_method_get_traffic_series_with_all_params(self, async_client: AsyncGcore) -> None:
575-
statistic = await async_client.waap.domains.statistics.get_traffic_series(
576-
domain_id=1,
577-
resolution="daily",
578-
start="2024-04-13T00:00:00+01:00",
579-
end="2024-04-14T12:00:00Z",
580-
)
583+
with pytest.warns(DeprecationWarning):
584+
statistic = await async_client.waap.domains.statistics.get_traffic_series(
585+
domain_id=1,
586+
resolution="daily",
587+
start="2024-04-13T00:00:00+01:00",
588+
end="2024-04-14T12:00:00Z",
589+
)
590+
581591
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
582592

583593
@parametrize
584594
async def test_raw_response_get_traffic_series(self, async_client: AsyncGcore) -> None:
585-
response = await async_client.waap.domains.statistics.with_raw_response.get_traffic_series(
586-
domain_id=1,
587-
resolution="daily",
588-
start="2024-04-13T00:00:00+01:00",
589-
)
595+
with pytest.warns(DeprecationWarning):
596+
response = await async_client.waap.domains.statistics.with_raw_response.get_traffic_series(
597+
domain_id=1,
598+
resolution="daily",
599+
start="2024-04-13T00:00:00+01:00",
600+
)
590601

591602
assert response.is_closed is True
592603
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -595,15 +606,16 @@ async def test_raw_response_get_traffic_series(self, async_client: AsyncGcore) -
595606

596607
@parametrize
597608
async def test_streaming_response_get_traffic_series(self, async_client: AsyncGcore) -> None:
598-
async with async_client.waap.domains.statistics.with_streaming_response.get_traffic_series(
599-
domain_id=1,
600-
resolution="daily",
601-
start="2024-04-13T00:00:00+01:00",
602-
) as response:
603-
assert not response.is_closed
604-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
609+
with pytest.warns(DeprecationWarning):
610+
async with async_client.waap.domains.statistics.with_streaming_response.get_traffic_series(
611+
domain_id=1,
612+
resolution="daily",
613+
start="2024-04-13T00:00:00+01:00",
614+
) as response:
615+
assert not response.is_closed
616+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
605617

606-
statistic = await response.parse()
607-
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
618+
statistic = await response.parse()
619+
assert_matches_type(StatisticGetTrafficSeriesResponse, statistic, path=["response"])
608620

609621
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)