|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
5 |
| -from typing import Any, Type, Iterable, Optional, cast |
6 |
| -from typing_extensions import Literal, overload |
| 5 | +from typing import Type, Optional, cast |
| 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 | )
|
@@ -58,7 +57,6 @@ def with_streaming_response(self) -> ImpersonationRegistryResourceWithStreamingR
|
58 | 57 | """
|
59 | 58 | return ImpersonationRegistryResourceWithStreamingResponse(self)
|
60 | 59 |
|
61 |
| - @overload |
62 | 60 | def create(
|
63 | 61 | self,
|
64 | 62 | *,
|
@@ -87,79 +85,26 @@ def create(
|
87 | 85 |
|
88 | 86 | timeout: Override the client-level default timeout for this request, in seconds
|
89 | 87 | """
|
90 |
| - ... |
91 |
| - |
92 |
| - @overload |
93 |
| - def create( |
94 |
| - self, |
95 |
| - *, |
96 |
| - account_id: str, |
97 |
| - body: Iterable[impersonation_registry_create_params.Variant1Body], |
98 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
99 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
100 |
| - extra_headers: Headers | None = None, |
101 |
| - extra_query: Query | None = None, |
102 |
| - extra_body: Body | None = None, |
103 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
104 |
| - ) -> ImpersonationRegistryCreateResponse: |
105 |
| - """ |
106 |
| - Create an entry in impersonation registry |
107 |
| -
|
108 |
| - Args: |
109 |
| - account_id: Account Identifier |
110 |
| -
|
111 |
| - extra_headers: Send extra headers |
112 |
| -
|
113 |
| - extra_query: Add additional query parameters to the request |
114 |
| -
|
115 |
| - extra_body: Add additional JSON properties to the request |
116 |
| -
|
117 |
| - timeout: Override the client-level default timeout for this request, in seconds |
118 |
| - """ |
119 |
| - ... |
120 |
| - |
121 |
| - @required_args(["account_id", "email", "is_email_regex", "name"], ["account_id", "body"]) |
122 |
| - def create( |
123 |
| - self, |
124 |
| - *, |
125 |
| - account_id: str, |
126 |
| - email: str | NotGiven = NOT_GIVEN, |
127 |
| - is_email_regex: bool | NotGiven = NOT_GIVEN, |
128 |
| - name: str | NotGiven = NOT_GIVEN, |
129 |
| - body: Iterable[impersonation_registry_create_params.Variant1Body] | NotGiven = NOT_GIVEN, |
130 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
131 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
132 |
| - extra_headers: Headers | None = None, |
133 |
| - extra_query: Query | None = None, |
134 |
| - extra_body: Body | None = None, |
135 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
136 |
| - ) -> ImpersonationRegistryCreateResponse: |
137 | 88 | if not account_id:
|
138 | 89 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
139 |
| - return cast( |
140 |
| - ImpersonationRegistryCreateResponse, |
141 |
| - self._post( |
142 |
| - f"/accounts/{account_id}/email-security/settings/impersonation_registry", |
143 |
| - body=maybe_transform( |
144 |
| - { |
145 |
| - "email": email, |
146 |
| - "is_email_regex": is_email_regex, |
147 |
| - "name": name, |
148 |
| - "body": body, |
149 |
| - }, |
150 |
| - impersonation_registry_create_params.ImpersonationRegistryCreateParams, |
151 |
| - ), |
152 |
| - options=make_request_options( |
153 |
| - extra_headers=extra_headers, |
154 |
| - extra_query=extra_query, |
155 |
| - extra_body=extra_body, |
156 |
| - timeout=timeout, |
157 |
| - post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, |
158 |
| - ), |
159 |
| - cast_to=cast( |
160 |
| - Any, ResultWrapper[ImpersonationRegistryCreateResponse] |
161 |
| - ), # Union types cannot be passed in as arguments in the type system |
| 90 | + return self._post( |
| 91 | + f"/accounts/{account_id}/email-security/settings/impersonation_registry", |
| 92 | + body=maybe_transform( |
| 93 | + { |
| 94 | + "email": email, |
| 95 | + "is_email_regex": is_email_regex, |
| 96 | + "name": name, |
| 97 | + }, |
| 98 | + impersonation_registry_create_params.ImpersonationRegistryCreateParams, |
| 99 | + ), |
| 100 | + options=make_request_options( |
| 101 | + extra_headers=extra_headers, |
| 102 | + extra_query=extra_query, |
| 103 | + extra_body=extra_body, |
| 104 | + timeout=timeout, |
| 105 | + post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, |
162 | 106 | ),
|
| 107 | + cast_to=cast(Type[ImpersonationRegistryCreateResponse], ResultWrapper[ImpersonationRegistryCreateResponse]), |
163 | 108 | )
|
164 | 109 |
|
165 | 110 | def list(
|
@@ -383,7 +328,6 @@ def with_streaming_response(self) -> AsyncImpersonationRegistryResourceWithStrea
|
383 | 328 | """
|
384 | 329 | return AsyncImpersonationRegistryResourceWithStreamingResponse(self)
|
385 | 330 |
|
386 |
| - @overload |
387 | 331 | async def create(
|
388 | 332 | self,
|
389 | 333 | *,
|
@@ -412,79 +356,26 @@ async def create(
|
412 | 356 |
|
413 | 357 | timeout: Override the client-level default timeout for this request, in seconds
|
414 | 358 | """
|
415 |
| - ... |
416 |
| - |
417 |
| - @overload |
418 |
| - async def create( |
419 |
| - self, |
420 |
| - *, |
421 |
| - account_id: str, |
422 |
| - body: Iterable[impersonation_registry_create_params.Variant1Body], |
423 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
424 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
425 |
| - extra_headers: Headers | None = None, |
426 |
| - extra_query: Query | None = None, |
427 |
| - extra_body: Body | None = None, |
428 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
429 |
| - ) -> ImpersonationRegistryCreateResponse: |
430 |
| - """ |
431 |
| - Create an entry in impersonation registry |
432 |
| -
|
433 |
| - Args: |
434 |
| - account_id: Account Identifier |
435 |
| -
|
436 |
| - extra_headers: Send extra headers |
437 |
| -
|
438 |
| - extra_query: Add additional query parameters to the request |
439 |
| -
|
440 |
| - extra_body: Add additional JSON properties to the request |
441 |
| -
|
442 |
| - timeout: Override the client-level default timeout for this request, in seconds |
443 |
| - """ |
444 |
| - ... |
445 |
| - |
446 |
| - @required_args(["account_id", "email", "is_email_regex", "name"], ["account_id", "body"]) |
447 |
| - async def create( |
448 |
| - self, |
449 |
| - *, |
450 |
| - account_id: str, |
451 |
| - email: str | NotGiven = NOT_GIVEN, |
452 |
| - is_email_regex: bool | NotGiven = NOT_GIVEN, |
453 |
| - name: str | NotGiven = NOT_GIVEN, |
454 |
| - body: Iterable[impersonation_registry_create_params.Variant1Body] | NotGiven = NOT_GIVEN, |
455 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
456 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
457 |
| - extra_headers: Headers | None = None, |
458 |
| - extra_query: Query | None = None, |
459 |
| - extra_body: Body | None = None, |
460 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
461 |
| - ) -> ImpersonationRegistryCreateResponse: |
462 | 359 | if not account_id:
|
463 | 360 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
464 |
| - return cast( |
465 |
| - ImpersonationRegistryCreateResponse, |
466 |
| - await self._post( |
467 |
| - f"/accounts/{account_id}/email-security/settings/impersonation_registry", |
468 |
| - body=await async_maybe_transform( |
469 |
| - { |
470 |
| - "email": email, |
471 |
| - "is_email_regex": is_email_regex, |
472 |
| - "name": name, |
473 |
| - "body": body, |
474 |
| - }, |
475 |
| - impersonation_registry_create_params.ImpersonationRegistryCreateParams, |
476 |
| - ), |
477 |
| - options=make_request_options( |
478 |
| - extra_headers=extra_headers, |
479 |
| - extra_query=extra_query, |
480 |
| - extra_body=extra_body, |
481 |
| - timeout=timeout, |
482 |
| - post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, |
483 |
| - ), |
484 |
| - cast_to=cast( |
485 |
| - Any, ResultWrapper[ImpersonationRegistryCreateResponse] |
486 |
| - ), # Union types cannot be passed in as arguments in the type system |
| 361 | + return await self._post( |
| 362 | + f"/accounts/{account_id}/email-security/settings/impersonation_registry", |
| 363 | + body=await async_maybe_transform( |
| 364 | + { |
| 365 | + "email": email, |
| 366 | + "is_email_regex": is_email_regex, |
| 367 | + "name": name, |
| 368 | + }, |
| 369 | + impersonation_registry_create_params.ImpersonationRegistryCreateParams, |
| 370 | + ), |
| 371 | + options=make_request_options( |
| 372 | + extra_headers=extra_headers, |
| 373 | + extra_query=extra_query, |
| 374 | + extra_body=extra_body, |
| 375 | + timeout=timeout, |
| 376 | + post_parser=ResultWrapper[ImpersonationRegistryCreateResponse]._unwrapper, |
487 | 377 | ),
|
| 378 | + cast_to=cast(Type[ImpersonationRegistryCreateResponse], ResultWrapper[ImpersonationRegistryCreateResponse]), |
488 | 379 | )
|
489 | 380 |
|
490 | 381 | def list(
|
|
0 commit comments