Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1467
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-df037996f4a1d35cf34bb8d9deeee63b60463bb6f8814caec9fa4c659073fb0d.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9b4bc41265e65f34a72f25fd0be8ee70604cd5687d02af20401c22046c736243.yml
404 changes: 392 additions & 12 deletions src/cloudflare/resources/dns/records.py

Large diffs are not rendered by default.

199 changes: 50 additions & 149 deletions src/cloudflare/resources/email_security/settings/block_senders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

from __future__ import annotations

from typing import Any, Type, Iterable, Optional, cast
from typing_extensions import Literal, overload
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 (
required_args,
maybe_transform,
async_maybe_transform,
)
Expand Down Expand Up @@ -58,7 +57,6 @@ def with_streaming_response(self) -> BlockSendersResourceWithStreamingResponse:
"""
return BlockSendersResourceWithStreamingResponse(self)

@overload
def create(
self,
*,
Expand Down Expand Up @@ -88,81 +86,27 @@ def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
...

@overload
def create(
self,
*,
account_id: str,
body: Iterable[block_sender_create_params.Variant1Body],
# 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,
) -> BlockSenderCreateResponse:
"""
Create a blocked email sender

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
"""
...

@required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"])
def create(
self,
*,
account_id: str,
is_regex: bool | NotGiven = NOT_GIVEN,
pattern: str | NotGiven = NOT_GIVEN,
pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN,
comments: Optional[str] | NotGiven = NOT_GIVEN,
body: Iterable[block_sender_create_params.Variant1Body] | 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,
) -> BlockSenderCreateResponse:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return cast(
BlockSenderCreateResponse,
self._post(
f"/accounts/{account_id}/email-security/settings/block_senders",
body=maybe_transform(
{
"is_regex": is_regex,
"pattern": pattern,
"pattern_type": pattern_type,
"comments": comments,
"body": body,
},
block_sender_create_params.BlockSenderCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[BlockSenderCreateResponse]
), # Union types cannot be passed in as arguments in the type system
return self._post(
f"/accounts/{account_id}/email-security/settings/block_senders",
body=maybe_transform(
{
"is_regex": is_regex,
"pattern": pattern,
"pattern_type": pattern_type,
"comments": comments,
},
block_sender_create_params.BlockSenderCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
),
cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]),
)

def list(
Expand Down Expand Up @@ -251,6 +195,8 @@ def delete(
Args:
account_id: Account Identifier

pattern_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 @@ -295,6 +241,8 @@ def edit(
Args:
account_id: Account Identifier

pattern_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 @@ -344,6 +292,8 @@ def get(
Args:
account_id: Account Identifier

pattern_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 @@ -387,7 +337,6 @@ def with_streaming_response(self) -> AsyncBlockSendersResourceWithStreamingRespo
"""
return AsyncBlockSendersResourceWithStreamingResponse(self)

@overload
async def create(
self,
*,
Expand Down Expand Up @@ -417,81 +366,27 @@ async def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
...

@overload
async def create(
self,
*,
account_id: str,
body: Iterable[block_sender_create_params.Variant1Body],
# 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,
) -> BlockSenderCreateResponse:
"""
Create a blocked email sender

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
"""
...

@required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"])
async def create(
self,
*,
account_id: str,
is_regex: bool | NotGiven = NOT_GIVEN,
pattern: str | NotGiven = NOT_GIVEN,
pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN,
comments: Optional[str] | NotGiven = NOT_GIVEN,
body: Iterable[block_sender_create_params.Variant1Body] | 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,
) -> BlockSenderCreateResponse:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return cast(
BlockSenderCreateResponse,
await self._post(
f"/accounts/{account_id}/email-security/settings/block_senders",
body=await async_maybe_transform(
{
"is_regex": is_regex,
"pattern": pattern,
"pattern_type": pattern_type,
"comments": comments,
"body": body,
},
block_sender_create_params.BlockSenderCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[BlockSenderCreateResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._post(
f"/accounts/{account_id}/email-security/settings/block_senders",
body=await async_maybe_transform(
{
"is_regex": is_regex,
"pattern": pattern,
"pattern_type": pattern_type,
"comments": comments,
},
block_sender_create_params.BlockSenderCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
),
cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]),
)

def list(
Expand Down Expand Up @@ -580,6 +475,8 @@ async def delete(
Args:
account_id: Account Identifier

pattern_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 @@ -624,6 +521,8 @@ async def edit(
Args:
account_id: Account Identifier

pattern_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 @@ -673,6 +572,8 @@ async def get(
Args:
account_id: Account Identifier

pattern_id: The unique identifier for the allow policy.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand Down
Loading