Skip to content

Commit

Permalink
feat(api): api update (#2211)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Nov 26, 2024
1 parent d01d568 commit 8d13abd
Show file tree
Hide file tree
Showing 29 changed files with 277 additions and 712 deletions.
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1451
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3151e81bdc8e6e6f3dc90b21f78c472b90c934926fef1dad65df1f1e13f21b6d.yml
configured_endpoints: 1448
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-96e28d4d04ac2f1a00dda1130ef53e8bd9f2f1590e5d7ba8bed38cad29f8b2de.yml
6 changes: 0 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1367,19 +1367,13 @@ Types:
from cloudflare.types.email_security.settings import (
TrustedDomainCreateResponse,
TrustedDomainListResponse,
TrustedDomainDeleteResponse,
TrustedDomainEditResponse,
TrustedDomainGetResponse,
)
```

Methods:

- <code title="post /accounts/{account_id}/email-security/settings/trusted_domains">client.email_security.settings.trusted_domains.<a href="./src/cloudflare/resources/email_security/settings/trusted_domains.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/email_security/settings/trusted_domain_create_params.py">params</a>) -> <a href="./src/cloudflare/types/email_security/settings/trusted_domain_create_response.py">TrustedDomainCreateResponse</a></code>
- <code title="get /accounts/{account_id}/email-security/settings/trusted_domains">client.email_security.settings.trusted_domains.<a href="./src/cloudflare/resources/email_security/settings/trusted_domains.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/email_security/settings/trusted_domain_list_params.py">params</a>) -> <a href="./src/cloudflare/types/email_security/settings/trusted_domain_list_response.py">SyncV4PagePaginationArray[TrustedDomainListResponse]</a></code>
- <code title="delete /accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}">client.email_security.settings.trusted_domains.<a href="./src/cloudflare/resources/email_security/settings/trusted_domains.py">delete</a>(pattern_id, \*, account_id) -> <a href="./src/cloudflare/types/email_security/settings/trusted_domain_delete_response.py">TrustedDomainDeleteResponse</a></code>
- <code title="patch /accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}">client.email_security.settings.trusted_domains.<a href="./src/cloudflare/resources/email_security/settings/trusted_domains.py">edit</a>(pattern_id, \*, account_id, \*\*<a href="src/cloudflare/types/email_security/settings/trusted_domain_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/email_security/settings/trusted_domain_edit_response.py">TrustedDomainEditResponse</a></code>
- <code title="get /accounts/{account_id}/email-security/settings/trusted_domains/{pattern_id}">client.email_security.settings.trusted_domains.<a href="./src/cloudflare/resources/email_security/settings/trusted_domains.py">get</a>(pattern_id, \*, account_id) -> <a href="./src/cloudflare/types/email_security/settings/trusted_domain_get_response.py">TrustedDomainGetResponse</a></code>

## Submissions

Expand Down
15 changes: 8 additions & 7 deletions src/cloudflare/resources/email_security/investigate/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, Type, cast
from typing import Type, cast

import httpx

Expand All @@ -21,6 +21,7 @@
)
from ...._wrappers import ResultWrapper
from ...._base_client import make_request_options
from ....types.email_security.investigate import preview_create_params
from ....types.email_security.investigate.preview_get_response import PreviewGetResponse
from ....types.email_security.investigate.preview_create_response import PreviewCreateResponse

Expand Down Expand Up @@ -51,7 +52,7 @@ def create(
self,
*,
account_id: str,
body: List[str],
postfix_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -65,7 +66,7 @@ def create(
Args:
account_id: Account Identifier
body: A list of messages identfied by their `postfix_id`s that should be released.
postfix_id: The identifier of the message.
extra_headers: Send extra headers
Expand All @@ -79,7 +80,7 @@ def create(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
f"/accounts/{account_id}/email-security/investigate/preview",
body=maybe_transform(body, List[str]),
body=maybe_transform({"postfix_id": postfix_id}, preview_create_params.PreviewCreateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -160,7 +161,7 @@ async def create(
self,
*,
account_id: str,
body: List[str],
postfix_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -174,7 +175,7 @@ async def create(
Args:
account_id: Account Identifier
body: A list of messages identfied by their `postfix_id`s that should be released.
postfix_id: The identifier of the message.
extra_headers: Send extra headers
Expand All @@ -188,7 +189,7 @@ async def create(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
f"/accounts/{account_id}/email-security/investigate/preview",
body=await async_maybe_transform(body, List[str]),
body=await async_maybe_transform({"postfix_id": postfix_id}, preview_create_params.PreviewCreateParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down
24 changes: 24 additions & 0 deletions src/cloudflare/resources/email_security/settings/allow_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@ def list(
*,
account_id: str,
direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
is_acceptable_sender: bool | NotGiven = NOT_GIVEN,
is_exempt_recipient: bool | NotGiven = NOT_GIVEN,
is_recipient: bool | NotGiven = NOT_GIVEN,
is_sender: bool | NotGiven = NOT_GIVEN,
is_spoof: bool | NotGiven = NOT_GIVEN,
is_trusted_sender: bool | NotGiven = NOT_GIVEN,
order: Literal["pattern", "created_at"] | NotGiven = NOT_GIVEN,
page: int | NotGiven = NOT_GIVEN,
pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -194,9 +197,12 @@ def list(
query=maybe_transform(
{
"direction": direction,
"is_acceptable_sender": is_acceptable_sender,
"is_exempt_recipient": is_exempt_recipient,
"is_recipient": is_recipient,
"is_sender": is_sender,
"is_spoof": is_spoof,
"is_trusted_sender": is_trusted_sender,
"order": order,
"page": page,
"pattern_type": pattern_type,
Expand Down Expand Up @@ -228,6 +234,8 @@ def delete(
Args:
account_id: Account Identifier
policy_id: The unique identifier for the allow policy.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand Down Expand Up @@ -276,6 +284,8 @@ def edit(
Args:
account_id: Account Identifier
policy_id: The unique identifier for the allow policy.
is_acceptable_sender: Messages from this sender will be exempted from Spam, Spoof and Bulk
dispositions. Note: This will not exempt messages with Malicious or Suspicious
dispositions.
Expand Down Expand Up @@ -340,6 +350,8 @@ def get(
Args:
account_id: Account Identifier
policy_id: The unique identifier for the allow policy.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand Down Expand Up @@ -465,9 +477,12 @@ def list(
*,
account_id: str,
direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
is_acceptable_sender: bool | NotGiven = NOT_GIVEN,
is_exempt_recipient: bool | NotGiven = NOT_GIVEN,
is_recipient: bool | NotGiven = NOT_GIVEN,
is_sender: bool | NotGiven = NOT_GIVEN,
is_spoof: bool | NotGiven = NOT_GIVEN,
is_trusted_sender: bool | NotGiven = NOT_GIVEN,
order: Literal["pattern", "created_at"] | NotGiven = NOT_GIVEN,
page: int | NotGiven = NOT_GIVEN,
pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -520,9 +535,12 @@ def list(
query=maybe_transform(
{
"direction": direction,
"is_acceptable_sender": is_acceptable_sender,
"is_exempt_recipient": is_exempt_recipient,
"is_recipient": is_recipient,
"is_sender": is_sender,
"is_spoof": is_spoof,
"is_trusted_sender": is_trusted_sender,
"order": order,
"page": page,
"pattern_type": pattern_type,
Expand Down Expand Up @@ -554,6 +572,8 @@ async def delete(
Args:
account_id: Account Identifier
policy_id: The unique identifier for the allow policy.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand Down Expand Up @@ -602,6 +622,8 @@ async def edit(
Args:
account_id: Account Identifier
policy_id: The unique identifier for the allow policy.
is_acceptable_sender: Messages from this sender will be exempted from Spam, Spoof and Bulk
dispositions. Note: This will not exempt messages with Malicious or Suspicious
dispositions.
Expand Down Expand Up @@ -666,6 +688,8 @@ async def get(
Args:
account_id: Account Identifier
policy_id: The unique identifier for the allow policy.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand Down
48 changes: 48 additions & 0 deletions src/cloudflare/resources/email_security/settings/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,29 @@ def edit(
domain_id: int,
*,
account_id: str,
ip_restrictions: List[str],
domain: Optional[str] | NotGiven = NOT_GIVEN,
drop_dispositions: List[
Literal[
"MALICIOUS",
"MALICIOUS-BEC",
"SUSPICIOUS",
"SPOOF",
"SPAM",
"BULK",
"ENCRYPTED",
"EXTERNAL",
"UNKNOWN",
"NONE",
]
]
| NotGiven = NOT_GIVEN,
folder: Literal["AllItems", "Inbox"] | NotGiven = NOT_GIVEN,
integration_id: Optional[str] | NotGiven = NOT_GIVEN,
lookback_hops: Optional[int] | NotGiven = NOT_GIVEN,
require_tls_inbound: bool | NotGiven = NOT_GIVEN,
require_tls_outbound: bool | NotGiven = NOT_GIVEN,
transport: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -246,10 +265,15 @@ def edit(
f"/accounts/{account_id}/email-security/settings/domains/{domain_id}",
body=maybe_transform(
{
"ip_restrictions": ip_restrictions,
"domain": domain,
"drop_dispositions": drop_dispositions,
"folder": folder,
"integration_id": integration_id,
"lookback_hops": lookback_hops,
"require_tls_inbound": require_tls_inbound,
"require_tls_outbound": require_tls_outbound,
"transport": transport,
},
domain_edit_params.DomainEditParams,
),
Expand Down Expand Up @@ -486,10 +510,29 @@ async def edit(
domain_id: int,
*,
account_id: str,
ip_restrictions: List[str],
domain: Optional[str] | NotGiven = NOT_GIVEN,
drop_dispositions: List[
Literal[
"MALICIOUS",
"MALICIOUS-BEC",
"SUSPICIOUS",
"SPOOF",
"SPAM",
"BULK",
"ENCRYPTED",
"EXTERNAL",
"UNKNOWN",
"NONE",
]
]
| NotGiven = NOT_GIVEN,
folder: Literal["AllItems", "Inbox"] | NotGiven = NOT_GIVEN,
integration_id: Optional[str] | NotGiven = NOT_GIVEN,
lookback_hops: Optional[int] | NotGiven = NOT_GIVEN,
require_tls_inbound: bool | NotGiven = NOT_GIVEN,
require_tls_outbound: bool | NotGiven = NOT_GIVEN,
transport: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -519,10 +562,15 @@ async def edit(
f"/accounts/{account_id}/email-security/settings/domains/{domain_id}",
body=await async_maybe_transform(
{
"ip_restrictions": ip_restrictions,
"domain": domain,
"drop_dispositions": drop_dispositions,
"folder": folder,
"integration_id": integration_id,
"lookback_hops": lookback_hops,
"require_tls_inbound": require_tls_inbound,
"require_tls_outbound": require_tls_outbound,
"transport": transport,
},
domain_edit_params.DomainEditParams,
),
Expand Down
Loading

0 comments on commit 8d13abd

Please sign in to comment.