Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent fbf4ac6 commit 662356e
Show file tree
Hide file tree
Showing 62 changed files with 529 additions and 900 deletions.
30 changes: 13 additions & 17 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

```python
from cloudflare.types import (
AuditLog,
ErrorData,
IamRole,
Identifier,
LoadBalancerPreview,
PaginationInfo,
Expand Down Expand Up @@ -52,12 +54,12 @@ Methods:
Types:

```python
from cloudflare.types.accounts import PermissionGrant, RoleListResponse, RoleGetResponse
from cloudflare.types.accounts import PermissionGrant, RoleGetResponse
```

Methods:

- <code title="get /accounts/{account_id}/roles">client.accounts.roles.<a href="./src/cloudflare/resources/accounts/roles.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/accounts/role_list_response.py">SyncSinglePage[RoleListResponse]</a></code>
- <code title="get /accounts/{account_id}/roles">client.accounts.roles.<a href="./src/cloudflare/resources/accounts/roles.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/shared/iam_role.py">SyncSinglePage[IamRole]</a></code>
- <code title="get /accounts/{account_id}/roles/{role_id}">client.accounts.roles.<a href="./src/cloudflare/resources/accounts/roles.py">get</a>(role_id, \*, account_id) -> <a href="./src/cloudflare/types/accounts/role_get_response.py">RoleGetResponse</a></code>

# OriginCACertificates
Expand Down Expand Up @@ -127,15 +129,9 @@ Methods:

## AuditLogs

Types:

```python
from cloudflare.types.user import AuditLogListResponse
```

Methods:

- <code title="get /user/audit_logs">client.user.audit_logs.<a href="./src/cloudflare/resources/user/audit_logs.py">list</a>(\*\*<a href="src/cloudflare/types/user/audit_log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/user/audit_log_list_response.py">SyncV4PagePaginationArray[AuditLogListResponse]</a></code>
- <code title="get /user/audit_logs">client.user.audit_logs.<a href="./src/cloudflare/resources/user/audit_logs.py">list</a>(\*\*<a href="src/cloudflare/types/user/audit_log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/shared/audit_log.py">SyncV4PagePaginationArray[AuditLog]</a></code>

## Billing

Expand Down Expand Up @@ -197,7 +193,11 @@ Types:

```python
from cloudflare.types.user import (
RatePlan,
Subscription,
SubscriptionComponent,
SubscriptionComponentValue,
SubscriptionZone,
SubscriptionUpdateResponse,
SubscriptionDeleteResponse,
SubscriptionEditResponse,
Expand Down Expand Up @@ -3019,6 +3019,8 @@ Types:

```python
from cloudflare.types import (
RequestRule,
ResponeRule,
Ruleset,
RulesetCreateResponse,
RulesetUpdateResponse,
Expand Down Expand Up @@ -3382,15 +3384,9 @@ Methods:

# AuditLogs

Types:

```python
from cloudflare.types import AuditLogListResponse
```

Methods:

- <code title="get /accounts/{account_id}/audit_logs">client.audit_logs.<a href="./src/cloudflare/resources/audit_logs.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/audit_log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/audit_log_list_response.py">SyncV4PagePaginationArray[AuditLogListResponse]</a></code>
- <code title="get /accounts/{account_id}/audit_logs">client.audit_logs.<a href="./src/cloudflare/resources/audit_logs.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/audit_log_list_params.py">params</a>) -> <a href="./src/cloudflare/types/shared/audit_log.py">SyncV4PagePaginationArray[AuditLog]</a></code>

# Billing

Expand Down Expand Up @@ -5435,7 +5431,7 @@ Methods:
Types:

```python
from cloudflare.types.zero_trust import Tunnel, WARPConnectorTunnel
from cloudflare.types.zero_trust import Tunnel, TunnelConnection, WARPConnectorTunnel
```

Methods:
Expand Down
5 changes: 3 additions & 2 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
)
from ...types.accounts import (
Member,
MemberRoleParam,
MemberListResponse,
MemberDeleteResponse,
MemberWithInviteCode,
Expand Down Expand Up @@ -104,7 +105,7 @@ def update(
member_id: str,
*,
account_id: object,
roles: Iterable[member_update_params.Role],
roles: Iterable[MemberRoleParam],
# 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 Down Expand Up @@ -350,7 +351,7 @@ async def update(
member_id: str,
*,
account_id: object,
roles: Iterable[member_update_params.Role],
roles: Iterable[MemberRoleParam],
# 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 Down
15 changes: 8 additions & 7 deletions src/cloudflare/resources/accounts/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
AsyncPaginator,
make_request_options,
)
from ...types.accounts import RoleGetResponse, RoleListResponse
from ...types.shared import IamRole
from ...types.accounts import RoleGetResponse

__all__ = ["Roles", "AsyncRoles"]

Expand All @@ -45,7 +46,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[RoleListResponse]:
) -> SyncSinglePage[IamRole]:
"""
Get all available roles for an account.
Expand All @@ -60,11 +61,11 @@ def list(
"""
return self._get_api_list(
f"/accounts/{account_id}/roles",
page=SyncSinglePage[RoleListResponse],
page=SyncSinglePage[IamRole],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=RoleListResponse,
model=IamRole,
)

def get(
Expand Down Expand Up @@ -128,7 +129,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[RoleListResponse, AsyncSinglePage[RoleListResponse]]:
) -> AsyncPaginator[IamRole, AsyncSinglePage[IamRole]]:
"""
Get all available roles for an account.
Expand All @@ -143,11 +144,11 @@ def list(
"""
return self._get_api_list(
f"/accounts/{account_id}/roles",
page=AsyncSinglePage[RoleListResponse],
page=AsyncSinglePage[IamRole],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=RoleListResponse,
model=IamRole,
)

async def get(
Expand Down
15 changes: 8 additions & 7 deletions src/cloudflare/resources/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import httpx

from ..types import AuditLogListResponse, audit_log_list_params
from ..types import audit_log_list_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import maybe_transform
from .._compat import cached_property
Expand All @@ -24,6 +24,7 @@
AsyncPaginator,
make_request_options,
)
from ..types.shared import AuditLog

__all__ = ["AuditLogs", "AsyncAuditLogs"]

Expand Down Expand Up @@ -58,7 +59,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncV4PagePaginationArray[AuditLogListResponse]:
) -> SyncV4PagePaginationArray[AuditLog]:
"""Gets a list of audit logs for an account.
Can be filtered by who made the
Expand Down Expand Up @@ -97,7 +98,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/audit_logs",
page=SyncV4PagePaginationArray[AuditLogListResponse],
page=SyncV4PagePaginationArray[AuditLog],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -120,7 +121,7 @@ def list(
audit_log_list_params.AuditLogListParams,
),
),
model=AuditLogListResponse,
model=AuditLog,
)


Expand Down Expand Up @@ -154,7 +155,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[AuditLogListResponse, AsyncV4PagePaginationArray[AuditLogListResponse]]:
) -> AsyncPaginator[AuditLog, AsyncV4PagePaginationArray[AuditLog]]:
"""Gets a list of audit logs for an account.
Can be filtered by who made the
Expand Down Expand Up @@ -193,7 +194,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/audit_logs",
page=AsyncV4PagePaginationArray[AuditLogListResponse],
page=AsyncV4PagePaginationArray[AuditLog],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -216,7 +217,7 @@ def list(
audit_log_list_params.AuditLogListParams,
),
),
model=AuditLogListResponse,
model=AuditLog,
)


Expand Down
5 changes: 3 additions & 2 deletions src/cloudflare/resources/rulesets/phases/phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import httpx

from ....types import RequestRuleParam
from .versions import (
Versions,
AsyncVersions,
Expand Down Expand Up @@ -78,7 +79,7 @@ def update(
"magic_transit_managed",
],
*,
rules: Iterable[phase_update_params.Rule],
rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -311,7 +312,7 @@ async def update(
"magic_transit_managed",
],
*,
rules: Iterable[phase_update_params.Rule],
rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
Expand Down
9 changes: 5 additions & 4 deletions src/cloudflare/resources/rulesets/rulesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
)
from ...types import (
Ruleset,
RequestRuleParam,
RulesetGetResponse,
RulesetCreateResponse,
RulesetUpdateResponse,
Expand Down Expand Up @@ -115,7 +116,7 @@ def create(
"magic_transit_ids_managed",
"magic_transit_managed",
],
rules: Iterable[ruleset_create_params.Rule],
rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -193,7 +194,7 @@ def update(
self,
ruleset_id: str,
*,
rules: Iterable[ruleset_update_params.Rule],
rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -520,7 +521,7 @@ async def create(
"magic_transit_ids_managed",
"magic_transit_managed",
],
rules: Iterable[ruleset_create_params.Rule],
rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -598,7 +599,7 @@ async def update(
self,
ruleset_id: str,
*,
rules: Iterable[ruleset_update_params.Rule],
rules: Iterable[RequestRuleParam],
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
Expand Down
31 changes: 18 additions & 13 deletions src/cloudflare/resources/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
)
from .._wrappers import ResultWrapper
from ..pagination import SyncSinglePage, AsyncSinglePage
from ..types.user import Subscription
from ..types.user import (
Subscription,
RatePlanParam,
SubscriptionZoneParam,
SubscriptionComponentParam,
)
from .._base_client import (
AsyncPaginator,
make_request_options,
Expand All @@ -54,10 +59,10 @@ def create(
identifier: str,
*,
app: subscription_create_params.App | NotGiven = NOT_GIVEN,
component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN,
component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN,
frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN,
zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN,
rate_plan: RatePlanParam | NotGiven = NOT_GIVEN,
zone: SubscriptionZoneParam | 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 Down Expand Up @@ -122,10 +127,10 @@ def update(
*,
account_identifier: str,
app: subscription_update_params.App | NotGiven = NOT_GIVEN,
component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN,
component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN,
frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN,
zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN,
rate_plan: RatePlanParam | NotGiven = NOT_GIVEN,
zone: SubscriptionZoneParam | 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 Down Expand Up @@ -333,10 +338,10 @@ async def create(
identifier: str,
*,
app: subscription_create_params.App | NotGiven = NOT_GIVEN,
component_values: Iterable[subscription_create_params.ComponentValue] | NotGiven = NOT_GIVEN,
component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN,
frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
rate_plan: subscription_create_params.RatePlan | NotGiven = NOT_GIVEN,
zone: subscription_create_params.Zone | NotGiven = NOT_GIVEN,
rate_plan: RatePlanParam | NotGiven = NOT_GIVEN,
zone: SubscriptionZoneParam | 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 Down Expand Up @@ -401,10 +406,10 @@ async def update(
*,
account_identifier: str,
app: subscription_update_params.App | NotGiven = NOT_GIVEN,
component_values: Iterable[subscription_update_params.ComponentValue] | NotGiven = NOT_GIVEN,
component_values: Iterable[SubscriptionComponentParam] | NotGiven = NOT_GIVEN,
frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
rate_plan: subscription_update_params.RatePlan | NotGiven = NOT_GIVEN,
zone: subscription_update_params.Zone | NotGiven = NOT_GIVEN,
rate_plan: RatePlanParam | NotGiven = NOT_GIVEN,
zone: SubscriptionZoneParam | 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 Down
Loading

0 comments on commit 662356e

Please sign in to comment.