Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#302)
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 c5ea97f commit 6be0122
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 66 deletions.
6 changes: 3 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ from cloudflare.types import (
PaginationInfo,
ResponseInfo,
Result,
User,
)
```

Expand All @@ -33,7 +34,6 @@ Types:

```python
from cloudflare.types.accounts import (
Member,
MemberRole,
MemberWithInviteCode,
MemberListResponse,
Expand All @@ -44,10 +44,10 @@ from cloudflare.types.accounts import (
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/accounts/member.py">Member</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="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/accounts/member.py">Member</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>

## Roles

Expand Down
18 changes: 9 additions & 9 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
AsyncPaginator,
make_request_options,
)
from ...types.shared import User
from ...types.accounts import (
Member,
MemberRoleParam,
MemberListResponse,
MemberDeleteResponse,
Expand Down Expand Up @@ -112,7 +112,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Member:
) -> User:
"""
Modify an account member.
Expand Down Expand Up @@ -141,7 +141,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Member], ResultWrapper[Member]),
cast_to=cast(Type[User], ResultWrapper[User]),
)

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


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

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


Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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
1 change: 0 additions & 1 deletion src/cloudflare/types/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

from .member import Member as Member
from .member_role import MemberRole as MemberRole
from .permission_grant import PermissionGrant as PermissionGrant
from .member_role_param import MemberRoleParam as MemberRoleParam
Expand Down
40 changes: 0 additions & 40 deletions src/cloudflare/types/accounts/member.py

This file was deleted.

1 change: 1 addition & 0 deletions src/cloudflare/types/shared/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .user import User as User
from .result import Result as Result
from .audit_log import AuditLog as AuditLog
from .error_data import ErrorData as ErrorData
Expand Down
20 changes: 20 additions & 0 deletions src/cloudflare/types/shared/user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from ..._models import BaseModel
from ..accounts import MemberRole

__all__ = ["User"]


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

roles: List[MemberRole]
"""Roles assigned to this member."""

status: object

user: User
26 changes: 13 additions & 13 deletions tests/api_resources/accounts/test_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from cloudflare.types.shared import User
from cloudflare.types.accounts import (
Member,
MemberListResponse,
MemberDeleteResponse,
MemberWithInviteCode,
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_method_update(self, client: Cloudflare) -> None:
{"id": "3536bcfad5faccb999b47003c79917fb"},
],
)
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -120,7 +120,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -138,7 +138,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

member = response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -260,7 +260,7 @@ def test_method_get(self, client: Cloudflare) -> None:
"4536bcfad5faccb111b47003c79917fa",
account_id={},
)
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -273,7 +273,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -286,7 +286,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

member = response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -382,7 +382,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
{"id": "3536bcfad5faccb999b47003c79917fb"},
],
)
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -400,7 +400,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -418,7 +418,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

member = await response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -540,7 +540,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
"4536bcfad5faccb111b47003c79917fa",
account_id={},
)
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -553,7 +553,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -566,7 +566,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

member = await response.parse()
assert_matches_type(Member, member, path=["response"])
assert_matches_type(User, member, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down

0 comments on commit 6be0122

Please sign in to comment.