Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 12, 2024
1 parent 0dce24d commit 2966e10
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 174 deletions.
27 changes: 14 additions & 13 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ from cloudflare.types import (
PaginationInfo,
ResponseInfo,
Result,
User,
)
```

Expand All @@ -19,7 +18,14 @@ from cloudflare.types import (
Types:

```python
from cloudflare.types import Account, AccountUpdateResponse, AccountListResponse, AccountGetResponse
from cloudflare.types import (
Account,
Role,
User,
AccountUpdateResponse,
AccountListResponse,
AccountGetResponse,
)
```

Methods:
Expand All @@ -33,33 +39,28 @@ Methods:
Types:

```python
from cloudflare.types.accounts import (
MemberRole,
MemberWithInviteCode,
MemberListResponse,
MemberDeleteResponse,
)
from cloudflare.types.accounts import UserWithInviteCode, MemberListResponse, MemberDeleteResponse
```

Methods:

- <code title="post /accounts/{account_id}/members">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/accounts/member_create_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/member_with_invite_code.py">MemberWithInviteCode</a></code>
- <code title="put /accounts/{account_id}/members/{member_id}">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">update</a>(member_id, \*, account_id, \*\*<a href="src/cloudflare/types/accounts/member_update_params.py">params</a>) -> <a href="./src/cloudflare/types/shared/user.py">User</a></code>
- <code title="post /accounts/{account_id}/members">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/accounts/member_create_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/user_with_invite_code.py">UserWithInviteCode</a></code>
- <code title="put /accounts/{account_id}/members/{member_id}">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">update</a>(member_id, \*, account_id, \*\*<a href="src/cloudflare/types/accounts/member_update_params.py">params</a>) -> <a href="./src/cloudflare/types/user.py">User</a></code>
- <code title="get /accounts/{account_id}/members">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/accounts/member_list_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/member_list_response.py">SyncV4PagePaginationArray[MemberListResponse]</a></code>
- <code title="delete /accounts/{account_id}/members/{member_id}">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">delete</a>(member_id, \*, account_id, \*\*<a href="src/cloudflare/types/accounts/member_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/member_delete_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/members/{member_id}">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">get</a>(member_id, \*, account_id) -> <a href="./src/cloudflare/types/shared/user.py">User</a></code>
- <code title="get /accounts/{account_id}/members/{member_id}">client.accounts.members.<a href="./src/cloudflare/resources/accounts/members.py">get</a>(member_id, \*, account_id) -> <a href="./src/cloudflare/types/user.py">User</a></code>

## Roles

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/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">RoleGetResponse</a></code>

# OriginCACertificates
Expand Down
17 changes: 8 additions & 9 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import httpx

from ...types import User
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
maybe_transform,
Expand All @@ -26,12 +27,10 @@
AsyncPaginator,
make_request_options,
)
from ...types.shared import User
from ...types.accounts import (
MemberRoleParam,
MemberListResponse,
UserWithInviteCode,
MemberDeleteResponse,
MemberWithInviteCode,
member_list_params,
member_create_params,
member_delete_params,
Expand Down Expand Up @@ -63,7 +62,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> MemberWithInviteCode:
) -> UserWithInviteCode:
"""
Add a user to the list of members for this account.
Expand Down Expand Up @@ -97,15 +96,15 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[MemberWithInviteCode], ResultWrapper[MemberWithInviteCode]),
cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]),
)

def update(
self,
member_id: str,
*,
account_id: object,
roles: Iterable[MemberRoleParam],
roles: Iterable[member_update_params.Role],
# 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 @@ -309,7 +308,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> MemberWithInviteCode:
) -> UserWithInviteCode:
"""
Add a user to the list of members for this account.
Expand Down Expand Up @@ -343,15 +342,15 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[MemberWithInviteCode], ResultWrapper[MemberWithInviteCode]),
cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]),
)

async def update(
self,
member_id: str,
*,
account_id: object,
roles: Iterable[MemberRoleParam],
roles: Iterable[member_update_params.Role],
# 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 @@ -6,6 +6,7 @@

import httpx

from ...types import Role
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
Expand All @@ -21,7 +22,7 @@
AsyncPaginator,
make_request_options,
)
from ...types.accounts import RoleGetResponse, RoleListResponse
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[Role]:
"""
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[Role],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=RoleListResponse,
model=Role,
)

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[Role, AsyncSinglePage[Role]]:
"""
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[Role],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=RoleListResponse,
model=Role,
)

async def get(
Expand Down
3 changes: 2 additions & 1 deletion src/cloudflare/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from .host import Host as Host
from .info import Info as Info
from .pcap import PCAP as PCAP
from .role import Role as Role
from .user import User as User
from .zone import Zone as Zone
from .queue import Queue as Queue
from .route import Route as Route
Expand All @@ -19,7 +21,6 @@
from .header import Header as Header
from .origin import Origin as Origin
from .shared import (
User as User,
Result as Result,
AuditLog as AuditLog,
ErrorData as ErrorData,
Expand Down
5 changes: 1 addition & 4 deletions src/cloudflare/types/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

from __future__ import annotations

from .member_role import MemberRole as MemberRole
from .permission_grant import PermissionGrant as PermissionGrant
from .member_role_param import MemberRoleParam as MemberRoleParam
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 .member_create_params import MemberCreateParams as MemberCreateParams
from .member_delete_params import MemberDeleteParams as MemberDeleteParams
from .member_list_response import MemberListResponse as MemberListResponse
from .member_update_params import MemberUpdateParams as MemberUpdateParams
from .user_with_invite_code import UserWithInviteCode as UserWithInviteCode
from .member_delete_response import MemberDeleteResponse as MemberDeleteResponse
from .permission_grant_param import PermissionGrantParam as PermissionGrantParam
from .member_with_invite_code import MemberWithInviteCode as MemberWithInviteCode
18 changes: 2 additions & 16 deletions src/cloudflare/types/accounts/member_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,10 @@
from typing import List, Optional
from typing_extensions import Literal

from ..role import Role
from ..._models import BaseModel
from ..user.tokens import Permission

__all__ = ["MemberListResponse", "Role"]


class Role(BaseModel):
id: str
"""Role identifier tag."""

description: str
"""Description of role's permissions."""

name: str
"""Role Name."""

permissions: List[Permission]
"""Access permissions for this User."""
__all__ = ["MemberListResponse"]


class MemberListResponse(BaseModel):
Expand Down
12 changes: 0 additions & 12 deletions src/cloudflare/types/accounts/member_role_param.py

This file was deleted.

11 changes: 7 additions & 4 deletions src/cloudflare/types/accounts/member_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
from typing import Iterable
from typing_extensions import Required, TypedDict

from .member_role_param import MemberRoleParam

__all__ = ["MemberUpdateParams"]
__all__ = ["MemberUpdateParams", "Role"]


class MemberUpdateParams(TypedDict, total=False):
account_id: Required[object]

roles: Required[Iterable[MemberRoleParam]]
roles: Required[Iterable[Role]]
"""Roles assigned to this member."""


class Role(TypedDict, total=False):
id: Required[str]
"""Role identifier tag."""
43 changes: 0 additions & 43 deletions src/cloudflare/types/accounts/member_with_invite_code.py

This file was deleted.

Loading

0 comments on commit 2966e10

Please sign in to comment.