From 8d13abdf63c2514d09daa70e9b9778797adde34c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 06:22:26 +0000 Subject: [PATCH] feat(api): api update (#2211) --- .stats.yml | 4 +- api.md | 6 - .../email_security/investigate/preview.py | 15 +- .../email_security/settings/allow_policies.py | 24 ++ .../email_security/settings/domains.py | 48 +++ .../settings/trusted_domains.py | 329 +----------------- .../investigate/preview_create_params.py | 5 +- .../types/email_security/settings/__init__.py | 4 - .../settings/allow_policy_create_response.py | 1 + .../settings/allow_policy_delete_response.py | 1 + .../settings/allow_policy_edit_response.py | 1 + .../settings/allow_policy_get_response.py | 1 + .../settings/allow_policy_list_params.py | 6 + .../settings/allow_policy_list_response.py | 1 + .../settings/domain_edit_params.py | 25 +- .../settings/domain_edit_response.py | 23 ++ .../settings/domain_get_response.py | 23 ++ .../settings/domain_list_response.py | 23 ++ .../settings/trusted_domain_create_params.py | 16 + .../trusted_domain_create_response.py | 18 + .../trusted_domain_delete_response.py | 10 - .../settings/trusted_domain_edit_params.py | 23 -- .../settings/trusted_domain_edit_response.py | 26 -- .../settings/trusted_domain_get_response.py | 26 -- .../settings/trusted_domain_list_response.py | 9 + .../investigate/test_preview.py | 16 +- .../settings/test_allow_policies.py | 6 + .../email_security/settings/test_domains.py | 18 + .../settings/test_trusted_domains.py | 281 --------------- 29 files changed, 277 insertions(+), 712 deletions(-) delete mode 100644 src/cloudflare/types/email_security/settings/trusted_domain_delete_response.py delete mode 100644 src/cloudflare/types/email_security/settings/trusted_domain_edit_params.py delete mode 100644 src/cloudflare/types/email_security/settings/trusted_domain_edit_response.py delete mode 100644 src/cloudflare/types/email_security/settings/trusted_domain_get_response.py diff --git a/.stats.yml b/.stats.yml index 23c3024b33a..eba8f42b0c8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1451 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3151e81bdc8e6e6f3dc90b21f78c472b90c934926fef1dad65df1f1e13f21b6d.yml +configured_endpoints: 1448 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-96e28d4d04ac2f1a00dda1130ef53e8bd9f2f1590e5d7ba8bed38cad29f8b2de.yml diff --git a/api.md b/api.md index c6b145c3549..a11b220bf61 100644 --- a/api.md +++ b/api.md @@ -1367,9 +1367,6 @@ Types: from cloudflare.types.email_security.settings import ( TrustedDomainCreateResponse, TrustedDomainListResponse, - TrustedDomainDeleteResponse, - TrustedDomainEditResponse, - TrustedDomainGetResponse, ) ``` @@ -1377,9 +1374,6 @@ Methods: - client.email_security.settings.trusted_domains.create(\*, account_id, \*\*params) -> TrustedDomainCreateResponse - client.email_security.settings.trusted_domains.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TrustedDomainListResponse] -- client.email_security.settings.trusted_domains.delete(pattern_id, \*, account_id) -> TrustedDomainDeleteResponse -- client.email_security.settings.trusted_domains.edit(pattern_id, \*, account_id, \*\*params) -> TrustedDomainEditResponse -- client.email_security.settings.trusted_domains.get(pattern_id, \*, account_id) -> TrustedDomainGetResponse ## Submissions diff --git a/src/cloudflare/resources/email_security/investigate/preview.py b/src/cloudflare/resources/email_security/investigate/preview.py index b11d0ec6482..89e653ae889 100644 --- a/src/cloudflare/resources/email_security/investigate/preview.py +++ b/src/cloudflare/resources/email_security/investigate/preview.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, cast +from typing import Type, cast import httpx @@ -21,6 +21,7 @@ ) from ...._wrappers import ResultWrapper from ...._base_client import make_request_options +from ....types.email_security.investigate import preview_create_params from ....types.email_security.investigate.preview_get_response import PreviewGetResponse from ....types.email_security.investigate.preview_create_response import PreviewCreateResponse @@ -51,7 +52,7 @@ def create( self, *, account_id: str, - body: List[str], + postfix_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -65,7 +66,7 @@ def create( Args: account_id: Account Identifier - body: A list of messages identfied by their `postfix_id`s that should be released. + postfix_id: The identifier of the message. extra_headers: Send extra headers @@ -79,7 +80,7 @@ def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( f"/accounts/{account_id}/email-security/investigate/preview", - body=maybe_transform(body, List[str]), + body=maybe_transform({"postfix_id": postfix_id}, preview_create_params.PreviewCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -160,7 +161,7 @@ async def create( self, *, account_id: str, - body: List[str], + postfix_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -174,7 +175,7 @@ async def create( Args: account_id: Account Identifier - body: A list of messages identfied by their `postfix_id`s that should be released. + postfix_id: The identifier of the message. extra_headers: Send extra headers @@ -188,7 +189,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( f"/accounts/{account_id}/email-security/investigate/preview", - body=await async_maybe_transform(body, List[str]), + body=await async_maybe_transform({"postfix_id": postfix_id}, preview_create_params.PreviewCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/email_security/settings/allow_policies.py b/src/cloudflare/resources/email_security/settings/allow_policies.py index d6e654a69ea..bfae3bab2df 100644 --- a/src/cloudflare/resources/email_security/settings/allow_policies.py +++ b/src/cloudflare/resources/email_security/settings/allow_policies.py @@ -139,9 +139,12 @@ def list( *, account_id: str, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + is_acceptable_sender: bool | NotGiven = NOT_GIVEN, + is_exempt_recipient: bool | NotGiven = NOT_GIVEN, is_recipient: bool | NotGiven = NOT_GIVEN, is_sender: bool | NotGiven = NOT_GIVEN, is_spoof: bool | NotGiven = NOT_GIVEN, + is_trusted_sender: bool | NotGiven = NOT_GIVEN, order: Literal["pattern", "created_at"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN, @@ -194,9 +197,12 @@ def list( query=maybe_transform( { "direction": direction, + "is_acceptable_sender": is_acceptable_sender, + "is_exempt_recipient": is_exempt_recipient, "is_recipient": is_recipient, "is_sender": is_sender, "is_spoof": is_spoof, + "is_trusted_sender": is_trusted_sender, "order": order, "page": page, "pattern_type": pattern_type, @@ -228,6 +234,8 @@ def delete( Args: account_id: Account Identifier + policy_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -276,6 +284,8 @@ def edit( Args: account_id: Account Identifier + policy_id: The unique identifier for the allow policy. + is_acceptable_sender: Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. @@ -340,6 +350,8 @@ def get( Args: account_id: Account Identifier + policy_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -465,9 +477,12 @@ def list( *, account_id: str, direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, + is_acceptable_sender: bool | NotGiven = NOT_GIVEN, + is_exempt_recipient: bool | NotGiven = NOT_GIVEN, is_recipient: bool | NotGiven = NOT_GIVEN, is_sender: bool | NotGiven = NOT_GIVEN, is_spoof: bool | NotGiven = NOT_GIVEN, + is_trusted_sender: bool | NotGiven = NOT_GIVEN, order: Literal["pattern", "created_at"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN, @@ -520,9 +535,12 @@ def list( query=maybe_transform( { "direction": direction, + "is_acceptable_sender": is_acceptable_sender, + "is_exempt_recipient": is_exempt_recipient, "is_recipient": is_recipient, "is_sender": is_sender, "is_spoof": is_spoof, + "is_trusted_sender": is_trusted_sender, "order": order, "page": page, "pattern_type": pattern_type, @@ -554,6 +572,8 @@ async def delete( Args: account_id: Account Identifier + policy_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -602,6 +622,8 @@ async def edit( Args: account_id: Account Identifier + policy_id: The unique identifier for the allow policy. + is_acceptable_sender: Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. @@ -666,6 +688,8 @@ async def get( Args: account_id: Account Identifier + policy_id: The unique identifier for the allow policy. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/cloudflare/resources/email_security/settings/domains.py b/src/cloudflare/resources/email_security/settings/domains.py index d0587f9f3f8..1a92ca4e857 100644 --- a/src/cloudflare/resources/email_security/settings/domains.py +++ b/src/cloudflare/resources/email_security/settings/domains.py @@ -213,10 +213,29 @@ def edit( domain_id: int, *, account_id: str, + ip_restrictions: List[str], domain: Optional[str] | NotGiven = NOT_GIVEN, + drop_dispositions: List[ + Literal[ + "MALICIOUS", + "MALICIOUS-BEC", + "SUSPICIOUS", + "SPOOF", + "SPAM", + "BULK", + "ENCRYPTED", + "EXTERNAL", + "UNKNOWN", + "NONE", + ] + ] + | NotGiven = NOT_GIVEN, folder: Literal["AllItems", "Inbox"] | NotGiven = NOT_GIVEN, integration_id: Optional[str] | NotGiven = NOT_GIVEN, lookback_hops: Optional[int] | NotGiven = NOT_GIVEN, + require_tls_inbound: bool | NotGiven = NOT_GIVEN, + require_tls_outbound: bool | NotGiven = NOT_GIVEN, + transport: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -246,10 +265,15 @@ def edit( f"/accounts/{account_id}/email-security/settings/domains/{domain_id}", body=maybe_transform( { + "ip_restrictions": ip_restrictions, "domain": domain, + "drop_dispositions": drop_dispositions, "folder": folder, "integration_id": integration_id, "lookback_hops": lookback_hops, + "require_tls_inbound": require_tls_inbound, + "require_tls_outbound": require_tls_outbound, + "transport": transport, }, domain_edit_params.DomainEditParams, ), @@ -486,10 +510,29 @@ async def edit( domain_id: int, *, account_id: str, + ip_restrictions: List[str], domain: Optional[str] | NotGiven = NOT_GIVEN, + drop_dispositions: List[ + Literal[ + "MALICIOUS", + "MALICIOUS-BEC", + "SUSPICIOUS", + "SPOOF", + "SPAM", + "BULK", + "ENCRYPTED", + "EXTERNAL", + "UNKNOWN", + "NONE", + ] + ] + | NotGiven = NOT_GIVEN, folder: Literal["AllItems", "Inbox"] | NotGiven = NOT_GIVEN, integration_id: Optional[str] | NotGiven = NOT_GIVEN, lookback_hops: Optional[int] | NotGiven = NOT_GIVEN, + require_tls_inbound: bool | NotGiven = NOT_GIVEN, + require_tls_outbound: bool | NotGiven = NOT_GIVEN, + transport: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -519,10 +562,15 @@ async def edit( f"/accounts/{account_id}/email-security/settings/domains/{domain_id}", body=await async_maybe_transform( { + "ip_restrictions": ip_restrictions, "domain": domain, + "drop_dispositions": drop_dispositions, "folder": folder, "integration_id": integration_id, "lookback_hops": lookback_hops, + "require_tls_inbound": require_tls_inbound, + "require_tls_outbound": require_tls_outbound, + "transport": transport, }, domain_edit_params.DomainEditParams, ), diff --git a/src/cloudflare/resources/email_security/settings/trusted_domains.py b/src/cloudflare/resources/email_security/settings/trusted_domains.py index a1010084b41..c563a78885b 100644 --- a/src/cloudflare/resources/email_security/settings/trusted_domains.py +++ b/src/cloudflare/resources/email_security/settings/trusted_domains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Iterable, Optional, cast +from typing import Any, Iterable, Optional, cast from typing_extensions import Literal, overload import httpx @@ -24,16 +24,9 @@ from ...._wrappers import ResultWrapper from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options -from ....types.email_security.settings import ( - trusted_domain_edit_params, - trusted_domain_list_params, - trusted_domain_create_params, -) -from ....types.email_security.settings.trusted_domain_get_response import TrustedDomainGetResponse -from ....types.email_security.settings.trusted_domain_edit_response import TrustedDomainEditResponse +from ....types.email_security.settings import trusted_domain_list_params, trusted_domain_create_params from ....types.email_security.settings.trusted_domain_list_response import TrustedDomainListResponse from ....types.email_security.settings.trusted_domain_create_response import TrustedDomainCreateResponse -from ....types.email_security.settings.trusted_domain_delete_response import TrustedDomainDeleteResponse __all__ = ["TrustedDomainsResource", "AsyncTrustedDomainsResource"] @@ -81,6 +74,12 @@ def create( Args: account_id: Account Identifier + is_recent: Select to prevent recently registered domains from triggering a Suspicious or + Malicious disposition. + + is_similarity: Select for partner or other approved domains that have similar spelling to your + connected domains. Prevents listed domains from triggering a Spoof disposition. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -238,141 +237,6 @@ def list( model=TrustedDomainListResponse, ) - def delete( - self, - pattern_id: int, - *, - account_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TrustedDomainDeleteResponse: - """ - Delete a trusted email domain - - Args: - account_id: Account Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._delete( - f"/accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TrustedDomainDeleteResponse]._unwrapper, - ), - cast_to=cast(Type[TrustedDomainDeleteResponse], ResultWrapper[TrustedDomainDeleteResponse]), - ) - - def edit( - self, - pattern_id: int, - *, - account_id: str, - comments: Optional[str] | NotGiven = NOT_GIVEN, - is_recent: Optional[bool] | NotGiven = NOT_GIVEN, - is_regex: Optional[bool] | NotGiven = NOT_GIVEN, - is_similarity: Optional[bool] | NotGiven = NOT_GIVEN, - pattern: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TrustedDomainEditResponse: - """ - Update a trusted email domain - - Args: - account_id: Account Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._patch( - f"/accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}", - body=maybe_transform( - { - "comments": comments, - "is_recent": is_recent, - "is_regex": is_regex, - "is_similarity": is_similarity, - "pattern": pattern, - }, - trusted_domain_edit_params.TrustedDomainEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TrustedDomainEditResponse]._unwrapper, - ), - cast_to=cast(Type[TrustedDomainEditResponse], ResultWrapper[TrustedDomainEditResponse]), - ) - - def get( - self, - pattern_id: int, - *, - account_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TrustedDomainGetResponse: - """ - Get a trusted email domain - - Args: - account_id: Account Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( - f"/accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TrustedDomainGetResponse]._unwrapper, - ), - cast_to=cast(Type[TrustedDomainGetResponse], ResultWrapper[TrustedDomainGetResponse]), - ) - class AsyncTrustedDomainsResource(AsyncAPIResource): @cached_property @@ -417,6 +281,12 @@ async def create( Args: account_id: Account Identifier + is_recent: Select to prevent recently registered domains from triggering a Suspicious or + Malicious disposition. + + is_similarity: Select for partner or other approved domains that have similar spelling to your + connected domains. Prevents listed domains from triggering a Spoof disposition. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -574,141 +444,6 @@ def list( model=TrustedDomainListResponse, ) - async def delete( - self, - pattern_id: int, - *, - account_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TrustedDomainDeleteResponse: - """ - Delete a trusted email domain - - Args: - account_id: Account Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._delete( - f"/accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TrustedDomainDeleteResponse]._unwrapper, - ), - cast_to=cast(Type[TrustedDomainDeleteResponse], ResultWrapper[TrustedDomainDeleteResponse]), - ) - - async def edit( - self, - pattern_id: int, - *, - account_id: str, - comments: Optional[str] | NotGiven = NOT_GIVEN, - is_recent: Optional[bool] | NotGiven = NOT_GIVEN, - is_regex: Optional[bool] | NotGiven = NOT_GIVEN, - is_similarity: Optional[bool] | NotGiven = NOT_GIVEN, - pattern: Optional[str] | NotGiven = NOT_GIVEN, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TrustedDomainEditResponse: - """ - Update a trusted email domain - - Args: - account_id: Account Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._patch( - f"/accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}", - body=await async_maybe_transform( - { - "comments": comments, - "is_recent": is_recent, - "is_regex": is_regex, - "is_similarity": is_similarity, - "pattern": pattern, - }, - trusted_domain_edit_params.TrustedDomainEditParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TrustedDomainEditResponse]._unwrapper, - ), - cast_to=cast(Type[TrustedDomainEditResponse], ResultWrapper[TrustedDomainEditResponse]), - ) - - async def get( - self, - pattern_id: int, - *, - account_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TrustedDomainGetResponse: - """ - Get a trusted email domain - - Args: - account_id: Account Identifier - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not account_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( - f"/accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[TrustedDomainGetResponse]._unwrapper, - ), - cast_to=cast(Type[TrustedDomainGetResponse], ResultWrapper[TrustedDomainGetResponse]), - ) - class TrustedDomainsResourceWithRawResponse: def __init__(self, trusted_domains: TrustedDomainsResource) -> None: @@ -720,15 +455,6 @@ def __init__(self, trusted_domains: TrustedDomainsResource) -> None: self.list = to_raw_response_wrapper( trusted_domains.list, ) - self.delete = to_raw_response_wrapper( - trusted_domains.delete, - ) - self.edit = to_raw_response_wrapper( - trusted_domains.edit, - ) - self.get = to_raw_response_wrapper( - trusted_domains.get, - ) class AsyncTrustedDomainsResourceWithRawResponse: @@ -741,15 +467,6 @@ def __init__(self, trusted_domains: AsyncTrustedDomainsResource) -> None: self.list = async_to_raw_response_wrapper( trusted_domains.list, ) - self.delete = async_to_raw_response_wrapper( - trusted_domains.delete, - ) - self.edit = async_to_raw_response_wrapper( - trusted_domains.edit, - ) - self.get = async_to_raw_response_wrapper( - trusted_domains.get, - ) class TrustedDomainsResourceWithStreamingResponse: @@ -762,15 +479,6 @@ def __init__(self, trusted_domains: TrustedDomainsResource) -> None: self.list = to_streamed_response_wrapper( trusted_domains.list, ) - self.delete = to_streamed_response_wrapper( - trusted_domains.delete, - ) - self.edit = to_streamed_response_wrapper( - trusted_domains.edit, - ) - self.get = to_streamed_response_wrapper( - trusted_domains.get, - ) class AsyncTrustedDomainsResourceWithStreamingResponse: @@ -783,12 +491,3 @@ def __init__(self, trusted_domains: AsyncTrustedDomainsResource) -> None: self.list = async_to_streamed_response_wrapper( trusted_domains.list, ) - self.delete = async_to_streamed_response_wrapper( - trusted_domains.delete, - ) - self.edit = async_to_streamed_response_wrapper( - trusted_domains.edit, - ) - self.get = async_to_streamed_response_wrapper( - trusted_domains.get, - ) diff --git a/src/cloudflare/types/email_security/investigate/preview_create_params.py b/src/cloudflare/types/email_security/investigate/preview_create_params.py index 8797183621a..b5443edc58f 100644 --- a/src/cloudflare/types/email_security/investigate/preview_create_params.py +++ b/src/cloudflare/types/email_security/investigate/preview_create_params.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import List from typing_extensions import Required, TypedDict __all__ = ["PreviewCreateParams"] @@ -12,5 +11,5 @@ class PreviewCreateParams(TypedDict, total=False): account_id: Required[str] """Account Identifier""" - body: Required[List[str]] - """A list of messages identfied by their `postfix_id`s that should be released.""" + postfix_id: Required[str] + """The identifier of the message.""" diff --git a/src/cloudflare/types/email_security/settings/__init__.py b/src/cloudflare/types/email_security/settings/__init__.py index 26c5fc41f06..f549ba0d676 100644 --- a/src/cloudflare/types/email_security/settings/__init__.py +++ b/src/cloudflare/types/email_security/settings/__init__.py @@ -20,19 +20,15 @@ from .block_sender_create_params import BlockSenderCreateParams as BlockSenderCreateParams from .block_sender_edit_response import BlockSenderEditResponse as BlockSenderEditResponse from .block_sender_list_response import BlockSenderListResponse as BlockSenderListResponse -from .trusted_domain_edit_params import TrustedDomainEditParams as TrustedDomainEditParams from .trusted_domain_list_params import TrustedDomainListParams as TrustedDomainListParams from .domain_bulk_delete_response import DomainBulkDeleteResponse as DomainBulkDeleteResponse -from .trusted_domain_get_response import TrustedDomainGetResponse as TrustedDomainGetResponse from .allow_policy_create_response import AllowPolicyCreateResponse as AllowPolicyCreateResponse from .allow_policy_delete_response import AllowPolicyDeleteResponse as AllowPolicyDeleteResponse from .block_sender_create_response import BlockSenderCreateResponse as BlockSenderCreateResponse from .block_sender_delete_response import BlockSenderDeleteResponse as BlockSenderDeleteResponse from .trusted_domain_create_params import TrustedDomainCreateParams as TrustedDomainCreateParams -from .trusted_domain_edit_response import TrustedDomainEditResponse as TrustedDomainEditResponse from .trusted_domain_list_response import TrustedDomainListResponse as TrustedDomainListResponse from .trusted_domain_create_response import TrustedDomainCreateResponse as TrustedDomainCreateResponse -from .trusted_domain_delete_response import TrustedDomainDeleteResponse as TrustedDomainDeleteResponse from .impersonation_registry_edit_params import ImpersonationRegistryEditParams as ImpersonationRegistryEditParams from .impersonation_registry_list_params import ImpersonationRegistryListParams as ImpersonationRegistryListParams from .impersonation_registry_get_response import ImpersonationRegistryGetResponse as ImpersonationRegistryGetResponse diff --git a/src/cloudflare/types/email_security/settings/allow_policy_create_response.py b/src/cloudflare/types/email_security/settings/allow_policy_create_response.py index 5588d086dc1..312ff7e2a7c 100644 --- a/src/cloudflare/types/email_security/settings/allow_policy_create_response.py +++ b/src/cloudflare/types/email_security/settings/allow_policy_create_response.py @@ -11,6 +11,7 @@ class AllowPolicyCreateResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime diff --git a/src/cloudflare/types/email_security/settings/allow_policy_delete_response.py b/src/cloudflare/types/email_security/settings/allow_policy_delete_response.py index 229af8c5cfe..367167eb68f 100644 --- a/src/cloudflare/types/email_security/settings/allow_policy_delete_response.py +++ b/src/cloudflare/types/email_security/settings/allow_policy_delete_response.py @@ -8,3 +8,4 @@ class AllowPolicyDeleteResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" diff --git a/src/cloudflare/types/email_security/settings/allow_policy_edit_response.py b/src/cloudflare/types/email_security/settings/allow_policy_edit_response.py index 1424b6ccb42..eb66126b593 100644 --- a/src/cloudflare/types/email_security/settings/allow_policy_edit_response.py +++ b/src/cloudflare/types/email_security/settings/allow_policy_edit_response.py @@ -11,6 +11,7 @@ class AllowPolicyEditResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime diff --git a/src/cloudflare/types/email_security/settings/allow_policy_get_response.py b/src/cloudflare/types/email_security/settings/allow_policy_get_response.py index aa37a40c510..e9cb0384cf3 100644 --- a/src/cloudflare/types/email_security/settings/allow_policy_get_response.py +++ b/src/cloudflare/types/email_security/settings/allow_policy_get_response.py @@ -11,6 +11,7 @@ class AllowPolicyGetResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime diff --git a/src/cloudflare/types/email_security/settings/allow_policy_list_params.py b/src/cloudflare/types/email_security/settings/allow_policy_list_params.py index c81ccd0532c..20b3901d97e 100644 --- a/src/cloudflare/types/email_security/settings/allow_policy_list_params.py +++ b/src/cloudflare/types/email_security/settings/allow_policy_list_params.py @@ -14,12 +14,18 @@ class AllowPolicyListParams(TypedDict, total=False): direction: Literal["asc", "desc"] """The sorting direction.""" + is_acceptable_sender: bool + + is_exempt_recipient: bool + is_recipient: bool is_sender: bool is_spoof: bool + is_trusted_sender: bool + order: Literal["pattern", "created_at"] """The field to sort by.""" diff --git a/src/cloudflare/types/email_security/settings/allow_policy_list_response.py b/src/cloudflare/types/email_security/settings/allow_policy_list_response.py index 219e3bb9401..9b4c57f2a22 100644 --- a/src/cloudflare/types/email_security/settings/allow_policy_list_response.py +++ b/src/cloudflare/types/email_security/settings/allow_policy_list_response.py @@ -11,6 +11,7 @@ class AllowPolicyListResponse(BaseModel): id: int + """The unique identifier for the allow policy.""" created_at: datetime diff --git a/src/cloudflare/types/email_security/settings/domain_edit_params.py b/src/cloudflare/types/email_security/settings/domain_edit_params.py index e963127bd95..e228242a83d 100644 --- a/src/cloudflare/types/email_security/settings/domain_edit_params.py +++ b/src/cloudflare/types/email_security/settings/domain_edit_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import List, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["DomainEditParams"] @@ -12,10 +12,33 @@ class DomainEditParams(TypedDict, total=False): account_id: Required[str] """Account Identifier""" + ip_restrictions: Required[List[str]] + domain: Optional[str] + drop_dispositions: List[ + Literal[ + "MALICIOUS", + "MALICIOUS-BEC", + "SUSPICIOUS", + "SPOOF", + "SPAM", + "BULK", + "ENCRYPTED", + "EXTERNAL", + "UNKNOWN", + "NONE", + ] + ] + folder: Literal["AllItems", "Inbox"] integration_id: Optional[str] lookback_hops: Optional[int] + + require_tls_inbound: bool + + require_tls_outbound: bool + + transport: str diff --git a/src/cloudflare/types/email_security/settings/domain_edit_response.py b/src/cloudflare/types/email_security/settings/domain_edit_response.py index a8e5108d5c0..8ea6d9f2e97 100644 --- a/src/cloudflare/types/email_security/settings/domain_edit_response.py +++ b/src/cloudflare/types/email_security/settings/domain_edit_response.py @@ -19,10 +19,29 @@ class DomainEditResponse(BaseModel): domain: str + drop_dispositions: List[ + Literal[ + "MALICIOUS", + "MALICIOUS-BEC", + "SUSPICIOUS", + "SPOOF", + "SPAM", + "BULK", + "ENCRYPTED", + "EXTERNAL", + "UNKNOWN", + "NONE", + ] + ] + + ip_restrictions: List[str] + last_modified: datetime lookback_hops: int + transport: str + folder: Optional[Literal["AllItems", "Inbox"]] = None inbox_provider: Optional[Literal["Microsoft", "Google"]] = None @@ -30,3 +49,7 @@ class DomainEditResponse(BaseModel): integration_id: Optional[str] = None o365_tenant_id: Optional[str] = None + + require_tls_inbound: Optional[bool] = None + + require_tls_outbound: Optional[bool] = None diff --git a/src/cloudflare/types/email_security/settings/domain_get_response.py b/src/cloudflare/types/email_security/settings/domain_get_response.py index 83dbc59718d..7943664ea15 100644 --- a/src/cloudflare/types/email_security/settings/domain_get_response.py +++ b/src/cloudflare/types/email_security/settings/domain_get_response.py @@ -19,10 +19,29 @@ class DomainGetResponse(BaseModel): domain: str + drop_dispositions: List[ + Literal[ + "MALICIOUS", + "MALICIOUS-BEC", + "SUSPICIOUS", + "SPOOF", + "SPAM", + "BULK", + "ENCRYPTED", + "EXTERNAL", + "UNKNOWN", + "NONE", + ] + ] + + ip_restrictions: List[str] + last_modified: datetime lookback_hops: int + transport: str + folder: Optional[Literal["AllItems", "Inbox"]] = None inbox_provider: Optional[Literal["Microsoft", "Google"]] = None @@ -30,3 +49,7 @@ class DomainGetResponse(BaseModel): integration_id: Optional[str] = None o365_tenant_id: Optional[str] = None + + require_tls_inbound: Optional[bool] = None + + require_tls_outbound: Optional[bool] = None diff --git a/src/cloudflare/types/email_security/settings/domain_list_response.py b/src/cloudflare/types/email_security/settings/domain_list_response.py index ebd660aecb4..cf7eb4380ce 100644 --- a/src/cloudflare/types/email_security/settings/domain_list_response.py +++ b/src/cloudflare/types/email_security/settings/domain_list_response.py @@ -19,10 +19,29 @@ class DomainListResponse(BaseModel): domain: str + drop_dispositions: List[ + Literal[ + "MALICIOUS", + "MALICIOUS-BEC", + "SUSPICIOUS", + "SPOOF", + "SPAM", + "BULK", + "ENCRYPTED", + "EXTERNAL", + "UNKNOWN", + "NONE", + ] + ] + + ip_restrictions: List[str] + last_modified: datetime lookback_hops: int + transport: str + folder: Optional[Literal["AllItems", "Inbox"]] = None inbox_provider: Optional[Literal["Microsoft", "Google"]] = None @@ -30,3 +49,7 @@ class DomainListResponse(BaseModel): integration_id: Optional[str] = None o365_tenant_id: Optional[str] = None + + require_tls_inbound: Optional[bool] = None + + require_tls_outbound: Optional[bool] = None diff --git a/src/cloudflare/types/email_security/settings/trusted_domain_create_params.py b/src/cloudflare/types/email_security/settings/trusted_domain_create_params.py index 2b05202dfa6..3159478e22d 100644 --- a/src/cloudflare/types/email_security/settings/trusted_domain_create_params.py +++ b/src/cloudflare/types/email_security/settings/trusted_domain_create_params.py @@ -13,10 +13,18 @@ class EmailSecurityCreateTrustedDomain(TypedDict, total=False): """Account Identifier""" is_recent: Required[bool] + """ + Select to prevent recently registered domains from triggering a Suspicious or + Malicious disposition. + """ is_regex: Required[bool] is_similarity: Required[bool] + """ + Select for partner or other approved domains that have similar spelling to your + connected domains. Prevents listed domains from triggering a Spoof disposition. + """ pattern: Required[str] @@ -32,10 +40,18 @@ class Variant1(TypedDict, total=False): class Variant1Body(TypedDict, total=False): is_recent: Required[bool] + """ + Select to prevent recently registered domains from triggering a Suspicious or + Malicious disposition. + """ is_regex: Required[bool] is_similarity: Required[bool] + """ + Select for partner or other approved domains that have similar spelling to your + connected domains. Prevents listed domains from triggering a Spoof disposition. + """ pattern: Required[str] diff --git a/src/cloudflare/types/email_security/settings/trusted_domain_create_response.py b/src/cloudflare/types/email_security/settings/trusted_domain_create_response.py index e5163ad6ff0..1dfe56cf075 100644 --- a/src/cloudflare/types/email_security/settings/trusted_domain_create_response.py +++ b/src/cloudflare/types/email_security/settings/trusted_domain_create_response.py @@ -11,14 +11,23 @@ class EmailSecurityTrustedDomain(BaseModel): id: int + """The unique identifier for the trusted domain.""" created_at: datetime is_recent: bool + """ + Select to prevent recently registered domains from triggering a Suspicious or + Malicious disposition. + """ is_regex: bool is_similarity: bool + """ + Select for partner or other approved domains that have similar spelling to your + connected domains. Prevents listed domains from triggering a Spoof disposition. + """ last_modified: datetime @@ -29,14 +38,23 @@ class EmailSecurityTrustedDomain(BaseModel): class UnionMember1(BaseModel): id: int + """The unique identifier for the trusted domain.""" created_at: datetime is_recent: bool + """ + Select to prevent recently registered domains from triggering a Suspicious or + Malicious disposition. + """ is_regex: bool is_similarity: bool + """ + Select for partner or other approved domains that have similar spelling to your + connected domains. Prevents listed domains from triggering a Spoof disposition. + """ last_modified: datetime diff --git a/src/cloudflare/types/email_security/settings/trusted_domain_delete_response.py b/src/cloudflare/types/email_security/settings/trusted_domain_delete_response.py deleted file mode 100644 index 68cfd29b210..00000000000 --- a/src/cloudflare/types/email_security/settings/trusted_domain_delete_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -from ...._models import BaseModel - -__all__ = ["TrustedDomainDeleteResponse"] - - -class TrustedDomainDeleteResponse(BaseModel): - id: int diff --git a/src/cloudflare/types/email_security/settings/trusted_domain_edit_params.py b/src/cloudflare/types/email_security/settings/trusted_domain_edit_params.py deleted file mode 100644 index ea811eb605b..00000000000 --- a/src/cloudflare/types/email_security/settings/trusted_domain_edit_params.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["TrustedDomainEditParams"] - - -class TrustedDomainEditParams(TypedDict, total=False): - account_id: Required[str] - """Account Identifier""" - - comments: Optional[str] - - is_recent: Optional[bool] - - is_regex: Optional[bool] - - is_similarity: Optional[bool] - - pattern: Optional[str] diff --git a/src/cloudflare/types/email_security/settings/trusted_domain_edit_response.py b/src/cloudflare/types/email_security/settings/trusted_domain_edit_response.py deleted file mode 100644 index bffaf42d7d1..00000000000 --- a/src/cloudflare/types/email_security/settings/trusted_domain_edit_response.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["TrustedDomainEditResponse"] - - -class TrustedDomainEditResponse(BaseModel): - id: int - - created_at: datetime - - is_recent: bool - - is_regex: bool - - is_similarity: bool - - last_modified: datetime - - pattern: str - - comments: Optional[str] = None diff --git a/src/cloudflare/types/email_security/settings/trusted_domain_get_response.py b/src/cloudflare/types/email_security/settings/trusted_domain_get_response.py deleted file mode 100644 index a10c3bd2e17..00000000000 --- a/src/cloudflare/types/email_security/settings/trusted_domain_get_response.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime - -from ...._models import BaseModel - -__all__ = ["TrustedDomainGetResponse"] - - -class TrustedDomainGetResponse(BaseModel): - id: int - - created_at: datetime - - is_recent: bool - - is_regex: bool - - is_similarity: bool - - last_modified: datetime - - pattern: str - - comments: Optional[str] = None diff --git a/src/cloudflare/types/email_security/settings/trusted_domain_list_response.py b/src/cloudflare/types/email_security/settings/trusted_domain_list_response.py index 480bf33f117..42e7eec4fed 100644 --- a/src/cloudflare/types/email_security/settings/trusted_domain_list_response.py +++ b/src/cloudflare/types/email_security/settings/trusted_domain_list_response.py @@ -10,14 +10,23 @@ class TrustedDomainListResponse(BaseModel): id: int + """The unique identifier for the trusted domain.""" created_at: datetime is_recent: bool + """ + Select to prevent recently registered domains from triggering a Suspicious or + Malicious disposition. + """ is_regex: bool is_similarity: bool + """ + Select for partner or other approved domains that have similar spelling to your + connected domains. Prevents listed domains from triggering a Spoof disposition. + """ last_modified: datetime diff --git a/tests/api_resources/email_security/investigate/test_preview.py b/tests/api_resources/email_security/investigate/test_preview.py index 4d773c0d59a..90c38b7e703 100644 --- a/tests/api_resources/email_security/investigate/test_preview.py +++ b/tests/api_resources/email_security/investigate/test_preview.py @@ -21,7 +21,7 @@ class TestPreview: def test_method_create(self, client: Cloudflare) -> None: preview = client.email_security.investigate.preview.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) assert_matches_type(PreviewCreateResponse, preview, path=["response"]) @@ -29,7 +29,7 @@ def test_method_create(self, client: Cloudflare) -> None: def test_raw_response_create(self, client: Cloudflare) -> None: response = client.email_security.investigate.preview.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) assert response.is_closed is True @@ -41,7 +41,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: def test_streaming_response_create(self, client: Cloudflare) -> None: with client.email_security.investigate.preview.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,7 +56,7 @@ def test_path_params_create(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.email_security.investigate.preview.with_raw_response.create( account_id="", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) @parametrize @@ -115,7 +115,7 @@ class TestAsyncPreview: async def test_method_create(self, async_client: AsyncCloudflare) -> None: preview = await async_client.email_security.investigate.preview.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) assert_matches_type(PreviewCreateResponse, preview, path=["response"]) @@ -123,7 +123,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_security.investigate.preview.with_raw_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) assert response.is_closed is True @@ -135,7 +135,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: async with async_client.email_security.investigate.preview.with_streaming_response.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -150,7 +150,7 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.email_security.investigate.preview.with_raw_response.create( account_id="", - body=["4Njp3P0STMz2c02Q"], + postfix_id="4Njp3P0STMz2c02Q", ) @parametrize diff --git a/tests/api_resources/email_security/settings/test_allow_policies.py b/tests/api_resources/email_security/settings/test_allow_policies.py index 34e4d4d4d99..dd2afd7b539 100644 --- a/tests/api_resources/email_security/settings/test_allow_policies.py +++ b/tests/api_resources/email_security/settings/test_allow_policies.py @@ -120,9 +120,12 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: allow_policy = client.email_security.settings.allow_policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", direction="asc", + is_acceptable_sender=True, + is_exempt_recipient=True, is_recipient=True, is_sender=True, is_spoof=True, + is_trusted_sender=True, order="pattern", page=1, pattern_type="EMAIL", @@ -405,9 +408,12 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) allow_policy = await async_client.email_security.settings.allow_policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", direction="asc", + is_acceptable_sender=True, + is_exempt_recipient=True, is_recipient=True, is_sender=True, is_spoof=True, + is_trusted_sender=True, order="pattern", page=1, pattern_type="EMAIL", diff --git a/tests/api_resources/email_security/settings/test_domains.py b/tests/api_resources/email_security/settings/test_domains.py index f2ee13c6fbb..b6668368e0a 100644 --- a/tests/api_resources/email_security/settings/test_domains.py +++ b/tests/api_resources/email_security/settings/test_domains.py @@ -161,6 +161,7 @@ def test_method_edit(self, client: Cloudflare) -> None: domain = client.email_security.settings.domains.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) assert_matches_type(DomainEditResponse, domain, path=["response"]) @@ -169,10 +170,15 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None: domain = client.email_security.settings.domains.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], domain="domain", + drop_dispositions=["MALICIOUS"], folder="AllItems", integration_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", lookback_hops=1, + require_tls_inbound=True, + require_tls_outbound=True, + transport="transport", ) assert_matches_type(DomainEditResponse, domain, path=["response"]) @@ -181,6 +187,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None: response = client.email_security.settings.domains.with_raw_response.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) assert response.is_closed is True @@ -193,6 +200,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None: with client.email_security.settings.domains.with_streaming_response.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -208,6 +216,7 @@ def test_path_params_edit(self, client: Cloudflare) -> None: client.email_security.settings.domains.with_raw_response.edit( domain_id=2400, account_id="", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) @parametrize @@ -393,6 +402,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None: domain = await async_client.email_security.settings.domains.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) assert_matches_type(DomainEditResponse, domain, path=["response"]) @@ -401,10 +411,15 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) domain = await async_client.email_security.settings.domains.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], domain="domain", + drop_dispositions=["MALICIOUS"], folder="AllItems", integration_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", lookback_hops=1, + require_tls_inbound=True, + require_tls_outbound=True, + transport="transport", ) assert_matches_type(DomainEditResponse, domain, path=["response"]) @@ -413,6 +428,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: response = await async_client.email_security.settings.domains.with_raw_response.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) assert response.is_closed is True @@ -425,6 +441,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N async with async_client.email_security.settings.domains.with_streaming_response.edit( domain_id=2400, account_id="023e105f4ecef8ad9ca31a8372d0c353", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -440,6 +457,7 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: await async_client.email_security.settings.domains.with_raw_response.edit( domain_id=2400, account_id="", + ip_restrictions=["192.0.2.0/24", "2001:db8::/32"], ) @parametrize diff --git a/tests/api_resources/email_security/settings/test_trusted_domains.py b/tests/api_resources/email_security/settings/test_trusted_domains.py index 14d30051f0c..ebd849f1118 100644 --- a/tests/api_resources/email_security/settings/test_trusted_domains.py +++ b/tests/api_resources/email_security/settings/test_trusted_domains.py @@ -11,11 +11,8 @@ from tests.utils import assert_matches_type from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from cloudflare.types.email_security.settings import ( - TrustedDomainGetResponse, - TrustedDomainEditResponse, TrustedDomainListResponse, TrustedDomainCreateResponse, - TrustedDomainDeleteResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -212,145 +209,6 @@ def test_path_params_list(self, client: Cloudflare) -> None: account_id="", ) - @parametrize - def test_method_delete(self, client: Cloudflare) -> None: - trusted_domain = client.email_security.settings.trusted_domains.delete( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(TrustedDomainDeleteResponse, trusted_domain, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Cloudflare) -> None: - response = client.email_security.settings.trusted_domains.with_raw_response.delete( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trusted_domain = response.parse() - assert_matches_type(TrustedDomainDeleteResponse, trusted_domain, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Cloudflare) -> None: - with client.email_security.settings.trusted_domains.with_streaming_response.delete( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trusted_domain = response.parse() - assert_matches_type(TrustedDomainDeleteResponse, trusted_domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.email_security.settings.trusted_domains.with_raw_response.delete( - pattern_id=2401, - account_id="", - ) - - @parametrize - def test_method_edit(self, client: Cloudflare) -> None: - trusted_domain = client.email_security.settings.trusted_domains.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - @parametrize - def test_method_edit_with_all_params(self, client: Cloudflare) -> None: - trusted_domain = client.email_security.settings.trusted_domains.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - comments="comments", - is_recent=True, - is_regex=True, - is_similarity=True, - pattern="x", - ) - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - @parametrize - def test_raw_response_edit(self, client: Cloudflare) -> None: - response = client.email_security.settings.trusted_domains.with_raw_response.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trusted_domain = response.parse() - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - @parametrize - def test_streaming_response_edit(self, client: Cloudflare) -> None: - with client.email_security.settings.trusted_domains.with_streaming_response.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trusted_domain = response.parse() - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_edit(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.email_security.settings.trusted_domains.with_raw_response.edit( - pattern_id=2401, - account_id="", - ) - - @parametrize - def test_method_get(self, client: Cloudflare) -> None: - trusted_domain = client.email_security.settings.trusted_domains.get( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(TrustedDomainGetResponse, trusted_domain, path=["response"]) - - @parametrize - def test_raw_response_get(self, client: Cloudflare) -> None: - response = client.email_security.settings.trusted_domains.with_raw_response.get( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trusted_domain = response.parse() - assert_matches_type(TrustedDomainGetResponse, trusted_domain, path=["response"]) - - @parametrize - def test_streaming_response_get(self, client: Cloudflare) -> None: - with client.email_security.settings.trusted_domains.with_streaming_response.get( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trusted_domain = response.parse() - assert_matches_type(TrustedDomainGetResponse, trusted_domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_get(self, client: Cloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.email_security.settings.trusted_domains.with_raw_response.get( - pattern_id=2401, - account_id="", - ) - class TestAsyncTrustedDomains: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -544,142 +402,3 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None: await async_client.email_security.settings.trusted_domains.with_raw_response.list( account_id="", ) - - @parametrize - async def test_method_delete(self, async_client: AsyncCloudflare) -> None: - trusted_domain = await async_client.email_security.settings.trusted_domains.delete( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(TrustedDomainDeleteResponse, trusted_domain, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: - response = await async_client.email_security.settings.trusted_domains.with_raw_response.delete( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trusted_domain = await response.parse() - assert_matches_type(TrustedDomainDeleteResponse, trusted_domain, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None: - async with async_client.email_security.settings.trusted_domains.with_streaming_response.delete( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trusted_domain = await response.parse() - assert_matches_type(TrustedDomainDeleteResponse, trusted_domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.email_security.settings.trusted_domains.with_raw_response.delete( - pattern_id=2401, - account_id="", - ) - - @parametrize - async def test_method_edit(self, async_client: AsyncCloudflare) -> None: - trusted_domain = await async_client.email_security.settings.trusted_domains.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - @parametrize - async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None: - trusted_domain = await async_client.email_security.settings.trusted_domains.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - comments="comments", - is_recent=True, - is_regex=True, - is_similarity=True, - pattern="x", - ) - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - @parametrize - async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None: - response = await async_client.email_security.settings.trusted_domains.with_raw_response.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trusted_domain = await response.parse() - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - @parametrize - async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None: - async with async_client.email_security.settings.trusted_domains.with_streaming_response.edit( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trusted_domain = await response.parse() - assert_matches_type(TrustedDomainEditResponse, trusted_domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.email_security.settings.trusted_domains.with_raw_response.edit( - pattern_id=2401, - account_id="", - ) - - @parametrize - async def test_method_get(self, async_client: AsyncCloudflare) -> None: - trusted_domain = await async_client.email_security.settings.trusted_domains.get( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - assert_matches_type(TrustedDomainGetResponse, trusted_domain, path=["response"]) - - @parametrize - async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: - response = await async_client.email_security.settings.trusted_domains.with_raw_response.get( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - trusted_domain = await response.parse() - assert_matches_type(TrustedDomainGetResponse, trusted_domain, path=["response"]) - - @parametrize - async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: - async with async_client.email_security.settings.trusted_domains.with_streaming_response.get( - pattern_id=2401, - account_id="023e105f4ecef8ad9ca31a8372d0c353", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - trusted_domain = await response.parse() - assert_matches_type(TrustedDomainGetResponse, trusted_domain, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_get(self, async_client: AsyncCloudflare) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.email_security.settings.trusted_domains.with_raw_response.get( - pattern_id=2401, - account_id="", - )