Skip to content

Commit

Permalink
feat(api): api update (#2142)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 12, 2024
1 parent d44d69e commit 0b5a5d0
Show file tree
Hide file tree
Showing 25 changed files with 351 additions and 192 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: 1365
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8ab175377b40ec09207fa70914e51f8bec9d6030f6f628635d56f4c3321d4809.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4593529df2c582c5e4de92308af748d9f8abbca6c92fff7e99e08bd463b7271e.yml
15 changes: 6 additions & 9 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ from cloudflare.types import (
ErrorData,
Identifier,
LoadBalancerPreview,
Member,
PaginationInfo,
Permission,
PermissionGrant,
RatePlan,
ResponseInfo,
Result,
Role,
SortDirection,
Subscription,
SubscriptionComponent,
Expand Down Expand Up @@ -48,7 +46,6 @@ Types:
```python
from cloudflare.types.accounts import (
Status,
UserWithInviteCode,
MemberCreateResponse,
MemberUpdateResponse,
MemberListResponse,
Expand All @@ -70,13 +67,13 @@ Methods:
Types:

```python
from cloudflare.types.accounts import RoleGetResponse
from cloudflare.types.accounts import RoleListResponse, 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/shared/role.py">SyncSinglePage[Role]</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">object</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/accounts/role_list_response.py">SyncSinglePage[RoleListResponse]</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">Optional</a></code>

## Subscriptions

Expand Down Expand Up @@ -198,14 +195,14 @@ Methods:
Types:

```python
from cloudflare.types.user import Invite, InviteEditResponse, InviteGetResponse
from cloudflare.types.user import Invite
```

Methods:

- <code title="get /user/invites">client.user.invites.<a href="./src/cloudflare/resources/user/invites.py">list</a>() -> <a href="./src/cloudflare/types/user/invite.py">SyncSinglePage[Invite]</a></code>
- <code title="patch /user/invites/{invite_id}">client.user.invites.<a href="./src/cloudflare/resources/user/invites.py">edit</a>(invite_id, \*\*<a href="src/cloudflare/types/user/invite_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/user/invite_edit_response.py">object</a></code>
- <code title="get /user/invites/{invite_id}">client.user.invites.<a href="./src/cloudflare/resources/user/invites.py">get</a>(invite_id) -> <a href="./src/cloudflare/types/user/invite_get_response.py">object</a></code>
- <code title="patch /user/invites/{invite_id}">client.user.invites.<a href="./src/cloudflare/resources/user/invites.py">edit</a>(invite_id, \*\*<a href="src/cloudflare/types/user/invite_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/user/invite.py">Optional</a></code>
- <code title="get /user/invites/{invite_id}">client.user.invites.<a href="./src/cloudflare/resources/user/invites.py">get</a>(invite_id) -> <a href="./src/cloudflare/types/user/invite.py">Optional</a></code>

## Organizations

Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def update(
member_id: str,
*,
account_id: str,
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | 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 @@ -237,7 +237,7 @@ def update(
member_id: str,
*,
account_id: str,
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | NotGiven = NOT_GIVEN,
policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | 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.
Expand Down Expand Up @@ -557,7 +557,7 @@ async def update(
member_id: str,
*,
account_id: str,
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | 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 @@ -625,7 +625,7 @@ async def update(
member_id: str,
*,
account_id: str,
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
roles: Iterable[member_update_params.IAMUpdateMemberWithRolesRole] | NotGiven = NOT_GIVEN,
policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | 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.
Expand Down
27 changes: 14 additions & 13 deletions src/cloudflare/resources/accounts/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from ..._wrappers import ResultWrapper
from ...pagination import SyncSinglePage, AsyncSinglePage
from ..._base_client import AsyncPaginator, make_request_options
from ...types.shared.role import Role
from ...types.accounts.role_get_response import RoleGetResponse
from ...types.accounts.role_list_response import RoleListResponse

__all__ = ["RolesResource", "AsyncRolesResource"]

Expand Down Expand Up @@ -53,7 +54,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Role]:
) -> SyncSinglePage[RoleListResponse]:
"""
Get all available roles for an account.
Expand All @@ -72,11 +73,11 @@ 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}/roles",
page=SyncSinglePage[Role],
page=SyncSinglePage[RoleListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Role,
model=RoleListResponse,
)

def get(
Expand All @@ -90,7 +91,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> Optional[RoleGetResponse]:
"""
Get information about a specific role for an account.
Expand Down Expand Up @@ -118,9 +119,9 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[object]]._unwrapper,
post_parser=ResultWrapper[Optional[RoleGetResponse]]._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
cast_to=cast(Type[Optional[RoleGetResponse]], ResultWrapper[RoleGetResponse]),
)


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[Role, AsyncSinglePage[Role]]:
) -> AsyncPaginator[RoleListResponse, AsyncSinglePage[RoleListResponse]]:
"""
Get all available roles for an account.
Expand All @@ -173,11 +174,11 @@ 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}/roles",
page=AsyncSinglePage[Role],
page=AsyncSinglePage[RoleListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Role,
model=RoleListResponse,
)

async def get(
Expand All @@ -191,7 +192,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> Optional[RoleGetResponse]:
"""
Get information about a specific role for an account.
Expand Down Expand Up @@ -219,9 +220,9 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[object]]._unwrapper,
post_parser=ResultWrapper[Optional[RoleGetResponse]]._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
cast_to=cast(Type[Optional[RoleGetResponse]], ResultWrapper[RoleGetResponse]),
)


Expand Down
24 changes: 12 additions & 12 deletions src/cloudflare/resources/user/invites.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> Optional[Invite]:
"""
Responds to an invitation.
Expand All @@ -107,9 +107,9 @@ def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[object]]._unwrapper,
post_parser=ResultWrapper[Optional[Invite]]._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]),
)

def get(
Expand All @@ -122,7 +122,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> Optional[Invite]:
"""
Gets the details of an invitation.
Expand All @@ -146,9 +146,9 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[object]]._unwrapper,
post_parser=ResultWrapper[Optional[Invite]]._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]),
)


Expand Down Expand Up @@ -203,7 +203,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> Optional[Invite]:
"""
Responds to an invitation.
Expand All @@ -230,9 +230,9 @@ async def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[object]]._unwrapper,
post_parser=ResultWrapper[Optional[Invite]]._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]),
)

async def get(
Expand All @@ -245,7 +245,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> Optional[Invite]:
"""
Gets the details of an invitation.
Expand All @@ -269,9 +269,9 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[object]]._unwrapper,
post_parser=ResultWrapper[Optional[Invite]]._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
cast_to=cast(Type[Optional[Invite]], ResultWrapper[Invite]),
)


Expand Down
2 changes: 0 additions & 2 deletions src/cloudflare/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from .shared import (
ASN as ASN,
Role as Role,
Member as Member,
Result as Result,
AuditLog as AuditLog,
RatePlan as RatePlan,
Expand Down
2 changes: 2 additions & 0 deletions src/cloudflare/types/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

from .status import Status as Status
from .account import Account as Account
from .role_get_response import RoleGetResponse as RoleGetResponse
from .member_list_params import MemberListParams as MemberListParams
from .role_list_response import RoleListResponse as RoleListResponse
from .account_list_params import AccountListParams as AccountListParams
from .member_get_response import MemberGetResponse as MemberGetResponse
from .member_create_params import MemberCreateParams as MemberCreateParams
Expand Down
6 changes: 5 additions & 1 deletion src/cloudflare/types/accounts/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class Settings(BaseModel):
See
[Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/)
for more information.
Deprecated in favor of
[DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings).
"""

enforce_twofactor: Optional[bool] = None
Expand All @@ -38,7 +41,8 @@ class Settings(BaseModel):
Indicates whether new zones should use the account-level custom nameservers by
default.
Deprecated in favor of `default_nameservers`.
Deprecated in favor of
[DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings).
"""


Expand Down
6 changes: 5 additions & 1 deletion src/cloudflare/types/accounts/account_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class Settings(TypedDict, total=False):
See
[Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/)
for more information.
Deprecated in favor of
[DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings).
"""

enforce_twofactor: bool
Expand All @@ -47,5 +50,6 @@ class Settings(TypedDict, total=False):
Indicates whether new zones should use the account-level custom nameservers by
default.
Deprecated in favor of `default_nameservers`.
Deprecated in favor of
[DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings).
"""
Loading

0 comments on commit 0b5a5d0

Please sign in to comment.