Skip to content

Commit

Permalink
feat(api): api update (#2291)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Dec 18, 2024
1 parent db76849 commit 17a3ce1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 13 additions & 13 deletions src/cloudflare/resources/accounts/logs/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions src/cloudflare/types/accounts/logs/audit_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
40 changes: 20 additions & 20 deletions tests/api_resources/accounts/logs/test_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ 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"])

@parametrize
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",
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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"),
)


Expand All @@ -106,17 +106,17 @@ 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"])

@parametrize
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",
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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"),
)

0 comments on commit 17a3ce1

Please sign in to comment.