Skip to content

Commit d692eb6

Browse files
feat(api): OpenAPI spec update via Stainless API (#867)
1 parent ac7d4e2 commit d692eb6

File tree

5 files changed

+35
-1302
lines changed

5 files changed

+35
-1302
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1343
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-dd6f560da6eb9ae8d43a6fd37d706e939ef20c6cca15655adc5dc821fa2fd19f.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-90de7c383d660ce2dd1c4dfa53b4c75ef8c4c37d485f16f9cc2da269d4852095.yml

src/cloudflare/resources/accounts/members.py

+5-224
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, List, Type, Iterable, Optional, cast, overload
5+
from typing import Any, List, Type, Iterable, Optional, cast
66
from typing_extensions import Literal
77

88
import httpx
99

1010
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1111
from ..._utils import (
12-
required_args,
1312
maybe_transform,
1413
async_maybe_transform,
1514
)
@@ -46,7 +45,6 @@ def with_raw_response(self) -> MembersResourceWithRawResponse:
4645
def with_streaming_response(self) -> MembersResourceWithStreamingResponse:
4746
return MembersResourceWithStreamingResponse(self)
4847

49-
@overload
5048
def create(
5149
self,
5250
*,
@@ -77,57 +75,6 @@ def create(
7775
7876
timeout: Override the client-level default timeout for this request, in seconds
7977
"""
80-
...
81-
82-
@overload
83-
def create(
84-
self,
85-
*,
86-
account_id: str,
87-
email: str,
88-
policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy],
89-
status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
90-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
91-
# The extra values given here take precedence over values defined on the client or passed to this method.
92-
extra_headers: Headers | None = None,
93-
extra_query: Query | None = None,
94-
extra_body: Body | None = None,
95-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
96-
) -> MemberCreateResponse:
97-
"""
98-
Add a user to the list of members for this account.
99-
100-
Args:
101-
email: The contact email address of the user.
102-
103-
policies: Array of policies associated with this member.
104-
105-
extra_headers: Send extra headers
106-
107-
extra_query: Add additional query parameters to the request
108-
109-
extra_body: Add additional JSON properties to the request
110-
111-
timeout: Override the client-level default timeout for this request, in seconds
112-
"""
113-
...
114-
115-
@required_args(["account_id", "email", "roles"], ["account_id", "email", "policies"])
116-
def create(
117-
self,
118-
*,
119-
account_id: str,
120-
email: str,
121-
roles: List[str] | NotGiven = NOT_GIVEN,
122-
status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
123-
policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
124-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
125-
# The extra values given here take precedence over values defined on the client or passed to this method.
126-
extra_headers: Headers | None = None,
127-
extra_query: Query | None = None,
128-
extra_body: Body | None = None,
129-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
130-
) -> MemberCreateResponse:
13178
if not account_id:
13279
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
13380
return cast(
@@ -139,7 +86,6 @@ def create(
13986
"email": email,
14087
"roles": roles,
14188
"status": status,
142-
"policies": policies,
14389
},
14490
member_create_params.MemberCreateParams,
14591
),
@@ -152,13 +98,12 @@ def create(
15298
),
15399
)
154100

155-
@overload
156101
def update(
157102
self,
158103
member_id: str,
159104
*,
160105
account_id: str,
161-
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
106+
roles: Iterable[member_update_params.Role] | NotGiven = NOT_GIVEN,
162107
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
163108
# The extra values given here take precedence over values defined on the client or passed to this method.
164109
extra_headers: Headers | None = None,
@@ -182,55 +127,6 @@ def update(
182127
183128
timeout: Override the client-level default timeout for this request, in seconds
184129
"""
185-
...
186-
187-
@overload
188-
def update(
189-
self,
190-
member_id: str,
191-
*,
192-
account_id: str,
193-
policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy],
194-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195-
# The extra values given here take precedence over values defined on the client or passed to this method.
196-
extra_headers: Headers | None = None,
197-
extra_query: Query | None = None,
198-
extra_body: Body | None = None,
199-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
200-
) -> MemberUpdateResponse:
201-
"""
202-
Modify an account member.
203-
204-
Args:
205-
member_id: Membership identifier tag.
206-
207-
policies: Array of policies associated with this member.
208-
209-
extra_headers: Send extra headers
210-
211-
extra_query: Add additional query parameters to the request
212-
213-
extra_body: Add additional JSON properties to the request
214-
215-
timeout: Override the client-level default timeout for this request, in seconds
216-
"""
217-
...
218-
219-
@required_args(["account_id"], ["account_id", "policies"])
220-
def update(
221-
self,
222-
member_id: str,
223-
*,
224-
account_id: str,
225-
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
226-
policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
227-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
228-
# The extra values given here take precedence over values defined on the client or passed to this method.
229-
extra_headers: Headers | None = None,
230-
extra_query: Query | None = None,
231-
extra_body: Body | None = None,
232-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
233-
) -> MemberUpdateResponse:
234130
if not account_id:
235131
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
236132
if not member_id:
@@ -239,13 +135,7 @@ def update(
239135
MemberUpdateResponse,
240136
self._put(
241137
f"/accounts/{account_id}/members/{member_id}",
242-
body=maybe_transform(
243-
{
244-
"roles": roles,
245-
"policies": policies,
246-
},
247-
member_update_params.MemberUpdateParams,
248-
),
138+
body=maybe_transform({"roles": roles}, member_update_params.MemberUpdateParams),
249139
options=make_request_options(
250140
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
251141
),
@@ -410,7 +300,6 @@ def with_raw_response(self) -> AsyncMembersResourceWithRawResponse:
410300
def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse:
411301
return AsyncMembersResourceWithStreamingResponse(self)
412302

413-
@overload
414303
async def create(
415304
self,
416305
*,
@@ -441,57 +330,6 @@ async def create(
441330
442331
timeout: Override the client-level default timeout for this request, in seconds
443332
"""
444-
...
445-
446-
@overload
447-
async def create(
448-
self,
449-
*,
450-
account_id: str,
451-
email: str,
452-
policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy],
453-
status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
454-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
455-
# The extra values given here take precedence over values defined on the client or passed to this method.
456-
extra_headers: Headers | None = None,
457-
extra_query: Query | None = None,
458-
extra_body: Body | None = None,
459-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
460-
) -> MemberCreateResponse:
461-
"""
462-
Add a user to the list of members for this account.
463-
464-
Args:
465-
email: The contact email address of the user.
466-
467-
policies: Array of policies associated with this member.
468-
469-
extra_headers: Send extra headers
470-
471-
extra_query: Add additional query parameters to the request
472-
473-
extra_body: Add additional JSON properties to the request
474-
475-
timeout: Override the client-level default timeout for this request, in seconds
476-
"""
477-
...
478-
479-
@required_args(["account_id", "email", "roles"], ["account_id", "email", "policies"])
480-
async def create(
481-
self,
482-
*,
483-
account_id: str,
484-
email: str,
485-
roles: List[str] | NotGiven = NOT_GIVEN,
486-
status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
487-
policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
488-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
489-
# The extra values given here take precedence over values defined on the client or passed to this method.
490-
extra_headers: Headers | None = None,
491-
extra_query: Query | None = None,
492-
extra_body: Body | None = None,
493-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
494-
) -> MemberCreateResponse:
495333
if not account_id:
496334
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
497335
return cast(
@@ -503,7 +341,6 @@ async def create(
503341
"email": email,
504342
"roles": roles,
505343
"status": status,
506-
"policies": policies,
507344
},
508345
member_create_params.MemberCreateParams,
509346
),
@@ -516,13 +353,12 @@ async def create(
516353
),
517354
)
518355

519-
@overload
520356
async def update(
521357
self,
522358
member_id: str,
523359
*,
524360
account_id: str,
525-
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
361+
roles: Iterable[member_update_params.Role] | NotGiven = NOT_GIVEN,
526362
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
527363
# The extra values given here take precedence over values defined on the client or passed to this method.
528364
extra_headers: Headers | None = None,
@@ -546,55 +382,6 @@ async def update(
546382
547383
timeout: Override the client-level default timeout for this request, in seconds
548384
"""
549-
...
550-
551-
@overload
552-
async def update(
553-
self,
554-
member_id: str,
555-
*,
556-
account_id: str,
557-
policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy],
558-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
559-
# The extra values given here take precedence over values defined on the client or passed to this method.
560-
extra_headers: Headers | None = None,
561-
extra_query: Query | None = None,
562-
extra_body: Body | None = None,
563-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
564-
) -> MemberUpdateResponse:
565-
"""
566-
Modify an account member.
567-
568-
Args:
569-
member_id: Membership identifier tag.
570-
571-
policies: Array of policies associated with this member.
572-
573-
extra_headers: Send extra headers
574-
575-
extra_query: Add additional query parameters to the request
576-
577-
extra_body: Add additional JSON properties to the request
578-
579-
timeout: Override the client-level default timeout for this request, in seconds
580-
"""
581-
...
582-
583-
@required_args(["account_id"], ["account_id", "policies"])
584-
async def update(
585-
self,
586-
member_id: str,
587-
*,
588-
account_id: str,
589-
roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
590-
policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
591-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
592-
# The extra values given here take precedence over values defined on the client or passed to this method.
593-
extra_headers: Headers | None = None,
594-
extra_query: Query | None = None,
595-
extra_body: Body | None = None,
596-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
597-
) -> MemberUpdateResponse:
598385
if not account_id:
599386
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
600387
if not member_id:
@@ -603,13 +390,7 @@ async def update(
603390
MemberUpdateResponse,
604391
await self._put(
605392
f"/accounts/{account_id}/members/{member_id}",
606-
body=await async_maybe_transform(
607-
{
608-
"roles": roles,
609-
"policies": policies,
610-
},
611-
member_update_params.MemberUpdateParams,
612-
),
393+
body=await async_maybe_transform({"roles": roles}, member_update_params.MemberUpdateParams),
613394
options=make_request_options(
614395
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
615396
),

0 commit comments

Comments
 (0)