diff --git a/.stats.yml b/.stats.yml index b0cb3255a62..7b854f28633 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1269 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-35412fd158c3e184d9aa368a2fd1c169ec542af1a1892f41155afe8df8ad79bf.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4fc19263c4199ac7a9f52555bb93fb6873cdf2fd27956ca936d69a5f32a26204.yml diff --git a/README.md b/README.md index e9794b3725e..9e5395a7053 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,7 @@ client = Cloudflare( ) # Override per-request: -client.with_options(timeout=5 * 1000).zones.edit( +client.with_options(timeout=5.0).zones.edit( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) ``` diff --git a/api.md b/api.md index 6a46abc2cbe..b842639a7e8 100644 --- a/api.md +++ b/api.md @@ -3636,7 +3636,7 @@ from cloudflare.types.intel import Whois, WhoisGetResponse Methods: -- client.intel.whois.get(\*, account_id, \*\*params) -> Optional +- client.intel.whois.get(\*, account_id, \*\*params) -> WhoisGetResponse ## IndicatorFeeds @@ -7355,14 +7355,14 @@ from cloudflare.types.cloudforce_one import ( Methods: -- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Optional -- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Item +- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Item - client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[ListItem] - client.cloudforce_one.requests.delete(request_identifier, \*, account_identifier) -> RequestDeleteResponse -- client.cloudforce_one.requests.constants(account_identifier) -> Optional -- client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Optional -- client.cloudforce_one.requests.quota(account_identifier) -> Optional -- client.cloudforce_one.requests.types(account_identifier) -> Optional +- client.cloudforce_one.requests.constants(account_identifier) -> RequestConstants +- client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Item +- client.cloudforce_one.requests.quota(account_identifier) -> Quota +- client.cloudforce_one.requests.types(account_identifier) -> RequestTypes ### Message @@ -7378,10 +7378,10 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> Optional -- client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> Message +- client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> Message - client.cloudforce_one.requests.message.delete(message_identifer, \*, account_identifier, request_identifier) -> MessageDeleteResponse -- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> MessageGetResponse ### Priority @@ -7398,11 +7398,11 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.priority.create(account_identifier, \*\*params) -> Optional -- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.priority.create(account_identifier, \*\*params) -> Priority +- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> Item - client.cloudforce_one.requests.priority.delete(priority_identifer, \*, account_identifier) -> PriorityDeleteResponse -- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Optional -- client.cloudforce_one.requests.priority.quota(account_identifier) -> Optional +- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Item +- client.cloudforce_one.requests.priority.quota(account_identifier) -> Quota # EventNotifications diff --git a/src/cloudflare/resources/cloudforce_one/requests/message.py b/src/cloudflare/resources/cloudforce_one/requests/message.py index 177e2c5b099..eaea1a987b6 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/message.py +++ b/src/cloudflare/resources/cloudforce_one/requests/message.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, Optional, cast +from typing import Any, Type, Union, cast from datetime import datetime from typing_extensions import Literal @@ -54,7 +54,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Message]: + ) -> Message: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -87,9 +87,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Message]]._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) def update( @@ -109,7 +109,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Message]: + ) -> Message: """ Update a Request Message @@ -157,9 +157,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Message]]._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) def delete( @@ -195,12 +195,21 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + return cast( + MessageDeleteResponse, + self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[MessageDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=MessageDeleteResponse, ) def get( @@ -220,7 +229,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MessageGetResponse]: + ) -> MessageGetResponse: """ List Request Messages @@ -271,9 +280,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper, + post_parser=ResultWrapper[MessageGetResponse]._unwrapper, ), - cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]), + cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), ) @@ -298,7 +307,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Message]: + ) -> Message: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -331,9 +340,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Message]]._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) async def update( @@ -353,7 +362,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Message]: + ) -> Message: """ Update a Request Message @@ -401,9 +410,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Message]]._unwrapper, + post_parser=ResultWrapper[Message]._unwrapper, ), - cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), + cast_to=cast(Type[Message], ResultWrapper[Message]), ) async def delete( @@ -439,12 +448,21 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return await self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + return cast( + MessageDeleteResponse, + await self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[MessageDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=MessageDeleteResponse, ) async def get( @@ -464,7 +482,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MessageGetResponse]: + ) -> MessageGetResponse: """ List Request Messages @@ -515,9 +533,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper, + post_parser=ResultWrapper[MessageGetResponse]._unwrapper, ), - cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]), + cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), ) diff --git a/src/cloudflare/resources/cloudforce_one/requests/priority.py b/src/cloudflare/resources/cloudforce_one/requests/priority.py index 243e43f789b..0f1d6795a40 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/priority.py +++ b/src/cloudflare/resources/cloudforce_one/requests/priority.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Optional, cast +from typing import Any, List, Type, cast from typing_extensions import Literal import httpx @@ -57,7 +57,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Priority]: + ) -> Priority: """ Create a New Priority Requirement @@ -98,9 +98,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Priority]]._unwrapper, + post_parser=ResultWrapper[Priority]._unwrapper, ), - cast_to=cast(Type[Optional[Priority]], ResultWrapper[Priority]), + cast_to=cast(Type[Priority], ResultWrapper[Priority]), ) def update( @@ -118,7 +118,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Update a Priority Intelligence Requirement @@ -163,9 +163,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def delete( @@ -200,12 +200,21 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not priority_identifer: raise ValueError(f"Expected a non-empty value for `priority_identifer` but received {priority_identifer!r}") - return self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + return cast( + PriorityDeleteResponse, + self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[PriorityDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[PriorityDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=PriorityDeleteResponse, ) def get( @@ -219,7 +228,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Get a Priority Intelligence Requirement @@ -247,9 +256,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def quota( @@ -262,7 +271,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Quota]: + ) -> Quota: """ Get Priority Intelligence Requirement Quota @@ -286,9 +295,9 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Quota]]._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) @@ -315,7 +324,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Priority]: + ) -> Priority: """ Create a New Priority Requirement @@ -356,9 +365,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Priority]]._unwrapper, + post_parser=ResultWrapper[Priority]._unwrapper, ), - cast_to=cast(Type[Optional[Priority]], ResultWrapper[Priority]), + cast_to=cast(Type[Priority], ResultWrapper[Priority]), ) async def update( @@ -376,7 +385,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Update a Priority Intelligence Requirement @@ -421,9 +430,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def delete( @@ -458,12 +467,21 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not priority_identifer: raise ValueError(f"Expected a non-empty value for `priority_identifer` but received {priority_identifer!r}") - return await self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + return cast( + PriorityDeleteResponse, + await self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[PriorityDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[PriorityDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=PriorityDeleteResponse, ) async def get( @@ -477,7 +495,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Get a Priority Intelligence Requirement @@ -505,9 +523,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def quota( @@ -520,7 +538,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Quota]: + ) -> Quota: """ Get Priority Intelligence Requirement Quota @@ -544,9 +562,9 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Quota]]._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) diff --git a/src/cloudflare/resources/cloudforce_one/requests/requests.py b/src/cloudflare/resources/cloudforce_one/requests/requests.py index 267e04595d6..61a739aaa7c 100644 --- a/src/cloudflare/resources/cloudforce_one/requests/requests.py +++ b/src/cloudflare/resources/cloudforce_one/requests/requests.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Union, Optional, cast +from typing import Any, Type, Union, cast from datetime import datetime from typing_extensions import Literal @@ -86,7 +86,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -132,9 +132,9 @@ def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def update( @@ -153,7 +153,7 @@ def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """Updating a request alters the request in the Cloudforce One queue. This API may @@ -204,9 +204,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def list( @@ -323,12 +323,21 @@ def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + return cast( + RequestDeleteResponse, + self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[RequestDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[RequestDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=RequestDeleteResponse, ) def constants( @@ -341,7 +350,7 @@ def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RequestConstants]: + ) -> RequestConstants: """ Get Request Priority, Status, and TLP constants @@ -365,9 +374,9 @@ def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RequestConstants]]._unwrapper, + post_parser=ResultWrapper[RequestConstants]._unwrapper, ), - cast_to=cast(Type[Optional[RequestConstants]], ResultWrapper[RequestConstants]), + cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), ) def get( @@ -381,7 +390,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Get a Request @@ -409,9 +418,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def quota( @@ -424,7 +433,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Quota]: + ) -> Quota: """ Get Request Quota @@ -448,9 +457,9 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Quota]]._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) def types( @@ -463,7 +472,7 @@ def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RequestTypes]: + ) -> RequestTypes: """ Get Request Types @@ -487,9 +496,9 @@ def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RequestTypes]]._unwrapper, + post_parser=ResultWrapper[RequestTypes]._unwrapper, ), - cast_to=cast(Type[Optional[RequestTypes]], ResultWrapper[RequestTypes]), + cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), ) @@ -525,7 +534,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability @@ -571,9 +580,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def update( @@ -592,7 +601,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """Updating a request alters the request in the Cloudforce One queue. This API may @@ -643,9 +652,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) def list( @@ -762,12 +771,21 @@ async def delete( raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") if not request_identifier: raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}") - return await self._delete( - f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + return cast( + RequestDeleteResponse, + await self._delete( + f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[RequestDeleteResponse]._unwrapper, + ), + cast_to=cast( + Any, ResultWrapper[RequestDeleteResponse] + ), # Union types cannot be passed in as arguments in the type system ), - cast_to=RequestDeleteResponse, ) async def constants( @@ -780,7 +798,7 @@ async def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RequestConstants]: + ) -> RequestConstants: """ Get Request Priority, Status, and TLP constants @@ -804,9 +822,9 @@ async def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RequestConstants]]._unwrapper, + post_parser=ResultWrapper[RequestConstants]._unwrapper, ), - cast_to=cast(Type[Optional[RequestConstants]], ResultWrapper[RequestConstants]), + cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), ) async def get( @@ -820,7 +838,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Item]: + ) -> Item: """ Get a Request @@ -848,9 +866,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Item]]._unwrapper, + post_parser=ResultWrapper[Item]._unwrapper, ), - cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), + cast_to=cast(Type[Item], ResultWrapper[Item]), ) async def quota( @@ -863,7 +881,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[Quota]: + ) -> Quota: """ Get Request Quota @@ -887,9 +905,9 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[Quota]]._unwrapper, + post_parser=ResultWrapper[Quota]._unwrapper, ), - cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), + cast_to=cast(Type[Quota], ResultWrapper[Quota]), ) async def types( @@ -902,7 +920,7 @@ async def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RequestTypes]: + ) -> RequestTypes: """ Get Request Types @@ -926,9 +944,9 @@ async def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Optional[RequestTypes]]._unwrapper, + post_parser=ResultWrapper[RequestTypes]._unwrapper, ), - cast_to=cast(Type[Optional[RequestTypes]], ResultWrapper[RequestTypes]), + cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), ) diff --git a/src/cloudflare/resources/intel/whois.py b/src/cloudflare/resources/intel/whois.py index d8f2efe389c..050da13d396 100644 --- a/src/cloudflare/resources/intel/whois.py +++ b/src/cloudflare/resources/intel/whois.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -49,7 +49,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WhoisGetResponse]: + ) -> WhoisGetResponse: """ Get WHOIS Record @@ -74,9 +74,9 @@ def get( extra_body=extra_body, timeout=timeout, query=maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[Optional[WhoisGetResponse]]._unwrapper, + post_parser=ResultWrapper[WhoisGetResponse]._unwrapper, ), - cast_to=cast(Type[Optional[WhoisGetResponse]], ResultWrapper[WhoisGetResponse]), + cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]), ) @@ -100,7 +100,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WhoisGetResponse]: + ) -> WhoisGetResponse: """ Get WHOIS Record @@ -125,9 +125,9 @@ async def get( extra_body=extra_body, timeout=timeout, query=await async_maybe_transform({"domain": domain}, whois_get_params.WhoisGetParams), - post_parser=ResultWrapper[Optional[WhoisGetResponse]]._unwrapper, + post_parser=ResultWrapper[WhoisGetResponse]._unwrapper, ), - cast_to=cast(Type[Optional[WhoisGetResponse]], ResultWrapper[WhoisGetResponse]), + cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]), ) diff --git a/src/cloudflare/types/cloudforce_one/request_delete_response.py b/src/cloudflare/types/cloudforce_one/request_delete_response.py index b7ed5ffbe10..f6dca1edb3f 100644 --- a/src/cloudflare/types/cloudforce_one/request_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/request_delete_response.py @@ -1,18 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from typing_extensions import Literal - -from ..._models import BaseModel -from ..shared.response_info import ResponseInfo +from typing import List, Union __all__ = ["RequestDeleteResponse"] - -class RequestDeleteResponse(BaseModel): - errors: List[ResponseInfo] - - messages: List[ResponseInfo] - - success: Literal[True] - """Whether the API call was successful""" +RequestDeleteResponse = Union[List[object], str, object] diff --git a/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py b/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py index a0d45a64036..eaadbea2ab5 100644 --- a/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py @@ -1,18 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from typing_extensions import Literal - -from ...._models import BaseModel -from ...shared.response_info import ResponseInfo +from typing import List, Union __all__ = ["MessageDeleteResponse"] - -class MessageDeleteResponse(BaseModel): - errors: List[ResponseInfo] - - messages: List[ResponseInfo] - - success: Literal[True] - """Whether the API call was successful""" +MessageDeleteResponse = Union[List[object], str, object] diff --git a/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py b/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py index ee172239bfe..60bd9aae8bd 100644 --- a/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py @@ -1,18 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List -from typing_extensions import Literal - -from ...._models import BaseModel -from ...shared.response_info import ResponseInfo +from typing import List, Union __all__ = ["PriorityDeleteResponse"] - -class PriorityDeleteResponse(BaseModel): - errors: List[ResponseInfo] - - messages: List[ResponseInfo] - - success: Literal[True] - """Whether the API call was successful""" +PriorityDeleteResponse = Union[List[object], str, object] diff --git a/tests/api_resources/cloudforce_one/requests/test_message.py b/tests/api_resources/cloudforce_one/requests/test_message.py index e804d3ab846..cae9250892e 100644 --- a/tests/api_resources/cloudforce_one/requests/test_message.py +++ b/tests/api_resources/cloudforce_one/requests/test_message.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -28,7 +28,7 @@ def test_method_create(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", content="Can you elaborate on the type of DoS that occurred?", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -49,7 +49,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -61,7 +61,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -86,7 +86,7 @@ def test_method_update(self, client: Cloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", request_identifier="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -100,7 +100,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -113,7 +113,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -126,7 +126,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -207,7 +207,7 @@ def test_method_get(self, client: Cloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: @@ -221,7 +221,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: sort_by="created", sort_order="asc", ) - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -235,7 +235,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -249,7 +249,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = response.parse() - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -281,7 +281,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -290,7 +290,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare account_identifier="023e105f4ecef8ad9ca31a8372d0c353", content="Can you elaborate on the type of DoS that occurred?", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -302,7 +302,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -314,7 +314,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +339,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: account_identifier="023e105f4ecef8ad9ca31a8372d0c353", request_identifier="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -353,7 +353,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -366,7 +366,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -379,7 +379,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Optional[Message], message, path=["response"]) + assert_matches_type(Message, message, path=["response"]) assert cast(Any, response.is_closed) is True @@ -460,7 +460,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: page=0, per_page=10, ) - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -474,7 +474,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - sort_by="created", sort_order="asc", ) - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -488,7 +488,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -502,7 +502,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" message = await response.parse() - assert_matches_type(Optional[MessageGetResponse], message, path=["response"]) + assert_matches_type(MessageGetResponse, message, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloudforce_one/requests/test_priority.py b/tests/api_resources/cloudforce_one/requests/test_priority.py index 012e01b34cf..46276ab9dcf 100644 --- a/tests/api_resources/cloudforce_one/requests/test_priority.py +++ b/tests/api_resources/cloudforce_one/requests/test_priority.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -30,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Optional[Priority], priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -45,7 +45,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Priority], priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -60,7 +60,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Priority], priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -85,7 +85,7 @@ def test_method_update(self, client: Cloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -101,7 +101,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -117,7 +117,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -197,7 +197,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -209,7 +209,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -221,7 +221,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -244,7 +244,7 @@ def test_method_quota(self, client: Cloudflare) -> None: priority = client.cloudforce_one.requests.priority.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Quota], priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @parametrize def test_raw_response_quota(self, client: Cloudflare) -> None: @@ -255,7 +255,7 @@ def test_raw_response_quota(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Quota], priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @parametrize def test_streaming_response_quota(self, client: Cloudflare) -> None: @@ -266,7 +266,7 @@ def test_streaming_response_quota(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = response.parse() - assert_matches_type(Optional[Quota], priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -290,7 +290,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Optional[Priority], priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -305,7 +305,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Priority], priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -320,7 +320,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Priority], priority, path=["response"]) + assert_matches_type(Priority, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -345,7 +345,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: requirement="DoS attacks carried out by CVEs", tlp="clear", ) - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -361,7 +361,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -377,7 +377,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -457,7 +457,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -469,7 +469,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -481,7 +481,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Item], priority, path=["response"]) + assert_matches_type(Item, priority, path=["response"]) assert cast(Any, response.is_closed) is True @@ -504,7 +504,7 @@ async def test_method_quota(self, async_client: AsyncCloudflare) -> None: priority = await async_client.cloudforce_one.requests.priority.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Quota], priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @parametrize async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -515,7 +515,7 @@ async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Quota], priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) @parametrize async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -526,7 +526,7 @@ async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" priority = await response.parse() - assert_matches_type(Optional[Quota], priority, path=["response"]) + assert_matches_type(Quota, priority, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cloudforce_one/test_requests.py b/tests/api_resources/cloudforce_one/test_requests.py index 9e43e1a22b2..327ae61c1bb 100644 --- a/tests/api_resources/cloudforce_one/test_requests.py +++ b/tests/api_resources/cloudforce_one/test_requests.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -31,7 +31,7 @@ def test_method_create(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.create( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Cloudflare) -> None: @@ -43,7 +43,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_raw_response_create(self, client: Cloudflare) -> None: @@ -54,7 +54,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_streaming_response_create(self, client: Cloudflare) -> None: @@ -65,7 +65,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -82,7 +82,7 @@ def test_method_update(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: @@ -95,7 +95,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None: summary="DoS attack", tlp="clear", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: @@ -107,7 +107,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: @@ -119,7 +119,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -253,7 +253,7 @@ def test_method_constants(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.constants( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RequestConstants], request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @parametrize def test_raw_response_constants(self, client: Cloudflare) -> None: @@ -264,7 +264,7 @@ def test_raw_response_constants(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[RequestConstants], request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @parametrize def test_streaming_response_constants(self, client: Cloudflare) -> None: @@ -275,7 +275,7 @@ def test_streaming_response_constants(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[RequestConstants], request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -292,7 +292,7 @@ def test_method_get(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -304,7 +304,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -316,7 +316,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +339,7 @@ def test_method_quota(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Quota], request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @parametrize def test_raw_response_quota(self, client: Cloudflare) -> None: @@ -350,7 +350,7 @@ def test_raw_response_quota(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Quota], request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @parametrize def test_streaming_response_quota(self, client: Cloudflare) -> None: @@ -361,7 +361,7 @@ def test_streaming_response_quota(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[Quota], request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -377,7 +377,7 @@ def test_method_types(self, client: Cloudflare) -> None: request = client.cloudforce_one.requests.types( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RequestTypes], request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @parametrize def test_raw_response_types(self, client: Cloudflare) -> None: @@ -388,7 +388,7 @@ def test_raw_response_types(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[RequestTypes], request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @parametrize def test_streaming_response_types(self, client: Cloudflare) -> None: @@ -399,7 +399,7 @@ def test_streaming_response_types(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = response.parse() - assert_matches_type(Optional[RequestTypes], request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -419,7 +419,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.create( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -431,7 +431,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: @@ -442,7 +442,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None: @@ -453,7 +453,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -470,7 +470,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -483,7 +483,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare summary="DoS attack", tlp="clear", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: @@ -495,7 +495,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: @@ -507,7 +507,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -641,7 +641,7 @@ async def test_method_constants(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.constants( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RequestConstants], request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @parametrize async def test_raw_response_constants(self, async_client: AsyncCloudflare) -> None: @@ -652,7 +652,7 @@ async def test_raw_response_constants(self, async_client: AsyncCloudflare) -> No assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[RequestConstants], request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) @parametrize async def test_streaming_response_constants(self, async_client: AsyncCloudflare) -> None: @@ -663,7 +663,7 @@ async def test_streaming_response_constants(self, async_client: AsyncCloudflare) assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[RequestConstants], request, path=["response"]) + assert_matches_type(RequestConstants, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -680,7 +680,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -692,7 +692,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -704,7 +704,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Item], request, path=["response"]) + assert_matches_type(Item, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -727,7 +727,7 @@ async def test_method_quota(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.quota( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[Quota], request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @parametrize async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -738,7 +738,7 @@ async def test_raw_response_quota(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Quota], request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) @parametrize async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> None: @@ -749,7 +749,7 @@ async def test_streaming_response_quota(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[Quota], request, path=["response"]) + assert_matches_type(Quota, request, path=["response"]) assert cast(Any, response.is_closed) is True @@ -765,7 +765,7 @@ async def test_method_types(self, async_client: AsyncCloudflare) -> None: request = await async_client.cloudforce_one.requests.types( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RequestTypes], request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @parametrize async def test_raw_response_types(self, async_client: AsyncCloudflare) -> None: @@ -776,7 +776,7 @@ async def test_raw_response_types(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[RequestTypes], request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) @parametrize async def test_streaming_response_types(self, async_client: AsyncCloudflare) -> None: @@ -787,7 +787,7 @@ async def test_streaming_response_types(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" request = await response.parse() - assert_matches_type(Optional[RequestTypes], request, path=["response"]) + assert_matches_type(RequestTypes, request, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_whois.py b/tests/api_resources/intel/test_whois.py index c8f0f4035df..215bb9b2e3f 100644 --- a/tests/api_resources/intel/test_whois.py +++ b/tests/api_resources/intel/test_whois.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -22,7 +22,7 @@ def test_method_get(self, client: Cloudflare) -> None: whois = client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) @parametrize def test_method_get_with_all_params(self, client: Cloudflare) -> None: @@ -30,7 +30,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: @@ -41,7 +41,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = response.parse() - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) @parametrize def test_streaming_response_get(self, client: Cloudflare) -> None: @@ -52,7 +52,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = response.parse() - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: whois = await async_client.intel.whois.get( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) @parametrize async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: @@ -80,7 +80,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="023e105f4ecef8ad9ca31a8372d0c353", domain="string", ) - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: @@ -91,7 +91,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = await response.parse() - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) @parametrize async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" whois = await response.parse() - assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) + assert_matches_type(WhoisGetResponse, whois, path=["response"]) assert cast(Any, response.is_closed) is True