|
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) -> BlockSendersResourceWithStreamingResponse:
|
58 | 57 | """
|
59 | 58 | return BlockSendersResourceWithStreamingResponse(self)
|
60 | 59 |
|
61 |
| - @overload |
62 | 60 | def create(
|
63 | 61 | self,
|
64 | 62 | *,
|
@@ -88,81 +86,27 @@ def create(
|
88 | 86 |
|
89 | 87 | timeout: Override the client-level default timeout for this request, in seconds
|
90 | 88 | """
|
91 |
| - ... |
92 |
| - |
93 |
| - @overload |
94 |
| - def create( |
95 |
| - self, |
96 |
| - *, |
97 |
| - account_id: str, |
98 |
| - body: Iterable[block_sender_create_params.Variant1Body], |
99 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
100 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
101 |
| - extra_headers: Headers | None = None, |
102 |
| - extra_query: Query | None = None, |
103 |
| - extra_body: Body | None = None, |
104 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
105 |
| - ) -> BlockSenderCreateResponse: |
106 |
| - """ |
107 |
| - Create a blocked email sender |
108 |
| -
|
109 |
| - Args: |
110 |
| - account_id: Account Identifier |
111 |
| -
|
112 |
| - extra_headers: Send extra headers |
113 |
| -
|
114 |
| - extra_query: Add additional query parameters to the request |
115 |
| -
|
116 |
| - extra_body: Add additional JSON properties to the request |
117 |
| -
|
118 |
| - timeout: Override the client-level default timeout for this request, in seconds |
119 |
| - """ |
120 |
| - ... |
121 |
| - |
122 |
| - @required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"]) |
123 |
| - def create( |
124 |
| - self, |
125 |
| - *, |
126 |
| - account_id: str, |
127 |
| - is_regex: bool | NotGiven = NOT_GIVEN, |
128 |
| - pattern: str | NotGiven = NOT_GIVEN, |
129 |
| - pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN, |
130 |
| - comments: Optional[str] | NotGiven = NOT_GIVEN, |
131 |
| - body: Iterable[block_sender_create_params.Variant1Body] | NotGiven = NOT_GIVEN, |
132 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
133 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
134 |
| - extra_headers: Headers | None = None, |
135 |
| - extra_query: Query | None = None, |
136 |
| - extra_body: Body | None = None, |
137 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
138 |
| - ) -> BlockSenderCreateResponse: |
139 | 89 | if not account_id:
|
140 | 90 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
141 |
| - return cast( |
142 |
| - BlockSenderCreateResponse, |
143 |
| - self._post( |
144 |
| - f"/accounts/{account_id}/email-security/settings/block_senders", |
145 |
| - body=maybe_transform( |
146 |
| - { |
147 |
| - "is_regex": is_regex, |
148 |
| - "pattern": pattern, |
149 |
| - "pattern_type": pattern_type, |
150 |
| - "comments": comments, |
151 |
| - "body": body, |
152 |
| - }, |
153 |
| - block_sender_create_params.BlockSenderCreateParams, |
154 |
| - ), |
155 |
| - options=make_request_options( |
156 |
| - extra_headers=extra_headers, |
157 |
| - extra_query=extra_query, |
158 |
| - extra_body=extra_body, |
159 |
| - timeout=timeout, |
160 |
| - post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, |
161 |
| - ), |
162 |
| - cast_to=cast( |
163 |
| - Any, ResultWrapper[BlockSenderCreateResponse] |
164 |
| - ), # Union types cannot be passed in as arguments in the type system |
| 91 | + return self._post( |
| 92 | + f"/accounts/{account_id}/email-security/settings/block_senders", |
| 93 | + body=maybe_transform( |
| 94 | + { |
| 95 | + "is_regex": is_regex, |
| 96 | + "pattern": pattern, |
| 97 | + "pattern_type": pattern_type, |
| 98 | + "comments": comments, |
| 99 | + }, |
| 100 | + block_sender_create_params.BlockSenderCreateParams, |
165 | 101 | ),
|
| 102 | + options=make_request_options( |
| 103 | + extra_headers=extra_headers, |
| 104 | + extra_query=extra_query, |
| 105 | + extra_body=extra_body, |
| 106 | + timeout=timeout, |
| 107 | + post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, |
| 108 | + ), |
| 109 | + cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]), |
166 | 110 | )
|
167 | 111 |
|
168 | 112 | def list(
|
@@ -251,6 +195,8 @@ def delete(
|
251 | 195 | Args:
|
252 | 196 | account_id: Account Identifier
|
253 | 197 |
|
| 198 | + pattern_id: The unique identifier for the allow policy. |
| 199 | +
|
254 | 200 | extra_headers: Send extra headers
|
255 | 201 |
|
256 | 202 | extra_query: Add additional query parameters to the request
|
@@ -295,6 +241,8 @@ def edit(
|
295 | 241 | Args:
|
296 | 242 | account_id: Account Identifier
|
297 | 243 |
|
| 244 | + pattern_id: The unique identifier for the allow policy. |
| 245 | +
|
298 | 246 | extra_headers: Send extra headers
|
299 | 247 |
|
300 | 248 | extra_query: Add additional query parameters to the request
|
@@ -344,6 +292,8 @@ def get(
|
344 | 292 | Args:
|
345 | 293 | account_id: Account Identifier
|
346 | 294 |
|
| 295 | + pattern_id: The unique identifier for the allow policy. |
| 296 | +
|
347 | 297 | extra_headers: Send extra headers
|
348 | 298 |
|
349 | 299 | extra_query: Add additional query parameters to the request
|
@@ -387,7 +337,6 @@ def with_streaming_response(self) -> AsyncBlockSendersResourceWithStreamingRespo
|
387 | 337 | """
|
388 | 338 | return AsyncBlockSendersResourceWithStreamingResponse(self)
|
389 | 339 |
|
390 |
| - @overload |
391 | 340 | async def create(
|
392 | 341 | self,
|
393 | 342 | *,
|
@@ -417,81 +366,27 @@ async def create(
|
417 | 366 |
|
418 | 367 | timeout: Override the client-level default timeout for this request, in seconds
|
419 | 368 | """
|
420 |
| - ... |
421 |
| - |
422 |
| - @overload |
423 |
| - async def create( |
424 |
| - self, |
425 |
| - *, |
426 |
| - account_id: str, |
427 |
| - body: Iterable[block_sender_create_params.Variant1Body], |
428 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
429 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
430 |
| - extra_headers: Headers | None = None, |
431 |
| - extra_query: Query | None = None, |
432 |
| - extra_body: Body | None = None, |
433 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
434 |
| - ) -> BlockSenderCreateResponse: |
435 |
| - """ |
436 |
| - Create a blocked email sender |
437 |
| -
|
438 |
| - Args: |
439 |
| - account_id: Account Identifier |
440 |
| -
|
441 |
| - extra_headers: Send extra headers |
442 |
| -
|
443 |
| - extra_query: Add additional query parameters to the request |
444 |
| -
|
445 |
| - extra_body: Add additional JSON properties to the request |
446 |
| -
|
447 |
| - timeout: Override the client-level default timeout for this request, in seconds |
448 |
| - """ |
449 |
| - ... |
450 |
| - |
451 |
| - @required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"]) |
452 |
| - async def create( |
453 |
| - self, |
454 |
| - *, |
455 |
| - account_id: str, |
456 |
| - is_regex: bool | NotGiven = NOT_GIVEN, |
457 |
| - pattern: str | NotGiven = NOT_GIVEN, |
458 |
| - pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN, |
459 |
| - comments: Optional[str] | NotGiven = NOT_GIVEN, |
460 |
| - body: Iterable[block_sender_create_params.Variant1Body] | NotGiven = NOT_GIVEN, |
461 |
| - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
462 |
| - # The extra values given here take precedence over values defined on the client or passed to this method. |
463 |
| - extra_headers: Headers | None = None, |
464 |
| - extra_query: Query | None = None, |
465 |
| - extra_body: Body | None = None, |
466 |
| - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
467 |
| - ) -> BlockSenderCreateResponse: |
468 | 369 | if not account_id:
|
469 | 370 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
470 |
| - return cast( |
471 |
| - BlockSenderCreateResponse, |
472 |
| - await self._post( |
473 |
| - f"/accounts/{account_id}/email-security/settings/block_senders", |
474 |
| - body=await async_maybe_transform( |
475 |
| - { |
476 |
| - "is_regex": is_regex, |
477 |
| - "pattern": pattern, |
478 |
| - "pattern_type": pattern_type, |
479 |
| - "comments": comments, |
480 |
| - "body": body, |
481 |
| - }, |
482 |
| - block_sender_create_params.BlockSenderCreateParams, |
483 |
| - ), |
484 |
| - options=make_request_options( |
485 |
| - extra_headers=extra_headers, |
486 |
| - extra_query=extra_query, |
487 |
| - extra_body=extra_body, |
488 |
| - timeout=timeout, |
489 |
| - post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, |
490 |
| - ), |
491 |
| - cast_to=cast( |
492 |
| - Any, ResultWrapper[BlockSenderCreateResponse] |
493 |
| - ), # Union types cannot be passed in as arguments in the type system |
| 371 | + return await self._post( |
| 372 | + f"/accounts/{account_id}/email-security/settings/block_senders", |
| 373 | + body=await async_maybe_transform( |
| 374 | + { |
| 375 | + "is_regex": is_regex, |
| 376 | + "pattern": pattern, |
| 377 | + "pattern_type": pattern_type, |
| 378 | + "comments": comments, |
| 379 | + }, |
| 380 | + block_sender_create_params.BlockSenderCreateParams, |
494 | 381 | ),
|
| 382 | + options=make_request_options( |
| 383 | + extra_headers=extra_headers, |
| 384 | + extra_query=extra_query, |
| 385 | + extra_body=extra_body, |
| 386 | + timeout=timeout, |
| 387 | + post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper, |
| 388 | + ), |
| 389 | + cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]), |
495 | 390 | )
|
496 | 391 |
|
497 | 392 | def list(
|
@@ -580,6 +475,8 @@ async def delete(
|
580 | 475 | Args:
|
581 | 476 | account_id: Account Identifier
|
582 | 477 |
|
| 478 | + pattern_id: The unique identifier for the allow policy. |
| 479 | +
|
583 | 480 | extra_headers: Send extra headers
|
584 | 481 |
|
585 | 482 | extra_query: Add additional query parameters to the request
|
@@ -624,6 +521,8 @@ async def edit(
|
624 | 521 | Args:
|
625 | 522 | account_id: Account Identifier
|
626 | 523 |
|
| 524 | + pattern_id: The unique identifier for the allow policy. |
| 525 | +
|
627 | 526 | extra_headers: Send extra headers
|
628 | 527 |
|
629 | 528 | extra_query: Add additional query parameters to the request
|
@@ -673,6 +572,8 @@ async def get(
|
673 | 572 | Args:
|
674 | 573 | account_id: Account Identifier
|
675 | 574 |
|
| 575 | + pattern_id: The unique identifier for the allow policy. |
| 576 | +
|
676 | 577 | extra_headers: Send extra headers
|
677 | 578 |
|
678 | 579 | extra_query: Add additional query parameters to the request
|
|
0 commit comments