diff --git a/.stats.yml b/.stats.yml
index af6c12b06a0..c397995164b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 1411
+configured_endpoints: 1435
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-829ade7062fed63a30accc2a5e1a14c6c26fd4dc003d300d1b25a5416b8b8727.yml
diff --git a/api.md b/api.md
index 7a80cacce4c..a44181e0287 100644
--- a/api.md
+++ b/api.md
@@ -1174,27 +1174,124 @@ Methods:
Types:
```python
-from cloudflare.types.email_security import (
- InvestigateListResponse,
- InvestigateDetectionsResponse,
- InvestigateGetResponse,
- InvestigatePreviewResponse,
- InvestigateRawResponse,
- InvestigateTraceResponse,
-)
+from cloudflare.types.email_security import InvestigateListResponse, InvestigateGetResponse
+```
+
+Methods:
+
+- client.email_security.investigate.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[InvestigateListResponse]
+- client.email_security.investigate.get(postfix_id, \*, account_id) -> InvestigateGetResponse
+
+### Detections
+
+Types:
+
+```python
+from cloudflare.types.email_security.investigate import DetectionGetResponse
+```
+
+Methods:
+
+- client.email_security.investigate.detections.get(postfix_id, \*, account_id) -> DetectionGetResponse
+
+### Preview
+
+Types:
+
+```python
+from cloudflare.types.email_security.investigate import PreviewCreateResponse, PreviewGetResponse
+```
+
+Methods:
+
+- client.email_security.investigate.preview.create(\*, account_id, \*\*params) -> PreviewCreateResponse
+- client.email_security.investigate.preview.get(postfix_id, \*, account_id) -> PreviewGetResponse
+
+### Raw
+
+Types:
+
+```python
+from cloudflare.types.email_security.investigate import RawGetResponse
+```
+
+Methods:
+
+- client.email_security.investigate.raw.get(postfix_id, \*, account_id) -> RawGetResponse
+
+### Trace
+
+Types:
+
+```python
+from cloudflare.types.email_security.investigate import TraceGetResponse
+```
+
+Methods:
+
+- client.email_security.investigate.trace.get(postfix_id, \*, account_id) -> TraceGetResponse
+
+### Move
+
+Types:
+
+```python
+from cloudflare.types.email_security.investigate import MoveCreateResponse, MoveBulkResponse
+```
+
+Methods:
+
+- client.email_security.investigate.move.create(postfix_id, \*, account_id, \*\*params) -> MoveCreateResponse
+- client.email_security.investigate.move.bulk(\*, account_id, \*\*params) -> MoveBulkResponse
+
+### Reclassify
+
+Types:
+
+```python
+from cloudflare.types.email_security.investigate import ReclassifyCreateResponse
+```
+
+Methods:
+
+- client.email_security.investigate.reclassify.create(postfix_id, \*, account_id, \*\*params) -> object
+
+### Release
+
+Types:
+
+```python
+from cloudflare.types.email_security.investigate import ReleaseBulkResponse
```
Methods:
-- client.email_security.investigate.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[InvestigateListResponse]
-- client.email_security.investigate.detections(postfix_id, \*, account_id) -> InvestigateDetectionsResponse
-- client.email_security.investigate.get(postfix_id, \*, account_id) -> InvestigateGetResponse
-- client.email_security.investigate.preview(postfix_id, \*, account_id) -> InvestigatePreviewResponse
-- client.email_security.investigate.raw(postfix_id, \*, account_id) -> InvestigateRawResponse
-- client.email_security.investigate.trace(postfix_id, \*, account_id) -> InvestigateTraceResponse
+- client.email_security.investigate.release.bulk(\*, account_id, \*\*params) -> ReleaseBulkResponse
## Settings
+### AllowPolicies
+
+Types:
+
+```python
+from cloudflare.types.email_security.settings import (
+ AllowPolicyCreateResponse,
+ AllowPolicyListResponse,
+ AllowPolicyDeleteResponse,
+ AllowPolicyEditResponse,
+ AllowPolicyGetResponse,
+)
+```
+
+Methods:
+
+- client.email_security.settings.allow_policies.create(\*, account_id, \*\*params) -> AllowPolicyCreateResponse
+- client.email_security.settings.allow_policies.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[AllowPolicyListResponse]
+- client.email_security.settings.allow_policies.delete(policy_id, \*, account_id) -> AllowPolicyDeleteResponse
+- client.email_security.settings.allow_policies.edit(policy_id, \*, account_id, \*\*params) -> AllowPolicyEditResponse
+- client.email_security.settings.allow_policies.get(policy_id, \*, account_id) -> AllowPolicyGetResponse
+
### BlockSenders
Types:
@@ -1226,6 +1323,7 @@ from cloudflare.types.email_security.settings import (
DomainListResponse,
DomainDeleteResponse,
DomainEditResponse,
+ DomainGetResponse,
)
```
@@ -1234,6 +1332,7 @@ Methods:
- client.email_security.settings.domains.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DomainListResponse]
- client.email_security.settings.domains.delete(domain_id, \*, account_id) -> DomainDeleteResponse
- client.email_security.settings.domains.edit(domain_id, \*, account_id, \*\*params) -> DomainEditResponse
+- client.email_security.settings.domains.get(domain_id, \*, account_id) -> DomainGetResponse
### ImpersonationRegistry
@@ -1279,6 +1378,18 @@ Methods:
- 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
+
+Types:
+
+```python
+from cloudflare.types.email_security import SubmissionListResponse
+```
+
+Methods:
+
+- client.email_security.submissions.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[SubmissionListResponse]
+
# EmailRouting
Types:
@@ -5846,6 +5957,28 @@ Methods:
- client.zero_trust.dlp.limits.list(\*, account_id) -> Optional
+### Entries
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.dlp import (
+ EntryCreateResponse,
+ EntryUpdateResponse,
+ EntryListResponse,
+ EntryDeleteResponse,
+ EntryGetResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.dlp.entries.create(\*, account_id, \*\*params) -> Optional
+- client.zero_trust.dlp.entries.update(entry_id, \*, account_id, \*\*params) -> Optional
+- client.zero_trust.dlp.entries.list(\*, account_id) -> SyncSinglePage[EntryListResponse]
+- client.zero_trust.dlp.entries.delete(entry_id, \*, account_id) -> object
+- client.zero_trust.dlp.entries.get(entry_id, \*, account_id) -> Optional
+
## Gateway
Types:
@@ -6340,9 +6473,13 @@ Methods:
Types:
```python
-from cloudflare.types.url_scanner import URLScannerDomain, URLScannerTask
+from cloudflare.types.url_scanner import URLScannerDomain, URLScannerTask, URLScannerBulkResponse
```
+Methods:
+
+- client.url_scanner.bulk(account_id, \*\*params) -> URLScannerBulkResponse
+
## Responses
Types:
@@ -8184,3 +8321,36 @@ Methods:
- client.resource_sharing.resources.list(share_identifier, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[ResourceListResponse]
- client.resource_sharing.resources.delete(resource_identifier, \*, account_id, share_identifier) -> Optional
- client.resource_sharing.resources.get(resource_identifier, \*, account_id, share_identifier) -> Optional
+
+# LeakedCredentialChecks
+
+Types:
+
+```python
+from cloudflare.types import LeakedCredentialCheckCreateResponse, LeakedCredentialCheckListResponse
+```
+
+Methods:
+
+- client.leaked_credential_checks.create(\*, zone_id, \*\*params) -> LeakedCredentialCheckCreateResponse
+- client.leaked_credential_checks.list(\*, zone_id) -> LeakedCredentialCheckListResponse
+
+## Detections
+
+Types:
+
+```python
+from cloudflare.types.leaked_credential_checks import (
+ DetectionCreateResponse,
+ DetectionUpdateResponse,
+ DetectionListResponse,
+ DetectionDeleteResponse,
+)
+```
+
+Methods:
+
+- client.leaked_credential_checks.detections.create(\*, zone_id, \*\*params) -> DetectionCreateResponse
+- client.leaked_credential_checks.detections.update(detection_id, \*, zone_id, \*\*params) -> DetectionUpdateResponse
+- client.leaked_credential_checks.detections.list(\*, zone_id) -> SyncSinglePage[DetectionListResponse]
+- client.leaked_credential_checks.detections.delete(detection_id, \*, zone_id) -> object
diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py
index b14d401cd35..41ff9ac25d2 100644
--- a/src/cloudflare/_client.py
+++ b/src/cloudflare/_client.py
@@ -119,6 +119,7 @@
origin_ca_certificates,
origin_tls_client_auth,
certificate_authorities,
+ leaked_credential_checks,
magic_network_monitoring,
origin_post_quantum_encryption,
)
@@ -718,6 +719,12 @@ def resource_sharing(self) -> resource_sharing.ResourceSharingResource:
return ResourceSharingResource(self)
+ @cached_property
+ def leaked_credential_checks(self) -> leaked_credential_checks.LeakedCredentialChecksResource:
+ from .resources.leaked_credential_checks import LeakedCredentialChecksResource
+
+ return LeakedCredentialChecksResource(self)
+
@cached_property
def with_raw_response(self) -> CloudflareWithRawResponse:
return CloudflareWithRawResponse(self)
@@ -1483,6 +1490,12 @@ def resource_sharing(self) -> resource_sharing.AsyncResourceSharingResource:
return AsyncResourceSharingResource(self)
+ @cached_property
+ def leaked_credential_checks(self) -> leaked_credential_checks.AsyncLeakedCredentialChecksResource:
+ from .resources.leaked_credential_checks import AsyncLeakedCredentialChecksResource
+
+ return AsyncLeakedCredentialChecksResource(self)
+
@cached_property
def with_raw_response(self) -> AsyncCloudflareWithRawResponse:
return AsyncCloudflareWithRawResponse(self)
@@ -2183,6 +2196,12 @@ def resource_sharing(self) -> resource_sharing.ResourceSharingResourceWithRawRes
return ResourceSharingResourceWithRawResponse(self._client.resource_sharing)
+ @cached_property
+ def leaked_credential_checks(self) -> leaked_credential_checks.LeakedCredentialChecksResourceWithRawResponse:
+ from .resources.leaked_credential_checks import LeakedCredentialChecksResourceWithRawResponse
+
+ return LeakedCredentialChecksResourceWithRawResponse(self._client.leaked_credential_checks)
+
class AsyncCloudflareWithRawResponse:
_client: AsyncCloudflare
@@ -2702,6 +2721,12 @@ def resource_sharing(self) -> resource_sharing.AsyncResourceSharingResourceWithR
return AsyncResourceSharingResourceWithRawResponse(self._client.resource_sharing)
+ @cached_property
+ def leaked_credential_checks(self) -> leaked_credential_checks.AsyncLeakedCredentialChecksResourceWithRawResponse:
+ from .resources.leaked_credential_checks import AsyncLeakedCredentialChecksResourceWithRawResponse
+
+ return AsyncLeakedCredentialChecksResourceWithRawResponse(self._client.leaked_credential_checks)
+
class CloudflareWithStreamedResponse:
_client: Cloudflare
@@ -3221,6 +3246,12 @@ def resource_sharing(self) -> resource_sharing.ResourceSharingResourceWithStream
return ResourceSharingResourceWithStreamingResponse(self._client.resource_sharing)
+ @cached_property
+ def leaked_credential_checks(self) -> leaked_credential_checks.LeakedCredentialChecksResourceWithStreamingResponse:
+ from .resources.leaked_credential_checks import LeakedCredentialChecksResourceWithStreamingResponse
+
+ return LeakedCredentialChecksResourceWithStreamingResponse(self._client.leaked_credential_checks)
+
class AsyncCloudflareWithStreamedResponse:
_client: AsyncCloudflare
@@ -3748,6 +3779,14 @@ def resource_sharing(self) -> resource_sharing.AsyncResourceSharingResourceWithS
return AsyncResourceSharingResourceWithStreamingResponse(self._client.resource_sharing)
+ @cached_property
+ def leaked_credential_checks(
+ self,
+ ) -> leaked_credential_checks.AsyncLeakedCredentialChecksResourceWithStreamingResponse:
+ from .resources.leaked_credential_checks import AsyncLeakedCredentialChecksResourceWithStreamingResponse
+
+ return AsyncLeakedCredentialChecksResourceWithStreamingResponse(self._client.leaked_credential_checks)
+
Client = Cloudflare
diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py
index fd8019a9a1a..e8dc62443c5 100644
--- a/src/cloudflare/resources/__init__.py
+++ b/src/cloudflare/resources/__init__.py
@@ -1 +1,19 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .leaked_credential_checks import (
+ LeakedCredentialChecksResource,
+ AsyncLeakedCredentialChecksResource,
+ LeakedCredentialChecksResourceWithRawResponse,
+ AsyncLeakedCredentialChecksResourceWithRawResponse,
+ LeakedCredentialChecksResourceWithStreamingResponse,
+ AsyncLeakedCredentialChecksResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "LeakedCredentialChecksResource",
+ "AsyncLeakedCredentialChecksResource",
+ "LeakedCredentialChecksResourceWithRawResponse",
+ "AsyncLeakedCredentialChecksResourceWithRawResponse",
+ "LeakedCredentialChecksResourceWithStreamingResponse",
+ "AsyncLeakedCredentialChecksResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/email_security/__init__.py b/src/cloudflare/resources/email_security/__init__.py
index dd7d0e7a767..092b0ddf17c 100644
--- a/src/cloudflare/resources/email_security/__init__.py
+++ b/src/cloudflare/resources/email_security/__init__.py
@@ -16,6 +16,14 @@
InvestigateResourceWithStreamingResponse,
AsyncInvestigateResourceWithStreamingResponse,
)
+from .submissions import (
+ SubmissionsResource,
+ AsyncSubmissionsResource,
+ SubmissionsResourceWithRawResponse,
+ AsyncSubmissionsResourceWithRawResponse,
+ SubmissionsResourceWithStreamingResponse,
+ AsyncSubmissionsResourceWithStreamingResponse,
+)
from .email_security import (
EmailSecurityResource,
AsyncEmailSecurityResource,
@@ -38,6 +46,12 @@
"AsyncSettingsResourceWithRawResponse",
"SettingsResourceWithStreamingResponse",
"AsyncSettingsResourceWithStreamingResponse",
+ "SubmissionsResource",
+ "AsyncSubmissionsResource",
+ "SubmissionsResourceWithRawResponse",
+ "AsyncSubmissionsResourceWithRawResponse",
+ "SubmissionsResourceWithStreamingResponse",
+ "AsyncSubmissionsResourceWithStreamingResponse",
"EmailSecurityResource",
"AsyncEmailSecurityResource",
"EmailSecurityResourceWithRawResponse",
diff --git a/src/cloudflare/resources/email_security/email_security.py b/src/cloudflare/resources/email_security/email_security.py
index a7d8846ac4f..9c7863f0b09 100644
--- a/src/cloudflare/resources/email_security/email_security.py
+++ b/src/cloudflare/resources/email_security/email_security.py
@@ -20,7 +20,16 @@
InvestigateResourceWithStreamingResponse,
AsyncInvestigateResourceWithStreamingResponse,
)
+from .submissions import (
+ SubmissionsResource,
+ AsyncSubmissionsResource,
+ SubmissionsResourceWithRawResponse,
+ AsyncSubmissionsResourceWithRawResponse,
+ SubmissionsResourceWithStreamingResponse,
+ AsyncSubmissionsResourceWithStreamingResponse,
+)
from .settings.settings import SettingsResource, AsyncSettingsResource
+from .investigate.investigate import InvestigateResource, AsyncInvestigateResource
__all__ = ["EmailSecurityResource", "AsyncEmailSecurityResource"]
@@ -34,6 +43,10 @@ def investigate(self) -> InvestigateResource:
def settings(self) -> SettingsResource:
return SettingsResource(self._client)
+ @cached_property
+ def submissions(self) -> SubmissionsResource:
+ return SubmissionsResource(self._client)
+
@cached_property
def with_raw_response(self) -> EmailSecurityResourceWithRawResponse:
"""
@@ -63,6 +76,10 @@ def investigate(self) -> AsyncInvestigateResource:
def settings(self) -> AsyncSettingsResource:
return AsyncSettingsResource(self._client)
+ @cached_property
+ def submissions(self) -> AsyncSubmissionsResource:
+ return AsyncSubmissionsResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncEmailSecurityResourceWithRawResponse:
"""
@@ -95,6 +112,10 @@ def investigate(self) -> InvestigateResourceWithRawResponse:
def settings(self) -> SettingsResourceWithRawResponse:
return SettingsResourceWithRawResponse(self._email_security.settings)
+ @cached_property
+ def submissions(self) -> SubmissionsResourceWithRawResponse:
+ return SubmissionsResourceWithRawResponse(self._email_security.submissions)
+
class AsyncEmailSecurityResourceWithRawResponse:
def __init__(self, email_security: AsyncEmailSecurityResource) -> None:
@@ -108,6 +129,10 @@ def investigate(self) -> AsyncInvestigateResourceWithRawResponse:
def settings(self) -> AsyncSettingsResourceWithRawResponse:
return AsyncSettingsResourceWithRawResponse(self._email_security.settings)
+ @cached_property
+ def submissions(self) -> AsyncSubmissionsResourceWithRawResponse:
+ return AsyncSubmissionsResourceWithRawResponse(self._email_security.submissions)
+
class EmailSecurityResourceWithStreamingResponse:
def __init__(self, email_security: EmailSecurityResource) -> None:
@@ -121,6 +146,10 @@ def investigate(self) -> InvestigateResourceWithStreamingResponse:
def settings(self) -> SettingsResourceWithStreamingResponse:
return SettingsResourceWithStreamingResponse(self._email_security.settings)
+ @cached_property
+ def submissions(self) -> SubmissionsResourceWithStreamingResponse:
+ return SubmissionsResourceWithStreamingResponse(self._email_security.submissions)
+
class AsyncEmailSecurityResourceWithStreamingResponse:
def __init__(self, email_security: AsyncEmailSecurityResource) -> None:
@@ -133,3 +162,7 @@ def investigate(self) -> AsyncInvestigateResourceWithStreamingResponse:
@cached_property
def settings(self) -> AsyncSettingsResourceWithStreamingResponse:
return AsyncSettingsResourceWithStreamingResponse(self._email_security.settings)
+
+ @cached_property
+ def submissions(self) -> AsyncSubmissionsResourceWithStreamingResponse:
+ return AsyncSubmissionsResourceWithStreamingResponse(self._email_security.submissions)
diff --git a/src/cloudflare/resources/email_security/investigate.py b/src/cloudflare/resources/email_security/investigate.py
deleted file mode 100644
index 00bd691377e..00000000000
--- a/src/cloudflare/resources/email_security/investigate.py
+++ /dev/null
@@ -1,848 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing import Type, Union, cast
-from datetime import datetime
-from typing_extensions import Literal
-
-import httpx
-
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from ..._utils import maybe_transform
-from ..._compat import cached_property
-from ..._resource import SyncAPIResource, AsyncAPIResource
-from ..._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
-from ..._wrappers import ResultWrapper
-from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
-from ..._base_client import AsyncPaginator, make_request_options
-from ...types.email_security import investigate_list_params
-from ...types.email_security.investigate_get_response import InvestigateGetResponse
-from ...types.email_security.investigate_raw_response import InvestigateRawResponse
-from ...types.email_security.investigate_list_response import InvestigateListResponse
-from ...types.email_security.investigate_trace_response import InvestigateTraceResponse
-from ...types.email_security.investigate_preview_response import InvestigatePreviewResponse
-from ...types.email_security.investigate_detections_response import InvestigateDetectionsResponse
-
-__all__ = ["InvestigateResource", "AsyncInvestigateResource"]
-
-
-class InvestigateResource(SyncAPIResource):
- @cached_property
- def with_raw_response(self) -> InvestigateResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
- """
- return InvestigateResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> InvestigateResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
- """
- return InvestigateResourceWithStreamingResponse(self)
-
- def list(
- self,
- *,
- account_id: str,
- action_log: bool | NotGiven = NOT_GIVEN,
- alert_id: str | NotGiven = NOT_GIVEN,
- detections_only: bool | NotGiven = NOT_GIVEN,
- domain: str | NotGiven = NOT_GIVEN,
- end: Union[str, datetime] | NotGiven = NOT_GIVEN,
- final_disposition: Literal["MALICIOUS", "SUSPICIOUS", "SPOOF", "SPAM", "BULK"] | NotGiven = NOT_GIVEN,
- message_action: Literal["PREVIEW", "QUARANTINE_RELEASED", "MOVED"] | NotGiven = NOT_GIVEN,
- message_id: str | NotGiven = NOT_GIVEN,
- metric: str | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- query: str | NotGiven = NOT_GIVEN,
- recipient: str | NotGiven = NOT_GIVEN,
- sender: str | NotGiven = NOT_GIVEN,
- start: Union[str, datetime] | 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,
- ) -> SyncV4PagePaginationArray[InvestigateListResponse]:
- """
- Returns information for each email that matches the search parameter(s).
-
- Args:
- account_id: Account Identifier
-
- action_log: Determines if the message action log is included in the response.
-
- detections_only: Determines if the search results will include detections or not.
-
- domain: The sender domains the search filters by.
-
- end: The end of the search date range. Defaults to `now`.
-
- final_disposition: The dispositions the search filters by.
-
- message_action: The message actions the search filters by.
-
- page: The page number of paginated results.
-
- per_page: The number of results per page.
-
- query: The space-delimited term used in the query. The search is case-insensitive.
-
- The content of the following email metadata fields are searched:
-
- - alert_id
- - CC
- - From (envelope_from)
- - From Name
- - final_disposition
- - md5 hash (of any attachment)
- - sha1 hash (of any attachment)
- - sha256 hash (of any attachment)
- - name (of any attachment)
- - Reason
- - Received DateTime (yyyy-mm-ddThh:mm:ss)
- - Sent DateTime (yyyy-mm-ddThh:mm:ss)
- - ReplyTo
- - To (envelope_to)
- - To Name
- - Message-ID
- - smtp_helo_server_ip
- - smtp_previous_hop_ip
- - x_originating_ip
- - Subject
-
- start: The beginning of the search date range. Defaults to `now - 30 days`.
-
- 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_api_list(
- f"/accounts/{account_id}/email-security/investigate",
- page=SyncV4PagePaginationArray[InvestigateListResponse],
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=maybe_transform(
- {
- "action_log": action_log,
- "alert_id": alert_id,
- "detections_only": detections_only,
- "domain": domain,
- "end": end,
- "final_disposition": final_disposition,
- "message_action": message_action,
- "message_id": message_id,
- "metric": metric,
- "page": page,
- "per_page": per_page,
- "query": query,
- "recipient": recipient,
- "sender": sender,
- "start": start,
- },
- investigate_list_params.InvestigateListParams,
- ),
- ),
- model=InvestigateListResponse,
- )
-
- def detections(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateDetectionsResponse:
- """
- Returns detection details such as threat categories and sender information for
- non-benign messages.
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/detections",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateDetectionsResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateDetectionsResponse], ResultWrapper[InvestigateDetectionsResponse]),
- )
-
- def get(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateGetResponse:
- """
- Get message details
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateGetResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateGetResponse], ResultWrapper[InvestigateGetResponse]),
- )
-
- def preview(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigatePreviewResponse:
- """
- Returns a preview of the message body as a base64 encoded PNG image for
- non-benign messages.
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/preview",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigatePreviewResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigatePreviewResponse], ResultWrapper[InvestigatePreviewResponse]),
- )
-
- def raw(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateRawResponse:
- """
- Returns the raw eml of any non-benign message.
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/raw",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateRawResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateRawResponse], ResultWrapper[InvestigateRawResponse]),
- )
-
- def trace(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateTraceResponse:
- """
- Get email trace
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/trace",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateTraceResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateTraceResponse], ResultWrapper[InvestigateTraceResponse]),
- )
-
-
-class AsyncInvestigateResource(AsyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AsyncInvestigateResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return the
- the raw response object instead of the parsed content.
-
- For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
- """
- return AsyncInvestigateResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncInvestigateResourceWithStreamingResponse:
- """
- An alternative to `.with_raw_response` that doesn't eagerly read the response body.
-
- For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
- """
- return AsyncInvestigateResourceWithStreamingResponse(self)
-
- def list(
- self,
- *,
- account_id: str,
- action_log: bool | NotGiven = NOT_GIVEN,
- alert_id: str | NotGiven = NOT_GIVEN,
- detections_only: bool | NotGiven = NOT_GIVEN,
- domain: str | NotGiven = NOT_GIVEN,
- end: Union[str, datetime] | NotGiven = NOT_GIVEN,
- final_disposition: Literal["MALICIOUS", "SUSPICIOUS", "SPOOF", "SPAM", "BULK"] | NotGiven = NOT_GIVEN,
- message_action: Literal["PREVIEW", "QUARANTINE_RELEASED", "MOVED"] | NotGiven = NOT_GIVEN,
- message_id: str | NotGiven = NOT_GIVEN,
- metric: str | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- query: str | NotGiven = NOT_GIVEN,
- recipient: str | NotGiven = NOT_GIVEN,
- sender: str | NotGiven = NOT_GIVEN,
- start: Union[str, datetime] | 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,
- ) -> AsyncPaginator[InvestigateListResponse, AsyncV4PagePaginationArray[InvestigateListResponse]]:
- """
- Returns information for each email that matches the search parameter(s).
-
- Args:
- account_id: Account Identifier
-
- action_log: Determines if the message action log is included in the response.
-
- detections_only: Determines if the search results will include detections or not.
-
- domain: The sender domains the search filters by.
-
- end: The end of the search date range. Defaults to `now`.
-
- final_disposition: The dispositions the search filters by.
-
- message_action: The message actions the search filters by.
-
- page: The page number of paginated results.
-
- per_page: The number of results per page.
-
- query: The space-delimited term used in the query. The search is case-insensitive.
-
- The content of the following email metadata fields are searched:
-
- - alert_id
- - CC
- - From (envelope_from)
- - From Name
- - final_disposition
- - md5 hash (of any attachment)
- - sha1 hash (of any attachment)
- - sha256 hash (of any attachment)
- - name (of any attachment)
- - Reason
- - Received DateTime (yyyy-mm-ddThh:mm:ss)
- - Sent DateTime (yyyy-mm-ddThh:mm:ss)
- - ReplyTo
- - To (envelope_to)
- - To Name
- - Message-ID
- - smtp_helo_server_ip
- - smtp_previous_hop_ip
- - x_originating_ip
- - Subject
-
- start: The beginning of the search date range. Defaults to `now - 30 days`.
-
- 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_api_list(
- f"/accounts/{account_id}/email-security/investigate",
- page=AsyncV4PagePaginationArray[InvestigateListResponse],
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=maybe_transform(
- {
- "action_log": action_log,
- "alert_id": alert_id,
- "detections_only": detections_only,
- "domain": domain,
- "end": end,
- "final_disposition": final_disposition,
- "message_action": message_action,
- "message_id": message_id,
- "metric": metric,
- "page": page,
- "per_page": per_page,
- "query": query,
- "recipient": recipient,
- "sender": sender,
- "start": start,
- },
- investigate_list_params.InvestigateListParams,
- ),
- ),
- model=InvestigateListResponse,
- )
-
- async def detections(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateDetectionsResponse:
- """
- Returns detection details such as threat categories and sender information for
- non-benign messages.
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return await self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/detections",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateDetectionsResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateDetectionsResponse], ResultWrapper[InvestigateDetectionsResponse]),
- )
-
- async def get(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateGetResponse:
- """
- Get message details
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return await self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateGetResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateGetResponse], ResultWrapper[InvestigateGetResponse]),
- )
-
- async def preview(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigatePreviewResponse:
- """
- Returns a preview of the message body as a base64 encoded PNG image for
- non-benign messages.
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return await self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/preview",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigatePreviewResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigatePreviewResponse], ResultWrapper[InvestigatePreviewResponse]),
- )
-
- async def raw(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateRawResponse:
- """
- Returns the raw eml of any non-benign message.
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return await self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/raw",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateRawResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateRawResponse], ResultWrapper[InvestigateRawResponse]),
- )
-
- async def trace(
- self,
- postfix_id: str,
- *,
- 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,
- ) -> InvestigateTraceResponse:
- """
- Get email trace
-
- Args:
- account_id: Account Identifier
-
- postfix_id: The identifier of the message.
-
- 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}")
- if not postfix_id:
- raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
- return await self._get(
- f"/accounts/{account_id}/email-security/investigate/{postfix_id}/trace",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InvestigateTraceResponse]._unwrapper,
- ),
- cast_to=cast(Type[InvestigateTraceResponse], ResultWrapper[InvestigateTraceResponse]),
- )
-
-
-class InvestigateResourceWithRawResponse:
- def __init__(self, investigate: InvestigateResource) -> None:
- self._investigate = investigate
-
- self.list = to_raw_response_wrapper(
- investigate.list,
- )
- self.detections = to_raw_response_wrapper(
- investigate.detections,
- )
- self.get = to_raw_response_wrapper(
- investigate.get,
- )
- self.preview = to_raw_response_wrapper(
- investigate.preview,
- )
- self.raw = to_raw_response_wrapper(
- investigate.raw,
- )
- self.trace = to_raw_response_wrapper(
- investigate.trace,
- )
-
-
-class AsyncInvestigateResourceWithRawResponse:
- def __init__(self, investigate: AsyncInvestigateResource) -> None:
- self._investigate = investigate
-
- self.list = async_to_raw_response_wrapper(
- investigate.list,
- )
- self.detections = async_to_raw_response_wrapper(
- investigate.detections,
- )
- self.get = async_to_raw_response_wrapper(
- investigate.get,
- )
- self.preview = async_to_raw_response_wrapper(
- investigate.preview,
- )
- self.raw = async_to_raw_response_wrapper(
- investigate.raw,
- )
- self.trace = async_to_raw_response_wrapper(
- investigate.trace,
- )
-
-
-class InvestigateResourceWithStreamingResponse:
- def __init__(self, investigate: InvestigateResource) -> None:
- self._investigate = investigate
-
- self.list = to_streamed_response_wrapper(
- investigate.list,
- )
- self.detections = to_streamed_response_wrapper(
- investigate.detections,
- )
- self.get = to_streamed_response_wrapper(
- investigate.get,
- )
- self.preview = to_streamed_response_wrapper(
- investigate.preview,
- )
- self.raw = to_streamed_response_wrapper(
- investigate.raw,
- )
- self.trace = to_streamed_response_wrapper(
- investigate.trace,
- )
-
-
-class AsyncInvestigateResourceWithStreamingResponse:
- def __init__(self, investigate: AsyncInvestigateResource) -> None:
- self._investigate = investigate
-
- self.list = async_to_streamed_response_wrapper(
- investigate.list,
- )
- self.detections = async_to_streamed_response_wrapper(
- investigate.detections,
- )
- self.get = async_to_streamed_response_wrapper(
- investigate.get,
- )
- self.preview = async_to_streamed_response_wrapper(
- investigate.preview,
- )
- self.raw = async_to_streamed_response_wrapper(
- investigate.raw,
- )
- self.trace = async_to_streamed_response_wrapper(
- investigate.trace,
- )
diff --git a/src/cloudflare/resources/email_security/investigate/__init__.py b/src/cloudflare/resources/email_security/investigate/__init__.py
new file mode 100644
index 00000000000..5b206205771
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/__init__.py
@@ -0,0 +1,117 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .raw import (
+ RawResource,
+ AsyncRawResource,
+ RawResourceWithRawResponse,
+ AsyncRawResourceWithRawResponse,
+ RawResourceWithStreamingResponse,
+ AsyncRawResourceWithStreamingResponse,
+)
+from .move import (
+ MoveResource,
+ AsyncMoveResource,
+ MoveResourceWithRawResponse,
+ AsyncMoveResourceWithRawResponse,
+ MoveResourceWithStreamingResponse,
+ AsyncMoveResourceWithStreamingResponse,
+)
+from .trace import (
+ TraceResource,
+ AsyncTraceResource,
+ TraceResourceWithRawResponse,
+ AsyncTraceResourceWithRawResponse,
+ TraceResourceWithStreamingResponse,
+ AsyncTraceResourceWithStreamingResponse,
+)
+from .preview import (
+ PreviewResource,
+ AsyncPreviewResource,
+ PreviewResourceWithRawResponse,
+ AsyncPreviewResourceWithRawResponse,
+ PreviewResourceWithStreamingResponse,
+ AsyncPreviewResourceWithStreamingResponse,
+)
+from .release import (
+ ReleaseResource,
+ AsyncReleaseResource,
+ ReleaseResourceWithRawResponse,
+ AsyncReleaseResourceWithRawResponse,
+ ReleaseResourceWithStreamingResponse,
+ AsyncReleaseResourceWithStreamingResponse,
+)
+from .detections import (
+ DetectionsResource,
+ AsyncDetectionsResource,
+ DetectionsResourceWithRawResponse,
+ AsyncDetectionsResourceWithRawResponse,
+ DetectionsResourceWithStreamingResponse,
+ AsyncDetectionsResourceWithStreamingResponse,
+)
+from .reclassify import (
+ ReclassifyResource,
+ AsyncReclassifyResource,
+ ReclassifyResourceWithRawResponse,
+ AsyncReclassifyResourceWithRawResponse,
+ ReclassifyResourceWithStreamingResponse,
+ AsyncReclassifyResourceWithStreamingResponse,
+)
+from .investigate import (
+ InvestigateResource,
+ AsyncInvestigateResource,
+ InvestigateResourceWithRawResponse,
+ AsyncInvestigateResourceWithRawResponse,
+ InvestigateResourceWithStreamingResponse,
+ AsyncInvestigateResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "DetectionsResource",
+ "AsyncDetectionsResource",
+ "DetectionsResourceWithRawResponse",
+ "AsyncDetectionsResourceWithRawResponse",
+ "DetectionsResourceWithStreamingResponse",
+ "AsyncDetectionsResourceWithStreamingResponse",
+ "PreviewResource",
+ "AsyncPreviewResource",
+ "PreviewResourceWithRawResponse",
+ "AsyncPreviewResourceWithRawResponse",
+ "PreviewResourceWithStreamingResponse",
+ "AsyncPreviewResourceWithStreamingResponse",
+ "RawResource",
+ "AsyncRawResource",
+ "RawResourceWithRawResponse",
+ "AsyncRawResourceWithRawResponse",
+ "RawResourceWithStreamingResponse",
+ "AsyncRawResourceWithStreamingResponse",
+ "TraceResource",
+ "AsyncTraceResource",
+ "TraceResourceWithRawResponse",
+ "AsyncTraceResourceWithRawResponse",
+ "TraceResourceWithStreamingResponse",
+ "AsyncTraceResourceWithStreamingResponse",
+ "MoveResource",
+ "AsyncMoveResource",
+ "MoveResourceWithRawResponse",
+ "AsyncMoveResourceWithRawResponse",
+ "MoveResourceWithStreamingResponse",
+ "AsyncMoveResourceWithStreamingResponse",
+ "ReclassifyResource",
+ "AsyncReclassifyResource",
+ "ReclassifyResourceWithRawResponse",
+ "AsyncReclassifyResourceWithRawResponse",
+ "ReclassifyResourceWithStreamingResponse",
+ "AsyncReclassifyResourceWithStreamingResponse",
+ "ReleaseResource",
+ "AsyncReleaseResource",
+ "ReleaseResourceWithRawResponse",
+ "AsyncReleaseResourceWithRawResponse",
+ "ReleaseResourceWithStreamingResponse",
+ "AsyncReleaseResourceWithStreamingResponse",
+ "InvestigateResource",
+ "AsyncInvestigateResource",
+ "InvestigateResourceWithRawResponse",
+ "AsyncInvestigateResourceWithRawResponse",
+ "InvestigateResourceWithStreamingResponse",
+ "AsyncInvestigateResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/email_security/investigate/detections.py b/src/cloudflare/resources/email_security/investigate/detections.py
new file mode 100644
index 00000000000..5087dfbd0c9
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/detections.py
@@ -0,0 +1,190 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import make_request_options
+from ....types.email_security.investigate.detection_get_response import DetectionGetResponse
+
+__all__ = ["DetectionsResource", "AsyncDetectionsResource"]
+
+
+class DetectionsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> DetectionsResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return DetectionsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> DetectionsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return DetectionsResourceWithStreamingResponse(self)
+
+ def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> DetectionGetResponse:
+ """
+ Returns detection details such as threat categories and sender information for
+ non-benign messages.
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/detections",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DetectionGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DetectionGetResponse], ResultWrapper[DetectionGetResponse]),
+ )
+
+
+class AsyncDetectionsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncDetectionsResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncDetectionsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncDetectionsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncDetectionsResourceWithStreamingResponse(self)
+
+ async def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> DetectionGetResponse:
+ """
+ Returns detection details such as threat categories and sender information for
+ non-benign messages.
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/detections",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DetectionGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DetectionGetResponse], ResultWrapper[DetectionGetResponse]),
+ )
+
+
+class DetectionsResourceWithRawResponse:
+ def __init__(self, detections: DetectionsResource) -> None:
+ self._detections = detections
+
+ self.get = to_raw_response_wrapper(
+ detections.get,
+ )
+
+
+class AsyncDetectionsResourceWithRawResponse:
+ def __init__(self, detections: AsyncDetectionsResource) -> None:
+ self._detections = detections
+
+ self.get = async_to_raw_response_wrapper(
+ detections.get,
+ )
+
+
+class DetectionsResourceWithStreamingResponse:
+ def __init__(self, detections: DetectionsResource) -> None:
+ self._detections = detections
+
+ self.get = to_streamed_response_wrapper(
+ detections.get,
+ )
+
+
+class AsyncDetectionsResourceWithStreamingResponse:
+ def __init__(self, detections: AsyncDetectionsResource) -> None:
+ self._detections = detections
+
+ self.get = async_to_streamed_response_wrapper(
+ detections.get,
+ )
diff --git a/src/cloudflare/resources/email_security/investigate/investigate.py b/src/cloudflare/resources/email_security/investigate/investigate.py
new file mode 100644
index 00000000000..ed321b9a335
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/investigate.py
@@ -0,0 +1,664 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, Union, cast
+from datetime import datetime
+from typing_extensions import Literal
+
+import httpx
+
+from .raw import (
+ RawResource,
+ AsyncRawResource,
+ RawResourceWithRawResponse,
+ AsyncRawResourceWithRawResponse,
+ RawResourceWithStreamingResponse,
+ AsyncRawResourceWithStreamingResponse,
+)
+from .move import (
+ MoveResource,
+ AsyncMoveResource,
+ MoveResourceWithRawResponse,
+ AsyncMoveResourceWithRawResponse,
+ MoveResourceWithStreamingResponse,
+ AsyncMoveResourceWithStreamingResponse,
+)
+from .trace import (
+ TraceResource,
+ AsyncTraceResource,
+ TraceResourceWithRawResponse,
+ AsyncTraceResourceWithRawResponse,
+ TraceResourceWithStreamingResponse,
+ AsyncTraceResourceWithStreamingResponse,
+)
+from .preview import (
+ PreviewResource,
+ AsyncPreviewResource,
+ PreviewResourceWithRawResponse,
+ AsyncPreviewResourceWithRawResponse,
+ PreviewResourceWithStreamingResponse,
+ AsyncPreviewResourceWithStreamingResponse,
+)
+from .release import (
+ ReleaseResource,
+ AsyncReleaseResource,
+ ReleaseResourceWithRawResponse,
+ AsyncReleaseResourceWithRawResponse,
+ ReleaseResourceWithStreamingResponse,
+ AsyncReleaseResourceWithStreamingResponse,
+)
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import maybe_transform
+from ...._compat import cached_property
+from .detections import (
+ DetectionsResource,
+ AsyncDetectionsResource,
+ DetectionsResourceWithRawResponse,
+ AsyncDetectionsResourceWithRawResponse,
+ DetectionsResourceWithStreamingResponse,
+ AsyncDetectionsResourceWithStreamingResponse,
+)
+from .reclassify import (
+ ReclassifyResource,
+ AsyncReclassifyResource,
+ ReclassifyResourceWithRawResponse,
+ AsyncReclassifyResourceWithRawResponse,
+ ReclassifyResourceWithStreamingResponse,
+ AsyncReclassifyResourceWithStreamingResponse,
+)
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ...._base_client import AsyncPaginator, make_request_options
+from ....types.email_security import investigate_list_params
+from ....types.email_security.investigate_get_response import InvestigateGetResponse
+from ....types.email_security.investigate_list_response import InvestigateListResponse
+
+__all__ = ["InvestigateResource", "AsyncInvestigateResource"]
+
+
+class InvestigateResource(SyncAPIResource):
+ @cached_property
+ def detections(self) -> DetectionsResource:
+ return DetectionsResource(self._client)
+
+ @cached_property
+ def preview(self) -> PreviewResource:
+ return PreviewResource(self._client)
+
+ @cached_property
+ def raw(self) -> RawResource:
+ return RawResource(self._client)
+
+ @cached_property
+ def trace(self) -> TraceResource:
+ return TraceResource(self._client)
+
+ @cached_property
+ def move(self) -> MoveResource:
+ return MoveResource(self._client)
+
+ @cached_property
+ def reclassify(self) -> ReclassifyResource:
+ return ReclassifyResource(self._client)
+
+ @cached_property
+ def release(self) -> ReleaseResource:
+ return ReleaseResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> InvestigateResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return InvestigateResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> InvestigateResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return InvestigateResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ action_log: bool | NotGiven = NOT_GIVEN,
+ alert_id: str | NotGiven = NOT_GIVEN,
+ detections_only: bool | NotGiven = NOT_GIVEN,
+ domain: str | NotGiven = NOT_GIVEN,
+ end: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ final_disposition: Literal["MALICIOUS", "SUSPICIOUS", "SPOOF", "SPAM", "BULK"] | NotGiven = NOT_GIVEN,
+ message_action: Literal["PREVIEW", "QUARANTINE_RELEASED", "MOVED"] | NotGiven = NOT_GIVEN,
+ message_id: str | NotGiven = NOT_GIVEN,
+ metric: str | NotGiven = NOT_GIVEN,
+ page: int | NotGiven = NOT_GIVEN,
+ per_page: int | NotGiven = NOT_GIVEN,
+ query: str | NotGiven = NOT_GIVEN,
+ recipient: str | NotGiven = NOT_GIVEN,
+ sender: str | NotGiven = NOT_GIVEN,
+ start: Union[str, datetime] | 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,
+ ) -> SyncV4PagePaginationArray[InvestigateListResponse]:
+ """
+ Returns information for each email that matches the search parameter(s).
+
+ Args:
+ account_id: Account Identifier
+
+ action_log: Determines if the message action log is included in the response.
+
+ detections_only: Determines if the search results will include detections or not.
+
+ domain: The sender domains the search filters by.
+
+ end: The end of the search date range. Defaults to `now`.
+
+ final_disposition: The dispositions the search filters by.
+
+ message_action: The message actions the search filters by.
+
+ page: The page number of paginated results.
+
+ per_page: The number of results per page.
+
+ query: The space-delimited term used in the query. The search is case-insensitive.
+
+ The content of the following email metadata fields are searched:
+
+ - alert_id
+ - CC
+ - From (envelope_from)
+ - From Name
+ - final_disposition
+ - md5 hash (of any attachment)
+ - sha1 hash (of any attachment)
+ - sha256 hash (of any attachment)
+ - name (of any attachment)
+ - Reason
+ - Received DateTime (yyyy-mm-ddThh:mm:ss)
+ - Sent DateTime (yyyy-mm-ddThh:mm:ss)
+ - ReplyTo
+ - To (envelope_to)
+ - To Name
+ - Message-ID
+ - smtp_helo_server_ip
+ - smtp_previous_hop_ip
+ - x_originating_ip
+ - Subject
+
+ start: The beginning of the search date range. Defaults to `now - 30 days`.
+
+ 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_api_list(
+ f"/accounts/{account_id}/email-security/investigate",
+ page=SyncV4PagePaginationArray[InvestigateListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "action_log": action_log,
+ "alert_id": alert_id,
+ "detections_only": detections_only,
+ "domain": domain,
+ "end": end,
+ "final_disposition": final_disposition,
+ "message_action": message_action,
+ "message_id": message_id,
+ "metric": metric,
+ "page": page,
+ "per_page": per_page,
+ "query": query,
+ "recipient": recipient,
+ "sender": sender,
+ "start": start,
+ },
+ investigate_list_params.InvestigateListParams,
+ ),
+ ),
+ model=InvestigateListResponse,
+ )
+
+ def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> InvestigateGetResponse:
+ """
+ Get message details
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InvestigateGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InvestigateGetResponse], ResultWrapper[InvestigateGetResponse]),
+ )
+
+
+class AsyncInvestigateResource(AsyncAPIResource):
+ @cached_property
+ def detections(self) -> AsyncDetectionsResource:
+ return AsyncDetectionsResource(self._client)
+
+ @cached_property
+ def preview(self) -> AsyncPreviewResource:
+ return AsyncPreviewResource(self._client)
+
+ @cached_property
+ def raw(self) -> AsyncRawResource:
+ return AsyncRawResource(self._client)
+
+ @cached_property
+ def trace(self) -> AsyncTraceResource:
+ return AsyncTraceResource(self._client)
+
+ @cached_property
+ def move(self) -> AsyncMoveResource:
+ return AsyncMoveResource(self._client)
+
+ @cached_property
+ def reclassify(self) -> AsyncReclassifyResource:
+ return AsyncReclassifyResource(self._client)
+
+ @cached_property
+ def release(self) -> AsyncReleaseResource:
+ return AsyncReleaseResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncInvestigateResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncInvestigateResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncInvestigateResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncInvestigateResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ action_log: bool | NotGiven = NOT_GIVEN,
+ alert_id: str | NotGiven = NOT_GIVEN,
+ detections_only: bool | NotGiven = NOT_GIVEN,
+ domain: str | NotGiven = NOT_GIVEN,
+ end: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ final_disposition: Literal["MALICIOUS", "SUSPICIOUS", "SPOOF", "SPAM", "BULK"] | NotGiven = NOT_GIVEN,
+ message_action: Literal["PREVIEW", "QUARANTINE_RELEASED", "MOVED"] | NotGiven = NOT_GIVEN,
+ message_id: str | NotGiven = NOT_GIVEN,
+ metric: str | NotGiven = NOT_GIVEN,
+ page: int | NotGiven = NOT_GIVEN,
+ per_page: int | NotGiven = NOT_GIVEN,
+ query: str | NotGiven = NOT_GIVEN,
+ recipient: str | NotGiven = NOT_GIVEN,
+ sender: str | NotGiven = NOT_GIVEN,
+ start: Union[str, datetime] | 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,
+ ) -> AsyncPaginator[InvestigateListResponse, AsyncV4PagePaginationArray[InvestigateListResponse]]:
+ """
+ Returns information for each email that matches the search parameter(s).
+
+ Args:
+ account_id: Account Identifier
+
+ action_log: Determines if the message action log is included in the response.
+
+ detections_only: Determines if the search results will include detections or not.
+
+ domain: The sender domains the search filters by.
+
+ end: The end of the search date range. Defaults to `now`.
+
+ final_disposition: The dispositions the search filters by.
+
+ message_action: The message actions the search filters by.
+
+ page: The page number of paginated results.
+
+ per_page: The number of results per page.
+
+ query: The space-delimited term used in the query. The search is case-insensitive.
+
+ The content of the following email metadata fields are searched:
+
+ - alert_id
+ - CC
+ - From (envelope_from)
+ - From Name
+ - final_disposition
+ - md5 hash (of any attachment)
+ - sha1 hash (of any attachment)
+ - sha256 hash (of any attachment)
+ - name (of any attachment)
+ - Reason
+ - Received DateTime (yyyy-mm-ddThh:mm:ss)
+ - Sent DateTime (yyyy-mm-ddThh:mm:ss)
+ - ReplyTo
+ - To (envelope_to)
+ - To Name
+ - Message-ID
+ - smtp_helo_server_ip
+ - smtp_previous_hop_ip
+ - x_originating_ip
+ - Subject
+
+ start: The beginning of the search date range. Defaults to `now - 30 days`.
+
+ 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_api_list(
+ f"/accounts/{account_id}/email-security/investigate",
+ page=AsyncV4PagePaginationArray[InvestigateListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "action_log": action_log,
+ "alert_id": alert_id,
+ "detections_only": detections_only,
+ "domain": domain,
+ "end": end,
+ "final_disposition": final_disposition,
+ "message_action": message_action,
+ "message_id": message_id,
+ "metric": metric,
+ "page": page,
+ "per_page": per_page,
+ "query": query,
+ "recipient": recipient,
+ "sender": sender,
+ "start": start,
+ },
+ investigate_list_params.InvestigateListParams,
+ ),
+ ),
+ model=InvestigateListResponse,
+ )
+
+ async def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> InvestigateGetResponse:
+ """
+ Get message details
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InvestigateGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InvestigateGetResponse], ResultWrapper[InvestigateGetResponse]),
+ )
+
+
+class InvestigateResourceWithRawResponse:
+ def __init__(self, investigate: InvestigateResource) -> None:
+ self._investigate = investigate
+
+ self.list = to_raw_response_wrapper(
+ investigate.list,
+ )
+ self.get = to_raw_response_wrapper(
+ investigate.get,
+ )
+
+ @cached_property
+ def detections(self) -> DetectionsResourceWithRawResponse:
+ return DetectionsResourceWithRawResponse(self._investigate.detections)
+
+ @cached_property
+ def preview(self) -> PreviewResourceWithRawResponse:
+ return PreviewResourceWithRawResponse(self._investigate.preview)
+
+ @cached_property
+ def raw(self) -> RawResourceWithRawResponse:
+ return RawResourceWithRawResponse(self._investigate.raw)
+
+ @cached_property
+ def trace(self) -> TraceResourceWithRawResponse:
+ return TraceResourceWithRawResponse(self._investigate.trace)
+
+ @cached_property
+ def move(self) -> MoveResourceWithRawResponse:
+ return MoveResourceWithRawResponse(self._investigate.move)
+
+ @cached_property
+ def reclassify(self) -> ReclassifyResourceWithRawResponse:
+ return ReclassifyResourceWithRawResponse(self._investigate.reclassify)
+
+ @cached_property
+ def release(self) -> ReleaseResourceWithRawResponse:
+ return ReleaseResourceWithRawResponse(self._investigate.release)
+
+
+class AsyncInvestigateResourceWithRawResponse:
+ def __init__(self, investigate: AsyncInvestigateResource) -> None:
+ self._investigate = investigate
+
+ self.list = async_to_raw_response_wrapper(
+ investigate.list,
+ )
+ self.get = async_to_raw_response_wrapper(
+ investigate.get,
+ )
+
+ @cached_property
+ def detections(self) -> AsyncDetectionsResourceWithRawResponse:
+ return AsyncDetectionsResourceWithRawResponse(self._investigate.detections)
+
+ @cached_property
+ def preview(self) -> AsyncPreviewResourceWithRawResponse:
+ return AsyncPreviewResourceWithRawResponse(self._investigate.preview)
+
+ @cached_property
+ def raw(self) -> AsyncRawResourceWithRawResponse:
+ return AsyncRawResourceWithRawResponse(self._investigate.raw)
+
+ @cached_property
+ def trace(self) -> AsyncTraceResourceWithRawResponse:
+ return AsyncTraceResourceWithRawResponse(self._investigate.trace)
+
+ @cached_property
+ def move(self) -> AsyncMoveResourceWithRawResponse:
+ return AsyncMoveResourceWithRawResponse(self._investigate.move)
+
+ @cached_property
+ def reclassify(self) -> AsyncReclassifyResourceWithRawResponse:
+ return AsyncReclassifyResourceWithRawResponse(self._investigate.reclassify)
+
+ @cached_property
+ def release(self) -> AsyncReleaseResourceWithRawResponse:
+ return AsyncReleaseResourceWithRawResponse(self._investigate.release)
+
+
+class InvestigateResourceWithStreamingResponse:
+ def __init__(self, investigate: InvestigateResource) -> None:
+ self._investigate = investigate
+
+ self.list = to_streamed_response_wrapper(
+ investigate.list,
+ )
+ self.get = to_streamed_response_wrapper(
+ investigate.get,
+ )
+
+ @cached_property
+ def detections(self) -> DetectionsResourceWithStreamingResponse:
+ return DetectionsResourceWithStreamingResponse(self._investigate.detections)
+
+ @cached_property
+ def preview(self) -> PreviewResourceWithStreamingResponse:
+ return PreviewResourceWithStreamingResponse(self._investigate.preview)
+
+ @cached_property
+ def raw(self) -> RawResourceWithStreamingResponse:
+ return RawResourceWithStreamingResponse(self._investigate.raw)
+
+ @cached_property
+ def trace(self) -> TraceResourceWithStreamingResponse:
+ return TraceResourceWithStreamingResponse(self._investigate.trace)
+
+ @cached_property
+ def move(self) -> MoveResourceWithStreamingResponse:
+ return MoveResourceWithStreamingResponse(self._investigate.move)
+
+ @cached_property
+ def reclassify(self) -> ReclassifyResourceWithStreamingResponse:
+ return ReclassifyResourceWithStreamingResponse(self._investigate.reclassify)
+
+ @cached_property
+ def release(self) -> ReleaseResourceWithStreamingResponse:
+ return ReleaseResourceWithStreamingResponse(self._investigate.release)
+
+
+class AsyncInvestigateResourceWithStreamingResponse:
+ def __init__(self, investigate: AsyncInvestigateResource) -> None:
+ self._investigate = investigate
+
+ self.list = async_to_streamed_response_wrapper(
+ investigate.list,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ investigate.get,
+ )
+
+ @cached_property
+ def detections(self) -> AsyncDetectionsResourceWithStreamingResponse:
+ return AsyncDetectionsResourceWithStreamingResponse(self._investigate.detections)
+
+ @cached_property
+ def preview(self) -> AsyncPreviewResourceWithStreamingResponse:
+ return AsyncPreviewResourceWithStreamingResponse(self._investigate.preview)
+
+ @cached_property
+ def raw(self) -> AsyncRawResourceWithStreamingResponse:
+ return AsyncRawResourceWithStreamingResponse(self._investigate.raw)
+
+ @cached_property
+ def trace(self) -> AsyncTraceResourceWithStreamingResponse:
+ return AsyncTraceResourceWithStreamingResponse(self._investigate.trace)
+
+ @cached_property
+ def move(self) -> AsyncMoveResourceWithStreamingResponse:
+ return AsyncMoveResourceWithStreamingResponse(self._investigate.move)
+
+ @cached_property
+ def reclassify(self) -> AsyncReclassifyResourceWithStreamingResponse:
+ return AsyncReclassifyResourceWithStreamingResponse(self._investigate.reclassify)
+
+ @cached_property
+ def release(self) -> AsyncReleaseResourceWithStreamingResponse:
+ return AsyncReleaseResourceWithStreamingResponse(self._investigate.release)
diff --git a/src/cloudflare/resources/email_security/investigate/move.py b/src/cloudflare/resources/email_security/investigate/move.py
new file mode 100644
index 00000000000..f3946cd6068
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/move.py
@@ -0,0 +1,315 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Type, cast
+from typing_extensions import Literal
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import make_request_options
+from ....types.email_security.investigate import move_bulk_params, move_create_params
+from ....types.email_security.investigate.move_bulk_response import MoveBulkResponse
+from ....types.email_security.investigate.move_create_response import MoveCreateResponse
+
+__all__ = ["MoveResource", "AsyncMoveResource"]
+
+
+class MoveResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> MoveResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return MoveResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> MoveResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return MoveResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ postfix_id: str,
+ *,
+ account_id: str,
+ destination: Literal[
+ "Inbox", "JunkEmail", "DeletedItems", "RecoverableItemsDeletions", "RecoverableItemsPurges"
+ ],
+ # 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,
+ ) -> MoveCreateResponse:
+ """
+ Move a message
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/move",
+ body=maybe_transform({"destination": destination}, move_create_params.MoveCreateParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[MoveCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[MoveCreateResponse], ResultWrapper[MoveCreateResponse]),
+ )
+
+ def bulk(
+ self,
+ *,
+ account_id: str,
+ destination: Literal[
+ "Inbox", "JunkEmail", "DeletedItems", "RecoverableItemsDeletions", "RecoverableItemsPurges"
+ ],
+ postfix_ids: List[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,
+ ) -> MoveBulkResponse:
+ """
+ Move multiple messages
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/investigate/move",
+ body=maybe_transform(
+ {
+ "destination": destination,
+ "postfix_ids": postfix_ids,
+ },
+ move_bulk_params.MoveBulkParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[MoveBulkResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[MoveBulkResponse], ResultWrapper[MoveBulkResponse]),
+ )
+
+
+class AsyncMoveResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncMoveResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncMoveResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncMoveResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncMoveResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ postfix_id: str,
+ *,
+ account_id: str,
+ destination: Literal[
+ "Inbox", "JunkEmail", "DeletedItems", "RecoverableItemsDeletions", "RecoverableItemsPurges"
+ ],
+ # 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,
+ ) -> MoveCreateResponse:
+ """
+ Move a message
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/move",
+ body=await async_maybe_transform({"destination": destination}, move_create_params.MoveCreateParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[MoveCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[MoveCreateResponse], ResultWrapper[MoveCreateResponse]),
+ )
+
+ async def bulk(
+ self,
+ *,
+ account_id: str,
+ destination: Literal[
+ "Inbox", "JunkEmail", "DeletedItems", "RecoverableItemsDeletions", "RecoverableItemsPurges"
+ ],
+ postfix_ids: List[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,
+ ) -> MoveBulkResponse:
+ """
+ Move multiple messages
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/investigate/move",
+ body=await async_maybe_transform(
+ {
+ "destination": destination,
+ "postfix_ids": postfix_ids,
+ },
+ move_bulk_params.MoveBulkParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[MoveBulkResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[MoveBulkResponse], ResultWrapper[MoveBulkResponse]),
+ )
+
+
+class MoveResourceWithRawResponse:
+ def __init__(self, move: MoveResource) -> None:
+ self._move = move
+
+ self.create = to_raw_response_wrapper(
+ move.create,
+ )
+ self.bulk = to_raw_response_wrapper(
+ move.bulk,
+ )
+
+
+class AsyncMoveResourceWithRawResponse:
+ def __init__(self, move: AsyncMoveResource) -> None:
+ self._move = move
+
+ self.create = async_to_raw_response_wrapper(
+ move.create,
+ )
+ self.bulk = async_to_raw_response_wrapper(
+ move.bulk,
+ )
+
+
+class MoveResourceWithStreamingResponse:
+ def __init__(self, move: MoveResource) -> None:
+ self._move = move
+
+ self.create = to_streamed_response_wrapper(
+ move.create,
+ )
+ self.bulk = to_streamed_response_wrapper(
+ move.bulk,
+ )
+
+
+class AsyncMoveResourceWithStreamingResponse:
+ def __init__(self, move: AsyncMoveResource) -> None:
+ self._move = move
+
+ self.create = async_to_streamed_response_wrapper(
+ move.create,
+ )
+ self.bulk = async_to_streamed_response_wrapper(
+ move.bulk,
+ )
diff --git a/src/cloudflare/resources/email_security/investigate/preview.py b/src/cloudflare/resources/email_security/investigate/preview.py
new file mode 100644
index 00000000000..b11d0ec6482
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/preview.py
@@ -0,0 +1,293 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Type, cast
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import make_request_options
+from ....types.email_security.investigate.preview_get_response import PreviewGetResponse
+from ....types.email_security.investigate.preview_create_response import PreviewCreateResponse
+
+__all__ = ["PreviewResource", "AsyncPreviewResource"]
+
+
+class PreviewResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> PreviewResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return PreviewResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> PreviewResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return PreviewResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ body: List[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,
+ ) -> PreviewCreateResponse:
+ """
+ Preview for non-detection messages
+
+ Args:
+ account_id: Account Identifier
+
+ body: A list of messages identfied by their `postfix_id`s that should be released.
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/investigate/preview",
+ body=maybe_transform(body, List[str]),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[PreviewCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[PreviewCreateResponse], ResultWrapper[PreviewCreateResponse]),
+ )
+
+ def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> PreviewGetResponse:
+ """
+ Returns a preview of the message body as a base64 encoded PNG image for
+ non-benign messages.
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/preview",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[PreviewGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]),
+ )
+
+
+class AsyncPreviewResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncPreviewResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncPreviewResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncPreviewResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncPreviewResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ body: List[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,
+ ) -> PreviewCreateResponse:
+ """
+ Preview for non-detection messages
+
+ Args:
+ account_id: Account Identifier
+
+ body: A list of messages identfied by their `postfix_id`s that should be released.
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/investigate/preview",
+ body=await async_maybe_transform(body, List[str]),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[PreviewCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[PreviewCreateResponse], ResultWrapper[PreviewCreateResponse]),
+ )
+
+ async def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> PreviewGetResponse:
+ """
+ Returns a preview of the message body as a base64 encoded PNG image for
+ non-benign messages.
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/preview",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[PreviewGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[PreviewGetResponse], ResultWrapper[PreviewGetResponse]),
+ )
+
+
+class PreviewResourceWithRawResponse:
+ def __init__(self, preview: PreviewResource) -> None:
+ self._preview = preview
+
+ self.create = to_raw_response_wrapper(
+ preview.create,
+ )
+ self.get = to_raw_response_wrapper(
+ preview.get,
+ )
+
+
+class AsyncPreviewResourceWithRawResponse:
+ def __init__(self, preview: AsyncPreviewResource) -> None:
+ self._preview = preview
+
+ self.create = async_to_raw_response_wrapper(
+ preview.create,
+ )
+ self.get = async_to_raw_response_wrapper(
+ preview.get,
+ )
+
+
+class PreviewResourceWithStreamingResponse:
+ def __init__(self, preview: PreviewResource) -> None:
+ self._preview = preview
+
+ self.create = to_streamed_response_wrapper(
+ preview.create,
+ )
+ self.get = to_streamed_response_wrapper(
+ preview.get,
+ )
+
+
+class AsyncPreviewResourceWithStreamingResponse:
+ def __init__(self, preview: AsyncPreviewResource) -> None:
+ self._preview = preview
+
+ self.create = async_to_streamed_response_wrapper(
+ preview.create,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ preview.get,
+ )
diff --git a/src/cloudflare/resources/email_security/investigate/raw.py b/src/cloudflare/resources/email_security/investigate/raw.py
new file mode 100644
index 00000000000..b7d68ed3c2d
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/raw.py
@@ -0,0 +1,188 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import make_request_options
+from ....types.email_security.investigate.raw_get_response import RawGetResponse
+
+__all__ = ["RawResource", "AsyncRawResource"]
+
+
+class RawResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> RawResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return RawResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> RawResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return RawResourceWithStreamingResponse(self)
+
+ def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> RawGetResponse:
+ """
+ Returns the raw eml of any non-benign message.
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/raw",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[RawGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[RawGetResponse], ResultWrapper[RawGetResponse]),
+ )
+
+
+class AsyncRawResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncRawResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncRawResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncRawResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncRawResourceWithStreamingResponse(self)
+
+ async def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> RawGetResponse:
+ """
+ Returns the raw eml of any non-benign message.
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/raw",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[RawGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[RawGetResponse], ResultWrapper[RawGetResponse]),
+ )
+
+
+class RawResourceWithRawResponse:
+ def __init__(self, raw: RawResource) -> None:
+ self._raw = raw
+
+ self.get = to_raw_response_wrapper(
+ raw.get,
+ )
+
+
+class AsyncRawResourceWithRawResponse:
+ def __init__(self, raw: AsyncRawResource) -> None:
+ self._raw = raw
+
+ self.get = async_to_raw_response_wrapper(
+ raw.get,
+ )
+
+
+class RawResourceWithStreamingResponse:
+ def __init__(self, raw: RawResource) -> None:
+ self._raw = raw
+
+ self.get = to_streamed_response_wrapper(
+ raw.get,
+ )
+
+
+class AsyncRawResourceWithStreamingResponse:
+ def __init__(self, raw: AsyncRawResource) -> None:
+ self._raw = raw
+
+ self.get = async_to_streamed_response_wrapper(
+ raw.get,
+ )
diff --git a/src/cloudflare/resources/email_security/investigate/reclassify.py b/src/cloudflare/resources/email_security/investigate/reclassify.py
new file mode 100644
index 00000000000..c4a1a979bcb
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/reclassify.py
@@ -0,0 +1,215 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, Optional, cast
+from typing_extensions import Literal
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import make_request_options
+from ....types.email_security.investigate import reclassify_create_params
+
+__all__ = ["ReclassifyResource", "AsyncReclassifyResource"]
+
+
+class ReclassifyResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ReclassifyResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return ReclassifyResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ReclassifyResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return ReclassifyResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ postfix_id: str,
+ *,
+ account_id: str,
+ expected_disposition: Literal["NONE", "BULK", "MALICIOUS", "SPAM", "SPOOF", "SUSPICIOUS"],
+ eml_content: 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,
+ ) -> object:
+ """
+ Change email classfication
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ eml_content: Base64 encoded content of the EML file
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/reclassify",
+ body=maybe_transform(
+ {
+ "expected_disposition": expected_disposition,
+ "eml_content": eml_content,
+ },
+ reclassify_create_params.ReclassifyCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[object]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class AsyncReclassifyResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncReclassifyResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncReclassifyResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncReclassifyResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncReclassifyResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ postfix_id: str,
+ *,
+ account_id: str,
+ expected_disposition: Literal["NONE", "BULK", "MALICIOUS", "SPAM", "SPOOF", "SUSPICIOUS"],
+ eml_content: 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,
+ ) -> object:
+ """
+ Change email classfication
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ eml_content: Base64 encoded content of the EML file
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/reclassify",
+ body=await async_maybe_transform(
+ {
+ "expected_disposition": expected_disposition,
+ "eml_content": eml_content,
+ },
+ reclassify_create_params.ReclassifyCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[object]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class ReclassifyResourceWithRawResponse:
+ def __init__(self, reclassify: ReclassifyResource) -> None:
+ self._reclassify = reclassify
+
+ self.create = to_raw_response_wrapper(
+ reclassify.create,
+ )
+
+
+class AsyncReclassifyResourceWithRawResponse:
+ def __init__(self, reclassify: AsyncReclassifyResource) -> None:
+ self._reclassify = reclassify
+
+ self.create = async_to_raw_response_wrapper(
+ reclassify.create,
+ )
+
+
+class ReclassifyResourceWithStreamingResponse:
+ def __init__(self, reclassify: ReclassifyResource) -> None:
+ self._reclassify = reclassify
+
+ self.create = to_streamed_response_wrapper(
+ reclassify.create,
+ )
+
+
+class AsyncReclassifyResourceWithStreamingResponse:
+ def __init__(self, reclassify: AsyncReclassifyResource) -> None:
+ self._reclassify = reclassify
+
+ self.create = async_to_streamed_response_wrapper(
+ reclassify.create,
+ )
diff --git a/src/cloudflare/resources/email_security/investigate/release.py b/src/cloudflare/resources/email_security/investigate/release.py
new file mode 100644
index 00000000000..3bfd15d7dab
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/release.py
@@ -0,0 +1,190 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List, Type, cast
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import make_request_options
+from ....types.email_security.investigate.release_bulk_response import ReleaseBulkResponse
+
+__all__ = ["ReleaseResource", "AsyncReleaseResource"]
+
+
+class ReleaseResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ReleaseResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return ReleaseResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ReleaseResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return ReleaseResourceWithStreamingResponse(self)
+
+ def bulk(
+ self,
+ *,
+ account_id: str,
+ body: List[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,
+ ) -> ReleaseBulkResponse:
+ """
+ Release messages from quarantine
+
+ Args:
+ account_id: Account Identifier
+
+ body: A list of messages identfied by their `postfix_id`s that should be released.
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/investigate/release",
+ body=maybe_transform(body, List[str]),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[ReleaseBulkResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[ReleaseBulkResponse], ResultWrapper[ReleaseBulkResponse]),
+ )
+
+
+class AsyncReleaseResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncReleaseResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncReleaseResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncReleaseResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncReleaseResourceWithStreamingResponse(self)
+
+ async def bulk(
+ self,
+ *,
+ account_id: str,
+ body: List[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,
+ ) -> ReleaseBulkResponse:
+ """
+ Release messages from quarantine
+
+ Args:
+ account_id: Account Identifier
+
+ body: A list of messages identfied by their `postfix_id`s that should be released.
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/investigate/release",
+ body=await async_maybe_transform(body, List[str]),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[ReleaseBulkResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[ReleaseBulkResponse], ResultWrapper[ReleaseBulkResponse]),
+ )
+
+
+class ReleaseResourceWithRawResponse:
+ def __init__(self, release: ReleaseResource) -> None:
+ self._release = release
+
+ self.bulk = to_raw_response_wrapper(
+ release.bulk,
+ )
+
+
+class AsyncReleaseResourceWithRawResponse:
+ def __init__(self, release: AsyncReleaseResource) -> None:
+ self._release = release
+
+ self.bulk = async_to_raw_response_wrapper(
+ release.bulk,
+ )
+
+
+class ReleaseResourceWithStreamingResponse:
+ def __init__(self, release: ReleaseResource) -> None:
+ self._release = release
+
+ self.bulk = to_streamed_response_wrapper(
+ release.bulk,
+ )
+
+
+class AsyncReleaseResourceWithStreamingResponse:
+ def __init__(self, release: AsyncReleaseResource) -> None:
+ self._release = release
+
+ self.bulk = async_to_streamed_response_wrapper(
+ release.bulk,
+ )
diff --git a/src/cloudflare/resources/email_security/investigate/trace.py b/src/cloudflare/resources/email_security/investigate/trace.py
new file mode 100644
index 00000000000..6aec7651835
--- /dev/null
+++ b/src/cloudflare/resources/email_security/investigate/trace.py
@@ -0,0 +1,188 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ...._base_client import make_request_options
+from ....types.email_security.investigate.trace_get_response import TraceGetResponse
+
+__all__ = ["TraceResource", "AsyncTraceResource"]
+
+
+class TraceResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> TraceResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return TraceResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> TraceResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return TraceResourceWithStreamingResponse(self)
+
+ def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> TraceGetResponse:
+ """
+ Get email trace
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/trace",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TraceGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TraceGetResponse], ResultWrapper[TraceGetResponse]),
+ )
+
+
+class AsyncTraceResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncTraceResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncTraceResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncTraceResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncTraceResourceWithStreamingResponse(self)
+
+ async def get(
+ self,
+ postfix_id: str,
+ *,
+ 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,
+ ) -> TraceGetResponse:
+ """
+ Get email trace
+
+ Args:
+ account_id: Account Identifier
+
+ postfix_id: The identifier of the message.
+
+ 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}")
+ if not postfix_id:
+ raise ValueError(f"Expected a non-empty value for `postfix_id` but received {postfix_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/email-security/investigate/{postfix_id}/trace",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TraceGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TraceGetResponse], ResultWrapper[TraceGetResponse]),
+ )
+
+
+class TraceResourceWithRawResponse:
+ def __init__(self, trace: TraceResource) -> None:
+ self._trace = trace
+
+ self.get = to_raw_response_wrapper(
+ trace.get,
+ )
+
+
+class AsyncTraceResourceWithRawResponse:
+ def __init__(self, trace: AsyncTraceResource) -> None:
+ self._trace = trace
+
+ self.get = async_to_raw_response_wrapper(
+ trace.get,
+ )
+
+
+class TraceResourceWithStreamingResponse:
+ def __init__(self, trace: TraceResource) -> None:
+ self._trace = trace
+
+ self.get = to_streamed_response_wrapper(
+ trace.get,
+ )
+
+
+class AsyncTraceResourceWithStreamingResponse:
+ def __init__(self, trace: AsyncTraceResource) -> None:
+ self._trace = trace
+
+ self.get = async_to_streamed_response_wrapper(
+ trace.get,
+ )
diff --git a/src/cloudflare/resources/email_security/settings/__init__.py b/src/cloudflare/resources/email_security/settings/__init__.py
index f961d525457..0c5dd6337f8 100644
--- a/src/cloudflare/resources/email_security/settings/__init__.py
+++ b/src/cloudflare/resources/email_security/settings/__init__.py
@@ -24,6 +24,14 @@
BlockSendersResourceWithStreamingResponse,
AsyncBlockSendersResourceWithStreamingResponse,
)
+from .allow_policies import (
+ AllowPoliciesResource,
+ AsyncAllowPoliciesResource,
+ AllowPoliciesResourceWithRawResponse,
+ AsyncAllowPoliciesResourceWithRawResponse,
+ AllowPoliciesResourceWithStreamingResponse,
+ AsyncAllowPoliciesResourceWithStreamingResponse,
+)
from .trusted_domains import (
TrustedDomainsResource,
AsyncTrustedDomainsResource,
@@ -42,6 +50,12 @@
)
__all__ = [
+ "AllowPoliciesResource",
+ "AsyncAllowPoliciesResource",
+ "AllowPoliciesResourceWithRawResponse",
+ "AsyncAllowPoliciesResourceWithRawResponse",
+ "AllowPoliciesResourceWithStreamingResponse",
+ "AsyncAllowPoliciesResourceWithStreamingResponse",
"BlockSendersResource",
"AsyncBlockSendersResource",
"BlockSendersResourceWithRawResponse",
diff --git a/src/cloudflare/resources/email_security/settings/allow_policies.py b/src/cloudflare/resources/email_security/settings/allow_policies.py
new file mode 100644
index 00000000000..d6e654a69ea
--- /dev/null
+++ b/src/cloudflare/resources/email_security/settings/allow_policies.py
@@ -0,0 +1,773 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, Optional, cast
+from typing_extensions import Literal
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ...._base_client import AsyncPaginator, make_request_options
+from ....types.email_security.settings import (
+ allow_policy_edit_params,
+ allow_policy_list_params,
+ allow_policy_create_params,
+)
+from ....types.email_security.settings.allow_policy_get_response import AllowPolicyGetResponse
+from ....types.email_security.settings.allow_policy_edit_response import AllowPolicyEditResponse
+from ....types.email_security.settings.allow_policy_list_response import AllowPolicyListResponse
+from ....types.email_security.settings.allow_policy_create_response import AllowPolicyCreateResponse
+from ....types.email_security.settings.allow_policy_delete_response import AllowPolicyDeleteResponse
+
+__all__ = ["AllowPoliciesResource", "AsyncAllowPoliciesResource"]
+
+
+class AllowPoliciesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AllowPoliciesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AllowPoliciesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AllowPoliciesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AllowPoliciesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ is_acceptable_sender: bool,
+ is_exempt_recipient: bool,
+ is_regex: bool,
+ is_trusted_sender: bool,
+ pattern: str,
+ pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"],
+ verify_sender: bool,
+ comments: Optional[str] | NotGiven = NOT_GIVEN,
+ is_recipient: bool | NotGiven = NOT_GIVEN,
+ is_sender: bool | NotGiven = NOT_GIVEN,
+ is_spoof: bool | 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,
+ ) -> AllowPolicyCreateResponse:
+ """
+ Create an email allow policy
+
+ Args:
+ account_id: Account Identifier
+
+ 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.
+
+ is_exempt_recipient: Messages to this recipient will bypass all detections.
+
+ is_trusted_sender: Messages from this sender will bypass all detections and link following.
+
+ verify_sender: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/settings/allow_policies",
+ body=maybe_transform(
+ {
+ "is_acceptable_sender": is_acceptable_sender,
+ "is_exempt_recipient": is_exempt_recipient,
+ "is_regex": is_regex,
+ "is_trusted_sender": is_trusted_sender,
+ "pattern": pattern,
+ "pattern_type": pattern_type,
+ "verify_sender": verify_sender,
+ "comments": comments,
+ "is_recipient": is_recipient,
+ "is_sender": is_sender,
+ "is_spoof": is_spoof,
+ },
+ allow_policy_create_params.AllowPolicyCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyCreateResponse], ResultWrapper[AllowPolicyCreateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
+ is_recipient: bool | NotGiven = NOT_GIVEN,
+ is_sender: bool | NotGiven = NOT_GIVEN,
+ is_spoof: 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,
+ per_page: int | NotGiven = NOT_GIVEN,
+ search: str | NotGiven = NOT_GIVEN,
+ verify_sender: bool | 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,
+ ) -> SyncV4PagePaginationArray[AllowPolicyListResponse]:
+ """
+ Lists, searches, and sorts an account’s email allow policies.
+
+ Args:
+ account_id: Account Identifier
+
+ direction: The sorting direction.
+
+ order: The field to sort by.
+
+ page: The page number of paginated results.
+
+ per_page: The number of results per page.
+
+ search: Allows searching in multiple properties of a record simultaneously. This
+ parameter is intended for human users, not automation. Its exact behavior is
+ intentionally left unspecified and is subject to change in the future.
+
+ 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_api_list(
+ f"/accounts/{account_id}/email-security/settings/allow_policies",
+ page=SyncV4PagePaginationArray[AllowPolicyListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "direction": direction,
+ "is_recipient": is_recipient,
+ "is_sender": is_sender,
+ "is_spoof": is_spoof,
+ "order": order,
+ "page": page,
+ "pattern_type": pattern_type,
+ "per_page": per_page,
+ "search": search,
+ "verify_sender": verify_sender,
+ },
+ allow_policy_list_params.AllowPolicyListParams,
+ ),
+ ),
+ model=AllowPolicyListResponse,
+ )
+
+ def delete(
+ self,
+ policy_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,
+ ) -> AllowPolicyDeleteResponse:
+ """
+ Delete an email allow policy
+
+ 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/allow_policies/{policy_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyDeleteResponse], ResultWrapper[AllowPolicyDeleteResponse]),
+ )
+
+ def edit(
+ self,
+ policy_id: int,
+ *,
+ account_id: str,
+ comments: Optional[str] | NotGiven = NOT_GIVEN,
+ is_acceptable_sender: Optional[bool] | NotGiven = NOT_GIVEN,
+ is_exempt_recipient: Optional[bool] | NotGiven = NOT_GIVEN,
+ is_regex: Optional[bool] | NotGiven = NOT_GIVEN,
+ is_trusted_sender: Optional[bool] | NotGiven = NOT_GIVEN,
+ pattern: Optional[str] | NotGiven = NOT_GIVEN,
+ pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]] | NotGiven = NOT_GIVEN,
+ verify_sender: Optional[bool] | 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,
+ ) -> AllowPolicyEditResponse:
+ """
+ Update an email allow policy
+
+ Args:
+ account_id: Account Identifier
+
+ 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.
+
+ is_exempt_recipient: Messages to this recipient will bypass all detections.
+
+ is_trusted_sender: Messages from this sender will bypass all detections and link following.
+
+ verify_sender: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+
+ 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/allow_policies/{policy_id}",
+ body=maybe_transform(
+ {
+ "comments": comments,
+ "is_acceptable_sender": is_acceptable_sender,
+ "is_exempt_recipient": is_exempt_recipient,
+ "is_regex": is_regex,
+ "is_trusted_sender": is_trusted_sender,
+ "pattern": pattern,
+ "pattern_type": pattern_type,
+ "verify_sender": verify_sender,
+ },
+ allow_policy_edit_params.AllowPolicyEditParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyEditResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyEditResponse], ResultWrapper[AllowPolicyEditResponse]),
+ )
+
+ def get(
+ self,
+ policy_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,
+ ) -> AllowPolicyGetResponse:
+ """
+ Get an email allow policy
+
+ 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/allow_policies/{policy_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyGetResponse], ResultWrapper[AllowPolicyGetResponse]),
+ )
+
+
+class AsyncAllowPoliciesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncAllowPoliciesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncAllowPoliciesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncAllowPoliciesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncAllowPoliciesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ is_acceptable_sender: bool,
+ is_exempt_recipient: bool,
+ is_regex: bool,
+ is_trusted_sender: bool,
+ pattern: str,
+ pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"],
+ verify_sender: bool,
+ comments: Optional[str] | NotGiven = NOT_GIVEN,
+ is_recipient: bool | NotGiven = NOT_GIVEN,
+ is_sender: bool | NotGiven = NOT_GIVEN,
+ is_spoof: bool | 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,
+ ) -> AllowPolicyCreateResponse:
+ """
+ Create an email allow policy
+
+ Args:
+ account_id: Account Identifier
+
+ 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.
+
+ is_exempt_recipient: Messages to this recipient will bypass all detections.
+
+ is_trusted_sender: Messages from this sender will bypass all detections and link following.
+
+ verify_sender: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+
+ 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._post(
+ f"/accounts/{account_id}/email-security/settings/allow_policies",
+ body=await async_maybe_transform(
+ {
+ "is_acceptable_sender": is_acceptable_sender,
+ "is_exempt_recipient": is_exempt_recipient,
+ "is_regex": is_regex,
+ "is_trusted_sender": is_trusted_sender,
+ "pattern": pattern,
+ "pattern_type": pattern_type,
+ "verify_sender": verify_sender,
+ "comments": comments,
+ "is_recipient": is_recipient,
+ "is_sender": is_sender,
+ "is_spoof": is_spoof,
+ },
+ allow_policy_create_params.AllowPolicyCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyCreateResponse], ResultWrapper[AllowPolicyCreateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
+ is_recipient: bool | NotGiven = NOT_GIVEN,
+ is_sender: bool | NotGiven = NOT_GIVEN,
+ is_spoof: 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,
+ per_page: int | NotGiven = NOT_GIVEN,
+ search: str | NotGiven = NOT_GIVEN,
+ verify_sender: bool | 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,
+ ) -> AsyncPaginator[AllowPolicyListResponse, AsyncV4PagePaginationArray[AllowPolicyListResponse]]:
+ """
+ Lists, searches, and sorts an account’s email allow policies.
+
+ Args:
+ account_id: Account Identifier
+
+ direction: The sorting direction.
+
+ order: The field to sort by.
+
+ page: The page number of paginated results.
+
+ per_page: The number of results per page.
+
+ search: Allows searching in multiple properties of a record simultaneously. This
+ parameter is intended for human users, not automation. Its exact behavior is
+ intentionally left unspecified and is subject to change in the future.
+
+ 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_api_list(
+ f"/accounts/{account_id}/email-security/settings/allow_policies",
+ page=AsyncV4PagePaginationArray[AllowPolicyListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "direction": direction,
+ "is_recipient": is_recipient,
+ "is_sender": is_sender,
+ "is_spoof": is_spoof,
+ "order": order,
+ "page": page,
+ "pattern_type": pattern_type,
+ "per_page": per_page,
+ "search": search,
+ "verify_sender": verify_sender,
+ },
+ allow_policy_list_params.AllowPolicyListParams,
+ ),
+ ),
+ model=AllowPolicyListResponse,
+ )
+
+ async def delete(
+ self,
+ policy_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,
+ ) -> AllowPolicyDeleteResponse:
+ """
+ Delete an email allow policy
+
+ 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/allow_policies/{policy_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyDeleteResponse], ResultWrapper[AllowPolicyDeleteResponse]),
+ )
+
+ async def edit(
+ self,
+ policy_id: int,
+ *,
+ account_id: str,
+ comments: Optional[str] | NotGiven = NOT_GIVEN,
+ is_acceptable_sender: Optional[bool] | NotGiven = NOT_GIVEN,
+ is_exempt_recipient: Optional[bool] | NotGiven = NOT_GIVEN,
+ is_regex: Optional[bool] | NotGiven = NOT_GIVEN,
+ is_trusted_sender: Optional[bool] | NotGiven = NOT_GIVEN,
+ pattern: Optional[str] | NotGiven = NOT_GIVEN,
+ pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]] | NotGiven = NOT_GIVEN,
+ verify_sender: Optional[bool] | 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,
+ ) -> AllowPolicyEditResponse:
+ """
+ Update an email allow policy
+
+ Args:
+ account_id: Account Identifier
+
+ 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.
+
+ is_exempt_recipient: Messages to this recipient will bypass all detections.
+
+ is_trusted_sender: Messages from this sender will bypass all detections and link following.
+
+ verify_sender: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+
+ 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/allow_policies/{policy_id}",
+ body=await async_maybe_transform(
+ {
+ "comments": comments,
+ "is_acceptable_sender": is_acceptable_sender,
+ "is_exempt_recipient": is_exempt_recipient,
+ "is_regex": is_regex,
+ "is_trusted_sender": is_trusted_sender,
+ "pattern": pattern,
+ "pattern_type": pattern_type,
+ "verify_sender": verify_sender,
+ },
+ allow_policy_edit_params.AllowPolicyEditParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyEditResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyEditResponse], ResultWrapper[AllowPolicyEditResponse]),
+ )
+
+ async def get(
+ self,
+ policy_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,
+ ) -> AllowPolicyGetResponse:
+ """
+ Get an email allow policy
+
+ 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/allow_policies/{policy_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AllowPolicyGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AllowPolicyGetResponse], ResultWrapper[AllowPolicyGetResponse]),
+ )
+
+
+class AllowPoliciesResourceWithRawResponse:
+ def __init__(self, allow_policies: AllowPoliciesResource) -> None:
+ self._allow_policies = allow_policies
+
+ self.create = to_raw_response_wrapper(
+ allow_policies.create,
+ )
+ self.list = to_raw_response_wrapper(
+ allow_policies.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ allow_policies.delete,
+ )
+ self.edit = to_raw_response_wrapper(
+ allow_policies.edit,
+ )
+ self.get = to_raw_response_wrapper(
+ allow_policies.get,
+ )
+
+
+class AsyncAllowPoliciesResourceWithRawResponse:
+ def __init__(self, allow_policies: AsyncAllowPoliciesResource) -> None:
+ self._allow_policies = allow_policies
+
+ self.create = async_to_raw_response_wrapper(
+ allow_policies.create,
+ )
+ self.list = async_to_raw_response_wrapper(
+ allow_policies.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ allow_policies.delete,
+ )
+ self.edit = async_to_raw_response_wrapper(
+ allow_policies.edit,
+ )
+ self.get = async_to_raw_response_wrapper(
+ allow_policies.get,
+ )
+
+
+class AllowPoliciesResourceWithStreamingResponse:
+ def __init__(self, allow_policies: AllowPoliciesResource) -> None:
+ self._allow_policies = allow_policies
+
+ self.create = to_streamed_response_wrapper(
+ allow_policies.create,
+ )
+ self.list = to_streamed_response_wrapper(
+ allow_policies.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ allow_policies.delete,
+ )
+ self.edit = to_streamed_response_wrapper(
+ allow_policies.edit,
+ )
+ self.get = to_streamed_response_wrapper(
+ allow_policies.get,
+ )
+
+
+class AsyncAllowPoliciesResourceWithStreamingResponse:
+ def __init__(self, allow_policies: AsyncAllowPoliciesResource) -> None:
+ self._allow_policies = allow_policies
+
+ self.create = async_to_streamed_response_wrapper(
+ allow_policies.create,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ allow_policies.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ allow_policies.delete,
+ )
+ self.edit = async_to_streamed_response_wrapper(
+ allow_policies.edit,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ allow_policies.get,
+ )
diff --git a/src/cloudflare/resources/email_security/settings/domains.py b/src/cloudflare/resources/email_security/settings/domains.py
index 00f33a1231d..2fa9d8ec5bf 100644
--- a/src/cloudflare/resources/email_security/settings/domains.py
+++ b/src/cloudflare/resources/email_security/settings/domains.py
@@ -24,6 +24,7 @@
from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ...._base_client import AsyncPaginator, make_request_options
from ....types.email_security.settings import domain_edit_params, domain_list_params
+from ....types.email_security.settings.domain_get_response import DomainGetResponse
from ....types.email_security.settings.domain_edit_response import DomainEditResponse
from ....types.email_security.settings.domain_list_response import DomainListResponse
from ....types.email_security.settings.domain_delete_response import DomainDeleteResponse
@@ -222,6 +223,48 @@ def edit(
cast_to=cast(Type[DomainEditResponse], ResultWrapper[DomainEditResponse]),
)
+ def get(
+ self,
+ domain_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,
+ ) -> DomainGetResponse:
+ """
+ Get an email domain
+
+ Args:
+ account_id: Account Identifier
+
+ domain_id: The unique identifier for the domain.
+
+ 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/domains/{domain_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DomainGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DomainGetResponse], ResultWrapper[DomainGetResponse]),
+ )
+
class AsyncDomainsResource(AsyncAPIResource):
@cached_property
@@ -414,6 +457,48 @@ async def edit(
cast_to=cast(Type[DomainEditResponse], ResultWrapper[DomainEditResponse]),
)
+ async def get(
+ self,
+ domain_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,
+ ) -> DomainGetResponse:
+ """
+ Get an email domain
+
+ Args:
+ account_id: Account Identifier
+
+ domain_id: The unique identifier for the domain.
+
+ 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/domains/{domain_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DomainGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DomainGetResponse], ResultWrapper[DomainGetResponse]),
+ )
+
class DomainsResourceWithRawResponse:
def __init__(self, domains: DomainsResource) -> None:
@@ -428,6 +513,9 @@ def __init__(self, domains: DomainsResource) -> None:
self.edit = to_raw_response_wrapper(
domains.edit,
)
+ self.get = to_raw_response_wrapper(
+ domains.get,
+ )
class AsyncDomainsResourceWithRawResponse:
@@ -443,6 +531,9 @@ def __init__(self, domains: AsyncDomainsResource) -> None:
self.edit = async_to_raw_response_wrapper(
domains.edit,
)
+ self.get = async_to_raw_response_wrapper(
+ domains.get,
+ )
class DomainsResourceWithStreamingResponse:
@@ -458,6 +549,9 @@ def __init__(self, domains: DomainsResource) -> None:
self.edit = to_streamed_response_wrapper(
domains.edit,
)
+ self.get = to_streamed_response_wrapper(
+ domains.get,
+ )
class AsyncDomainsResourceWithStreamingResponse:
@@ -473,3 +567,6 @@ def __init__(self, domains: AsyncDomainsResource) -> None:
self.edit = async_to_streamed_response_wrapper(
domains.edit,
)
+ self.get = async_to_streamed_response_wrapper(
+ domains.get,
+ )
diff --git a/src/cloudflare/resources/email_security/settings/settings.py b/src/cloudflare/resources/email_security/settings/settings.py
index f8f2ab6dd7d..85df275ed99 100644
--- a/src/cloudflare/resources/email_security/settings/settings.py
+++ b/src/cloudflare/resources/email_security/settings/settings.py
@@ -20,6 +20,14 @@
BlockSendersResourceWithStreamingResponse,
AsyncBlockSendersResourceWithStreamingResponse,
)
+from .allow_policies import (
+ AllowPoliciesResource,
+ AsyncAllowPoliciesResource,
+ AllowPoliciesResourceWithRawResponse,
+ AsyncAllowPoliciesResourceWithRawResponse,
+ AllowPoliciesResourceWithStreamingResponse,
+ AsyncAllowPoliciesResourceWithStreamingResponse,
+)
from .trusted_domains import (
TrustedDomainsResource,
AsyncTrustedDomainsResource,
@@ -41,6 +49,10 @@
class SettingsResource(SyncAPIResource):
+ @cached_property
+ def allow_policies(self) -> AllowPoliciesResource:
+ return AllowPoliciesResource(self._client)
+
@cached_property
def block_senders(self) -> BlockSendersResource:
return BlockSendersResource(self._client)
@@ -78,6 +90,10 @@ def with_streaming_response(self) -> SettingsResourceWithStreamingResponse:
class AsyncSettingsResource(AsyncAPIResource):
+ @cached_property
+ def allow_policies(self) -> AsyncAllowPoliciesResource:
+ return AsyncAllowPoliciesResource(self._client)
+
@cached_property
def block_senders(self) -> AsyncBlockSendersResource:
return AsyncBlockSendersResource(self._client)
@@ -118,6 +134,10 @@ class SettingsResourceWithRawResponse:
def __init__(self, settings: SettingsResource) -> None:
self._settings = settings
+ @cached_property
+ def allow_policies(self) -> AllowPoliciesResourceWithRawResponse:
+ return AllowPoliciesResourceWithRawResponse(self._settings.allow_policies)
+
@cached_property
def block_senders(self) -> BlockSendersResourceWithRawResponse:
return BlockSendersResourceWithRawResponse(self._settings.block_senders)
@@ -139,6 +159,10 @@ class AsyncSettingsResourceWithRawResponse:
def __init__(self, settings: AsyncSettingsResource) -> None:
self._settings = settings
+ @cached_property
+ def allow_policies(self) -> AsyncAllowPoliciesResourceWithRawResponse:
+ return AsyncAllowPoliciesResourceWithRawResponse(self._settings.allow_policies)
+
@cached_property
def block_senders(self) -> AsyncBlockSendersResourceWithRawResponse:
return AsyncBlockSendersResourceWithRawResponse(self._settings.block_senders)
@@ -160,6 +184,10 @@ class SettingsResourceWithStreamingResponse:
def __init__(self, settings: SettingsResource) -> None:
self._settings = settings
+ @cached_property
+ def allow_policies(self) -> AllowPoliciesResourceWithStreamingResponse:
+ return AllowPoliciesResourceWithStreamingResponse(self._settings.allow_policies)
+
@cached_property
def block_senders(self) -> BlockSendersResourceWithStreamingResponse:
return BlockSendersResourceWithStreamingResponse(self._settings.block_senders)
@@ -181,6 +209,10 @@ class AsyncSettingsResourceWithStreamingResponse:
def __init__(self, settings: AsyncSettingsResource) -> None:
self._settings = settings
+ @cached_property
+ def allow_policies(self) -> AsyncAllowPoliciesResourceWithStreamingResponse:
+ return AsyncAllowPoliciesResourceWithStreamingResponse(self._settings.allow_policies)
+
@cached_property
def block_senders(self) -> AsyncBlockSendersResourceWithStreamingResponse:
return AsyncBlockSendersResourceWithStreamingResponse(self._settings.block_senders)
diff --git a/src/cloudflare/resources/email_security/submissions.py b/src/cloudflare/resources/email_security/submissions.py
new file mode 100644
index 00000000000..9aac055298f
--- /dev/null
+++ b/src/cloudflare/resources/email_security/submissions.py
@@ -0,0 +1,232 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from datetime import datetime
+from typing_extensions import Literal
+
+import httpx
+
+from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._utils import maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.email_security import submission_list_params
+from ...types.email_security.submission_list_response import SubmissionListResponse
+
+__all__ = ["SubmissionsResource", "AsyncSubmissionsResource"]
+
+
+class SubmissionsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> SubmissionsResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return SubmissionsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> SubmissionsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return SubmissionsResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ end: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ page: int | NotGiven = NOT_GIVEN,
+ per_page: int | NotGiven = NOT_GIVEN,
+ start: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ submission_id: str | NotGiven = NOT_GIVEN,
+ type: Literal["TEAM", "USER"] | 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,
+ ) -> SyncV4PagePaginationArray[SubmissionListResponse]:
+ """
+ This endpoint returns information for submissions to made to reclassify emails.
+
+ Args:
+ account_id: Account Identifier
+
+ end: The end of the search date range. Defaults to `now`.
+
+ page: The page number of paginated results.
+
+ per_page: The number of results per page.
+
+ start: The beginning of the search date range. Defaults to `now - 30 days`.
+
+ 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_api_list(
+ f"/accounts/{account_id}/email-security/submissions",
+ page=SyncV4PagePaginationArray[SubmissionListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "end": end,
+ "page": page,
+ "per_page": per_page,
+ "start": start,
+ "submission_id": submission_id,
+ "type": type,
+ },
+ submission_list_params.SubmissionListParams,
+ ),
+ ),
+ model=SubmissionListResponse,
+ )
+
+
+class AsyncSubmissionsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncSubmissionsResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncSubmissionsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncSubmissionsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncSubmissionsResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ end: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ page: int | NotGiven = NOT_GIVEN,
+ per_page: int | NotGiven = NOT_GIVEN,
+ start: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ submission_id: str | NotGiven = NOT_GIVEN,
+ type: Literal["TEAM", "USER"] | 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,
+ ) -> AsyncPaginator[SubmissionListResponse, AsyncV4PagePaginationArray[SubmissionListResponse]]:
+ """
+ This endpoint returns information for submissions to made to reclassify emails.
+
+ Args:
+ account_id: Account Identifier
+
+ end: The end of the search date range. Defaults to `now`.
+
+ page: The page number of paginated results.
+
+ per_page: The number of results per page.
+
+ start: The beginning of the search date range. Defaults to `now - 30 days`.
+
+ 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_api_list(
+ f"/accounts/{account_id}/email-security/submissions",
+ page=AsyncV4PagePaginationArray[SubmissionListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "end": end,
+ "page": page,
+ "per_page": per_page,
+ "start": start,
+ "submission_id": submission_id,
+ "type": type,
+ },
+ submission_list_params.SubmissionListParams,
+ ),
+ ),
+ model=SubmissionListResponse,
+ )
+
+
+class SubmissionsResourceWithRawResponse:
+ def __init__(self, submissions: SubmissionsResource) -> None:
+ self._submissions = submissions
+
+ self.list = to_raw_response_wrapper(
+ submissions.list,
+ )
+
+
+class AsyncSubmissionsResourceWithRawResponse:
+ def __init__(self, submissions: AsyncSubmissionsResource) -> None:
+ self._submissions = submissions
+
+ self.list = async_to_raw_response_wrapper(
+ submissions.list,
+ )
+
+
+class SubmissionsResourceWithStreamingResponse:
+ def __init__(self, submissions: SubmissionsResource) -> None:
+ self._submissions = submissions
+
+ self.list = to_streamed_response_wrapper(
+ submissions.list,
+ )
+
+
+class AsyncSubmissionsResourceWithStreamingResponse:
+ def __init__(self, submissions: AsyncSubmissionsResource) -> None:
+ self._submissions = submissions
+
+ self.list = async_to_streamed_response_wrapper(
+ submissions.list,
+ )
diff --git a/src/cloudflare/resources/leaked_credential_checks/__init__.py b/src/cloudflare/resources/leaked_credential_checks/__init__.py
new file mode 100644
index 00000000000..a96abb9a3e0
--- /dev/null
+++ b/src/cloudflare/resources/leaked_credential_checks/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .detections import (
+ DetectionsResource,
+ AsyncDetectionsResource,
+ DetectionsResourceWithRawResponse,
+ AsyncDetectionsResourceWithRawResponse,
+ DetectionsResourceWithStreamingResponse,
+ AsyncDetectionsResourceWithStreamingResponse,
+)
+from .leaked_credential_checks import (
+ LeakedCredentialChecksResource,
+ AsyncLeakedCredentialChecksResource,
+ LeakedCredentialChecksResourceWithRawResponse,
+ AsyncLeakedCredentialChecksResourceWithRawResponse,
+ LeakedCredentialChecksResourceWithStreamingResponse,
+ AsyncLeakedCredentialChecksResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "DetectionsResource",
+ "AsyncDetectionsResource",
+ "DetectionsResourceWithRawResponse",
+ "AsyncDetectionsResourceWithRawResponse",
+ "DetectionsResourceWithStreamingResponse",
+ "AsyncDetectionsResourceWithStreamingResponse",
+ "LeakedCredentialChecksResource",
+ "AsyncLeakedCredentialChecksResource",
+ "LeakedCredentialChecksResourceWithRawResponse",
+ "AsyncLeakedCredentialChecksResourceWithRawResponse",
+ "LeakedCredentialChecksResourceWithStreamingResponse",
+ "AsyncLeakedCredentialChecksResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/leaked_credential_checks/detections.py b/src/cloudflare/resources/leaked_credential_checks/detections.py
new file mode 100644
index 00000000000..4b7705d4334
--- /dev/null
+++ b/src/cloudflare/resources/leaked_credential_checks/detections.py
@@ -0,0 +1,522 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from ...pagination import SyncSinglePage, AsyncSinglePage
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.leaked_credential_checks import detection_create_params, detection_update_params
+from ...types.leaked_credential_checks.detection_list_response import DetectionListResponse
+from ...types.leaked_credential_checks.detection_create_response import DetectionCreateResponse
+from ...types.leaked_credential_checks.detection_update_response import DetectionUpdateResponse
+
+__all__ = ["DetectionsResource", "AsyncDetectionsResource"]
+
+
+class DetectionsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> DetectionsResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return DetectionsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> DetectionsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return DetectionsResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ zone_id: str,
+ password: str | NotGiven = NOT_GIVEN,
+ username: 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,
+ ) -> DetectionCreateResponse:
+ """
+ Create user-defined detection pattern for Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ password: The ruleset expression to use in matching the password in a request
+
+ username: The ruleset expression to use in matching the username in a request
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return self._post(
+ f"/zones/{zone_id}/leaked-credential-checks/detections",
+ body=maybe_transform(
+ {
+ "password": password,
+ "username": username,
+ },
+ detection_create_params.DetectionCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DetectionCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DetectionCreateResponse], ResultWrapper[DetectionCreateResponse]),
+ )
+
+ def update(
+ self,
+ detection_id: str,
+ *,
+ zone_id: str,
+ password: str | NotGiven = NOT_GIVEN,
+ username: 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,
+ ) -> DetectionUpdateResponse:
+ """
+ Update user-defined detection pattern for Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ detection_id: The unique ID for this custom detection
+
+ password: The ruleset expression to use in matching the password in a request
+
+ username: The ruleset expression to use in matching the username in a request
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ if not detection_id:
+ raise ValueError(f"Expected a non-empty value for `detection_id` but received {detection_id!r}")
+ return self._put(
+ f"/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}",
+ body=maybe_transform(
+ {
+ "password": password,
+ "username": username,
+ },
+ detection_update_params.DetectionUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DetectionUpdateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DetectionUpdateResponse], ResultWrapper[DetectionUpdateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ zone_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,
+ ) -> SyncSinglePage[DetectionListResponse]:
+ """
+ List user-defined detection patterns for Leaked Credential Checks
+
+ Args:
+ zone_id: 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return self._get_api_list(
+ f"/zones/{zone_id}/leaked-credential-checks/detections",
+ page=SyncSinglePage[DetectionListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=DetectionListResponse,
+ )
+
+ def delete(
+ self,
+ detection_id: str,
+ *,
+ zone_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,
+ ) -> object:
+ """
+ Remove user-defined detection pattern for Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ detection_id: The unique ID for this custom detection
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ if not detection_id:
+ raise ValueError(f"Expected a non-empty value for `detection_id` but received {detection_id!r}")
+ return self._delete(
+ f"/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[object]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class AsyncDetectionsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncDetectionsResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncDetectionsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncDetectionsResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncDetectionsResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ zone_id: str,
+ password: str | NotGiven = NOT_GIVEN,
+ username: 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,
+ ) -> DetectionCreateResponse:
+ """
+ Create user-defined detection pattern for Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ password: The ruleset expression to use in matching the password in a request
+
+ username: The ruleset expression to use in matching the username in a request
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return await self._post(
+ f"/zones/{zone_id}/leaked-credential-checks/detections",
+ body=await async_maybe_transform(
+ {
+ "password": password,
+ "username": username,
+ },
+ detection_create_params.DetectionCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DetectionCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DetectionCreateResponse], ResultWrapper[DetectionCreateResponse]),
+ )
+
+ async def update(
+ self,
+ detection_id: str,
+ *,
+ zone_id: str,
+ password: str | NotGiven = NOT_GIVEN,
+ username: 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,
+ ) -> DetectionUpdateResponse:
+ """
+ Update user-defined detection pattern for Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ detection_id: The unique ID for this custom detection
+
+ password: The ruleset expression to use in matching the password in a request
+
+ username: The ruleset expression to use in matching the username in a request
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ if not detection_id:
+ raise ValueError(f"Expected a non-empty value for `detection_id` but received {detection_id!r}")
+ return await self._put(
+ f"/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}",
+ body=await async_maybe_transform(
+ {
+ "password": password,
+ "username": username,
+ },
+ detection_update_params.DetectionUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DetectionUpdateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DetectionUpdateResponse], ResultWrapper[DetectionUpdateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ zone_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,
+ ) -> AsyncPaginator[DetectionListResponse, AsyncSinglePage[DetectionListResponse]]:
+ """
+ List user-defined detection patterns for Leaked Credential Checks
+
+ Args:
+ zone_id: 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return self._get_api_list(
+ f"/zones/{zone_id}/leaked-credential-checks/detections",
+ page=AsyncSinglePage[DetectionListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=DetectionListResponse,
+ )
+
+ async def delete(
+ self,
+ detection_id: str,
+ *,
+ zone_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,
+ ) -> object:
+ """
+ Remove user-defined detection pattern for Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ detection_id: The unique ID for this custom detection
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ if not detection_id:
+ raise ValueError(f"Expected a non-empty value for `detection_id` but received {detection_id!r}")
+ return await self._delete(
+ f"/zones/{zone_id}/leaked-credential-checks/detections/{detection_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[object]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+
+class DetectionsResourceWithRawResponse:
+ def __init__(self, detections: DetectionsResource) -> None:
+ self._detections = detections
+
+ self.create = to_raw_response_wrapper(
+ detections.create,
+ )
+ self.update = to_raw_response_wrapper(
+ detections.update,
+ )
+ self.list = to_raw_response_wrapper(
+ detections.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ detections.delete,
+ )
+
+
+class AsyncDetectionsResourceWithRawResponse:
+ def __init__(self, detections: AsyncDetectionsResource) -> None:
+ self._detections = detections
+
+ self.create = async_to_raw_response_wrapper(
+ detections.create,
+ )
+ self.update = async_to_raw_response_wrapper(
+ detections.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ detections.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ detections.delete,
+ )
+
+
+class DetectionsResourceWithStreamingResponse:
+ def __init__(self, detections: DetectionsResource) -> None:
+ self._detections = detections
+
+ self.create = to_streamed_response_wrapper(
+ detections.create,
+ )
+ self.update = to_streamed_response_wrapper(
+ detections.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ detections.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ detections.delete,
+ )
+
+
+class AsyncDetectionsResourceWithStreamingResponse:
+ def __init__(self, detections: AsyncDetectionsResource) -> None:
+ self._detections = detections
+
+ self.create = async_to_streamed_response_wrapper(
+ detections.create,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ detections.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ detections.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ detections.delete,
+ )
diff --git a/src/cloudflare/resources/leaked_credential_checks/leaked_credential_checks.py b/src/cloudflare/resources/leaked_credential_checks/leaked_credential_checks.py
new file mode 100644
index 00000000000..ef96635ae76
--- /dev/null
+++ b/src/cloudflare/resources/leaked_credential_checks/leaked_credential_checks.py
@@ -0,0 +1,318 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+
+import httpx
+
+from ...types import leaked_credential_check_create_params
+from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ..._compat import cached_property
+from .detections import (
+ DetectionsResource,
+ AsyncDetectionsResource,
+ DetectionsResourceWithRawResponse,
+ AsyncDetectionsResourceWithRawResponse,
+ DetectionsResourceWithStreamingResponse,
+ AsyncDetectionsResourceWithStreamingResponse,
+)
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from ..._base_client import make_request_options
+from ...types.leaked_credential_check_list_response import LeakedCredentialCheckListResponse
+from ...types.leaked_credential_check_create_response import LeakedCredentialCheckCreateResponse
+
+__all__ = ["LeakedCredentialChecksResource", "AsyncLeakedCredentialChecksResource"]
+
+
+class LeakedCredentialChecksResource(SyncAPIResource):
+ @cached_property
+ def detections(self) -> DetectionsResource:
+ return DetectionsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> LeakedCredentialChecksResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return LeakedCredentialChecksResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> LeakedCredentialChecksResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return LeakedCredentialChecksResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ zone_id: str,
+ enabled: bool | 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,
+ ) -> LeakedCredentialCheckCreateResponse:
+ """
+ Updates the current status of Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ enabled: Whether or not Leaked Credential Checks are enabled
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return self._post(
+ f"/zones/{zone_id}/leaked-credential-checks",
+ body=maybe_transform(
+ {"enabled": enabled}, leaked_credential_check_create_params.LeakedCredentialCheckCreateParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[LeakedCredentialCheckCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[LeakedCredentialCheckCreateResponse], ResultWrapper[LeakedCredentialCheckCreateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ zone_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,
+ ) -> LeakedCredentialCheckListResponse:
+ """
+ Retrieves the current status of Leaked Credential Checks
+
+ Args:
+ zone_id: 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return self._get(
+ f"/zones/{zone_id}/leaked-credential-checks",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[LeakedCredentialCheckListResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[LeakedCredentialCheckListResponse], ResultWrapper[LeakedCredentialCheckListResponse]),
+ )
+
+
+class AsyncLeakedCredentialChecksResource(AsyncAPIResource):
+ @cached_property
+ def detections(self) -> AsyncDetectionsResource:
+ return AsyncDetectionsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncLeakedCredentialChecksResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncLeakedCredentialChecksResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncLeakedCredentialChecksResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncLeakedCredentialChecksResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ zone_id: str,
+ enabled: bool | 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,
+ ) -> LeakedCredentialCheckCreateResponse:
+ """
+ Updates the current status of Leaked Credential Checks
+
+ Args:
+ zone_id: Identifier
+
+ enabled: Whether or not Leaked Credential Checks are enabled
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return await self._post(
+ f"/zones/{zone_id}/leaked-credential-checks",
+ body=await async_maybe_transform(
+ {"enabled": enabled}, leaked_credential_check_create_params.LeakedCredentialCheckCreateParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[LeakedCredentialCheckCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[LeakedCredentialCheckCreateResponse], ResultWrapper[LeakedCredentialCheckCreateResponse]),
+ )
+
+ async def list(
+ self,
+ *,
+ zone_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,
+ ) -> LeakedCredentialCheckListResponse:
+ """
+ Retrieves the current status of Leaked Credential Checks
+
+ Args:
+ zone_id: 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return await self._get(
+ f"/zones/{zone_id}/leaked-credential-checks",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[LeakedCredentialCheckListResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[LeakedCredentialCheckListResponse], ResultWrapper[LeakedCredentialCheckListResponse]),
+ )
+
+
+class LeakedCredentialChecksResourceWithRawResponse:
+ def __init__(self, leaked_credential_checks: LeakedCredentialChecksResource) -> None:
+ self._leaked_credential_checks = leaked_credential_checks
+
+ self.create = to_raw_response_wrapper(
+ leaked_credential_checks.create,
+ )
+ self.list = to_raw_response_wrapper(
+ leaked_credential_checks.list,
+ )
+
+ @cached_property
+ def detections(self) -> DetectionsResourceWithRawResponse:
+ return DetectionsResourceWithRawResponse(self._leaked_credential_checks.detections)
+
+
+class AsyncLeakedCredentialChecksResourceWithRawResponse:
+ def __init__(self, leaked_credential_checks: AsyncLeakedCredentialChecksResource) -> None:
+ self._leaked_credential_checks = leaked_credential_checks
+
+ self.create = async_to_raw_response_wrapper(
+ leaked_credential_checks.create,
+ )
+ self.list = async_to_raw_response_wrapper(
+ leaked_credential_checks.list,
+ )
+
+ @cached_property
+ def detections(self) -> AsyncDetectionsResourceWithRawResponse:
+ return AsyncDetectionsResourceWithRawResponse(self._leaked_credential_checks.detections)
+
+
+class LeakedCredentialChecksResourceWithStreamingResponse:
+ def __init__(self, leaked_credential_checks: LeakedCredentialChecksResource) -> None:
+ self._leaked_credential_checks = leaked_credential_checks
+
+ self.create = to_streamed_response_wrapper(
+ leaked_credential_checks.create,
+ )
+ self.list = to_streamed_response_wrapper(
+ leaked_credential_checks.list,
+ )
+
+ @cached_property
+ def detections(self) -> DetectionsResourceWithStreamingResponse:
+ return DetectionsResourceWithStreamingResponse(self._leaked_credential_checks.detections)
+
+
+class AsyncLeakedCredentialChecksResourceWithStreamingResponse:
+ def __init__(self, leaked_credential_checks: AsyncLeakedCredentialChecksResource) -> None:
+ self._leaked_credential_checks = leaked_credential_checks
+
+ self.create = async_to_streamed_response_wrapper(
+ leaked_credential_checks.create,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ leaked_credential_checks.list,
+ )
+
+ @cached_property
+ def detections(self) -> AsyncDetectionsResourceWithStreamingResponse:
+ return AsyncDetectionsResourceWithStreamingResponse(self._leaked_credential_checks.detections)
diff --git a/src/cloudflare/resources/url_scanner/url_scanner.py b/src/cloudflare/resources/url_scanner/url_scanner.py
index 264d65cb777..eddc4828746 100644
--- a/src/cloudflare/resources/url_scanner/url_scanner.py
+++ b/src/cloudflare/resources/url_scanner/url_scanner.py
@@ -2,6 +2,10 @@
from __future__ import annotations
+from typing import Iterable
+
+import httpx
+
from .dom import (
DOMResource,
AsyncDOMResource,
@@ -34,6 +38,11 @@
ResultResourceWithStreamingResponse,
AsyncResultResourceWithStreamingResponse,
)
+from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
from ..._compat import cached_property
from .responses import (
ResponsesResource,
@@ -52,6 +61,15 @@
AsyncScreenshotResourceWithStreamingResponse,
)
from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._base_client import make_request_options
+from ...types.url_scanner import url_scanner_bulk_params
+from ...types.url_scanner.url_scanner_bulk_response import URLScannerBulkResponse
__all__ = ["URLScannerResource", "AsyncURLScannerResource"]
@@ -100,6 +118,49 @@ def with_streaming_response(self) -> URLScannerResourceWithStreamingResponse:
"""
return URLScannerResourceWithStreamingResponse(self)
+ def bulk(
+ self,
+ account_id: str,
+ *,
+ body: Iterable[url_scanner_bulk_params.Body],
+ # 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,
+ ) -> URLScannerBulkResponse:
+ """Submit URLs to scan.
+
+ Check limits at
+ https://developers.cloudflare.com/security-center/investigate/scan-limits/ and
+ take into account scans submitted in bulk have lower priority and may take
+ longer to finish.
+
+ Args:
+ account_id: Account Id.
+
+ body: List of urls to scan (up to a 100).
+
+ 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._post(
+ f"/accounts/{account_id}/urlscanner/v2/bulk",
+ body=maybe_transform(body, Iterable[url_scanner_bulk_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=URLScannerBulkResponse,
+ )
+
class AsyncURLScannerResource(AsyncAPIResource):
@cached_property
@@ -145,11 +206,58 @@ def with_streaming_response(self) -> AsyncURLScannerResourceWithStreamingRespons
"""
return AsyncURLScannerResourceWithStreamingResponse(self)
+ async def bulk(
+ self,
+ account_id: str,
+ *,
+ body: Iterable[url_scanner_bulk_params.Body],
+ # 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,
+ ) -> URLScannerBulkResponse:
+ """Submit URLs to scan.
+
+ Check limits at
+ https://developers.cloudflare.com/security-center/investigate/scan-limits/ and
+ take into account scans submitted in bulk have lower priority and may take
+ longer to finish.
+
+ Args:
+ account_id: Account Id.
+
+ body: List of urls to scan (up to a 100).
+
+ 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._post(
+ f"/accounts/{account_id}/urlscanner/v2/bulk",
+ body=await async_maybe_transform(body, Iterable[url_scanner_bulk_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=URLScannerBulkResponse,
+ )
+
class URLScannerResourceWithRawResponse:
def __init__(self, url_scanner: URLScannerResource) -> None:
self._url_scanner = url_scanner
+ self.bulk = to_raw_response_wrapper(
+ url_scanner.bulk,
+ )
+
@cached_property
def responses(self) -> ResponsesResourceWithRawResponse:
return ResponsesResourceWithRawResponse(self._url_scanner.responses)
@@ -179,6 +287,10 @@ class AsyncURLScannerResourceWithRawResponse:
def __init__(self, url_scanner: AsyncURLScannerResource) -> None:
self._url_scanner = url_scanner
+ self.bulk = async_to_raw_response_wrapper(
+ url_scanner.bulk,
+ )
+
@cached_property
def responses(self) -> AsyncResponsesResourceWithRawResponse:
return AsyncResponsesResourceWithRawResponse(self._url_scanner.responses)
@@ -208,6 +320,10 @@ class URLScannerResourceWithStreamingResponse:
def __init__(self, url_scanner: URLScannerResource) -> None:
self._url_scanner = url_scanner
+ self.bulk = to_streamed_response_wrapper(
+ url_scanner.bulk,
+ )
+
@cached_property
def responses(self) -> ResponsesResourceWithStreamingResponse:
return ResponsesResourceWithStreamingResponse(self._url_scanner.responses)
@@ -237,6 +353,10 @@ class AsyncURLScannerResourceWithStreamingResponse:
def __init__(self, url_scanner: AsyncURLScannerResource) -> None:
self._url_scanner = url_scanner
+ self.bulk = async_to_streamed_response_wrapper(
+ url_scanner.bulk,
+ )
+
@cached_property
def responses(self) -> AsyncResponsesResourceWithStreamingResponse:
return AsyncResponsesResourceWithStreamingResponse(self._url_scanner.responses)
diff --git a/src/cloudflare/resources/zero_trust/dlp/__init__.py b/src/cloudflare/resources/zero_trust/dlp/__init__.py
index 8bd7a4b4558..b3185380cfb 100644
--- a/src/cloudflare/resources/zero_trust/dlp/__init__.py
+++ b/src/cloudflare/resources/zero_trust/dlp/__init__.py
@@ -16,6 +16,14 @@
LimitsResourceWithStreamingResponse,
AsyncLimitsResourceWithStreamingResponse,
)
+from .entries import (
+ EntriesResource,
+ AsyncEntriesResource,
+ EntriesResourceWithRawResponse,
+ AsyncEntriesResourceWithRawResponse,
+ EntriesResourceWithStreamingResponse,
+ AsyncEntriesResourceWithStreamingResponse,
+)
from .datasets import (
DatasetsResource,
AsyncDatasetsResource,
@@ -80,6 +88,12 @@
"AsyncLimitsResourceWithRawResponse",
"LimitsResourceWithStreamingResponse",
"AsyncLimitsResourceWithStreamingResponse",
+ "EntriesResource",
+ "AsyncEntriesResource",
+ "EntriesResourceWithRawResponse",
+ "AsyncEntriesResourceWithRawResponse",
+ "EntriesResourceWithStreamingResponse",
+ "AsyncEntriesResourceWithStreamingResponse",
"DLPResource",
"AsyncDLPResource",
"DLPResourceWithRawResponse",
diff --git a/src/cloudflare/resources/zero_trust/dlp/dlp.py b/src/cloudflare/resources/zero_trust/dlp/dlp.py
index f3c299ac692..2b662155d69 100644
--- a/src/cloudflare/resources/zero_trust/dlp/dlp.py
+++ b/src/cloudflare/resources/zero_trust/dlp/dlp.py
@@ -10,6 +10,14 @@
LimitsResourceWithStreamingResponse,
AsyncLimitsResourceWithStreamingResponse,
)
+from .entries import (
+ EntriesResource,
+ AsyncEntriesResource,
+ EntriesResourceWithRawResponse,
+ AsyncEntriesResourceWithRawResponse,
+ EntriesResourceWithStreamingResponse,
+ AsyncEntriesResourceWithStreamingResponse,
+)
from .datasets import (
DatasetsResource,
AsyncDatasetsResource,
@@ -71,6 +79,10 @@ def profiles(self) -> ProfilesResource:
def limits(self) -> LimitsResource:
return LimitsResource(self._client)
+ @cached_property
+ def entries(self) -> EntriesResource:
+ return EntriesResource(self._client)
+
@cached_property
def with_raw_response(self) -> DLPResourceWithRawResponse:
"""
@@ -112,6 +124,10 @@ def profiles(self) -> AsyncProfilesResource:
def limits(self) -> AsyncLimitsResource:
return AsyncLimitsResource(self._client)
+ @cached_property
+ def entries(self) -> AsyncEntriesResource:
+ return AsyncEntriesResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncDLPResourceWithRawResponse:
"""
@@ -156,6 +172,10 @@ def profiles(self) -> ProfilesResourceWithRawResponse:
def limits(self) -> LimitsResourceWithRawResponse:
return LimitsResourceWithRawResponse(self._dlp.limits)
+ @cached_property
+ def entries(self) -> EntriesResourceWithRawResponse:
+ return EntriesResourceWithRawResponse(self._dlp.entries)
+
class AsyncDLPResourceWithRawResponse:
def __init__(self, dlp: AsyncDLPResource) -> None:
@@ -181,6 +201,10 @@ def profiles(self) -> AsyncProfilesResourceWithRawResponse:
def limits(self) -> AsyncLimitsResourceWithRawResponse:
return AsyncLimitsResourceWithRawResponse(self._dlp.limits)
+ @cached_property
+ def entries(self) -> AsyncEntriesResourceWithRawResponse:
+ return AsyncEntriesResourceWithRawResponse(self._dlp.entries)
+
class DLPResourceWithStreamingResponse:
def __init__(self, dlp: DLPResource) -> None:
@@ -206,6 +230,10 @@ def profiles(self) -> ProfilesResourceWithStreamingResponse:
def limits(self) -> LimitsResourceWithStreamingResponse:
return LimitsResourceWithStreamingResponse(self._dlp.limits)
+ @cached_property
+ def entries(self) -> EntriesResourceWithStreamingResponse:
+ return EntriesResourceWithStreamingResponse(self._dlp.entries)
+
class AsyncDLPResourceWithStreamingResponse:
def __init__(self, dlp: AsyncDLPResource) -> None:
@@ -230,3 +258,7 @@ def profiles(self) -> AsyncProfilesResourceWithStreamingResponse:
@cached_property
def limits(self) -> AsyncLimitsResourceWithStreamingResponse:
return AsyncLimitsResourceWithStreamingResponse(self._dlp.limits)
+
+ @cached_property
+ def entries(self) -> AsyncEntriesResourceWithStreamingResponse:
+ return AsyncEntriesResourceWithStreamingResponse(self._dlp.entries)
diff --git a/src/cloudflare/resources/zero_trust/dlp/entries.py b/src/cloudflare/resources/zero_trust/dlp/entries.py
new file mode 100644
index 00000000000..09ee9cb37af
--- /dev/null
+++ b/src/cloudflare/resources/zero_trust/dlp/entries.py
@@ -0,0 +1,760 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Any, Type, Optional, cast
+from typing_extensions import Literal, overload
+
+import httpx
+
+from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._utils import (
+ required_args,
+ maybe_transform,
+ async_maybe_transform,
+)
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ....pagination import SyncSinglePage, AsyncSinglePage
+from ...._base_client import AsyncPaginator, make_request_options
+from ....types.zero_trust.dlp import entry_create_params, entry_update_params
+from ....types.zero_trust.dlp.entry_get_response import EntryGetResponse
+from ....types.zero_trust.dlp.entry_list_response import EntryListResponse
+from ....types.zero_trust.dlp.entry_create_response import EntryCreateResponse
+from ....types.zero_trust.dlp.entry_update_response import EntryUpdateResponse
+from ....types.zero_trust.dlp.profiles.pattern_param import PatternParam
+
+__all__ = ["EntriesResource", "AsyncEntriesResource"]
+
+
+class EntriesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> EntriesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return EntriesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> EntriesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return EntriesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ enabled: bool,
+ name: str,
+ pattern: PatternParam,
+ profile_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,
+ ) -> Optional[EntryCreateResponse]:
+ """
+ Creates a DLP custom entry.
+
+ Args:
+ 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._post(
+ f"/accounts/{account_id}/dlp/entries",
+ body=maybe_transform(
+ {
+ "enabled": enabled,
+ "name": name,
+ "pattern": pattern,
+ "profile_id": profile_id,
+ },
+ entry_create_params.EntryCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[EntryCreateResponse]]._unwrapper,
+ ),
+ cast_to=cast(Type[Optional[EntryCreateResponse]], ResultWrapper[EntryCreateResponse]),
+ )
+
+ @overload
+ def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ name: str,
+ pattern: PatternParam,
+ type: Literal["custom"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ """
+ Updates a DLP entry.
+
+ Args:
+ 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
+ """
+ ...
+
+ @overload
+ def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ type: Literal["predefined"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ """
+ Updates a DLP entry.
+
+ Args:
+ 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
+ """
+ ...
+
+ @overload
+ def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ type: Literal["integration"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ """
+ Updates a DLP entry.
+
+ Args:
+ 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
+ """
+ ...
+
+ @required_args(["account_id", "name", "pattern", "type"], ["account_id", "type"])
+ def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ name: str | NotGiven = NOT_GIVEN,
+ pattern: PatternParam | NotGiven = NOT_GIVEN,
+ type: Literal["custom"] | Literal["predefined"] | Literal["integration"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return cast(
+ Optional[EntryUpdateResponse],
+ self._put(
+ f"/accounts/{account_id}/dlp/entries/{entry_id}",
+ body=maybe_transform(
+ {
+ "name": name,
+ "pattern": pattern,
+ "type": type,
+ },
+ entry_update_params.EntryUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[EntryUpdateResponse]]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[EntryUpdateResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+ def list(
+ self,
+ *,
+ 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,
+ ) -> SyncSinglePage[EntryListResponse]:
+ """
+ Lists all DLP entries in an account.
+
+ Args:
+ 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_api_list(
+ f"/accounts/{account_id}/dlp/entries",
+ page=SyncSinglePage[EntryListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=cast(Any, EntryListResponse), # Union types cannot be passed in as arguments in the type system
+ )
+
+ def delete(
+ self,
+ entry_id: str,
+ *,
+ 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,
+ ) -> object:
+ """
+ Deletes a DLP custom entry.
+
+ Args:
+ 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}")
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return self._delete(
+ f"/accounts/{account_id}/dlp/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+ def get(
+ self,
+ entry_id: str,
+ *,
+ 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,
+ ) -> Optional[EntryGetResponse]:
+ """
+ Fetches a DLP entry by ID
+
+ Args:
+ 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}")
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return cast(
+ Optional[EntryGetResponse],
+ self._get(
+ f"/accounts/{account_id}/dlp/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[EntryGetResponse]]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[EntryGetResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+
+class AsyncEntriesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncEntriesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncEntriesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncEntriesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response
+ """
+ return AsyncEntriesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ enabled: bool,
+ name: str,
+ pattern: PatternParam,
+ profile_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,
+ ) -> Optional[EntryCreateResponse]:
+ """
+ Creates a DLP custom entry.
+
+ Args:
+ 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._post(
+ f"/accounts/{account_id}/dlp/entries",
+ body=await async_maybe_transform(
+ {
+ "enabled": enabled,
+ "name": name,
+ "pattern": pattern,
+ "profile_id": profile_id,
+ },
+ entry_create_params.EntryCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[EntryCreateResponse]]._unwrapper,
+ ),
+ cast_to=cast(Type[Optional[EntryCreateResponse]], ResultWrapper[EntryCreateResponse]),
+ )
+
+ @overload
+ async def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ name: str,
+ pattern: PatternParam,
+ type: Literal["custom"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ """
+ Updates a DLP entry.
+
+ Args:
+ 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
+ """
+ ...
+
+ @overload
+ async def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ type: Literal["predefined"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ """
+ Updates a DLP entry.
+
+ Args:
+ 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
+ """
+ ...
+
+ @overload
+ async def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ type: Literal["integration"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ """
+ Updates a DLP entry.
+
+ Args:
+ 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
+ """
+ ...
+
+ @required_args(["account_id", "name", "pattern", "type"], ["account_id", "type"])
+ async def update(
+ self,
+ entry_id: str,
+ *,
+ account_id: str,
+ name: str | NotGiven = NOT_GIVEN,
+ pattern: PatternParam | NotGiven = NOT_GIVEN,
+ type: Literal["custom"] | Literal["predefined"] | Literal["integration"],
+ # 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,
+ ) -> Optional[EntryUpdateResponse]:
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return cast(
+ Optional[EntryUpdateResponse],
+ await self._put(
+ f"/accounts/{account_id}/dlp/entries/{entry_id}",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "pattern": pattern,
+ "type": type,
+ },
+ entry_update_params.EntryUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[EntryUpdateResponse]]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[EntryUpdateResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+ def list(
+ self,
+ *,
+ 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,
+ ) -> AsyncPaginator[EntryListResponse, AsyncSinglePage[EntryListResponse]]:
+ """
+ Lists all DLP entries in an account.
+
+ Args:
+ 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_api_list(
+ f"/accounts/{account_id}/dlp/entries",
+ page=AsyncSinglePage[EntryListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=cast(Any, EntryListResponse), # Union types cannot be passed in as arguments in the type system
+ )
+
+ async def delete(
+ self,
+ entry_id: str,
+ *,
+ 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,
+ ) -> object:
+ """
+ Deletes a DLP custom entry.
+
+ Args:
+ 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}")
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/dlp/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
+ )
+
+ async def get(
+ self,
+ entry_id: str,
+ *,
+ 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,
+ ) -> Optional[EntryGetResponse]:
+ """
+ Fetches a DLP entry by ID
+
+ Args:
+ 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}")
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return cast(
+ Optional[EntryGetResponse],
+ await self._get(
+ f"/accounts/{account_id}/dlp/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[EntryGetResponse]]._unwrapper,
+ ),
+ cast_to=cast(
+ Any, ResultWrapper[EntryGetResponse]
+ ), # Union types cannot be passed in as arguments in the type system
+ ),
+ )
+
+
+class EntriesResourceWithRawResponse:
+ def __init__(self, entries: EntriesResource) -> None:
+ self._entries = entries
+
+ self.create = to_raw_response_wrapper(
+ entries.create,
+ )
+ self.update = to_raw_response_wrapper(
+ entries.update,
+ )
+ self.list = to_raw_response_wrapper(
+ entries.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ entries.delete,
+ )
+ self.get = to_raw_response_wrapper(
+ entries.get,
+ )
+
+
+class AsyncEntriesResourceWithRawResponse:
+ def __init__(self, entries: AsyncEntriesResource) -> None:
+ self._entries = entries
+
+ self.create = async_to_raw_response_wrapper(
+ entries.create,
+ )
+ self.update = async_to_raw_response_wrapper(
+ entries.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ entries.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ entries.delete,
+ )
+ self.get = async_to_raw_response_wrapper(
+ entries.get,
+ )
+
+
+class EntriesResourceWithStreamingResponse:
+ def __init__(self, entries: EntriesResource) -> None:
+ self._entries = entries
+
+ self.create = to_streamed_response_wrapper(
+ entries.create,
+ )
+ self.update = to_streamed_response_wrapper(
+ entries.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ entries.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ entries.delete,
+ )
+ self.get = to_streamed_response_wrapper(
+ entries.get,
+ )
+
+
+class AsyncEntriesResourceWithStreamingResponse:
+ def __init__(self, entries: AsyncEntriesResource) -> None:
+ self._entries = entries
+
+ self.create = async_to_streamed_response_wrapper(
+ entries.create,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ entries.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ entries.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ entries.delete,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ entries.get,
+ )
diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py
index bfc0722f849..a5357be430b 100644
--- a/src/cloudflare/types/__init__.py
+++ b/src/cloudflare/types/__init__.py
@@ -28,3 +28,12 @@
CertificateRequestType as CertificateRequestType,
TokenConditionCIDRList as TokenConditionCIDRList,
)
+from .leaked_credential_check_create_params import (
+ LeakedCredentialCheckCreateParams as LeakedCredentialCheckCreateParams,
+)
+from .leaked_credential_check_list_response import (
+ LeakedCredentialCheckListResponse as LeakedCredentialCheckListResponse,
+)
+from .leaked_credential_check_create_response import (
+ LeakedCredentialCheckCreateResponse as LeakedCredentialCheckCreateResponse,
+)
diff --git a/src/cloudflare/types/email_security/__init__.py b/src/cloudflare/types/email_security/__init__.py
index baad343a973..c6de765e0ce 100644
--- a/src/cloudflare/types/email_security/__init__.py
+++ b/src/cloudflare/types/email_security/__init__.py
@@ -2,10 +2,8 @@
from __future__ import annotations
+from .submission_list_params import SubmissionListParams as SubmissionListParams
from .investigate_list_params import InvestigateListParams as InvestigateListParams
from .investigate_get_response import InvestigateGetResponse as InvestigateGetResponse
-from .investigate_raw_response import InvestigateRawResponse as InvestigateRawResponse
+from .submission_list_response import SubmissionListResponse as SubmissionListResponse
from .investigate_list_response import InvestigateListResponse as InvestigateListResponse
-from .investigate_trace_response import InvestigateTraceResponse as InvestigateTraceResponse
-from .investigate_preview_response import InvestigatePreviewResponse as InvestigatePreviewResponse
-from .investigate_detections_response import InvestigateDetectionsResponse as InvestigateDetectionsResponse
diff --git a/src/cloudflare/types/email_security/investigate/__init__.py b/src/cloudflare/types/email_security/investigate/__init__.py
new file mode 100644
index 00000000000..e694dd47b9b
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/__init__.py
@@ -0,0 +1,17 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .move_bulk_params import MoveBulkParams as MoveBulkParams
+from .raw_get_response import RawGetResponse as RawGetResponse
+from .move_bulk_response import MoveBulkResponse as MoveBulkResponse
+from .move_create_params import MoveCreateParams as MoveCreateParams
+from .trace_get_response import TraceGetResponse as TraceGetResponse
+from .release_bulk_params import ReleaseBulkParams as ReleaseBulkParams
+from .move_create_response import MoveCreateResponse as MoveCreateResponse
+from .preview_get_response import PreviewGetResponse as PreviewGetResponse
+from .preview_create_params import PreviewCreateParams as PreviewCreateParams
+from .release_bulk_response import ReleaseBulkResponse as ReleaseBulkResponse
+from .detection_get_response import DetectionGetResponse as DetectionGetResponse
+from .preview_create_response import PreviewCreateResponse as PreviewCreateResponse
+from .reclassify_create_params import ReclassifyCreateParams as ReclassifyCreateParams
diff --git a/src/cloudflare/types/email_security/investigate_detections_response.py b/src/cloudflare/types/email_security/investigate/detection_get_response.py
similarity index 89%
rename from src/cloudflare/types/email_security/investigate_detections_response.py
rename to src/cloudflare/types/email_security/investigate/detection_get_response.py
index aa55f2054d9..0897317cee2 100644
--- a/src/cloudflare/types/email_security/investigate_detections_response.py
+++ b/src/cloudflare/types/email_security/investigate/detection_get_response.py
@@ -3,17 +3,9 @@
from typing import List, Optional
from typing_extensions import Literal
-from ..._models import BaseModel
+from ...._models import BaseModel
-__all__ = [
- "InvestigateDetectionsResponse",
- "Attachment",
- "Header",
- "Link",
- "SenderInfo",
- "ThreatCategory",
- "Validation",
-]
+__all__ = ["DetectionGetResponse", "Attachment", "Header", "Link", "SenderInfo", "ThreatCategory", "Validation"]
class Attachment(BaseModel):
@@ -85,7 +77,7 @@ class Validation(BaseModel):
spf: Optional[Literal["pass", "neutral", "fail", "error", "none"]] = None
-class InvestigateDetectionsResponse(BaseModel):
+class DetectionGetResponse(BaseModel):
action: str
attachments: List[Attachment]
diff --git a/src/cloudflare/types/email_security/investigate/move_bulk_params.py b/src/cloudflare/types/email_security/investigate/move_bulk_params.py
new file mode 100644
index 00000000000..1fb8d4e3b90
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/move_bulk_params.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["MoveBulkParams"]
+
+
+class MoveBulkParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Account Identifier"""
+
+ destination: Required[
+ Literal["Inbox", "JunkEmail", "DeletedItems", "RecoverableItemsDeletions", "RecoverableItemsPurges"]
+ ]
+
+ postfix_ids: Required[List[str]]
diff --git a/src/cloudflare/types/email_security/investigate/move_bulk_response.py b/src/cloudflare/types/email_security/investigate/move_bulk_response.py
new file mode 100644
index 00000000000..8e626a9f881
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/move_bulk_response.py
@@ -0,0 +1,28 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+from datetime import datetime
+from typing_extensions import TypeAlias
+
+from ...._models import BaseModel
+
+__all__ = ["MoveBulkResponse", "MoveBulkResponseItem"]
+
+
+class MoveBulkResponseItem(BaseModel):
+ completed_timestamp: datetime
+
+ destination: str
+
+ item_count: int
+
+ message_id: str
+
+ operation: str
+
+ recipient: str
+
+ status: str
+
+
+MoveBulkResponse: TypeAlias = List[MoveBulkResponseItem]
diff --git a/src/cloudflare/types/email_security/investigate/move_create_params.py b/src/cloudflare/types/email_security/investigate/move_create_params.py
new file mode 100644
index 00000000000..7628fa91699
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/move_create_params.py
@@ -0,0 +1,16 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["MoveCreateParams"]
+
+
+class MoveCreateParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Account Identifier"""
+
+ destination: Required[
+ Literal["Inbox", "JunkEmail", "DeletedItems", "RecoverableItemsDeletions", "RecoverableItemsPurges"]
+ ]
diff --git a/src/cloudflare/types/email_security/investigate/move_create_response.py b/src/cloudflare/types/email_security/investigate/move_create_response.py
new file mode 100644
index 00000000000..02a887bf9b8
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/move_create_response.py
@@ -0,0 +1,28 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+from datetime import datetime
+from typing_extensions import TypeAlias
+
+from ...._models import BaseModel
+
+__all__ = ["MoveCreateResponse", "MoveCreateResponseItem"]
+
+
+class MoveCreateResponseItem(BaseModel):
+ completed_timestamp: datetime
+
+ destination: str
+
+ item_count: int
+
+ message_id: str
+
+ operation: str
+
+ recipient: str
+
+ status: str
+
+
+MoveCreateResponse: TypeAlias = List[MoveCreateResponseItem]
diff --git a/src/cloudflare/types/email_security/investigate/preview_create_params.py b/src/cloudflare/types/email_security/investigate/preview_create_params.py
new file mode 100644
index 00000000000..8797183621a
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/preview_create_params.py
@@ -0,0 +1,16 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+from typing_extensions import Required, TypedDict
+
+__all__ = ["PreviewCreateParams"]
+
+
+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."""
diff --git a/src/cloudflare/types/email_security/investigate/preview_create_response.py b/src/cloudflare/types/email_security/investigate/preview_create_response.py
new file mode 100644
index 00000000000..decc493cddc
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/preview_create_response.py
@@ -0,0 +1,13 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from ...._models import BaseModel
+
+__all__ = ["PreviewCreateResponse"]
+
+
+class PreviewCreateResponse(BaseModel):
+ screenshot: str
+
+ error: Optional[str] = None
diff --git a/src/cloudflare/types/email_security/investigate_preview_response.py b/src/cloudflare/types/email_security/investigate/preview_get_response.py
similarity index 57%
rename from src/cloudflare/types/email_security/investigate_preview_response.py
rename to src/cloudflare/types/email_security/investigate/preview_get_response.py
index a751b9ef3ac..a9e79178bcb 100644
--- a/src/cloudflare/types/email_security/investigate_preview_response.py
+++ b/src/cloudflare/types/email_security/investigate/preview_get_response.py
@@ -1,11 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from ..._models import BaseModel
+from ...._models import BaseModel
-__all__ = ["InvestigatePreviewResponse"]
+__all__ = ["PreviewGetResponse"]
-class InvestigatePreviewResponse(BaseModel):
+class PreviewGetResponse(BaseModel):
screenshot: str
"""A base64 encoded PNG image of the email."""
diff --git a/src/cloudflare/types/email_security/investigate_raw_response.py b/src/cloudflare/types/email_security/investigate/raw_get_response.py
similarity index 57%
rename from src/cloudflare/types/email_security/investigate_raw_response.py
rename to src/cloudflare/types/email_security/investigate/raw_get_response.py
index 341b44b0137..a4b1b4b7efd 100644
--- a/src/cloudflare/types/email_security/investigate_raw_response.py
+++ b/src/cloudflare/types/email_security/investigate/raw_get_response.py
@@ -1,11 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from ..._models import BaseModel
+from ...._models import BaseModel
-__all__ = ["InvestigateRawResponse"]
+__all__ = ["RawGetResponse"]
-class InvestigateRawResponse(BaseModel):
+class RawGetResponse(BaseModel):
raw: str
"""A UTF-8 encoded eml file of the email."""
diff --git a/src/cloudflare/types/email_security/investigate/reclassify_create_params.py b/src/cloudflare/types/email_security/investigate/reclassify_create_params.py
new file mode 100644
index 00000000000..5d96530df41
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/reclassify_create_params.py
@@ -0,0 +1,18 @@
+# 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 Literal, Required, TypedDict
+
+__all__ = ["ReclassifyCreateParams"]
+
+
+class ReclassifyCreateParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Account Identifier"""
+
+ expected_disposition: Required[Literal["NONE", "BULK", "MALICIOUS", "SPAM", "SPOOF", "SUSPICIOUS"]]
+
+ eml_content: Optional[str]
+ """Base64 encoded content of the EML file"""
diff --git a/src/cloudflare/types/email_security/investigate/release_bulk_params.py b/src/cloudflare/types/email_security/investigate/release_bulk_params.py
new file mode 100644
index 00000000000..4f8a1b98ece
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/release_bulk_params.py
@@ -0,0 +1,16 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+from typing_extensions import Required, TypedDict
+
+__all__ = ["ReleaseBulkParams"]
+
+
+class ReleaseBulkParams(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."""
diff --git a/src/cloudflare/types/email_security/investigate/release_bulk_response.py b/src/cloudflare/types/email_security/investigate/release_bulk_response.py
new file mode 100644
index 00000000000..75b93ca69cc
--- /dev/null
+++ b/src/cloudflare/types/email_security/investigate/release_bulk_response.py
@@ -0,0 +1,22 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from typing_extensions import TypeAlias
+
+from ...._models import BaseModel
+
+__all__ = ["ReleaseBulkResponse", "ReleaseBulkResponseItem"]
+
+
+class ReleaseBulkResponseItem(BaseModel):
+ postfix_id: str
+ """The identifier of the message."""
+
+ delivered: Optional[List[str]] = None
+
+ failed: Optional[List[str]] = None
+
+ undelivered: Optional[List[str]] = None
+
+
+ReleaseBulkResponse: TypeAlias = List[ReleaseBulkResponseItem]
diff --git a/src/cloudflare/types/email_security/investigate_trace_response.py b/src/cloudflare/types/email_security/investigate/trace_get_response.py
similarity index 75%
rename from src/cloudflare/types/email_security/investigate_trace_response.py
rename to src/cloudflare/types/email_security/investigate/trace_get_response.py
index e32f3949421..58ab898d0ed 100644
--- a/src/cloudflare/types/email_security/investigate_trace_response.py
+++ b/src/cloudflare/types/email_security/investigate/trace_get_response.py
@@ -3,9 +3,9 @@
from typing import List, Optional
from datetime import datetime
-from ..._models import BaseModel
+from ...._models import BaseModel
-__all__ = ["InvestigateTraceResponse", "Inbound", "InboundLine", "Outbound", "OutboundLine"]
+__all__ = ["TraceGetResponse", "Inbound", "InboundLine", "Outbound", "OutboundLine"]
class InboundLine(BaseModel):
@@ -32,7 +32,7 @@ class Outbound(BaseModel):
lines: Optional[List[OutboundLine]] = None
-class InvestigateTraceResponse(BaseModel):
+class TraceGetResponse(BaseModel):
inbound: Inbound
outbound: Outbound
diff --git a/src/cloudflare/types/email_security/settings/__init__.py b/src/cloudflare/types/email_security/settings/__init__.py
index d773495cf8f..3cdacd3f71b 100644
--- a/src/cloudflare/types/email_security/settings/__init__.py
+++ b/src/cloudflare/types/email_security/settings/__init__.py
@@ -4,18 +4,27 @@
from .domain_edit_params import DomainEditParams as DomainEditParams
from .domain_list_params import DomainListParams as DomainListParams
+from .domain_get_response import DomainGetResponse as DomainGetResponse
from .domain_edit_response import DomainEditResponse as DomainEditResponse
from .domain_list_response import DomainListResponse as DomainListResponse
from .domain_delete_response import DomainDeleteResponse as DomainDeleteResponse
+from .allow_policy_edit_params import AllowPolicyEditParams as AllowPolicyEditParams
+from .allow_policy_list_params import AllowPolicyListParams as AllowPolicyListParams
from .block_sender_edit_params import BlockSenderEditParams as BlockSenderEditParams
from .block_sender_list_params import BlockSenderListParams as BlockSenderListParams
+from .allow_policy_get_response import AllowPolicyGetResponse as AllowPolicyGetResponse
from .block_sender_get_response import BlockSenderGetResponse as BlockSenderGetResponse
+from .allow_policy_create_params import AllowPolicyCreateParams as AllowPolicyCreateParams
+from .allow_policy_edit_response import AllowPolicyEditResponse as AllowPolicyEditResponse
+from .allow_policy_list_response import AllowPolicyListResponse as AllowPolicyListResponse
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 .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
diff --git a/src/cloudflare/types/email_security/settings/allow_policy_create_params.py b/src/cloudflare/types/email_security/settings/allow_policy_create_params.py
new file mode 100644
index 00000000000..9c0e132e1b2
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_create_params.py
@@ -0,0 +1,46 @@
+# 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 Literal, Required, TypedDict
+
+__all__ = ["AllowPolicyCreateParams"]
+
+
+class AllowPolicyCreateParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Account Identifier"""
+
+ is_acceptable_sender: Required[bool]
+ """
+ Messages from this sender will be exempted from Spam, Spoof and Bulk
+ dispositions. Note: This will not exempt messages with Malicious or Suspicious
+ dispositions.
+ """
+
+ is_exempt_recipient: Required[bool]
+ """Messages to this recipient will bypass all detections."""
+
+ is_regex: Required[bool]
+
+ is_trusted_sender: Required[bool]
+ """Messages from this sender will bypass all detections and link following."""
+
+ pattern: Required[str]
+
+ pattern_type: Required[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]
+
+ verify_sender: Required[bool]
+ """
+ Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+ """
+
+ comments: Optional[str]
+
+ is_recipient: bool
+
+ is_sender: bool
+
+ is_spoof: bool
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
new file mode 100644
index 00000000000..5588d086dc1
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_create_response.py
@@ -0,0 +1,50 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ...._models import BaseModel
+
+__all__ = ["AllowPolicyCreateResponse"]
+
+
+class AllowPolicyCreateResponse(BaseModel):
+ id: int
+
+ created_at: datetime
+
+ is_acceptable_sender: bool
+ """
+ Messages from this sender will be exempted from Spam, Spoof and Bulk
+ dispositions. Note: This will not exempt messages with Malicious or Suspicious
+ dispositions.
+ """
+
+ is_exempt_recipient: bool
+ """Messages to this recipient will bypass all detections."""
+
+ is_regex: bool
+
+ is_trusted_sender: bool
+ """Messages from this sender will bypass all detections and link following."""
+
+ last_modified: datetime
+
+ pattern: str
+
+ pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]
+
+ verify_sender: bool
+ """
+ Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+ """
+
+ comments: Optional[str] = None
+
+ is_recipient: Optional[bool] = None
+
+ is_sender: Optional[bool] = None
+
+ is_spoof: Optional[bool] = None
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
new file mode 100644
index 00000000000..229af8c5cfe
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_delete_response.py
@@ -0,0 +1,10 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+
+from ...._models import BaseModel
+
+__all__ = ["AllowPolicyDeleteResponse"]
+
+
+class AllowPolicyDeleteResponse(BaseModel):
+ id: int
diff --git a/src/cloudflare/types/email_security/settings/allow_policy_edit_params.py b/src/cloudflare/types/email_security/settings/allow_policy_edit_params.py
new file mode 100644
index 00000000000..6b4de29a3bb
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_edit_params.py
@@ -0,0 +1,40 @@
+# 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 Literal, Required, TypedDict
+
+__all__ = ["AllowPolicyEditParams"]
+
+
+class AllowPolicyEditParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Account Identifier"""
+
+ comments: Optional[str]
+
+ is_acceptable_sender: Optional[bool]
+ """
+ Messages from this sender will be exempted from Spam, Spoof and Bulk
+ dispositions. Note: This will not exempt messages with Malicious or Suspicious
+ dispositions.
+ """
+
+ is_exempt_recipient: Optional[bool]
+ """Messages to this recipient will bypass all detections."""
+
+ is_regex: Optional[bool]
+
+ is_trusted_sender: Optional[bool]
+ """Messages from this sender will bypass all detections and link following."""
+
+ pattern: Optional[str]
+
+ pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]
+
+ verify_sender: Optional[bool]
+ """
+ Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+ """
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
new file mode 100644
index 00000000000..1424b6ccb42
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_edit_response.py
@@ -0,0 +1,50 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ...._models import BaseModel
+
+__all__ = ["AllowPolicyEditResponse"]
+
+
+class AllowPolicyEditResponse(BaseModel):
+ id: int
+
+ created_at: datetime
+
+ is_acceptable_sender: bool
+ """
+ Messages from this sender will be exempted from Spam, Spoof and Bulk
+ dispositions. Note: This will not exempt messages with Malicious or Suspicious
+ dispositions.
+ """
+
+ is_exempt_recipient: bool
+ """Messages to this recipient will bypass all detections."""
+
+ is_regex: bool
+
+ is_trusted_sender: bool
+ """Messages from this sender will bypass all detections and link following."""
+
+ last_modified: datetime
+
+ pattern: str
+
+ pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]
+
+ verify_sender: bool
+ """
+ Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+ """
+
+ comments: Optional[str] = None
+
+ is_recipient: Optional[bool] = None
+
+ is_sender: Optional[bool] = None
+
+ is_spoof: Optional[bool] = None
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
new file mode 100644
index 00000000000..aa37a40c510
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_get_response.py
@@ -0,0 +1,50 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ...._models import BaseModel
+
+__all__ = ["AllowPolicyGetResponse"]
+
+
+class AllowPolicyGetResponse(BaseModel):
+ id: int
+
+ created_at: datetime
+
+ is_acceptable_sender: bool
+ """
+ Messages from this sender will be exempted from Spam, Spoof and Bulk
+ dispositions. Note: This will not exempt messages with Malicious or Suspicious
+ dispositions.
+ """
+
+ is_exempt_recipient: bool
+ """Messages to this recipient will bypass all detections."""
+
+ is_regex: bool
+
+ is_trusted_sender: bool
+ """Messages from this sender will bypass all detections and link following."""
+
+ last_modified: datetime
+
+ pattern: str
+
+ pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]
+
+ verify_sender: bool
+ """
+ Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+ """
+
+ comments: Optional[str] = None
+
+ is_recipient: Optional[bool] = None
+
+ is_sender: Optional[bool] = None
+
+ is_spoof: Optional[bool] = None
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
new file mode 100644
index 00000000000..c81ccd0532c
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_list_params.py
@@ -0,0 +1,41 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["AllowPolicyListParams"]
+
+
+class AllowPolicyListParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Account Identifier"""
+
+ direction: Literal["asc", "desc"]
+ """The sorting direction."""
+
+ is_recipient: bool
+
+ is_sender: bool
+
+ is_spoof: bool
+
+ order: Literal["pattern", "created_at"]
+ """The field to sort by."""
+
+ page: int
+ """The page number of paginated results."""
+
+ pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]
+
+ per_page: int
+ """The number of results per page."""
+
+ search: str
+ """
+ Allows searching in multiple properties of a record simultaneously. This
+ parameter is intended for human users, not automation. Its exact behavior is
+ intentionally left unspecified and is subject to change in the future.
+ """
+
+ verify_sender: bool
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
new file mode 100644
index 00000000000..219e3bb9401
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/allow_policy_list_response.py
@@ -0,0 +1,50 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ...._models import BaseModel
+
+__all__ = ["AllowPolicyListResponse"]
+
+
+class AllowPolicyListResponse(BaseModel):
+ id: int
+
+ created_at: datetime
+
+ is_acceptable_sender: bool
+ """
+ Messages from this sender will be exempted from Spam, Spoof and Bulk
+ dispositions. Note: This will not exempt messages with Malicious or Suspicious
+ dispositions.
+ """
+
+ is_exempt_recipient: bool
+ """Messages to this recipient will bypass all detections."""
+
+ is_regex: bool
+
+ is_trusted_sender: bool
+ """Messages from this sender will bypass all detections and link following."""
+
+ last_modified: datetime
+
+ pattern: str
+
+ pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]
+
+ verify_sender: bool
+ """
+ Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors
+ policies that pass authentication.
+ """
+
+ comments: Optional[str] = None
+
+ is_recipient: Optional[bool] = None
+
+ is_sender: Optional[bool] = None
+
+ is_spoof: 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
new file mode 100644
index 00000000000..83dbc59718d
--- /dev/null
+++ b/src/cloudflare/types/email_security/settings/domain_get_response.py
@@ -0,0 +1,32 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ...._models import BaseModel
+
+__all__ = ["DomainGetResponse"]
+
+
+class DomainGetResponse(BaseModel):
+ id: int
+ """The unique identifier for the domain."""
+
+ allowed_delivery_modes: List[Literal["DIRECT", "BCC", "JOURNAL", "API", "RETRO_SCAN"]]
+
+ created_at: datetime
+
+ domain: str
+
+ last_modified: datetime
+
+ lookback_hops: int
+
+ folder: Optional[Literal["AllItems", "Inbox"]] = None
+
+ inbox_provider: Optional[Literal["Microsoft", "Google"]] = None
+
+ integration_id: Optional[str] = None
+
+ o365_tenant_id: Optional[str] = None
diff --git a/src/cloudflare/types/email_security/submission_list_params.py b/src/cloudflare/types/email_security/submission_list_params.py
new file mode 100644
index 00000000000..78a4d881344
--- /dev/null
+++ b/src/cloudflare/types/email_security/submission_list_params.py
@@ -0,0 +1,32 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from datetime import datetime
+from typing_extensions import Literal, Required, Annotated, TypedDict
+
+from ..._utils import PropertyInfo
+
+__all__ = ["SubmissionListParams"]
+
+
+class SubmissionListParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Account Identifier"""
+
+ end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
+ """The end of the search date range. Defaults to `now`."""
+
+ page: int
+ """The page number of paginated results."""
+
+ per_page: int
+ """The number of results per page."""
+
+ start: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
+ """The beginning of the search date range. Defaults to `now - 30 days`."""
+
+ submission_id: str
+
+ type: Literal["TEAM", "USER"]
diff --git a/src/cloudflare/types/email_security/submission_list_response.py b/src/cloudflare/types/email_security/submission_list_response.py
new file mode 100644
index 00000000000..b85c9a03193
--- /dev/null
+++ b/src/cloudflare/types/email_security/submission_list_response.py
@@ -0,0 +1,70 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["SubmissionListResponse"]
+
+
+class SubmissionListResponse(BaseModel):
+ requested_ts: datetime
+
+ submission_id: str
+
+ original_disposition: Optional[
+ Literal[
+ "MALICIOUS",
+ "MALICIOUS-BEC",
+ "SUSPICIOUS",
+ "SPOOF",
+ "SPAM",
+ "BULK",
+ "ENCRYPTED",
+ "EXTERNAL",
+ "UNKNOWN",
+ "NONE",
+ ]
+ ] = None
+
+ outcome: Optional[str] = None
+
+ outcome_disposition: Optional[
+ Literal[
+ "MALICIOUS",
+ "MALICIOUS-BEC",
+ "SUSPICIOUS",
+ "SPOOF",
+ "SPAM",
+ "BULK",
+ "ENCRYPTED",
+ "EXTERNAL",
+ "UNKNOWN",
+ "NONE",
+ ]
+ ] = None
+
+ requested_by: Optional[str] = None
+
+ requested_disposition: Optional[
+ Literal[
+ "MALICIOUS",
+ "MALICIOUS-BEC",
+ "SUSPICIOUS",
+ "SPOOF",
+ "SPAM",
+ "BULK",
+ "ENCRYPTED",
+ "EXTERNAL",
+ "UNKNOWN",
+ "NONE",
+ ]
+ ] = None
+
+ status: Optional[str] = None
+
+ subject: Optional[str] = None
+
+ type: Optional[str] = None
diff --git a/src/cloudflare/types/leaked_credential_check_create_params.py b/src/cloudflare/types/leaked_credential_check_create_params.py
new file mode 100644
index 00000000000..9387b96cb9d
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_check_create_params.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["LeakedCredentialCheckCreateParams"]
+
+
+class LeakedCredentialCheckCreateParams(TypedDict, total=False):
+ zone_id: Required[str]
+ """Identifier"""
+
+ enabled: bool
+ """Whether or not Leaked Credential Checks are enabled"""
diff --git a/src/cloudflare/types/leaked_credential_check_create_response.py b/src/cloudflare/types/leaked_credential_check_create_response.py
new file mode 100644
index 00000000000..3de524a4160
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_check_create_response.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from .._models import BaseModel
+
+__all__ = ["LeakedCredentialCheckCreateResponse"]
+
+
+class LeakedCredentialCheckCreateResponse(BaseModel):
+ enabled: Optional[bool] = None
+ """Whether or not Leaked Credential Checks are enabled"""
diff --git a/src/cloudflare/types/leaked_credential_check_list_response.py b/src/cloudflare/types/leaked_credential_check_list_response.py
new file mode 100644
index 00000000000..3ab990d3a57
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_check_list_response.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from .._models import BaseModel
+
+__all__ = ["LeakedCredentialCheckListResponse"]
+
+
+class LeakedCredentialCheckListResponse(BaseModel):
+ enabled: Optional[bool] = None
+ """Whether or not Leaked Credential Checks are enabled"""
diff --git a/src/cloudflare/types/leaked_credential_checks/__init__.py b/src/cloudflare/types/leaked_credential_checks/__init__.py
new file mode 100644
index 00000000000..a2cd95c5695
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_checks/__init__.py
@@ -0,0 +1,9 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .detection_create_params import DetectionCreateParams as DetectionCreateParams
+from .detection_list_response import DetectionListResponse as DetectionListResponse
+from .detection_update_params import DetectionUpdateParams as DetectionUpdateParams
+from .detection_create_response import DetectionCreateResponse as DetectionCreateResponse
+from .detection_update_response import DetectionUpdateResponse as DetectionUpdateResponse
diff --git a/src/cloudflare/types/leaked_credential_checks/detection_create_params.py b/src/cloudflare/types/leaked_credential_checks/detection_create_params.py
new file mode 100644
index 00000000000..f7277cce6d9
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_checks/detection_create_params.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["DetectionCreateParams"]
+
+
+class DetectionCreateParams(TypedDict, total=False):
+ zone_id: Required[str]
+ """Identifier"""
+
+ password: str
+ """The ruleset expression to use in matching the password in a request"""
+
+ username: str
+ """The ruleset expression to use in matching the username in a request"""
diff --git a/src/cloudflare/types/leaked_credential_checks/detection_create_response.py b/src/cloudflare/types/leaked_credential_checks/detection_create_response.py
new file mode 100644
index 00000000000..e8e7ea5cc6d
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_checks/detection_create_response.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from ..._models import BaseModel
+
+__all__ = ["DetectionCreateResponse"]
+
+
+class DetectionCreateResponse(BaseModel):
+ id: Optional[str] = None
+ """The unique ID for this custom detection"""
+
+ password: Optional[str] = None
+ """The ruleset expression to use in matching the password in a request"""
+
+ username: Optional[str] = None
+ """The ruleset expression to use in matching the username in a request"""
diff --git a/src/cloudflare/types/leaked_credential_checks/detection_list_response.py b/src/cloudflare/types/leaked_credential_checks/detection_list_response.py
new file mode 100644
index 00000000000..9423f3750aa
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_checks/detection_list_response.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from ..._models import BaseModel
+
+__all__ = ["DetectionListResponse"]
+
+
+class DetectionListResponse(BaseModel):
+ id: Optional[str] = None
+ """The unique ID for this custom detection"""
+
+ password: Optional[str] = None
+ """The ruleset expression to use in matching the password in a request"""
+
+ username: Optional[str] = None
+ """The ruleset expression to use in matching the username in a request"""
diff --git a/src/cloudflare/types/leaked_credential_checks/detection_update_params.py b/src/cloudflare/types/leaked_credential_checks/detection_update_params.py
new file mode 100644
index 00000000000..cbff67e0ab2
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_checks/detection_update_params.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["DetectionUpdateParams"]
+
+
+class DetectionUpdateParams(TypedDict, total=False):
+ zone_id: Required[str]
+ """Identifier"""
+
+ password: str
+ """The ruleset expression to use in matching the password in a request"""
+
+ username: str
+ """The ruleset expression to use in matching the username in a request"""
diff --git a/src/cloudflare/types/leaked_credential_checks/detection_update_response.py b/src/cloudflare/types/leaked_credential_checks/detection_update_response.py
new file mode 100644
index 00000000000..da71290916a
--- /dev/null
+++ b/src/cloudflare/types/leaked_credential_checks/detection_update_response.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from ..._models import BaseModel
+
+__all__ = ["DetectionUpdateResponse"]
+
+
+class DetectionUpdateResponse(BaseModel):
+ id: Optional[str] = None
+ """The unique ID for this custom detection"""
+
+ password: Optional[str] = None
+ """The ruleset expression to use in matching the password in a request"""
+
+ username: Optional[str] = None
+ """The ruleset expression to use in matching the username in a request"""
diff --git a/src/cloudflare/types/url_scanner/__init__.py b/src/cloudflare/types/url_scanner/__init__.py
index df2f5bcf89d..cf109c0b23c 100644
--- a/src/cloudflare/types/url_scanner/__init__.py
+++ b/src/cloudflare/types/url_scanner/__init__.py
@@ -16,3 +16,5 @@
from .response_get_response import ResponseGetResponse as ResponseGetResponse
from .screenshot_get_params import ScreenshotGetParams as ScreenshotGetParams
from .scan_screenshot_params import ScanScreenshotParams as ScanScreenshotParams
+from .url_scanner_bulk_params import URLScannerBulkParams as URLScannerBulkParams
+from .url_scanner_bulk_response import URLScannerBulkResponse as URLScannerBulkResponse
diff --git a/src/cloudflare/types/url_scanner/url_scanner_bulk_params.py b/src/cloudflare/types/url_scanner/url_scanner_bulk_params.py
new file mode 100644
index 00000000000..44c7452abdf
--- /dev/null
+++ b/src/cloudflare/types/url_scanner/url_scanner_bulk_params.py
@@ -0,0 +1,40 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict, List, Iterable
+from typing_extensions import Literal, Required, Annotated, TypedDict
+
+from ..._utils import PropertyInfo
+
+__all__ = ["URLScannerBulkParams", "Body"]
+
+
+class URLScannerBulkParams(TypedDict, total=False):
+ body: Required[Iterable[Body]]
+ """List of urls to scan (up to a 100)."""
+
+
+class Body(TypedDict, total=False):
+ url: Required[str]
+
+ customagent: str
+
+ custom_headers: Annotated[Dict[str, str], PropertyInfo(alias="customHeaders")]
+ """Set custom headers."""
+
+ referer: str
+
+ screenshots_resolutions: Annotated[
+ List[Literal["desktop", "mobile", "tablet"]], PropertyInfo(alias="screenshotsResolutions")
+ ]
+ """Take multiple screenshots targeting different device types."""
+
+ visibility: Literal["Public", "Unlisted"]
+ """
+ The option `Public` means it will be included in listings like recent scans and
+ search results. `Unlisted` means it will not be included in the aforementioned
+ listings, users will need to have the scan's ID to access it. A a scan will be
+ automatically marked as unlisted if it fails, if it contains potential PII or
+ other sensitive material.
+ """
diff --git a/src/cloudflare/types/url_scanner/url_scanner_bulk_response.py b/src/cloudflare/types/url_scanner/url_scanner_bulk_response.py
new file mode 100644
index 00000000000..c458a7d2508
--- /dev/null
+++ b/src/cloudflare/types/url_scanner/url_scanner_bulk_response.py
@@ -0,0 +1,34 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+from typing_extensions import TypeAlias
+
+from ..._models import BaseModel
+
+__all__ = ["URLScannerBulkResponse", "URLScannerBulkResponseItem", "URLScannerBulkResponseItemOptions"]
+
+
+class URLScannerBulkResponseItemOptions(BaseModel):
+ useragent: Optional[str] = None
+
+
+class URLScannerBulkResponseItem(BaseModel):
+ api: str
+ """URL to api report."""
+
+ result: str
+ """URL to report."""
+
+ url: str
+ """Submitted URL"""
+
+ uuid: str
+ """Scan ID."""
+
+ visibility: str
+ """Submitted visibility status."""
+
+ options: Optional[URLScannerBulkResponseItemOptions] = None
+
+
+URLScannerBulkResponse: TypeAlias = List[URLScannerBulkResponseItem]
diff --git a/src/cloudflare/types/zero_trust/dlp/__init__.py b/src/cloudflare/types/zero_trust/dlp/__init__.py
index b6c5ef3b762..fa6d87dbb47 100644
--- a/src/cloudflare/types/zero_trust/dlp/__init__.py
+++ b/src/cloudflare/types/zero_trust/dlp/__init__.py
@@ -7,11 +7,17 @@
from .dataset_array import DatasetArray as DatasetArray
from .dataset_creation import DatasetCreation as DatasetCreation
from .context_awareness import ContextAwareness as ContextAwareness
+from .entry_get_response import EntryGetResponse as EntryGetResponse
from .skip_configuration import SkipConfiguration as SkipConfiguration
+from .entry_create_params import EntryCreateParams as EntryCreateParams
+from .entry_list_response import EntryListResponse as EntryListResponse
+from .entry_update_params import EntryUpdateParams as EntryUpdateParams
from .limit_list_response import LimitListResponse as LimitListResponse
from .profile_list_params import ProfileListParams as ProfileListParams
from .dataset_create_params import DatasetCreateParams as DatasetCreateParams
from .dataset_update_params import DatasetUpdateParams as DatasetUpdateParams
+from .entry_create_response import EntryCreateResponse as EntryCreateResponse
+from .entry_update_response import EntryUpdateResponse as EntryUpdateResponse
from .context_awareness_param import ContextAwarenessParam as ContextAwarenessParam
from .pattern_validate_params import PatternValidateParams as PatternValidateParams
from .payload_log_get_response import PayloadLogGetResponse as PayloadLogGetResponse
diff --git a/src/cloudflare/types/zero_trust/dlp/entry_create_params.py b/src/cloudflare/types/zero_trust/dlp/entry_create_params.py
new file mode 100644
index 00000000000..3b0f427909e
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/dlp/entry_create_params.py
@@ -0,0 +1,21 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+from .profiles.pattern_param import PatternParam
+
+__all__ = ["EntryCreateParams"]
+
+
+class EntryCreateParams(TypedDict, total=False):
+ account_id: Required[str]
+
+ enabled: Required[bool]
+
+ name: Required[str]
+
+ pattern: Required[PatternParam]
+
+ profile_id: Required[str]
diff --git a/src/cloudflare/types/zero_trust/dlp/entry_create_response.py b/src/cloudflare/types/zero_trust/dlp/entry_create_response.py
new file mode 100644
index 00000000000..a21a44fe06e
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/dlp/entry_create_response.py
@@ -0,0 +1,25 @@
+# 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
+from .profiles.pattern import Pattern
+
+__all__ = ["EntryCreateResponse"]
+
+
+class EntryCreateResponse(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ pattern: Pattern
+
+ updated_at: datetime
+
+ profile_id: Optional[str] = None
diff --git a/src/cloudflare/types/zero_trust/dlp/entry_get_response.py b/src/cloudflare/types/zero_trust/dlp/entry_get_response.py
new file mode 100644
index 00000000000..0b88f2a8d76
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/dlp/entry_get_response.py
@@ -0,0 +1,112 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+from datetime import datetime
+from typing_extensions import Literal, TypeAlias
+
+from ...._models import BaseModel
+from .profiles.pattern import Pattern
+
+__all__ = [
+ "EntryGetResponse",
+ "CustomEntry",
+ "PredefinedEntry",
+ "PredefinedEntryConfidence",
+ "IntegrationEntry",
+ "ExactDataEntry",
+ "WordListEntry",
+]
+
+
+class CustomEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ pattern: Pattern
+
+ type: Literal["custom"]
+
+ updated_at: datetime
+
+ profile_id: Optional[str] = None
+
+
+class PredefinedEntryConfidence(BaseModel):
+ available: bool
+ """
+ Indicates whether this entry can be made more or less sensitive by setting a
+ confidence threshold. Profiles that use an entry with `available` set to true
+ can use confidence thresholds
+ """
+
+
+class PredefinedEntry(BaseModel):
+ id: str
+
+ confidence: PredefinedEntryConfidence
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["predefined"]
+
+ profile_id: Optional[str] = None
+
+
+class IntegrationEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["integration"]
+
+ updated_at: datetime
+
+ profile_id: Optional[str] = None
+
+
+class ExactDataEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ secret: bool
+
+ type: Literal["exact_data"]
+
+ updated_at: datetime
+
+
+class WordListEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["word_list"]
+
+ updated_at: datetime
+
+ word_list: object
+
+ profile_id: Optional[str] = None
+
+
+EntryGetResponse: TypeAlias = Union[CustomEntry, PredefinedEntry, IntegrationEntry, ExactDataEntry, WordListEntry]
diff --git a/src/cloudflare/types/zero_trust/dlp/entry_list_response.py b/src/cloudflare/types/zero_trust/dlp/entry_list_response.py
new file mode 100644
index 00000000000..0f9751b42cf
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/dlp/entry_list_response.py
@@ -0,0 +1,112 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+from datetime import datetime
+from typing_extensions import Literal, TypeAlias
+
+from ...._models import BaseModel
+from .profiles.pattern import Pattern
+
+__all__ = [
+ "EntryListResponse",
+ "CustomEntry",
+ "PredefinedEntry",
+ "PredefinedEntryConfidence",
+ "IntegrationEntry",
+ "ExactDataEntry",
+ "WordListEntry",
+]
+
+
+class CustomEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ pattern: Pattern
+
+ type: Literal["custom"]
+
+ updated_at: datetime
+
+ profile_id: Optional[str] = None
+
+
+class PredefinedEntryConfidence(BaseModel):
+ available: bool
+ """
+ Indicates whether this entry can be made more or less sensitive by setting a
+ confidence threshold. Profiles that use an entry with `available` set to true
+ can use confidence thresholds
+ """
+
+
+class PredefinedEntry(BaseModel):
+ id: str
+
+ confidence: PredefinedEntryConfidence
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["predefined"]
+
+ profile_id: Optional[str] = None
+
+
+class IntegrationEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["integration"]
+
+ updated_at: datetime
+
+ profile_id: Optional[str] = None
+
+
+class ExactDataEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ secret: bool
+
+ type: Literal["exact_data"]
+
+ updated_at: datetime
+
+
+class WordListEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["word_list"]
+
+ updated_at: datetime
+
+ word_list: object
+
+ profile_id: Optional[str] = None
+
+
+EntryListResponse: TypeAlias = Union[CustomEntry, PredefinedEntry, IntegrationEntry, ExactDataEntry, WordListEntry]
diff --git a/src/cloudflare/types/zero_trust/dlp/entry_update_params.py b/src/cloudflare/types/zero_trust/dlp/entry_update_params.py
new file mode 100644
index 00000000000..2caba23715c
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/dlp/entry_update_params.py
@@ -0,0 +1,35 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from typing_extensions import Literal, Required, TypeAlias, TypedDict
+
+from .profiles.pattern_param import PatternParam
+
+__all__ = ["EntryUpdateParams", "Variant0", "Variant1", "Variant2"]
+
+
+class Variant0(TypedDict, total=False):
+ account_id: Required[str]
+
+ name: Required[str]
+
+ pattern: Required[PatternParam]
+
+ type: Required[Literal["custom"]]
+
+
+class Variant1(TypedDict, total=False):
+ account_id: Required[str]
+
+ type: Required[Literal["predefined"]]
+
+
+class Variant2(TypedDict, total=False):
+ account_id: Required[str]
+
+ type: Required[Literal["integration"]]
+
+
+EntryUpdateParams: TypeAlias = Union[Variant0, Variant1, Variant2]
diff --git a/src/cloudflare/types/zero_trust/dlp/entry_update_response.py b/src/cloudflare/types/zero_trust/dlp/entry_update_response.py
new file mode 100644
index 00000000000..acaa3686d63
--- /dev/null
+++ b/src/cloudflare/types/zero_trust/dlp/entry_update_response.py
@@ -0,0 +1,112 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+from datetime import datetime
+from typing_extensions import Literal, TypeAlias
+
+from ...._models import BaseModel
+from .profiles.pattern import Pattern
+
+__all__ = [
+ "EntryUpdateResponse",
+ "CustomEntry",
+ "PredefinedEntry",
+ "PredefinedEntryConfidence",
+ "IntegrationEntry",
+ "ExactDataEntry",
+ "WordListEntry",
+]
+
+
+class CustomEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ pattern: Pattern
+
+ type: Literal["custom"]
+
+ updated_at: datetime
+
+ profile_id: Optional[str] = None
+
+
+class PredefinedEntryConfidence(BaseModel):
+ available: bool
+ """
+ Indicates whether this entry can be made more or less sensitive by setting a
+ confidence threshold. Profiles that use an entry with `available` set to true
+ can use confidence thresholds
+ """
+
+
+class PredefinedEntry(BaseModel):
+ id: str
+
+ confidence: PredefinedEntryConfidence
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["predefined"]
+
+ profile_id: Optional[str] = None
+
+
+class IntegrationEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["integration"]
+
+ updated_at: datetime
+
+ profile_id: Optional[str] = None
+
+
+class ExactDataEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ secret: bool
+
+ type: Literal["exact_data"]
+
+ updated_at: datetime
+
+
+class WordListEntry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ enabled: bool
+
+ name: str
+
+ type: Literal["word_list"]
+
+ updated_at: datetime
+
+ word_list: object
+
+ profile_id: Optional[str] = None
+
+
+EntryUpdateResponse: TypeAlias = Union[CustomEntry, PredefinedEntry, IntegrationEntry, ExactDataEntry, WordListEntry]
diff --git a/tests/api_resources/email_security/investigate/__init__.py b/tests/api_resources/email_security/investigate/__init__.py
new file mode 100644
index 00000000000..fd8019a9a1a
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/__init__.py
@@ -0,0 +1 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/email_security/investigate/test_detections.py b/tests/api_resources/email_security/investigate/test_detections.py
new file mode 100644
index 00000000000..0efb7939121
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/test_detections.py
@@ -0,0 +1,118 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.email_security.investigate import DetectionGetResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestDetections:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ detection = client.email_security.investigate.detections.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DetectionGetResponse, detection, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.detections.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = response.parse()
+ assert_matches_type(DetectionGetResponse, detection, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.detections.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = response.parse()
+ assert_matches_type(DetectionGetResponse, detection, 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.investigate.detections.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ client.email_security.investigate.detections.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+
+class TestAsyncDetections:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ detection = await async_client.email_security.investigate.detections.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DetectionGetResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.detections.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = await response.parse()
+ assert_matches_type(DetectionGetResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.detections.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = await response.parse()
+ assert_matches_type(DetectionGetResponse, detection, 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.investigate.detections.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ await async_client.email_security.investigate.detections.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
diff --git a/tests/api_resources/email_security/investigate/test_move.py b/tests/api_resources/email_security/investigate/test_move.py
new file mode 100644
index 00000000000..b1b2b935186
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/test_move.py
@@ -0,0 +1,223 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.email_security.investigate import (
+ MoveBulkResponse,
+ MoveCreateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestMove:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ move = client.email_security.investigate.move.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ )
+ assert_matches_type(MoveCreateResponse, move, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.move.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ move = response.parse()
+ assert_matches_type(MoveCreateResponse, move, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.move.with_streaming_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ move = response.parse()
+ assert_matches_type(MoveCreateResponse, move, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.move.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ destination="Inbox",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ client.email_security.investigate.move.with_raw_response.create(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ )
+
+ @parametrize
+ def test_method_bulk(self, client: Cloudflare) -> None:
+ move = client.email_security.investigate.move.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ )
+ assert_matches_type(MoveBulkResponse, move, path=["response"])
+
+ @parametrize
+ def test_raw_response_bulk(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.move.with_raw_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ move = response.parse()
+ assert_matches_type(MoveBulkResponse, move, path=["response"])
+
+ @parametrize
+ def test_streaming_response_bulk(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.move.with_streaming_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ move = response.parse()
+ assert_matches_type(MoveBulkResponse, move, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_bulk(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.email_security.investigate.move.with_raw_response.bulk(
+ account_id="",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ )
+
+
+class TestAsyncMove:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ move = await async_client.email_security.investigate.move.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ )
+ assert_matches_type(MoveCreateResponse, move, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.move.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ move = await response.parse()
+ assert_matches_type(MoveCreateResponse, move, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.move.with_streaming_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ move = await response.parse()
+ assert_matches_type(MoveCreateResponse, move, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.move.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ destination="Inbox",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ await async_client.email_security.investigate.move.with_raw_response.create(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ )
+
+ @parametrize
+ async def test_method_bulk(self, async_client: AsyncCloudflare) -> None:
+ move = await async_client.email_security.investigate.move.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ )
+ assert_matches_type(MoveBulkResponse, move, path=["response"])
+
+ @parametrize
+ async def test_raw_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.move.with_raw_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ move = await response.parse()
+ assert_matches_type(MoveBulkResponse, move, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.move.with_streaming_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ move = await response.parse()
+ assert_matches_type(MoveBulkResponse, move, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_bulk(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.move.with_raw_response.bulk(
+ account_id="",
+ destination="Inbox",
+ postfix_ids=["4Njp3P0STMz2c02Q"],
+ )
diff --git a/tests/api_resources/email_security/investigate/test_preview.py b/tests/api_resources/email_security/investigate/test_preview.py
new file mode 100644
index 00000000000..4d773c0d59a
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/test_preview.py
@@ -0,0 +1,202 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.email_security.investigate import PreviewGetResponse, PreviewCreateResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestPreview:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ preview = client.email_security.investigate.preview.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+ assert_matches_type(PreviewCreateResponse, preview, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.preview.with_raw_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ preview = response.parse()
+ assert_matches_type(PreviewCreateResponse, preview, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.preview.with_streaming_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ preview = response.parse()
+ assert_matches_type(PreviewCreateResponse, preview, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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"],
+ )
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ preview = client.email_security.investigate.preview.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(PreviewGetResponse, preview, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.preview.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ preview = response.parse()
+ assert_matches_type(PreviewGetResponse, preview, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.preview.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ preview = response.parse()
+ assert_matches_type(PreviewGetResponse, preview, 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.investigate.preview.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ client.email_security.investigate.preview.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+
+class TestAsyncPreview:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ preview = await async_client.email_security.investigate.preview.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+ assert_matches_type(PreviewCreateResponse, preview, path=["response"])
+
+ @parametrize
+ 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"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ preview = await response.parse()
+ assert_matches_type(PreviewCreateResponse, preview, path=["response"])
+
+ @parametrize
+ 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"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ preview = await response.parse()
+ assert_matches_type(PreviewCreateResponse, preview, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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"],
+ )
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ preview = await async_client.email_security.investigate.preview.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(PreviewGetResponse, preview, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.preview.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ preview = await response.parse()
+ assert_matches_type(PreviewGetResponse, preview, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.preview.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ preview = await response.parse()
+ assert_matches_type(PreviewGetResponse, preview, 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.investigate.preview.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ await async_client.email_security.investigate.preview.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
diff --git a/tests/api_resources/email_security/investigate/test_raw.py b/tests/api_resources/email_security/investigate/test_raw.py
new file mode 100644
index 00000000000..d7e214dc7fd
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/test_raw.py
@@ -0,0 +1,118 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.email_security.investigate import RawGetResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestRaw:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ raw = client.email_security.investigate.raw.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(RawGetResponse, raw, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.raw.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ raw = response.parse()
+ assert_matches_type(RawGetResponse, raw, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.raw.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ raw = response.parse()
+ assert_matches_type(RawGetResponse, raw, 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.investigate.raw.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ client.email_security.investigate.raw.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+
+class TestAsyncRaw:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ raw = await async_client.email_security.investigate.raw.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(RawGetResponse, raw, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.raw.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ raw = await response.parse()
+ assert_matches_type(RawGetResponse, raw, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.raw.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ raw = await response.parse()
+ assert_matches_type(RawGetResponse, raw, 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.investigate.raw.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ await async_client.email_security.investigate.raw.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
diff --git a/tests/api_resources/email_security/investigate/test_reclassify.py b/tests/api_resources/email_security/investigate/test_reclassify.py
new file mode 100644
index 00000000000..8fce2184e02
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/test_reclassify.py
@@ -0,0 +1,147 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestReclassify:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ reclassify = client.email_security.investigate.reclassify.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ )
+ assert_matches_type(object, reclassify, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ reclassify = client.email_security.investigate.reclassify.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ eml_content="eml_content",
+ )
+ assert_matches_type(object, reclassify, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.reclassify.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ reclassify = response.parse()
+ assert_matches_type(object, reclassify, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.reclassify.with_streaming_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ reclassify = response.parse()
+ assert_matches_type(object, reclassify, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.reclassify.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ expected_disposition="NONE",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ client.email_security.investigate.reclassify.with_raw_response.create(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ )
+
+
+class TestAsyncReclassify:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ reclassify = await async_client.email_security.investigate.reclassify.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ )
+ assert_matches_type(object, reclassify, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ reclassify = await async_client.email_security.investigate.reclassify.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ eml_content="eml_content",
+ )
+ assert_matches_type(object, reclassify, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.reclassify.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ reclassify = await response.parse()
+ assert_matches_type(object, reclassify, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.reclassify.with_streaming_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ reclassify = await response.parse()
+ assert_matches_type(object, reclassify, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.reclassify.with_raw_response.create(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ expected_disposition="NONE",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ await async_client.email_security.investigate.reclassify.with_raw_response.create(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ expected_disposition="NONE",
+ )
diff --git a/tests/api_resources/email_security/investigate/test_release.py b/tests/api_resources/email_security/investigate/test_release.py
new file mode 100644
index 00000000000..5d34bc6a07e
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/test_release.py
@@ -0,0 +1,106 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.email_security.investigate import ReleaseBulkResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestRelease:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_bulk(self, client: Cloudflare) -> None:
+ release = client.email_security.investigate.release.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+ assert_matches_type(ReleaseBulkResponse, release, path=["response"])
+
+ @parametrize
+ def test_raw_response_bulk(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.release.with_raw_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ release = response.parse()
+ assert_matches_type(ReleaseBulkResponse, release, path=["response"])
+
+ @parametrize
+ def test_streaming_response_bulk(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.release.with_streaming_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ release = response.parse()
+ assert_matches_type(ReleaseBulkResponse, release, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_bulk(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.email_security.investigate.release.with_raw_response.bulk(
+ account_id="",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+
+
+class TestAsyncRelease:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_bulk(self, async_client: AsyncCloudflare) -> None:
+ release = await async_client.email_security.investigate.release.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+ assert_matches_type(ReleaseBulkResponse, release, path=["response"])
+
+ @parametrize
+ async def test_raw_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.release.with_raw_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ release = await response.parse()
+ assert_matches_type(ReleaseBulkResponse, release, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.release.with_streaming_response.bulk(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ body=["4Njp3P0STMz2c02Q"],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ release = await response.parse()
+ assert_matches_type(ReleaseBulkResponse, release, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_bulk(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.release.with_raw_response.bulk(
+ account_id="",
+ body=["4Njp3P0STMz2c02Q"],
+ )
diff --git a/tests/api_resources/email_security/investigate/test_trace.py b/tests/api_resources/email_security/investigate/test_trace.py
new file mode 100644
index 00000000000..c01f3515dc4
--- /dev/null
+++ b/tests/api_resources/email_security/investigate/test_trace.py
@@ -0,0 +1,118 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.email_security.investigate import TraceGetResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestTrace:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ trace = client.email_security.investigate.trace.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(TraceGetResponse, trace, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.email_security.investigate.trace.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ trace = response.parse()
+ assert_matches_type(TraceGetResponse, trace, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.email_security.investigate.trace.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ trace = response.parse()
+ assert_matches_type(TraceGetResponse, trace, 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.investigate.trace.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ client.email_security.investigate.trace.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+
+class TestAsyncTrace:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ trace = await async_client.email_security.investigate.trace.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(TraceGetResponse, trace, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.investigate.trace.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ trace = await response.parse()
+ assert_matches_type(TraceGetResponse, trace, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.investigate.trace.with_streaming_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ trace = await response.parse()
+ assert_matches_type(TraceGetResponse, trace, 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.investigate.trace.with_raw_response.get(
+ postfix_id="4Njp3P0STMz2c02Q",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
+ await async_client.email_security.investigate.trace.with_raw_response.get(
+ postfix_id="",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
diff --git a/tests/api_resources/email_security/settings/test_allow_policies.py b/tests/api_resources/email_security/settings/test_allow_policies.py
new file mode 100644
index 00000000000..34e4d4d4d99
--- /dev/null
+++ b/tests/api_resources/email_security/settings/test_allow_policies.py
@@ -0,0 +1,591 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from cloudflare.types.email_security.settings import (
+ AllowPolicyGetResponse,
+ AllowPolicyEditResponse,
+ AllowPolicyListResponse,
+ AllowPolicyCreateResponse,
+ AllowPolicyDeleteResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestAllowPolicies:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ allow_policy = client.email_security.settings.allow_policies.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ allow_policy = client.email_security.settings.allow_policies.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ comments="Trust all messages send from test@example.com",
+ is_recipient=False,
+ is_sender=True,
+ is_spoof=False,
+ )
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.email_security.settings.allow_policies.with_raw_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.email_security.settings.allow_policies.with_streaming_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.settings.allow_policies.with_raw_response.create(
+ account_id="",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ allow_policy = client.email_security.settings.allow_policies.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ @parametrize
+ 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_recipient=True,
+ is_sender=True,
+ is_spoof=True,
+ order="pattern",
+ page=1,
+ pattern_type="EMAIL",
+ per_page=1,
+ search="search",
+ verify_sender=True,
+ )
+ assert_matches_type(SyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.email_security.settings.allow_policies.with_raw_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = response.parse()
+ assert_matches_type(SyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.email_security.settings.allow_policies.with_streaming_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = response.parse()
+ assert_matches_type(SyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.email_security.settings.allow_policies.with_raw_response.list(
+ account_id="",
+ )
+
+ @parametrize
+ def test_method_delete(self, client: Cloudflare) -> None:
+ allow_policy = client.email_security.settings.allow_policies.delete(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AllowPolicyDeleteResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_raw_response_delete(self, client: Cloudflare) -> None:
+ response = client.email_security.settings.allow_policies.with_raw_response.delete(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyDeleteResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_streaming_response_delete(self, client: Cloudflare) -> None:
+ with client.email_security.settings.allow_policies.with_streaming_response.delete(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyDeleteResponse, allow_policy, 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.allow_policies.with_raw_response.delete(
+ policy_id=2401,
+ account_id="",
+ )
+
+ @parametrize
+ def test_method_edit(self, client: Cloudflare) -> None:
+ allow_policy = client.email_security.settings.allow_policies.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
+ allow_policy = client.email_security.settings.allow_policies.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ comments="comments",
+ is_acceptable_sender=True,
+ is_exempt_recipient=True,
+ is_regex=True,
+ is_trusted_sender=True,
+ pattern="x",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_raw_response_edit(self, client: Cloudflare) -> None:
+ response = client.email_security.settings.allow_policies.with_raw_response.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_streaming_response_edit(self, client: Cloudflare) -> None:
+ with client.email_security.settings.allow_policies.with_streaming_response.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, 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.allow_policies.with_raw_response.edit(
+ policy_id=2401,
+ account_id="",
+ )
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ allow_policy = client.email_security.settings.allow_policies.get(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AllowPolicyGetResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.email_security.settings.allow_policies.with_raw_response.get(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyGetResponse, allow_policy, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.email_security.settings.allow_policies.with_streaming_response.get(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = response.parse()
+ assert_matches_type(AllowPolicyGetResponse, allow_policy, 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.allow_policies.with_raw_response.get(
+ policy_id=2401,
+ account_id="",
+ )
+
+
+class TestAsyncAllowPolicies:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ comments="Trust all messages send from test@example.com",
+ is_recipient=False,
+ is_sender=True,
+ is_spoof=False,
+ )
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.settings.allow_policies.with_raw_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.settings.allow_policies.with_streaming_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyCreateResponse, allow_policy, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.settings.allow_policies.with_raw_response.create(
+ account_id="",
+ is_acceptable_sender=False,
+ is_exempt_recipient=False,
+ is_regex=False,
+ is_trusted_sender=True,
+ pattern="test@example.com",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AsyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ direction="asc",
+ is_recipient=True,
+ is_sender=True,
+ is_spoof=True,
+ order="pattern",
+ page=1,
+ pattern_type="EMAIL",
+ per_page=1,
+ search="search",
+ verify_sender=True,
+ )
+ assert_matches_type(AsyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.settings.allow_policies.with_raw_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = await response.parse()
+ assert_matches_type(AsyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.settings.allow_policies.with_streaming_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = await response.parse()
+ assert_matches_type(AsyncV4PagePaginationArray[AllowPolicyListResponse], allow_policy, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(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.allow_policies.with_raw_response.list(
+ account_id="",
+ )
+
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.delete(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AllowPolicyDeleteResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.settings.allow_policies.with_raw_response.delete(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyDeleteResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.settings.allow_policies.with_streaming_response.delete(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyDeleteResponse, allow_policy, 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.allow_policies.with_raw_response.delete(
+ policy_id=2401,
+ account_id="",
+ )
+
+ @parametrize
+ async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ comments="comments",
+ is_acceptable_sender=True,
+ is_exempt_recipient=True,
+ is_regex=True,
+ is_trusted_sender=True,
+ pattern="x",
+ pattern_type="EMAIL",
+ verify_sender=True,
+ )
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.settings.allow_policies.with_raw_response.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.settings.allow_policies.with_streaming_response.edit(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyEditResponse, allow_policy, 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.allow_policies.with_raw_response.edit(
+ policy_id=2401,
+ account_id="",
+ )
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ allow_policy = await async_client.email_security.settings.allow_policies.get(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AllowPolicyGetResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.settings.allow_policies.with_raw_response.get(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyGetResponse, allow_policy, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.settings.allow_policies.with_streaming_response.get(
+ policy_id=2401,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ allow_policy = await response.parse()
+ assert_matches_type(AllowPolicyGetResponse, allow_policy, 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.allow_policies.with_raw_response.get(
+ policy_id=2401,
+ account_id="",
+ )
diff --git a/tests/api_resources/email_security/settings/test_domains.py b/tests/api_resources/email_security/settings/test_domains.py
index 120e9cd87b5..462d209c780 100644
--- a/tests/api_resources/email_security/settings/test_domains.py
+++ b/tests/api_resources/email_security/settings/test_domains.py
@@ -11,6 +11,7 @@
from tests.utils import assert_matches_type
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from cloudflare.types.email_security.settings import (
+ DomainGetResponse,
DomainEditResponse,
DomainListResponse,
DomainDeleteResponse,
@@ -170,6 +171,48 @@ def test_path_params_edit(self, client: Cloudflare) -> None:
account_id="",
)
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ domain = client.email_security.settings.domains.get(
+ domain_id=2400,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DomainGetResponse, domain, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.email_security.settings.domains.with_raw_response.get(
+ domain_id=2400,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ domain = response.parse()
+ assert_matches_type(DomainGetResponse, domain, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.email_security.settings.domains.with_streaming_response.get(
+ domain_id=2400,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ domain = response.parse()
+ assert_matches_type(DomainGetResponse, 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.domains.with_raw_response.get(
+ domain_id=2400,
+ account_id="",
+ )
+
class TestAsyncDomains:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -321,3 +364,45 @@ async def test_path_params_edit(self, async_client: AsyncCloudflare) -> None:
domain_id=2400,
account_id="",
)
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ domain = await async_client.email_security.settings.domains.get(
+ domain_id=2400,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DomainGetResponse, domain, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.settings.domains.with_raw_response.get(
+ domain_id=2400,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ domain = await response.parse()
+ assert_matches_type(DomainGetResponse, domain, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.settings.domains.with_streaming_response.get(
+ domain_id=2400,
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ domain = await response.parse()
+ assert_matches_type(DomainGetResponse, 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.domains.with_raw_response.get(
+ domain_id=2400,
+ account_id="",
+ )
diff --git a/tests/api_resources/email_security/test_investigate.py b/tests/api_resources/email_security/test_investigate.py
index dccf1561ae4..f0a6ec41d9b 100644
--- a/tests/api_resources/email_security/test_investigate.py
+++ b/tests/api_resources/email_security/test_investigate.py
@@ -11,14 +11,7 @@
from tests.utils import assert_matches_type
from cloudflare._utils import parse_datetime
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
-from cloudflare.types.email_security import (
- InvestigateGetResponse,
- InvestigateRawResponse,
- InvestigateListResponse,
- InvestigateTraceResponse,
- InvestigatePreviewResponse,
- InvestigateDetectionsResponse,
-)
+from cloudflare.types.email_security import InvestigateGetResponse, InvestigateListResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -86,54 +79,6 @@ def test_path_params_list(self, client: Cloudflare) -> None:
account_id="",
)
- @parametrize
- def test_method_detections(self, client: Cloudflare) -> None:
- investigate = client.email_security.investigate.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigateDetectionsResponse, investigate, path=["response"])
-
- @parametrize
- def test_raw_response_detections(self, client: Cloudflare) -> None:
- response = client.email_security.investigate.with_raw_response.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = response.parse()
- assert_matches_type(InvestigateDetectionsResponse, investigate, path=["response"])
-
- @parametrize
- def test_streaming_response_detections(self, client: Cloudflare) -> None:
- with client.email_security.investigate.with_streaming_response.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = response.parse()
- assert_matches_type(InvestigateDetectionsResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_detections(self, client: Cloudflare) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
- client.email_security.investigate.with_raw_response.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- client.email_security.investigate.with_raw_response.detections(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
@parametrize
def test_method_get(self, client: Cloudflare) -> None:
investigate = client.email_security.investigate.get(
@@ -182,150 +127,6 @@ def test_path_params_get(self, client: Cloudflare) -> None:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
- @parametrize
- def test_method_preview(self, client: Cloudflare) -> None:
- investigate = client.email_security.investigate.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigatePreviewResponse, investigate, path=["response"])
-
- @parametrize
- def test_raw_response_preview(self, client: Cloudflare) -> None:
- response = client.email_security.investigate.with_raw_response.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = response.parse()
- assert_matches_type(InvestigatePreviewResponse, investigate, path=["response"])
-
- @parametrize
- def test_streaming_response_preview(self, client: Cloudflare) -> None:
- with client.email_security.investigate.with_streaming_response.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = response.parse()
- assert_matches_type(InvestigatePreviewResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_preview(self, client: Cloudflare) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
- client.email_security.investigate.with_raw_response.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- client.email_security.investigate.with_raw_response.preview(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- @parametrize
- def test_method_raw(self, client: Cloudflare) -> None:
- investigate = client.email_security.investigate.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigateRawResponse, investigate, path=["response"])
-
- @parametrize
- def test_raw_response_raw(self, client: Cloudflare) -> None:
- response = client.email_security.investigate.with_raw_response.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = response.parse()
- assert_matches_type(InvestigateRawResponse, investigate, path=["response"])
-
- @parametrize
- def test_streaming_response_raw(self, client: Cloudflare) -> None:
- with client.email_security.investigate.with_streaming_response.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = response.parse()
- assert_matches_type(InvestigateRawResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_raw(self, client: Cloudflare) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
- client.email_security.investigate.with_raw_response.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- client.email_security.investigate.with_raw_response.raw(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- @parametrize
- def test_method_trace(self, client: Cloudflare) -> None:
- investigate = client.email_security.investigate.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigateTraceResponse, investigate, path=["response"])
-
- @parametrize
- def test_raw_response_trace(self, client: Cloudflare) -> None:
- response = client.email_security.investigate.with_raw_response.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = response.parse()
- assert_matches_type(InvestigateTraceResponse, investigate, path=["response"])
-
- @parametrize
- def test_streaming_response_trace(self, client: Cloudflare) -> None:
- with client.email_security.investigate.with_streaming_response.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = response.parse()
- assert_matches_type(InvestigateTraceResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_trace(self, client: Cloudflare) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
- client.email_security.investigate.with_raw_response.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- client.email_security.investigate.with_raw_response.trace(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
class TestAsyncInvestigate:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -390,54 +191,6 @@ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
account_id="",
)
- @parametrize
- async def test_method_detections(self, async_client: AsyncCloudflare) -> None:
- investigate = await async_client.email_security.investigate.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigateDetectionsResponse, investigate, path=["response"])
-
- @parametrize
- async def test_raw_response_detections(self, async_client: AsyncCloudflare) -> None:
- response = await async_client.email_security.investigate.with_raw_response.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = await response.parse()
- assert_matches_type(InvestigateDetectionsResponse, investigate, path=["response"])
-
- @parametrize
- async def test_streaming_response_detections(self, async_client: AsyncCloudflare) -> None:
- async with async_client.email_security.investigate.with_streaming_response.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = await response.parse()
- assert_matches_type(InvestigateDetectionsResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_detections(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.with_raw_response.detections(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- await async_client.email_security.investigate.with_raw_response.detections(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
@parametrize
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
investigate = await async_client.email_security.investigate.get(
@@ -485,147 +238,3 @@ async def test_path_params_get(self, async_client: AsyncCloudflare) -> None:
postfix_id="",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
-
- @parametrize
- async def test_method_preview(self, async_client: AsyncCloudflare) -> None:
- investigate = await async_client.email_security.investigate.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigatePreviewResponse, investigate, path=["response"])
-
- @parametrize
- async def test_raw_response_preview(self, async_client: AsyncCloudflare) -> None:
- response = await async_client.email_security.investigate.with_raw_response.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = await response.parse()
- assert_matches_type(InvestigatePreviewResponse, investigate, path=["response"])
-
- @parametrize
- async def test_streaming_response_preview(self, async_client: AsyncCloudflare) -> None:
- async with async_client.email_security.investigate.with_streaming_response.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = await response.parse()
- assert_matches_type(InvestigatePreviewResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_preview(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.with_raw_response.preview(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- await async_client.email_security.investigate.with_raw_response.preview(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- @parametrize
- async def test_method_raw(self, async_client: AsyncCloudflare) -> None:
- investigate = await async_client.email_security.investigate.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigateRawResponse, investigate, path=["response"])
-
- @parametrize
- async def test_raw_response_raw(self, async_client: AsyncCloudflare) -> None:
- response = await async_client.email_security.investigate.with_raw_response.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = await response.parse()
- assert_matches_type(InvestigateRawResponse, investigate, path=["response"])
-
- @parametrize
- async def test_streaming_response_raw(self, async_client: AsyncCloudflare) -> None:
- async with async_client.email_security.investigate.with_streaming_response.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = await response.parse()
- assert_matches_type(InvestigateRawResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_raw(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.with_raw_response.raw(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- await async_client.email_security.investigate.with_raw_response.raw(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- @parametrize
- async def test_method_trace(self, async_client: AsyncCloudflare) -> None:
- investigate = await async_client.email_security.investigate.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
- assert_matches_type(InvestigateTraceResponse, investigate, path=["response"])
-
- @parametrize
- async def test_raw_response_trace(self, async_client: AsyncCloudflare) -> None:
- response = await async_client.email_security.investigate.with_raw_response.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- investigate = await response.parse()
- assert_matches_type(InvestigateTraceResponse, investigate, path=["response"])
-
- @parametrize
- async def test_streaming_response_trace(self, async_client: AsyncCloudflare) -> None:
- async with async_client.email_security.investigate.with_streaming_response.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- investigate = await response.parse()
- assert_matches_type(InvestigateTraceResponse, investigate, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_trace(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.with_raw_response.trace(
- postfix_id="4Njp3P0STMz2c02Q",
- account_id="",
- )
-
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `postfix_id` but received ''"):
- await async_client.email_security.investigate.with_raw_response.trace(
- postfix_id="",
- account_id="023e105f4ecef8ad9ca31a8372d0c353",
- )
diff --git a/tests/api_resources/email_security/test_submissions.py b/tests/api_resources/email_security/test_submissions.py
new file mode 100644
index 00000000000..d2c0a96ec26
--- /dev/null
+++ b/tests/api_resources/email_security/test_submissions.py
@@ -0,0 +1,126 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare._utils import parse_datetime
+from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from cloudflare.types.email_security import SubmissionListResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestSubmissions:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ submission = client.email_security.submissions.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ @parametrize
+ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
+ submission = client.email_security.submissions.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ end=parse_datetime("2019-12-27T18:11:19.117Z"),
+ page=1,
+ per_page=1,
+ start=parse_datetime("2019-12-27T18:11:19.117Z"),
+ submission_id="submission_id",
+ type="TEAM",
+ )
+ assert_matches_type(SyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.email_security.submissions.with_raw_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ submission = response.parse()
+ assert_matches_type(SyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.email_security.submissions.with_streaming_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ submission = response.parse()
+ assert_matches_type(SyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.email_security.submissions.with_raw_response.list(
+ account_id="",
+ )
+
+
+class TestAsyncSubmissions:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ submission = await async_client.email_security.submissions.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AsyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ submission = await async_client.email_security.submissions.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ end=parse_datetime("2019-12-27T18:11:19.117Z"),
+ page=1,
+ per_page=1,
+ start=parse_datetime("2019-12-27T18:11:19.117Z"),
+ submission_id="submission_id",
+ type="TEAM",
+ )
+ assert_matches_type(AsyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.email_security.submissions.with_raw_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ submission = await response.parse()
+ assert_matches_type(AsyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.email_security.submissions.with_streaming_response.list(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ submission = await response.parse()
+ assert_matches_type(AsyncV4PagePaginationArray[SubmissionListResponse], submission, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(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.submissions.with_raw_response.list(
+ account_id="",
+ )
diff --git a/tests/api_resources/leaked_credential_checks/__init__.py b/tests/api_resources/leaked_credential_checks/__init__.py
new file mode 100644
index 00000000000..fd8019a9a1a
--- /dev/null
+++ b/tests/api_resources/leaked_credential_checks/__init__.py
@@ -0,0 +1 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/leaked_credential_checks/test_detections.py b/tests/api_resources/leaked_credential_checks/test_detections.py
new file mode 100644
index 00000000000..c74c2b245cc
--- /dev/null
+++ b/tests/api_resources/leaked_credential_checks/test_detections.py
@@ -0,0 +1,409 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
+from cloudflare.types.leaked_credential_checks import (
+ DetectionListResponse,
+ DetectionCreateResponse,
+ DetectionUpdateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestDetections:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ detection = client.leaked_credential_checks.detections.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ detection = client.leaked_credential_checks.detections.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ password='lookup_json_string(http.request.body.raw, "secret")',
+ username='lookup_json_string(http.request.body.raw, "user")',
+ )
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.leaked_credential_checks.detections.with_raw_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = response.parse()
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.leaked_credential_checks.detections.with_streaming_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = response.parse()
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_create(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ client.leaked_credential_checks.detections.with_raw_response.create(
+ zone_id="",
+ )
+
+ @parametrize
+ def test_method_update(self, client: Cloudflare) -> None:
+ detection = client.leaked_credential_checks.detections.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ @parametrize
+ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
+ detection = client.leaked_credential_checks.detections.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ password='lookup_json_string(http.request.body.raw, "secret")',
+ username='lookup_json_string(http.request.body.raw, "user")',
+ )
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ @parametrize
+ def test_raw_response_update(self, client: Cloudflare) -> None:
+ response = client.leaked_credential_checks.detections.with_raw_response.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = response.parse()
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update(self, client: Cloudflare) -> None:
+ with client.leaked_credential_checks.detections.with_streaming_response.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = response.parse()
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ client.leaked_credential_checks.detections.with_raw_response.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `detection_id` but received ''"):
+ client.leaked_credential_checks.detections.with_raw_response.update(
+ detection_id="",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ detection = client.leaked_credential_checks.detections.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(SyncSinglePage[DetectionListResponse], detection, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.leaked_credential_checks.detections.with_raw_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = response.parse()
+ assert_matches_type(SyncSinglePage[DetectionListResponse], detection, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.leaked_credential_checks.detections.with_streaming_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = response.parse()
+ assert_matches_type(SyncSinglePage[DetectionListResponse], detection, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ client.leaked_credential_checks.detections.with_raw_response.list(
+ zone_id="",
+ )
+
+ @parametrize
+ def test_method_delete(self, client: Cloudflare) -> None:
+ detection = client.leaked_credential_checks.detections.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(object, detection, path=["response"])
+
+ @parametrize
+ def test_raw_response_delete(self, client: Cloudflare) -> None:
+ response = client.leaked_credential_checks.detections.with_raw_response.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = response.parse()
+ assert_matches_type(object, detection, path=["response"])
+
+ @parametrize
+ def test_streaming_response_delete(self, client: Cloudflare) -> None:
+ with client.leaked_credential_checks.detections.with_streaming_response.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = response.parse()
+ assert_matches_type(object, detection, 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 `zone_id` but received ''"):
+ client.leaked_credential_checks.detections.with_raw_response.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `detection_id` but received ''"):
+ client.leaked_credential_checks.detections.with_raw_response.delete(
+ detection_id="",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+
+class TestAsyncDetections:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ detection = await async_client.leaked_credential_checks.detections.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ detection = await async_client.leaked_credential_checks.detections.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ password='lookup_json_string(http.request.body.raw, "secret")',
+ username='lookup_json_string(http.request.body.raw, "user")',
+ )
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.leaked_credential_checks.detections.with_raw_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = await response.parse()
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.leaked_credential_checks.detections.with_streaming_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = await response.parse()
+ assert_matches_type(DetectionCreateResponse, detection, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ await async_client.leaked_credential_checks.detections.with_raw_response.create(
+ zone_id="",
+ )
+
+ @parametrize
+ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
+ detection = await async_client.leaked_credential_checks.detections.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ detection = await async_client.leaked_credential_checks.detections.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ password='lookup_json_string(http.request.body.raw, "secret")',
+ username='lookup_json_string(http.request.body.raw, "user")',
+ )
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.leaked_credential_checks.detections.with_raw_response.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = await response.parse()
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.leaked_credential_checks.detections.with_streaming_response.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = await response.parse()
+ assert_matches_type(DetectionUpdateResponse, detection, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ await async_client.leaked_credential_checks.detections.with_raw_response.update(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `detection_id` but received ''"):
+ await async_client.leaked_credential_checks.detections.with_raw_response.update(
+ detection_id="",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ detection = await async_client.leaked_credential_checks.detections.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(AsyncSinglePage[DetectionListResponse], detection, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.leaked_credential_checks.detections.with_raw_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = await response.parse()
+ assert_matches_type(AsyncSinglePage[DetectionListResponse], detection, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.leaked_credential_checks.detections.with_streaming_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = await response.parse()
+ assert_matches_type(AsyncSinglePage[DetectionListResponse], detection, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ await async_client.leaked_credential_checks.detections.with_raw_response.list(
+ zone_id="",
+ )
+
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
+ detection = await async_client.leaked_credential_checks.detections.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(object, detection, path=["response"])
+
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.leaked_credential_checks.detections.with_raw_response.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ detection = await response.parse()
+ assert_matches_type(object, detection, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.leaked_credential_checks.detections.with_streaming_response.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ detection = await response.parse()
+ assert_matches_type(object, detection, 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 `zone_id` but received ''"):
+ await async_client.leaked_credential_checks.detections.with_raw_response.delete(
+ detection_id="18a14bafaa8eb1df04ce683ec18c765e",
+ zone_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `detection_id` but received ''"):
+ await async_client.leaked_credential_checks.detections.with_raw_response.delete(
+ detection_id="",
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
diff --git a/tests/api_resources/test_leaked_credential_checks.py b/tests/api_resources/test_leaked_credential_checks.py
new file mode 100644
index 00000000000..5fe8da324d7
--- /dev/null
+++ b/tests/api_resources/test_leaked_credential_checks.py
@@ -0,0 +1,193 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types import (
+ LeakedCredentialCheckListResponse,
+ LeakedCredentialCheckCreateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestLeakedCredentialChecks:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ leaked_credential_check = client.leaked_credential_checks.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ leaked_credential_check = client.leaked_credential_checks.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ enabled=True,
+ )
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.leaked_credential_checks.with_raw_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ leaked_credential_check = response.parse()
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.leaked_credential_checks.with_streaming_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ leaked_credential_check = response.parse()
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_create(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ client.leaked_credential_checks.with_raw_response.create(
+ zone_id="",
+ )
+
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ leaked_credential_check = client.leaked_credential_checks.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(LeakedCredentialCheckListResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.leaked_credential_checks.with_raw_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ leaked_credential_check = response.parse()
+ assert_matches_type(LeakedCredentialCheckListResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.leaked_credential_checks.with_streaming_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ leaked_credential_check = response.parse()
+ assert_matches_type(LeakedCredentialCheckListResponse, leaked_credential_check, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ client.leaked_credential_checks.with_raw_response.list(
+ zone_id="",
+ )
+
+
+class TestAsyncLeakedCredentialChecks:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ leaked_credential_check = await async_client.leaked_credential_checks.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ leaked_credential_check = await async_client.leaked_credential_checks.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ enabled=True,
+ )
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.leaked_credential_checks.with_raw_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ leaked_credential_check = await response.parse()
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.leaked_credential_checks.with_streaming_response.create(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ leaked_credential_check = await response.parse()
+ assert_matches_type(LeakedCredentialCheckCreateResponse, leaked_credential_check, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ await async_client.leaked_credential_checks.with_raw_response.create(
+ zone_id="",
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ leaked_credential_check = await async_client.leaked_credential_checks.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+ assert_matches_type(LeakedCredentialCheckListResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.leaked_credential_checks.with_raw_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ leaked_credential_check = await response.parse()
+ assert_matches_type(LeakedCredentialCheckListResponse, leaked_credential_check, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.leaked_credential_checks.with_streaming_response.list(
+ zone_id="023e105f4ecef8ad9ca31a8372d0c353",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ leaked_credential_check = await response.parse()
+ assert_matches_type(LeakedCredentialCheckListResponse, leaked_credential_check, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `zone_id` but received ''"):
+ await async_client.leaked_credential_checks.with_raw_response.list(
+ zone_id="",
+ )
diff --git a/tests/api_resources/test_url_scanner.py b/tests/api_resources/test_url_scanner.py
new file mode 100644
index 00000000000..57afc2fe48c
--- /dev/null
+++ b/tests/api_resources/test_url_scanner.py
@@ -0,0 +1,106 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.url_scanner import URLScannerBulkResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestURLScanner:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_bulk(self, client: Cloudflare) -> None:
+ url_scanner = client.url_scanner.bulk(
+ account_id="accountId",
+ body=[{"url": "https://www.example.com"}],
+ )
+ assert_matches_type(URLScannerBulkResponse, url_scanner, path=["response"])
+
+ @parametrize
+ def test_raw_response_bulk(self, client: Cloudflare) -> None:
+ response = client.url_scanner.with_raw_response.bulk(
+ account_id="accountId",
+ body=[{"url": "https://www.example.com"}],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ url_scanner = response.parse()
+ assert_matches_type(URLScannerBulkResponse, url_scanner, path=["response"])
+
+ @parametrize
+ def test_streaming_response_bulk(self, client: Cloudflare) -> None:
+ with client.url_scanner.with_streaming_response.bulk(
+ account_id="accountId",
+ body=[{"url": "https://www.example.com"}],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ url_scanner = response.parse()
+ assert_matches_type(URLScannerBulkResponse, url_scanner, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_bulk(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.url_scanner.with_raw_response.bulk(
+ account_id="",
+ body=[{"url": "https://www.example.com"}],
+ )
+
+
+class TestAsyncURLScanner:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_bulk(self, async_client: AsyncCloudflare) -> None:
+ url_scanner = await async_client.url_scanner.bulk(
+ account_id="accountId",
+ body=[{"url": "https://www.example.com"}],
+ )
+ assert_matches_type(URLScannerBulkResponse, url_scanner, path=["response"])
+
+ @parametrize
+ async def test_raw_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.url_scanner.with_raw_response.bulk(
+ account_id="accountId",
+ body=[{"url": "https://www.example.com"}],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ url_scanner = await response.parse()
+ assert_matches_type(URLScannerBulkResponse, url_scanner, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_bulk(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.url_scanner.with_streaming_response.bulk(
+ account_id="accountId",
+ body=[{"url": "https://www.example.com"}],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ url_scanner = await response.parse()
+ assert_matches_type(URLScannerBulkResponse, url_scanner, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_bulk(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.url_scanner.with_raw_response.bulk(
+ account_id="",
+ body=[{"url": "https://www.example.com"}],
+ )
diff --git a/tests/api_resources/zero_trust/dlp/test_entries.py b/tests/api_resources/zero_trust/dlp/test_entries.py
new file mode 100644
index 00000000000..d402f65a21e
--- /dev/null
+++ b/tests/api_resources/zero_trust/dlp/test_entries.py
@@ -0,0 +1,798 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, Optional, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
+from cloudflare.types.zero_trust.dlp import (
+ EntryGetResponse,
+ EntryListResponse,
+ EntryCreateResponse,
+ EntryUpdateResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestEntries:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={
+ "regex": "regex",
+ "validation": "luhn",
+ },
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.zero_trust.dlp.entries.with_raw_response.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.zero_trust.dlp.entries.with_streaming_response.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.zero_trust.dlp.entries.with_raw_response.create(
+ account_id="",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ @parametrize
+ def test_method_update_overload_1(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={
+ "regex": "regex",
+ "validation": "luhn",
+ },
+ type="custom",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None:
+ response = client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None:
+ with client.zero_trust.dlp.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update_overload_1(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+
+ @parametrize
+ def test_method_update_overload_2(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="predefined",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_raw_response_update_overload_2(self, client: Cloudflare) -> None:
+ response = client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="predefined",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None:
+ with client.zero_trust.dlp.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="predefined",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update_overload_2(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ type="predefined",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="",
+ account_id="account_id",
+ type="predefined",
+ )
+
+ @parametrize
+ def test_method_update_overload_3(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="integration",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_raw_response_update_overload_3(self, client: Cloudflare) -> None:
+ response = client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="integration",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update_overload_3(self, client: Cloudflare) -> None:
+ with client.zero_trust.dlp.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="integration",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update_overload_3(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ type="integration",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="",
+ account_id="account_id",
+ type="integration",
+ )
+
+ @parametrize
+ def test_method_list(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.list(
+ account_id="account_id",
+ )
+ assert_matches_type(SyncSinglePage[EntryListResponse], entry, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Cloudflare) -> None:
+ response = client.zero_trust.dlp.entries.with_raw_response.list(
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(SyncSinglePage[EntryListResponse], entry, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Cloudflare) -> None:
+ with client.zero_trust.dlp.entries.with_streaming_response.list(
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(SyncSinglePage[EntryListResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.list(
+ account_id="",
+ )
+
+ @parametrize
+ def test_method_delete(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+ assert_matches_type(object, entry, path=["response"])
+
+ @parametrize
+ def test_raw_response_delete(self, client: Cloudflare) -> None:
+ response = client.zero_trust.dlp.entries.with_raw_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(object, entry, path=["response"])
+
+ @parametrize
+ def test_streaming_response_delete(self, client: Cloudflare) -> None:
+ with client.zero_trust.dlp.entries.with_streaming_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(object, entry, 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.zero_trust.dlp.entries.with_raw_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.delete(
+ entry_id="",
+ account_id="account_id",
+ )
+
+ @parametrize
+ def test_method_get(self, client: Cloudflare) -> None:
+ entry = client.zero_trust.dlp.entries.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+ assert_matches_type(Optional[EntryGetResponse], entry, path=["response"])
+
+ @parametrize
+ def test_raw_response_get(self, client: Cloudflare) -> None:
+ response = client.zero_trust.dlp.entries.with_raw_response.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Optional[EntryGetResponse], entry, path=["response"])
+
+ @parametrize
+ def test_streaming_response_get(self, client: Cloudflare) -> None:
+ with client.zero_trust.dlp.entries.with_streaming_response.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Optional[EntryGetResponse], entry, 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.zero_trust.dlp.entries.with_raw_response.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.zero_trust.dlp.entries.with_raw_response.get(
+ entry_id="",
+ account_id="account_id",
+ )
+
+
+class TestAsyncEntries:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={
+ "regex": "regex",
+ "validation": "luhn",
+ },
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.dlp.entries.with_raw_response.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.dlp.entries.with_streaming_response.create(
+ account_id="account_id",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryCreateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ 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.zero_trust.dlp.entries.with_raw_response.create(
+ account_id="",
+ enabled=True,
+ name="name",
+ pattern={"regex": "regex"},
+ profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ @parametrize
+ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_method_update_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={
+ "regex": "regex",
+ "validation": "luhn",
+ },
+ type="custom",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.dlp.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="",
+ account_id="account_id",
+ name="name",
+ pattern={"regex": "regex"},
+ type="custom",
+ )
+
+ @parametrize
+ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="predefined",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="predefined",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.dlp.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="predefined",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ type="predefined",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="",
+ account_id="account_id",
+ type="predefined",
+ )
+
+ @parametrize
+ async def test_method_update_overload_3(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="integration",
+ )
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update_overload_3(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="integration",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update_overload_3(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.dlp.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ type="integration",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryUpdateResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update_overload_3(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ type="integration",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.update(
+ entry_id="",
+ account_id="account_id",
+ type="integration",
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.list(
+ account_id="account_id",
+ )
+ assert_matches_type(AsyncSinglePage[EntryListResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.dlp.entries.with_raw_response.list(
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(AsyncSinglePage[EntryListResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.dlp.entries.with_streaming_response.list(
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(AsyncSinglePage[EntryListResponse], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.list(
+ account_id="",
+ )
+
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+ assert_matches_type(object, entry, path=["response"])
+
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.dlp.entries.with_raw_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(object, entry, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.dlp.entries.with_streaming_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(object, entry, 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.zero_trust.dlp.entries.with_raw_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.delete(
+ entry_id="",
+ account_id="account_id",
+ )
+
+ @parametrize
+ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
+ entry = await async_client.zero_trust.dlp.entries.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+ assert_matches_type(Optional[EntryGetResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.zero_trust.dlp.entries.with_raw_response.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryGetResponse], entry, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.zero_trust.dlp.entries.with_streaming_response.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="account_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Optional[EntryGetResponse], entry, 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.zero_trust.dlp.entries.with_raw_response.get(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.zero_trust.dlp.entries.with_raw_response.get(
+ entry_id="",
+ account_id="account_id",
+ )