diff --git a/.stats.yml b/.stats.yml index 9514ffdd04b..9a17f3e2ed5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1480 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-940940879e4920ccdb9e851d6a4f0f3c313303b4917c6e3c49e81b7e44f1506c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-18ccd4bfa5225ea54ecb087df6d6542117dc16f65b932d7e33a3e05d6c8e3c7e.yml diff --git a/src/cloudflare/resources/accounts/logs/audit.py b/src/cloudflare/resources/accounts/logs/audit.py index 08893ade2e6..7375f4199ec 100644 --- a/src/cloudflare/resources/accounts/logs/audit.py +++ b/src/cloudflare/resources/accounts/logs/audit.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Union -from datetime import date, datetime +from datetime import date from typing_extensions import Literal import httpx @@ -50,8 +50,8 @@ def list( self, *, account_id: str, - before: Union[Union[str, date], Union[str, datetime]], - since: Union[Union[str, date], Union[str, datetime]], + before: Union[str, date], + since: Union[str, date], account_name: str | NotGiven = NOT_GIVEN, action_result: Literal["success", "failure"] | NotGiven = NOT_GIVEN, action_type: Literal["create", "delete", "view", "update"] | NotGiven = NOT_GIVEN, @@ -94,11 +94,11 @@ def list( Args: account_id: The unique id that identifies the account. - before: Filters actions based on a given timestamp, returning only logs that occurred - before the specified date. + before: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and before the specified date. - since: Filters actions based on a given timestamp, returning only logs that occurred - after the specified date. + since: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and after the specified date. account_name: Filters by the account name. @@ -232,8 +232,8 @@ def list( self, *, account_id: str, - before: Union[Union[str, date], Union[str, datetime]], - since: Union[Union[str, date], Union[str, datetime]], + before: Union[str, date], + since: Union[str, date], account_name: str | NotGiven = NOT_GIVEN, action_result: Literal["success", "failure"] | NotGiven = NOT_GIVEN, action_type: Literal["create", "delete", "view", "update"] | NotGiven = NOT_GIVEN, @@ -276,11 +276,11 @@ def list( Args: account_id: The unique id that identifies the account. - before: Filters actions based on a given timestamp, returning only logs that occurred - before the specified date. + before: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and before the specified date. - since: Filters actions based on a given timestamp, returning only logs that occurred - after the specified date. + since: Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and after the specified date. account_name: Filters by the account name. diff --git a/src/cloudflare/types/accounts/logs/audit_list_params.py b/src/cloudflare/types/accounts/logs/audit_list_params.py index 3d2556f2f0d..0d0bd685341 100644 --- a/src/cloudflare/types/accounts/logs/audit_list_params.py +++ b/src/cloudflare/types/accounts/logs/audit_list_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Union -from datetime import date, datetime +from datetime import date from typing_extensions import Literal, Required, Annotated, TypedDict from ...._utils import PropertyInfo @@ -15,16 +15,16 @@ class AuditListParams(TypedDict, total=False): account_id: Required[str] """The unique id that identifies the account.""" - before: Required[Annotated[Union[Union[str, date], Union[str, datetime]], PropertyInfo(format="iso8601")]] + before: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """ - Filters actions based on a given timestamp, returning only logs that occurred - before the specified date. + Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and before the specified date. """ - since: Required[Annotated[Union[Union[str, date], Union[str, datetime]], PropertyInfo(format="iso8601")]] + since: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """ - Filters actions based on a given timestamp, returning only logs that occurred - after the specified date. + Filters actions based on a given timestamp in the format yyyy-mm-dd, returning + only logs that occurred on and after the specified date. """ account_name: str diff --git a/tests/api_resources/accounts/logs/test_audit.py b/tests/api_resources/accounts/logs/test_audit.py index 563ef94f47f..4854d628f3a 100644 --- a/tests/api_resources/accounts/logs/test_audit.py +++ b/tests/api_resources/accounts/logs/test_audit.py @@ -23,8 +23,8 @@ class TestAudit: def test_method_list(self, client: Cloudflare) -> None: audit = client.accounts.logs.audit.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), ) assert_matches_type(SyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) @@ -32,8 +32,8 @@ def test_method_list(self, client: Cloudflare) -> None: def test_method_list_with_all_params(self, client: Cloudflare) -> None: audit = client.accounts.logs.audit.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), account_name="account_name", action_result="success", action_type="create", @@ -65,8 +65,8 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: def test_raw_response_list(self, client: Cloudflare) -> None: response = client.accounts.logs.audit.with_raw_response.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), ) assert response.is_closed is True @@ -78,8 +78,8 @@ def test_raw_response_list(self, client: Cloudflare) -> None: def test_streaming_response_list(self, client: Cloudflare) -> None: with client.accounts.logs.audit.with_streaming_response.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -94,8 +94,8 @@ def test_path_params_list(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.accounts.logs.audit.with_raw_response.list( account_id="", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), ) @@ -106,8 +106,8 @@ class TestAsyncAudit: async def test_method_list(self, async_client: AsyncCloudflare) -> None: audit = await async_client.accounts.logs.audit.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), ) assert_matches_type(AsyncCursorLimitPagination[AuditListResponse], audit, path=["response"]) @@ -115,8 +115,8 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None: audit = await async_client.accounts.logs.audit.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), account_name="account_name", action_result="success", action_type="create", @@ -148,8 +148,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: response = await async_client.accounts.logs.audit.with_raw_response.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), ) assert response.is_closed is True @@ -161,8 +161,8 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None: async with async_client.accounts.logs.audit.with_streaming_response.list( account_id="a67e14daa5f8dceeb91fe5449ba496ef", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -177,6 +177,6 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.accounts.logs.audit.with_raw_response.list( account_id="", - before=parse_date("2014-10-30"), - since=parse_date("2014-10-30"), + before=parse_date("2024-10-31"), + since=parse_date("2024-10-30"), )