Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#208)
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 9e8b61a commit 9a2ec53
Show file tree
Hide file tree
Showing 15 changed files with 185 additions and 191 deletions.
17 changes: 9 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,29 @@ Types:

```python
from cloudflare.types.accounts import (
AccountMember,
AccountMemberWithID,
RolePermissionGrant,
Member,
MemberPermission,
MemberRole,
MemberWithCode,
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/account_member_with_id.py">AccountMemberWithID</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/accounts/account_member.py">AccountMember</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/member_with_code.py">MemberWithCode</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/accounts/member.py">Member</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_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/accounts/account_member.py">AccountMember</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/accounts/member.py">Member</a></code>

## Roles

Types:

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

Methods:
Expand Down Expand Up @@ -101,7 +102,7 @@ from cloudflare.types import (
Methods:

- <code title="put /memberships/{membership_id}">client.memberships.<a href="./src/cloudflare/resources/memberships.py">update</a>(membership_id, \*\*<a href="src/cloudflare/types/membership_update_params.py">params</a>) -> <a href="./src/cloudflare/types/membership_update_response.py">MembershipUpdateResponse</a></code>
- <code title="get /memberships">client.memberships.<a href="./src/cloudflare/resources/memberships.py">list</a>(\*\*<a href="src/cloudflare/types/membership_list_params.py">params</a>) -> <a href="./src/cloudflare/types/membership.py">SyncV4PagePaginationArray[Membership]</a></code>
- <code title="get /memberships">client.memberships.<a href="./src/cloudflare/resources/memberships.py">list</a>(\*\*<a href="src/cloudflare/types/membership_list_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/member_role.py">SyncV4PagePaginationArray[MemberRole]</a></code>
- <code title="delete /memberships/{membership_id}">client.memberships.<a href="./src/cloudflare/resources/memberships.py">delete</a>(membership_id) -> <a href="./src/cloudflare/types/membership_delete_response.py">MembershipDeleteResponse</a></code>
- <code title="get /memberships/{membership_id}">client.memberships.<a href="./src/cloudflare/resources/memberships.py">get</a>(membership_id) -> <a href="./src/cloudflare/types/membership_get_response.py">MembershipGetResponse</a></code>

Expand Down
28 changes: 14 additions & 14 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
make_request_options,
)
from ...types.accounts import (
AccountMember,
Member,
MemberWithCode,
MemberListResponse,
AccountMemberWithID,
MemberDeleteResponse,
member_list_params,
member_create_params,
Expand Down Expand Up @@ -61,7 +61,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountMemberWithID:
) -> MemberWithCode:
"""
Add a user to the list of members for this account.
Expand Down Expand Up @@ -95,7 +95,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[AccountMemberWithID], ResultWrapper[AccountMemberWithID]),
cast_to=cast(Type[MemberWithCode], ResultWrapper[MemberWithCode]),
)

def update(
Expand All @@ -110,7 +110,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountMember:
) -> Member:
"""
Modify an account member.
Expand Down Expand Up @@ -139,7 +139,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)

def list(
Expand Down Expand Up @@ -253,7 +253,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountMember:
) -> Member:
"""
Get information about a specific member of an account.
Expand All @@ -279,7 +279,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)


Expand All @@ -305,7 +305,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountMemberWithID:
) -> MemberWithCode:
"""
Add a user to the list of members for this account.
Expand Down Expand Up @@ -339,7 +339,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[AccountMemberWithID], ResultWrapper[AccountMemberWithID]),
cast_to=cast(Type[MemberWithCode], ResultWrapper[MemberWithCode]),
)

async def update(
Expand All @@ -354,7 +354,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountMember:
) -> Member:
"""
Modify an account member.
Expand Down Expand Up @@ -383,7 +383,7 @@ async def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)

def list(
Expand Down Expand Up @@ -497,7 +497,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AccountMember:
) -> Member:
"""
Get information about a specific member of an account.
Expand All @@ -523,7 +523,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[AccountMember], ResultWrapper[AccountMember]),
cast_to=cast(Type[Member], ResultWrapper[Member]),
)


Expand Down
14 changes: 7 additions & 7 deletions src/cloudflare/resources/memberships.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import httpx

from ..types import (
Membership,
MembershipGetResponse,
MembershipDeleteResponse,
MembershipUpdateResponse,
Expand All @@ -34,6 +33,7 @@
AsyncPaginator,
make_request_options,
)
from ..types.accounts import MemberRole

__all__ = ["Memberships", "AsyncMemberships"]

Expand Down Expand Up @@ -111,7 +111,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncV4PagePaginationArray[Membership]:
) -> SyncV4PagePaginationArray[MemberRole]:
"""
List memberships of accounts the user can access.
Expand All @@ -138,7 +138,7 @@ def list(
"""
return self._get_api_list(
"/memberships",
page=SyncV4PagePaginationArray[Membership],
page=SyncV4PagePaginationArray[MemberRole],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -157,7 +157,7 @@ def list(
membership_list_params.MembershipListParams,
),
),
model=Membership,
model=MemberRole,
)

def delete(
Expand Down Expand Up @@ -317,7 +317,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Membership, AsyncV4PagePaginationArray[Membership]]:
) -> AsyncPaginator[MemberRole, AsyncV4PagePaginationArray[MemberRole]]:
"""
List memberships of accounts the user can access.
Expand All @@ -344,7 +344,7 @@ def list(
"""
return self._get_api_list(
"/memberships",
page=AsyncV4PagePaginationArray[Membership],
page=AsyncV4PagePaginationArray[MemberRole],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -363,7 +363,7 @@ def list(
membership_list_params.MembershipListParams,
),
),
model=Membership,
model=MemberRole,
)

async def delete(
Expand Down
1 change: 0 additions & 1 deletion src/cloudflare/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from .ruleset import Ruleset as Ruleset
from .snippet import Snippet as Snippet
from .calls_app import CallsApp as CallsApp
from .membership import Membership as Membership
from .healthcheck import Healthcheck as Healthcheck
from .jdcloud_ips import JDCloudIPs as JDCloudIPs
from .waiting_room import WaitingRoom as WaitingRoom
Expand Down
11 changes: 7 additions & 4 deletions src/cloudflare/types/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
from __future__ import annotations

from .role import Role as Role
from .account_member import AccountMember as AccountMember
from .member import Member as Member
from .member_role import MemberRole as MemberRole
from .member_with_code import MemberWithCode as MemberWithCode
from .permission_grant import PermissionGrant as PermissionGrant
from .member_permission import MemberPermission as MemberPermission
from .role_get_response import RoleGetResponse as RoleGetResponse
from .member_list_params import MemberListParams as MemberListParams
from .member_create_params import MemberCreateParams as MemberCreateParams
from .member_list_response import MemberListResponse as MemberListResponse
from .member_update_params import MemberUpdateParams as MemberUpdateParams
from .role_permission_grant import RolePermissionGrant as RolePermissionGrant
from .account_member_with_id import AccountMemberWithID as AccountMemberWithID
from .member_delete_response import MemberDeleteResponse as MemberDeleteResponse
from .role_permission_grant_param import RolePermissionGrantParam as RolePermissionGrantParam
from .permission_grant_param import PermissionGrantParam as PermissionGrantParam
from .member_permission_param import MemberPermissionParam as MemberPermissionParam
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,9 @@
from typing import List, Optional

from ..._models import BaseModel
from .role_permission_grant import RolePermissionGrant
from .member_permission import MemberPermission

__all__ = ["AccountMember", "Role", "RolePermissions", "User"]


class RolePermissions(BaseModel):
analytics: Optional[RolePermissionGrant] = None

billing: Optional[RolePermissionGrant] = None

cache_purge: Optional[RolePermissionGrant] = None

dns: Optional[RolePermissionGrant] = None

dns_records: Optional[RolePermissionGrant] = None

lb: Optional[RolePermissionGrant] = None

logs: Optional[RolePermissionGrant] = None

organization: Optional[RolePermissionGrant] = None

ssl: Optional[RolePermissionGrant] = None

waf: Optional[RolePermissionGrant] = None

zone_settings: Optional[RolePermissionGrant] = None

zones: Optional[RolePermissionGrant] = None
__all__ = ["Member", "Role", "User"]


class Role(BaseModel):
Expand All @@ -44,7 +18,7 @@ class Role(BaseModel):
name: str
"""Role name."""

permissions: RolePermissions
permissions: MemberPermission


class User(BaseModel):
Expand All @@ -67,7 +41,7 @@ class User(BaseModel):
"""


class AccountMember(BaseModel):
class Member(BaseModel):
id: str
"""Membership identifier tag."""

Expand Down
34 changes: 34 additions & 0 deletions src/cloudflare/types/accounts/member_permission.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional

from ..._models import BaseModel
from .permission_grant import PermissionGrant

__all__ = ["MemberPermission"]


class MemberPermission(BaseModel):
analytics: Optional[PermissionGrant] = None

billing: Optional[PermissionGrant] = None

cache_purge: Optional[PermissionGrant] = None

dns: Optional[PermissionGrant] = None

dns_records: Optional[PermissionGrant] = None

lb: Optional[PermissionGrant] = None

logs: Optional[PermissionGrant] = None

organization: Optional[PermissionGrant] = None

ssl: Optional[PermissionGrant] = None

waf: Optional[PermissionGrant] = None

zone_settings: Optional[PermissionGrant] = None

zones: Optional[PermissionGrant] = None
35 changes: 35 additions & 0 deletions src/cloudflare/types/accounts/member_permission_param.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import TypedDict

from .permission_grant_param import PermissionGrantParam

__all__ = ["MemberPermissionParam"]


class MemberPermissionParam(TypedDict, total=False):
analytics: PermissionGrantParam

billing: PermissionGrantParam

cache_purge: PermissionGrantParam

dns: PermissionGrantParam

dns_records: PermissionGrantParam

lb: PermissionGrantParam

logs: PermissionGrantParam

organization: PermissionGrantParam

ssl: PermissionGrantParam

waf: PermissionGrantParam

zone_settings: PermissionGrantParam

zones: PermissionGrantParam
Loading

0 comments on commit 9a2ec53

Please sign in to comment.