From 40e1e0340769e702e01db0ba3115d4d36c409d79 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Wed, 3 Apr 2024 02:58:59 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- api.md | 17 ++--- src/cloudflare/resources/accounts/members.py | 28 ++++----- src/cloudflare/resources/memberships.py | 14 ++--- src/cloudflare/types/__init__.py | 1 - src/cloudflare/types/accounts/__init__.py | 11 ++-- .../accounts/{account_member.py => member.py} | 34 ++-------- .../types/accounts/member_permission.py | 34 ++++++++++ .../types/accounts/member_permission_param.py | 35 +++++++++++ src/cloudflare/types/accounts/member_role.py | 36 +++++++++++ ..._member_with_id.py => member_with_code.py} | 34 ++-------- ...ermission_grant.py => permission_grant.py} | 4 +- ...ant_param.py => permission_grant_param.py} | 4 +- src/cloudflare/types/membership.py | 62 ------------------- tests/api_resources/accounts/test_members.py | 44 ++++++------- tests/api_resources/test_memberships.py | 18 +++--- 15 files changed, 185 insertions(+), 191 deletions(-) rename src/cloudflare/types/accounts/{account_member.py => member.py} (53%) create mode 100644 src/cloudflare/types/accounts/member_permission.py create mode 100644 src/cloudflare/types/accounts/member_permission_param.py create mode 100644 src/cloudflare/types/accounts/member_role.py rename src/cloudflare/types/accounts/{account_member_with_id.py => member_with_code.py} (55%) rename src/cloudflare/types/accounts/{role_permission_grant.py => permission_grant.py} (75%) rename src/cloudflare/types/accounts/{role_permission_grant_param.py => permission_grant_param.py} (67%) delete mode 100644 src/cloudflare/types/membership.py diff --git a/api.md b/api.md index afa16c5556e..fd6057c8cb9 100644 --- a/api.md +++ b/api.md @@ -24,9 +24,10 @@ Types: ```python from cloudflare.types.accounts import ( - AccountMember, - AccountMemberWithID, - RolePermissionGrant, + Member, + MemberPermission, + MemberRole, + MemberWithCode, MemberListResponse, MemberDeleteResponse, ) @@ -34,18 +35,18 @@ from cloudflare.types.accounts import ( Methods: -- client.accounts.members.create(\*, account_id, \*\*params) -> AccountMemberWithID -- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> AccountMember +- client.accounts.members.create(\*, account_id, \*\*params) -> MemberWithCode +- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> Member - client.accounts.members.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[MemberListResponse] - client.accounts.members.delete(member_id, \*, account_id) -> Optional -- client.accounts.members.get(member_id, \*, account_id) -> AccountMember +- client.accounts.members.get(member_id, \*, account_id) -> Member ## Roles Types: ```python -from cloudflare.types.accounts import Role, RoleGetResponse +from cloudflare.types.accounts import PermissionGrant, Role, RoleGetResponse ``` Methods: @@ -101,7 +102,7 @@ from cloudflare.types import ( Methods: - client.memberships.update(membership_id, \*\*params) -> MembershipUpdateResponse -- client.memberships.list(\*\*params) -> SyncV4PagePaginationArray[Membership] +- client.memberships.list(\*\*params) -> SyncV4PagePaginationArray[MemberRole] - client.memberships.delete(membership_id) -> MembershipDeleteResponse - client.memberships.get(membership_id) -> MembershipGetResponse diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index d3a414d4032..7ffc4782e66 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -27,9 +27,9 @@ make_request_options, ) from ...types.accounts import ( - AccountMember, + Member, + MemberWithCode, MemberListResponse, - AccountMemberWithID, MemberDeleteResponse, member_list_params, member_create_params, @@ -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. @@ -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( @@ -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. @@ -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( @@ -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. @@ -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]), ) @@ -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. @@ -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( @@ -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. @@ -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( @@ -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. @@ -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]), ) diff --git a/src/cloudflare/resources/memberships.py b/src/cloudflare/resources/memberships.py index ba9f0192a13..6319bd61ef1 100644 --- a/src/cloudflare/resources/memberships.py +++ b/src/cloudflare/resources/memberships.py @@ -8,7 +8,6 @@ import httpx from ..types import ( - Membership, MembershipGetResponse, MembershipDeleteResponse, MembershipUpdateResponse, @@ -34,6 +33,7 @@ AsyncPaginator, make_request_options, ) +from ..types.accounts import MemberRole __all__ = ["Memberships", "AsyncMemberships"] @@ -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. @@ -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, @@ -157,7 +157,7 @@ def list( membership_list_params.MembershipListParams, ), ), - model=Membership, + model=MemberRole, ) def delete( @@ -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. @@ -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, @@ -363,7 +363,7 @@ def list( membership_list_params.MembershipListParams, ), ), - model=Membership, + model=MemberRole, ) async def delete( diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index 9d99cc14a2a..d1362c4b5da 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -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 diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index ad9a9237c7b..e1d4eab4ad9 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -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 diff --git a/src/cloudflare/types/accounts/account_member.py b/src/cloudflare/types/accounts/member.py similarity index 53% rename from src/cloudflare/types/accounts/account_member.py rename to src/cloudflare/types/accounts/member.py index df9e586475b..ca3b971a5cf 100644 --- a/src/cloudflare/types/accounts/account_member.py +++ b/src/cloudflare/types/accounts/member.py @@ -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): @@ -44,7 +18,7 @@ class Role(BaseModel): name: str """Role name.""" - permissions: RolePermissions + permissions: MemberPermission class User(BaseModel): @@ -67,7 +41,7 @@ class User(BaseModel): """ -class AccountMember(BaseModel): +class Member(BaseModel): id: str """Membership identifier tag.""" diff --git a/src/cloudflare/types/accounts/member_permission.py b/src/cloudflare/types/accounts/member_permission.py new file mode 100644 index 00000000000..e940111b203 --- /dev/null +++ b/src/cloudflare/types/accounts/member_permission.py @@ -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 diff --git a/src/cloudflare/types/accounts/member_permission_param.py b/src/cloudflare/types/accounts/member_permission_param.py new file mode 100644 index 00000000000..e612295eb17 --- /dev/null +++ b/src/cloudflare/types/accounts/member_permission_param.py @@ -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 diff --git a/src/cloudflare/types/accounts/member_role.py b/src/cloudflare/types/accounts/member_role.py new file mode 100644 index 00000000000..b927b8c00cc --- /dev/null +++ b/src/cloudflare/types/accounts/member_role.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..account import Account +from ..._models import BaseModel +from .member_permission import MemberPermission + +__all__ = ["MemberRole"] + + +class MemberRole(BaseModel): + id: Optional[str] = None + """Membership identifier tag.""" + + account: Optional[Account] = None + + api_access_enabled: Optional[bool] = None + """Enterprise only. + + Indicates whether or not API access is enabled specifically for this user on a + given account. + """ + + code: Optional[str] = None + """The unique activation code for the account membership.""" + + permissions: Optional[MemberPermission] = None + """All access permissions for the user at the account.""" + + roles: Optional[List[str]] = None + """List of role names for the user at the account.""" + + status: Optional[Literal["accepted", "pending", "rejected"]] = None + """Status of this membership.""" diff --git a/src/cloudflare/types/accounts/account_member_with_id.py b/src/cloudflare/types/accounts/member_with_code.py similarity index 55% rename from src/cloudflare/types/accounts/account_member_with_id.py rename to src/cloudflare/types/accounts/member_with_code.py index 67a791cbaf7..32fa17c3962 100644 --- a/src/cloudflare/types/accounts/account_member_with_id.py +++ b/src/cloudflare/types/accounts/member_with_code.py @@ -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__ = ["AccountMemberWithID", "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__ = ["MemberWithCode", "Role", "User"] class Role(BaseModel): @@ -44,7 +18,7 @@ class Role(BaseModel): name: str """Role name.""" - permissions: RolePermissions + permissions: MemberPermission class User(BaseModel): @@ -67,7 +41,7 @@ class User(BaseModel): """ -class AccountMemberWithID(BaseModel): +class MemberWithCode(BaseModel): id: str """Membership identifier tag.""" diff --git a/src/cloudflare/types/accounts/role_permission_grant.py b/src/cloudflare/types/accounts/permission_grant.py similarity index 75% rename from src/cloudflare/types/accounts/role_permission_grant.py rename to src/cloudflare/types/accounts/permission_grant.py index dc24684d46f..b62bae8a56b 100644 --- a/src/cloudflare/types/accounts/role_permission_grant.py +++ b/src/cloudflare/types/accounts/permission_grant.py @@ -4,10 +4,10 @@ from ..._models import BaseModel -__all__ = ["RolePermissionGrant"] +__all__ = ["PermissionGrant"] -class RolePermissionGrant(BaseModel): +class PermissionGrant(BaseModel): read: Optional[bool] = None write: Optional[bool] = None diff --git a/src/cloudflare/types/accounts/role_permission_grant_param.py b/src/cloudflare/types/accounts/permission_grant_param.py similarity index 67% rename from src/cloudflare/types/accounts/role_permission_grant_param.py rename to src/cloudflare/types/accounts/permission_grant_param.py index c949627f3ac..c94d30fd6a1 100644 --- a/src/cloudflare/types/accounts/role_permission_grant_param.py +++ b/src/cloudflare/types/accounts/permission_grant_param.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["RolePermissionGrantParam"] +__all__ = ["PermissionGrantParam"] -class RolePermissionGrantParam(TypedDict, total=False): +class PermissionGrantParam(TypedDict, total=False): read: bool write: bool diff --git a/src/cloudflare/types/membership.py b/src/cloudflare/types/membership.py deleted file mode 100644 index 45d648dd1b9..00000000000 --- a/src/cloudflare/types/membership.py +++ /dev/null @@ -1,62 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from .account import Account -from .._models import BaseModel -from .accounts import RolePermissionGrant - -__all__ = ["Membership", "Permissions"] - - -class Permissions(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 - - -class Membership(BaseModel): - id: Optional[str] = None - """Membership identifier tag.""" - - account: Optional[Account] = None - - api_access_enabled: Optional[bool] = None - """Enterprise only. - - Indicates whether or not API access is enabled specifically for this user on a - given account. - """ - - code: Optional[str] = None - """The unique activation code for the account membership.""" - - permissions: Optional[Permissions] = None - """All access permissions for the user at the account.""" - - roles: Optional[List[str]] = None - """List of role names for the user at the account.""" - - status: Optional[Literal["accepted", "pending", "rejected"]] = None - """Status of this membership.""" diff --git a/tests/api_resources/accounts/test_members.py b/tests/api_resources/accounts/test_members.py index 43b22608ca2..4ea1f20e5e9 100644 --- a/tests/api_resources/accounts/test_members.py +++ b/tests/api_resources/accounts/test_members.py @@ -11,9 +11,9 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.accounts import ( - AccountMember, + Member, + MemberWithCode, MemberListResponse, - AccountMemberWithID, MemberDeleteResponse, ) @@ -35,7 +35,7 @@ def test_method_create(self, client: Cloudflare) -> None: "3536bcfad5faccb999b47003c79917fb", ], ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: ], status="accepted", ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +68,7 @@ def test_raw_response_create(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(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -86,7 +86,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = response.parse() - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -102,7 +102,7 @@ def test_method_update(self, client: Cloudflare) -> None: {"id": "3536bcfad5faccb999b47003c79917fb"}, ], ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -256,7 +256,7 @@ def test_method_get(self, client: Cloudflare) -> None: "4536bcfad5faccb111b47003c79917fa", account_id={}, ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -269,7 +269,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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -282,7 +282,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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -311,7 +311,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "3536bcfad5faccb999b47003c79917fb", ], ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -326,7 +326,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare ], status="accepted", ) - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -344,7 +344,7 @@ async def test_raw_response_create(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(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +362,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" member = await response.parse() - assert_matches_type(AccountMemberWithID, member, path=["response"]) + assert_matches_type(MemberWithCode, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -378,7 +378,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: {"id": "3536bcfad5faccb999b47003c79917fb"}, ], ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -396,7 +396,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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -414,7 +414,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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True @@ -532,7 +532,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "4536bcfad5faccb111b47003c79917fa", account_id={}, ) - assert_matches_type(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -545,7 +545,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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) @pytest.mark.skip() @parametrize @@ -558,7 +558,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(AccountMember, member, path=["response"]) + assert_matches_type(Member, member, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_memberships.py b/tests/api_resources/test_memberships.py index a61d32f96f0..fd239161a87 100644 --- a/tests/api_resources/test_memberships.py +++ b/tests/api_resources/test_memberships.py @@ -10,12 +10,12 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types import ( - Membership, MembershipGetResponse, MembershipDeleteResponse, MembershipUpdateResponse, ) from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from cloudflare.types.accounts import MemberRole base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -73,7 +73,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: membership = client.memberships.list() - assert_matches_type(SyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[MemberRole], membership, path=["response"]) @pytest.mark.skip() @parametrize @@ -87,7 +87,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: per_page=5, status="accepted", ) - assert_matches_type(SyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[MemberRole], membership, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +97,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = response.parse() - assert_matches_type(SyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[MemberRole], membership, path=["response"]) @pytest.mark.skip() @parametrize @@ -107,7 +107,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = response.parse() - assert_matches_type(SyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(SyncV4PagePaginationArray[MemberRole], membership, path=["response"]) assert cast(Any, response.is_closed) is True @@ -249,7 +249,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: membership = await async_client.memberships.list() - assert_matches_type(AsyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[MemberRole], membership, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,7 +263,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) per_page=5, status="accepted", ) - assert_matches_type(AsyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[MemberRole], membership, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +273,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[MemberRole], membership, path=["response"]) @pytest.mark.skip() @parametrize @@ -283,7 +283,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" membership = await response.parse() - assert_matches_type(AsyncV4PagePaginationArray[Membership], membership, path=["response"]) + assert_matches_type(AsyncV4PagePaginationArray[MemberRole], membership, path=["response"]) assert cast(Any, response.is_closed) is True