Skip to content

Commit 982f95a

Browse files
feat(api): api update (#2284)
1 parent 6b98f7a commit 982f95a

File tree

66 files changed

+3559
-417
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3559
-417
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1467
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-df037996f4a1d35cf34bb8d9deeee63b60463bb6f8814caec9fa4c659073fb0d.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9b4bc41265e65f34a72f25fd0be8ee70604cd5687d02af20401c22046c736243.yml

src/cloudflare/resources/dns/records.py

+392-12
Large diffs are not rendered by default.

src/cloudflare/resources/email_security/settings/block_senders.py

+50-149
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, Type, Iterable, Optional, cast
6-
from typing_extensions import Literal, overload
5+
from typing import Type, Optional, cast
6+
from typing_extensions import Literal
77

88
import httpx
99

1010
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1111
from ...._utils import (
12-
required_args,
1312
maybe_transform,
1413
async_maybe_transform,
1514
)
@@ -58,7 +57,6 @@ def with_streaming_response(self) -> BlockSendersResourceWithStreamingResponse:
5857
"""
5958
return BlockSendersResourceWithStreamingResponse(self)
6059

61-
@overload
6260
def create(
6361
self,
6462
*,
@@ -88,81 +86,27 @@ def create(
8886
8987
timeout: Override the client-level default timeout for this request, in seconds
9088
"""
91-
...
92-
93-
@overload
94-
def create(
95-
self,
96-
*,
97-
account_id: str,
98-
body: Iterable[block_sender_create_params.Variant1Body],
99-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
100-
# The extra values given here take precedence over values defined on the client or passed to this method.
101-
extra_headers: Headers | None = None,
102-
extra_query: Query | None = None,
103-
extra_body: Body | None = None,
104-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
105-
) -> BlockSenderCreateResponse:
106-
"""
107-
Create a blocked email sender
108-
109-
Args:
110-
account_id: Account Identifier
111-
112-
extra_headers: Send extra headers
113-
114-
extra_query: Add additional query parameters to the request
115-
116-
extra_body: Add additional JSON properties to the request
117-
118-
timeout: Override the client-level default timeout for this request, in seconds
119-
"""
120-
...
121-
122-
@required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"])
123-
def create(
124-
self,
125-
*,
126-
account_id: str,
127-
is_regex: bool | NotGiven = NOT_GIVEN,
128-
pattern: str | NotGiven = NOT_GIVEN,
129-
pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN,
130-
comments: Optional[str] | NotGiven = NOT_GIVEN,
131-
body: Iterable[block_sender_create_params.Variant1Body] | NotGiven = NOT_GIVEN,
132-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
133-
# The extra values given here take precedence over values defined on the client or passed to this method.
134-
extra_headers: Headers | None = None,
135-
extra_query: Query | None = None,
136-
extra_body: Body | None = None,
137-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
138-
) -> BlockSenderCreateResponse:
13989
if not account_id:
14090
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
141-
return cast(
142-
BlockSenderCreateResponse,
143-
self._post(
144-
f"/accounts/{account_id}/email-security/settings/block_senders",
145-
body=maybe_transform(
146-
{
147-
"is_regex": is_regex,
148-
"pattern": pattern,
149-
"pattern_type": pattern_type,
150-
"comments": comments,
151-
"body": body,
152-
},
153-
block_sender_create_params.BlockSenderCreateParams,
154-
),
155-
options=make_request_options(
156-
extra_headers=extra_headers,
157-
extra_query=extra_query,
158-
extra_body=extra_body,
159-
timeout=timeout,
160-
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
161-
),
162-
cast_to=cast(
163-
Any, ResultWrapper[BlockSenderCreateResponse]
164-
), # Union types cannot be passed in as arguments in the type system
91+
return self._post(
92+
f"/accounts/{account_id}/email-security/settings/block_senders",
93+
body=maybe_transform(
94+
{
95+
"is_regex": is_regex,
96+
"pattern": pattern,
97+
"pattern_type": pattern_type,
98+
"comments": comments,
99+
},
100+
block_sender_create_params.BlockSenderCreateParams,
165101
),
102+
options=make_request_options(
103+
extra_headers=extra_headers,
104+
extra_query=extra_query,
105+
extra_body=extra_body,
106+
timeout=timeout,
107+
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
108+
),
109+
cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]),
166110
)
167111

168112
def list(
@@ -251,6 +195,8 @@ def delete(
251195
Args:
252196
account_id: Account Identifier
253197
198+
pattern_id: The unique identifier for the allow policy.
199+
254200
extra_headers: Send extra headers
255201
256202
extra_query: Add additional query parameters to the request
@@ -295,6 +241,8 @@ def edit(
295241
Args:
296242
account_id: Account Identifier
297243
244+
pattern_id: The unique identifier for the allow policy.
245+
298246
extra_headers: Send extra headers
299247
300248
extra_query: Add additional query parameters to the request
@@ -344,6 +292,8 @@ def get(
344292
Args:
345293
account_id: Account Identifier
346294
295+
pattern_id: The unique identifier for the allow policy.
296+
347297
extra_headers: Send extra headers
348298
349299
extra_query: Add additional query parameters to the request
@@ -387,7 +337,6 @@ def with_streaming_response(self) -> AsyncBlockSendersResourceWithStreamingRespo
387337
"""
388338
return AsyncBlockSendersResourceWithStreamingResponse(self)
389339

390-
@overload
391340
async def create(
392341
self,
393342
*,
@@ -417,81 +366,27 @@ async def create(
417366
418367
timeout: Override the client-level default timeout for this request, in seconds
419368
"""
420-
...
421-
422-
@overload
423-
async def create(
424-
self,
425-
*,
426-
account_id: str,
427-
body: Iterable[block_sender_create_params.Variant1Body],
428-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
429-
# The extra values given here take precedence over values defined on the client or passed to this method.
430-
extra_headers: Headers | None = None,
431-
extra_query: Query | None = None,
432-
extra_body: Body | None = None,
433-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
434-
) -> BlockSenderCreateResponse:
435-
"""
436-
Create a blocked email sender
437-
438-
Args:
439-
account_id: Account Identifier
440-
441-
extra_headers: Send extra headers
442-
443-
extra_query: Add additional query parameters to the request
444-
445-
extra_body: Add additional JSON properties to the request
446-
447-
timeout: Override the client-level default timeout for this request, in seconds
448-
"""
449-
...
450-
451-
@required_args(["account_id", "is_regex", "pattern", "pattern_type"], ["account_id", "body"])
452-
async def create(
453-
self,
454-
*,
455-
account_id: str,
456-
is_regex: bool | NotGiven = NOT_GIVEN,
457-
pattern: str | NotGiven = NOT_GIVEN,
458-
pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"] | NotGiven = NOT_GIVEN,
459-
comments: Optional[str] | NotGiven = NOT_GIVEN,
460-
body: Iterable[block_sender_create_params.Variant1Body] | NotGiven = NOT_GIVEN,
461-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
462-
# The extra values given here take precedence over values defined on the client or passed to this method.
463-
extra_headers: Headers | None = None,
464-
extra_query: Query | None = None,
465-
extra_body: Body | None = None,
466-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
467-
) -> BlockSenderCreateResponse:
468369
if not account_id:
469370
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
470-
return cast(
471-
BlockSenderCreateResponse,
472-
await self._post(
473-
f"/accounts/{account_id}/email-security/settings/block_senders",
474-
body=await async_maybe_transform(
475-
{
476-
"is_regex": is_regex,
477-
"pattern": pattern,
478-
"pattern_type": pattern_type,
479-
"comments": comments,
480-
"body": body,
481-
},
482-
block_sender_create_params.BlockSenderCreateParams,
483-
),
484-
options=make_request_options(
485-
extra_headers=extra_headers,
486-
extra_query=extra_query,
487-
extra_body=extra_body,
488-
timeout=timeout,
489-
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
490-
),
491-
cast_to=cast(
492-
Any, ResultWrapper[BlockSenderCreateResponse]
493-
), # Union types cannot be passed in as arguments in the type system
371+
return await self._post(
372+
f"/accounts/{account_id}/email-security/settings/block_senders",
373+
body=await async_maybe_transform(
374+
{
375+
"is_regex": is_regex,
376+
"pattern": pattern,
377+
"pattern_type": pattern_type,
378+
"comments": comments,
379+
},
380+
block_sender_create_params.BlockSenderCreateParams,
494381
),
382+
options=make_request_options(
383+
extra_headers=extra_headers,
384+
extra_query=extra_query,
385+
extra_body=extra_body,
386+
timeout=timeout,
387+
post_parser=ResultWrapper[BlockSenderCreateResponse]._unwrapper,
388+
),
389+
cast_to=cast(Type[BlockSenderCreateResponse], ResultWrapper[BlockSenderCreateResponse]),
495390
)
496391

497392
def list(
@@ -580,6 +475,8 @@ async def delete(
580475
Args:
581476
account_id: Account Identifier
582477
478+
pattern_id: The unique identifier for the allow policy.
479+
583480
extra_headers: Send extra headers
584481
585482
extra_query: Add additional query parameters to the request
@@ -624,6 +521,8 @@ async def edit(
624521
Args:
625522
account_id: Account Identifier
626523
524+
pattern_id: The unique identifier for the allow policy.
525+
627526
extra_headers: Send extra headers
628527
629528
extra_query: Add additional query parameters to the request
@@ -673,6 +572,8 @@ async def get(
673572
Args:
674573
account_id: Account Identifier
675574
575+
pattern_id: The unique identifier for the allow policy.
576+
676577
extra_headers: Send extra headers
677578
678579
extra_query: Add additional query parameters to the request

0 commit comments

Comments
 (0)