2
2
3
3
from __future__ import annotations
4
4
5
- from typing import Any , List , Type , Iterable , Optional , cast , overload
5
+ from typing import Any , List , Type , Iterable , Optional , cast
6
6
from typing_extensions import Literal
7
7
8
8
import httpx
9
9
10
10
from ..._types import NOT_GIVEN , Body , Query , Headers , NotGiven
11
11
from ..._utils import (
12
- required_args ,
13
12
maybe_transform ,
14
13
async_maybe_transform ,
15
14
)
@@ -46,7 +45,6 @@ def with_raw_response(self) -> MembersResourceWithRawResponse:
46
45
def with_streaming_response (self ) -> MembersResourceWithStreamingResponse :
47
46
return MembersResourceWithStreamingResponse (self )
48
47
49
- @overload
50
48
def create (
51
49
self ,
52
50
* ,
@@ -77,57 +75,6 @@ def create(
77
75
78
76
timeout: Override the client-level default timeout for this request, in seconds
79
77
"""
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 :
131
78
if not account_id :
132
79
raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
133
80
return cast (
@@ -139,7 +86,6 @@ def create(
139
86
"email" : email ,
140
87
"roles" : roles ,
141
88
"status" : status ,
142
- "policies" : policies ,
143
89
},
144
90
member_create_params .MemberCreateParams ,
145
91
),
@@ -152,13 +98,12 @@ def create(
152
98
),
153
99
)
154
100
155
- @overload
156
101
def update (
157
102
self ,
158
103
member_id : str ,
159
104
* ,
160
105
account_id : str ,
161
- roles : Iterable [member_update_params .MemberRole ] | NotGiven = NOT_GIVEN ,
106
+ roles : Iterable [member_update_params .Role ] | NotGiven = NOT_GIVEN ,
162
107
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
163
108
# The extra values given here take precedence over values defined on the client or passed to this method.
164
109
extra_headers : Headers | None = None ,
@@ -182,55 +127,6 @@ def update(
182
127
183
128
timeout: Override the client-level default timeout for this request, in seconds
184
129
"""
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 :
234
130
if not account_id :
235
131
raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
236
132
if not member_id :
@@ -239,13 +135,7 @@ def update(
239
135
MemberUpdateResponse ,
240
136
self ._put (
241
137
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 ),
249
139
options = make_request_options (
250
140
extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
251
141
),
@@ -410,7 +300,6 @@ def with_raw_response(self) -> AsyncMembersResourceWithRawResponse:
410
300
def with_streaming_response (self ) -> AsyncMembersResourceWithStreamingResponse :
411
301
return AsyncMembersResourceWithStreamingResponse (self )
412
302
413
- @overload
414
303
async def create (
415
304
self ,
416
305
* ,
@@ -441,57 +330,6 @@ async def create(
441
330
442
331
timeout: Override the client-level default timeout for this request, in seconds
443
332
"""
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 :
495
333
if not account_id :
496
334
raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
497
335
return cast (
@@ -503,7 +341,6 @@ async def create(
503
341
"email" : email ,
504
342
"roles" : roles ,
505
343
"status" : status ,
506
- "policies" : policies ,
507
344
},
508
345
member_create_params .MemberCreateParams ,
509
346
),
@@ -516,13 +353,12 @@ async def create(
516
353
),
517
354
)
518
355
519
- @overload
520
356
async def update (
521
357
self ,
522
358
member_id : str ,
523
359
* ,
524
360
account_id : str ,
525
- roles : Iterable [member_update_params .MemberRole ] | NotGiven = NOT_GIVEN ,
361
+ roles : Iterable [member_update_params .Role ] | NotGiven = NOT_GIVEN ,
526
362
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
527
363
# The extra values given here take precedence over values defined on the client or passed to this method.
528
364
extra_headers : Headers | None = None ,
@@ -546,55 +382,6 @@ async def update(
546
382
547
383
timeout: Override the client-level default timeout for this request, in seconds
548
384
"""
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 :
598
385
if not account_id :
599
386
raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
600
387
if not member_id :
@@ -603,13 +390,7 @@ async def update(
603
390
MemberUpdateResponse ,
604
391
await self ._put (
605
392
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 ),
613
394
options = make_request_options (
614
395
extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
615
396
),
0 commit comments