From 91c6d1e462766bad209e6e1c1fbc247ee7bfd94a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 05:15:43 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#449) --- .stats.yml | 4 +- api.md | 42 +++-- .../cloudforce_one/requests/message.py | 76 +++----- .../cloudforce_one/requests/priority.py | 88 ++++----- .../cloudforce_one/requests/requests.py | 112 +++++------ .../intel/indicator_feeds/__init__.py | 14 ++ .../intel/indicator_feeds/indicator_feeds.py | 76 +++++++- .../intel/indicator_feeds/snapshots.py | 177 ++++++++++++++++++ src/cloudflare/resources/intel/whois.py | 14 +- .../cloudforce_one/request_delete_response.py | 15 +- .../requests/message_delete_response.py | 15 +- .../requests/priority_delete_response.py | 15 +- .../intel/indicator_feed_update_params.py | 10 +- .../intel/indicator_feed_update_response.py | 25 ++- .../types/intel/indicator_feeds/__init__.py | 2 + .../indicator_feeds/snapshot_update_params.py | 15 ++ .../snapshot_update_response.py | 18 ++ .../types/workers/ai_run_response.py | 1 - .../cloudforce_one/requests/test_message.py | 50 ++--- .../cloudforce_one/requests/test_priority.py | 50 ++--- .../cloudforce_one/test_requests.py | 82 ++++---- .../intel/indicator_feeds/test_snapshots.py | 134 +++++++++++++ .../intel/test_indicator_feeds.py | 18 +- tests/api_resources/intel/test_whois.py | 18 +- 24 files changed, 745 insertions(+), 326 deletions(-) create mode 100644 src/cloudflare/resources/intel/indicator_feeds/snapshots.py create mode 100644 src/cloudflare/types/intel/indicator_feeds/snapshot_update_params.py create mode 100644 src/cloudflare/types/intel/indicator_feeds/snapshot_update_response.py create mode 100644 tests/api_resources/intel/indicator_feeds/test_snapshots.py diff --git a/.stats.yml b/.stats.yml index f8966a9125d..b0cb3255a62 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1268 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0ca9f3bf36e4be37e5ff9fff004f125665870f7b965d04ba56aea67a98964371.yml +configured_endpoints: 1269 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-35412fd158c3e184d9aa368a2fd1c169ec542af1a1892f41155afe8df8ad79bf.yml diff --git a/api.md b/api.md index 106dd9f22de..6a46abc2cbe 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) -> WhoisGetResponse +- client.intel.whois.get(\*, account_id, \*\*params) -> Optional ## IndicatorFeeds @@ -3655,11 +3655,23 @@ from cloudflare.types.intel import ( Methods: - client.intel.indicator_feeds.create(\*, account_id, \*\*params) -> Optional -- client.intel.indicator_feeds.update(feed_id, \*, account_id, \*\*params) -> Optional +- client.intel.indicator_feeds.update(feed_id, \*, account_id, \*\*params) -> Optional - client.intel.indicator_feeds.list(\*, account_id) -> SyncSinglePage[IndicatorFeedListResponse] - client.intel.indicator_feeds.data(feed_id, \*, account_id) -> str - client.intel.indicator_feeds.get(feed_id, \*, account_id) -> Optional +### Snapshots + +Types: + +```python +from cloudflare.types.intel.indicator_feeds import SnapshotUpdateResponse +``` + +Methods: + +- client.intel.indicator_feeds.snapshots.update(feed_id, \*, account_id, \*\*params) -> Optional + ### Permissions Types: @@ -7343,14 +7355,14 @@ from cloudflare.types.cloudforce_one import ( Methods: -- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Item -- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Item +- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Optional - 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) -> 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 +- 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 ### Message @@ -7366,10 +7378,10 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- 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.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.delete(message_identifer, \*, account_identifier, request_identifier) -> MessageDeleteResponse -- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> MessageGetResponse +- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> Optional ### Priority @@ -7386,11 +7398,11 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- 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.create(account_identifier, \*\*params) -> Optional +- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> Optional - client.cloudforce_one.requests.priority.delete(priority_identifer, \*, account_identifier) -> PriorityDeleteResponse -- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Item -- client.cloudforce_one.requests.priority.quota(account_identifier) -> Quota +- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Optional +- client.cloudforce_one.requests.priority.quota(account_identifier) -> Optional # EventNotifications diff --git a/src/cloudflare/resources/cloudforce_one/requests/message.py b/src/cloudflare/resources/cloudforce_one/requests/message.py index eaea1a987b6..177e2c5b099 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 Any, Type, Union, cast +from typing import Type, Union, Optional, 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, - ) -> Message: + ) -> Optional[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[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[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, - ) -> Message: + ) -> Optional[Message]: """ Update a Request Message @@ -157,9 +157,9 @@ def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), ) def delete( @@ -195,21 +195,12 @@ 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 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 + 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 ), + cast_to=MessageDeleteResponse, ) def get( @@ -229,7 +220,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageGetResponse: + ) -> Optional[MessageGetResponse]: """ List Request Messages @@ -280,9 +271,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MessageGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper, ), - cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), + cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]), ) @@ -307,7 +298,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Message: + ) -> Optional[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 @@ -340,9 +331,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), ) async def update( @@ -362,7 +353,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Message: + ) -> Optional[Message]: """ Update a Request Message @@ -410,9 +401,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Message]._unwrapper, + post_parser=ResultWrapper[Optional[Message]]._unwrapper, ), - cast_to=cast(Type[Message], ResultWrapper[Message]), + cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]), ) async def delete( @@ -448,21 +439,12 @@ 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 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 + 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 ), + cast_to=MessageDeleteResponse, ) async def get( @@ -482,7 +464,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> MessageGetResponse: + ) -> Optional[MessageGetResponse]: """ List Request Messages @@ -533,9 +515,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[MessageGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper, ), - cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]), + cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]), ) diff --git a/src/cloudflare/resources/cloudforce_one/requests/priority.py b/src/cloudflare/resources/cloudforce_one/requests/priority.py index 0f1d6795a40..243e43f789b 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 Any, List, Type, cast +from typing import List, Type, Optional, 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, - ) -> Priority: + ) -> Optional[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[Priority]._unwrapper, + post_parser=ResultWrapper[Optional[Priority]]._unwrapper, ), - cast_to=cast(Type[Priority], ResultWrapper[Priority]), + cast_to=cast(Type[Optional[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, - ) -> Item: + ) -> Optional[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[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def delete( @@ -200,21 +200,12 @@ 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 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 + 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 ), + cast_to=PriorityDeleteResponse, ) def get( @@ -228,7 +219,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Priority Intelligence Requirement @@ -256,9 +247,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def quota( @@ -271,7 +262,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Priority Intelligence Requirement Quota @@ -295,9 +286,9 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) @@ -324,7 +315,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Priority: + ) -> Optional[Priority]: """ Create a New Priority Requirement @@ -365,9 +356,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Priority]._unwrapper, + post_parser=ResultWrapper[Optional[Priority]]._unwrapper, ), - cast_to=cast(Type[Priority], ResultWrapper[Priority]), + cast_to=cast(Type[Optional[Priority]], ResultWrapper[Priority]), ) async def update( @@ -385,7 +376,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Update a Priority Intelligence Requirement @@ -430,9 +421,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def delete( @@ -467,21 +458,12 @@ 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 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 + 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 ), + cast_to=PriorityDeleteResponse, ) async def get( @@ -495,7 +477,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Priority Intelligence Requirement @@ -523,9 +505,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def quota( @@ -538,7 +520,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Priority Intelligence Requirement Quota @@ -562,9 +544,9 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) diff --git a/src/cloudflare/resources/cloudforce_one/requests/requests.py b/src/cloudflare/resources/cloudforce_one/requests/requests.py index 61a739aaa7c..267e04595d6 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 Any, Type, Union, cast +from typing import Type, Union, Optional, 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, - ) -> Item: + ) -> Optional[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[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[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, - ) -> Item: + ) -> Optional[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[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def list( @@ -323,21 +323,12 @@ 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 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 + 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 ), + cast_to=RequestDeleteResponse, ) def constants( @@ -350,7 +341,7 @@ def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestConstants: + ) -> Optional[RequestConstants]: """ Get Request Priority, Status, and TLP constants @@ -374,9 +365,9 @@ def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestConstants]._unwrapper, + post_parser=ResultWrapper[Optional[RequestConstants]]._unwrapper, ), - cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), + cast_to=cast(Type[Optional[RequestConstants]], ResultWrapper[RequestConstants]), ) def get( @@ -390,7 +381,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Request @@ -418,9 +409,9 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def quota( @@ -433,7 +424,7 @@ def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Request Quota @@ -457,9 +448,9 @@ def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) def types( @@ -472,7 +463,7 @@ def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestTypes: + ) -> Optional[RequestTypes]: """ Get Request Types @@ -496,9 +487,9 @@ def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestTypes]._unwrapper, + post_parser=ResultWrapper[Optional[RequestTypes]]._unwrapper, ), - cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), + cast_to=cast(Type[Optional[RequestTypes]], ResultWrapper[RequestTypes]), ) @@ -534,7 +525,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[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 @@ -580,9 +571,9 @@ async def create( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def update( @@ -601,7 +592,7 @@ async def update( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """Updating a request alters the request in the Cloudforce One queue. This API may @@ -652,9 +643,9 @@ async def update( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) def list( @@ -771,21 +762,12 @@ 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 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 + 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 ), + cast_to=RequestDeleteResponse, ) async def constants( @@ -798,7 +780,7 @@ async def constants( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestConstants: + ) -> Optional[RequestConstants]: """ Get Request Priority, Status, and TLP constants @@ -822,9 +804,9 @@ async def constants( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestConstants]._unwrapper, + post_parser=ResultWrapper[Optional[RequestConstants]]._unwrapper, ), - cast_to=cast(Type[RequestConstants], ResultWrapper[RequestConstants]), + cast_to=cast(Type[Optional[RequestConstants]], ResultWrapper[RequestConstants]), ) async def get( @@ -838,7 +820,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Item: + ) -> Optional[Item]: """ Get a Request @@ -866,9 +848,9 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Item]._unwrapper, + post_parser=ResultWrapper[Optional[Item]]._unwrapper, ), - cast_to=cast(Type[Item], ResultWrapper[Item]), + cast_to=cast(Type[Optional[Item]], ResultWrapper[Item]), ) async def quota( @@ -881,7 +863,7 @@ async def quota( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Quota: + ) -> Optional[Quota]: """ Get Request Quota @@ -905,9 +887,9 @@ async def quota( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[Quota]._unwrapper, + post_parser=ResultWrapper[Optional[Quota]]._unwrapper, ), - cast_to=cast(Type[Quota], ResultWrapper[Quota]), + cast_to=cast(Type[Optional[Quota]], ResultWrapper[Quota]), ) async def types( @@ -920,7 +902,7 @@ async def types( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RequestTypes: + ) -> Optional[RequestTypes]: """ Get Request Types @@ -944,9 +926,9 @@ async def types( extra_query=extra_query, extra_body=extra_body, timeout=timeout, - post_parser=ResultWrapper[RequestTypes]._unwrapper, + post_parser=ResultWrapper[Optional[RequestTypes]]._unwrapper, ), - cast_to=cast(Type[RequestTypes], ResultWrapper[RequestTypes]), + cast_to=cast(Type[Optional[RequestTypes]], ResultWrapper[RequestTypes]), ) diff --git a/src/cloudflare/resources/intel/indicator_feeds/__init__.py b/src/cloudflare/resources/intel/indicator_feeds/__init__.py index a562b4be04d..3e67dcae5bc 100644 --- a/src/cloudflare/resources/intel/indicator_feeds/__init__.py +++ b/src/cloudflare/resources/intel/indicator_feeds/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .snapshots import ( + SnapshotsResource, + AsyncSnapshotsResource, + SnapshotsResourceWithRawResponse, + AsyncSnapshotsResourceWithRawResponse, + SnapshotsResourceWithStreamingResponse, + AsyncSnapshotsResourceWithStreamingResponse, +) from .permissions import ( PermissionsResource, AsyncPermissionsResource, @@ -18,6 +26,12 @@ ) __all__ = [ + "SnapshotsResource", + "AsyncSnapshotsResource", + "SnapshotsResourceWithRawResponse", + "AsyncSnapshotsResourceWithRawResponse", + "SnapshotsResourceWithStreamingResponse", + "AsyncSnapshotsResourceWithStreamingResponse", "PermissionsResource", "AsyncPermissionsResource", "PermissionsResourceWithRawResponse", diff --git a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py index d68e3598137..721bab7afab 100644 --- a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py +++ b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py @@ -11,6 +11,14 @@ maybe_transform, async_maybe_transform, ) +from .snapshots import ( + SnapshotsResource, + AsyncSnapshotsResource, + SnapshotsResourceWithRawResponse, + AsyncSnapshotsResourceWithRawResponse, + SnapshotsResourceWithStreamingResponse, + AsyncSnapshotsResourceWithStreamingResponse, +) from ...._compat import cached_property from .permissions import ( PermissionsResource, @@ -43,6 +51,10 @@ class IndicatorFeedsResource(SyncAPIResource): + @cached_property + def snapshots(self) -> SnapshotsResource: + return SnapshotsResource(self._client) + @cached_property def permissions(self) -> PermissionsResource: return PermissionsResource(self._client) @@ -112,7 +124,9 @@ def update( feed_id: int, *, account_id: str, - source: str | NotGiven = NOT_GIVEN, + feed_description: str | NotGiven = NOT_GIVEN, + is_attributable: bool | NotGiven = NOT_GIVEN, + is_public: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -121,14 +135,18 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IndicatorFeedUpdateResponse]: """ - Update indicator feed data + Update indicator feed metadata Args: account_id: Identifier feed_id: Indicator feed ID - source: The file to upload + feed_description: The new description of the feed + + is_attributable: The new is_attributable value of the feed + + is_public: The new is_public value of the feed extra_headers: Send extra headers @@ -141,8 +159,15 @@ def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._put( - f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}/snapshot", - body=maybe_transform({"source": source}, indicator_feed_update_params.IndicatorFeedUpdateParams), + f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}", + body=maybe_transform( + { + "feed_description": feed_description, + "is_attributable": is_attributable, + "is_public": is_public, + }, + indicator_feed_update_params.IndicatorFeedUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -272,6 +297,10 @@ def get( class AsyncIndicatorFeedsResource(AsyncAPIResource): + @cached_property + def snapshots(self) -> AsyncSnapshotsResource: + return AsyncSnapshotsResource(self._client) + @cached_property def permissions(self) -> AsyncPermissionsResource: return AsyncPermissionsResource(self._client) @@ -341,7 +370,9 @@ async def update( feed_id: int, *, account_id: str, - source: str | NotGiven = NOT_GIVEN, + feed_description: str | NotGiven = NOT_GIVEN, + is_attributable: bool | NotGiven = NOT_GIVEN, + is_public: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -350,14 +381,18 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[IndicatorFeedUpdateResponse]: """ - Update indicator feed data + Update indicator feed metadata Args: account_id: Identifier feed_id: Indicator feed ID - source: The file to upload + feed_description: The new description of the feed + + is_attributable: The new is_attributable value of the feed + + is_public: The new is_public value of the feed extra_headers: Send extra headers @@ -370,9 +405,14 @@ async def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._put( - f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}/snapshot", + f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}", body=await async_maybe_transform( - {"source": source}, indicator_feed_update_params.IndicatorFeedUpdateParams + { + "feed_description": feed_description, + "is_attributable": is_attributable, + "is_public": is_public, + }, + indicator_feed_update_params.IndicatorFeedUpdateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -522,6 +562,10 @@ def __init__(self, indicator_feeds: IndicatorFeedsResource) -> None: indicator_feeds.get, ) + @cached_property + def snapshots(self) -> SnapshotsResourceWithRawResponse: + return SnapshotsResourceWithRawResponse(self._indicator_feeds.snapshots) + @cached_property def permissions(self) -> PermissionsResourceWithRawResponse: return PermissionsResourceWithRawResponse(self._indicator_feeds.permissions) @@ -547,6 +591,10 @@ def __init__(self, indicator_feeds: AsyncIndicatorFeedsResource) -> None: indicator_feeds.get, ) + @cached_property + def snapshots(self) -> AsyncSnapshotsResourceWithRawResponse: + return AsyncSnapshotsResourceWithRawResponse(self._indicator_feeds.snapshots) + @cached_property def permissions(self) -> AsyncPermissionsResourceWithRawResponse: return AsyncPermissionsResourceWithRawResponse(self._indicator_feeds.permissions) @@ -572,6 +620,10 @@ def __init__(self, indicator_feeds: IndicatorFeedsResource) -> None: indicator_feeds.get, ) + @cached_property + def snapshots(self) -> SnapshotsResourceWithStreamingResponse: + return SnapshotsResourceWithStreamingResponse(self._indicator_feeds.snapshots) + @cached_property def permissions(self) -> PermissionsResourceWithStreamingResponse: return PermissionsResourceWithStreamingResponse(self._indicator_feeds.permissions) @@ -597,6 +649,10 @@ def __init__(self, indicator_feeds: AsyncIndicatorFeedsResource) -> None: indicator_feeds.get, ) + @cached_property + def snapshots(self) -> AsyncSnapshotsResourceWithStreamingResponse: + return AsyncSnapshotsResourceWithStreamingResponse(self._indicator_feeds.snapshots) + @cached_property def permissions(self) -> AsyncPermissionsResourceWithStreamingResponse: return AsyncPermissionsResourceWithStreamingResponse(self._indicator_feeds.permissions) diff --git a/src/cloudflare/resources/intel/indicator_feeds/snapshots.py b/src/cloudflare/resources/intel/indicator_feeds/snapshots.py new file mode 100644 index 00000000000..3f05ef5b71a --- /dev/null +++ b/src/cloudflare/resources/intel/indicator_feeds/snapshots.py @@ -0,0 +1,177 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Optional, cast + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import ( + maybe_transform, + async_maybe_transform, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._wrappers import ResultWrapper +from ...._base_client import ( + make_request_options, +) +from ....types.intel.indicator_feeds import snapshot_update_params +from ....types.intel.indicator_feeds.snapshot_update_response import SnapshotUpdateResponse + +__all__ = ["SnapshotsResource", "AsyncSnapshotsResource"] + + +class SnapshotsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SnapshotsResourceWithRawResponse: + return SnapshotsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SnapshotsResourceWithStreamingResponse: + return SnapshotsResourceWithStreamingResponse(self) + + def update( + self, + feed_id: int, + *, + account_id: str, + source: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SnapshotUpdateResponse]: + """ + Update indicator feed data + + Args: + account_id: Identifier + + feed_id: Indicator feed ID + + source: The file to upload + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._put( + f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}/snapshot", + body=maybe_transform({"source": source}, snapshot_update_params.SnapshotUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SnapshotUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SnapshotUpdateResponse]], ResultWrapper[SnapshotUpdateResponse]), + ) + + +class AsyncSnapshotsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSnapshotsResourceWithRawResponse: + return AsyncSnapshotsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSnapshotsResourceWithStreamingResponse: + return AsyncSnapshotsResourceWithStreamingResponse(self) + + async def update( + self, + feed_id: int, + *, + account_id: str, + source: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[SnapshotUpdateResponse]: + """ + Update indicator feed data + + Args: + account_id: Identifier + + feed_id: Indicator feed ID + + source: The file to upload + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._put( + f"/accounts/{account_id}/intel/indicator-feeds/{feed_id}/snapshot", + body=await async_maybe_transform({"source": source}, snapshot_update_params.SnapshotUpdateParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper[Optional[SnapshotUpdateResponse]]._unwrapper, + ), + cast_to=cast(Type[Optional[SnapshotUpdateResponse]], ResultWrapper[SnapshotUpdateResponse]), + ) + + +class SnapshotsResourceWithRawResponse: + def __init__(self, snapshots: SnapshotsResource) -> None: + self._snapshots = snapshots + + self.update = to_raw_response_wrapper( + snapshots.update, + ) + + +class AsyncSnapshotsResourceWithRawResponse: + def __init__(self, snapshots: AsyncSnapshotsResource) -> None: + self._snapshots = snapshots + + self.update = async_to_raw_response_wrapper( + snapshots.update, + ) + + +class SnapshotsResourceWithStreamingResponse: + def __init__(self, snapshots: SnapshotsResource) -> None: + self._snapshots = snapshots + + self.update = to_streamed_response_wrapper( + snapshots.update, + ) + + +class AsyncSnapshotsResourceWithStreamingResponse: + def __init__(self, snapshots: AsyncSnapshotsResource) -> None: + self._snapshots = snapshots + + self.update = async_to_streamed_response_wrapper( + snapshots.update, + ) diff --git a/src/cloudflare/resources/intel/whois.py b/src/cloudflare/resources/intel/whois.py index 050da13d396..d8f2efe389c 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, cast +from typing import Type, Optional, 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, - ) -> WhoisGetResponse: + ) -> Optional[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[WhoisGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WhoisGetResponse]]._unwrapper, ), - cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]), + cast_to=cast(Type[Optional[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, - ) -> WhoisGetResponse: + ) -> Optional[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[WhoisGetResponse]._unwrapper, + post_parser=ResultWrapper[Optional[WhoisGetResponse]]._unwrapper, ), - cast_to=cast(Type[WhoisGetResponse], ResultWrapper[WhoisGetResponse]), + cast_to=cast(Type[Optional[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 f6dca1edb3f..b7ed5ffbe10 100644 --- a/src/cloudflare/types/cloudforce_one/request_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/request_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel +from ..shared.response_info import ResponseInfo __all__ = ["RequestDeleteResponse"] -RequestDeleteResponse = Union[List[object], str, object] + +class RequestDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" 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 eaadbea2ab5..a0d45a64036 100644 --- a/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/requests/message_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo __all__ = ["MessageDeleteResponse"] -MessageDeleteResponse = Union[List[object], str, object] + +class MessageDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" 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 60bd9aae8bd..ee172239bfe 100644 --- a/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py +++ b/src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py @@ -1,7 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel +from ...shared.response_info import ResponseInfo __all__ = ["PriorityDeleteResponse"] -PriorityDeleteResponse = Union[List[object], str, object] + +class PriorityDeleteResponse(BaseModel): + errors: List[ResponseInfo] + + messages: List[ResponseInfo] + + success: Literal[True] + """Whether the API call was successful""" diff --git a/src/cloudflare/types/intel/indicator_feed_update_params.py b/src/cloudflare/types/intel/indicator_feed_update_params.py index 69f6383fa28..b7af16167f6 100644 --- a/src/cloudflare/types/intel/indicator_feed_update_params.py +++ b/src/cloudflare/types/intel/indicator_feed_update_params.py @@ -11,5 +11,11 @@ class IndicatorFeedUpdateParams(TypedDict, total=False): account_id: Required[str] """Identifier""" - source: str - """The file to upload""" + feed_description: str + """The new description of the feed""" + + is_attributable: bool + """The new is_attributable value of the feed""" + + is_public: bool + """The new is_public value of the feed""" diff --git a/src/cloudflare/types/intel/indicator_feed_update_response.py b/src/cloudflare/types/intel/indicator_feed_update_response.py index c4983df11d5..9cc5828a4e1 100644 --- a/src/cloudflare/types/intel/indicator_feed_update_response.py +++ b/src/cloudflare/types/intel/indicator_feed_update_response.py @@ -1,6 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from ..._models import BaseModel @@ -8,11 +9,23 @@ class IndicatorFeedUpdateResponse(BaseModel): - file_id: Optional[int] = None - """Feed id""" + id: Optional[int] = None + """The unique identifier for the indicator feed""" - filename: Optional[str] = None - """Name of the file unified in our system""" + created_on: Optional[datetime] = None + """The date and time when the data entry was created""" - status: Optional[str] = None - """Current status of upload, should be unified""" + description: Optional[str] = None + """The description of the example test""" + + is_attributable: Optional[bool] = None + """Whether the indicator feed can be attributed to a provider""" + + is_public: Optional[bool] = None + """Whether the indicator feed is exposed to customers""" + + modified_on: Optional[datetime] = None + """The date and time when the data entry was last modified""" + + name: Optional[str] = None + """The name of the indicator feed""" diff --git a/src/cloudflare/types/intel/indicator_feeds/__init__.py b/src/cloudflare/types/intel/indicator_feeds/__init__.py index e27400cd140..26be868632e 100644 --- a/src/cloudflare/types/intel/indicator_feeds/__init__.py +++ b/src/cloudflare/types/intel/indicator_feeds/__init__.py @@ -2,8 +2,10 @@ from __future__ import annotations +from .snapshot_update_params import SnapshotUpdateParams as SnapshotUpdateParams from .permission_create_params import PermissionCreateParams as PermissionCreateParams from .permission_delete_params import PermissionDeleteParams as PermissionDeleteParams from .permission_list_response import PermissionListResponse as PermissionListResponse +from .snapshot_update_response import SnapshotUpdateResponse as SnapshotUpdateResponse from .permission_create_response import PermissionCreateResponse as PermissionCreateResponse from .permission_delete_response import PermissionDeleteResponse as PermissionDeleteResponse diff --git a/src/cloudflare/types/intel/indicator_feeds/snapshot_update_params.py b/src/cloudflare/types/intel/indicator_feeds/snapshot_update_params.py new file mode 100644 index 00000000000..ec0d386ca4f --- /dev/null +++ b/src/cloudflare/types/intel/indicator_feeds/snapshot_update_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["SnapshotUpdateParams"] + + +class SnapshotUpdateParams(TypedDict, total=False): + account_id: Required[str] + """Identifier""" + + source: str + """The file to upload""" diff --git a/src/cloudflare/types/intel/indicator_feeds/snapshot_update_response.py b/src/cloudflare/types/intel/indicator_feeds/snapshot_update_response.py new file mode 100644 index 00000000000..60b48345210 --- /dev/null +++ b/src/cloudflare/types/intel/indicator_feeds/snapshot_update_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ...._models import BaseModel + +__all__ = ["SnapshotUpdateResponse"] + + +class SnapshotUpdateResponse(BaseModel): + file_id: Optional[int] = None + """Feed id""" + + filename: Optional[str] = None + """Name of the file unified in our system""" + + status: Optional[str] = None + """Current status of upload, should be unified""" diff --git a/src/cloudflare/types/workers/ai_run_response.py b/src/cloudflare/types/workers/ai_run_response.py index 4894fee25d6..5877761e02c 100644 --- a/src/cloudflare/types/workers/ai_run_response.py +++ b/src/cloudflare/types/workers/ai_run_response.py @@ -93,7 +93,6 @@ class ImageToText(BaseModel): AIRunResponse = Union[ List[TextClassification], object, - object, List[float], TextEmbeddings, SpeechRecognition, diff --git a/tests/api_resources/cloudforce_one/requests/test_message.py b/tests/api_resources/cloudforce_one/requests/test_message.py index cae9250892e..e804d3ab846 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, cast +from typing import Any, Optional, 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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(Message, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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(MessageGetResponse, message, path=["response"]) + assert_matches_type(Optional[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 46276ab9dcf..012e01b34cf 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, cast +from typing import Any, Optional, 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(Priority, priority, path=["response"]) + assert_matches_type(Optional[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(Priority, priority, path=["response"]) + assert_matches_type(Optional[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(Priority, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Quota, priority, path=["response"]) + assert_matches_type(Optional[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(Quota, priority, path=["response"]) + assert_matches_type(Optional[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(Quota, priority, path=["response"]) + assert_matches_type(Optional[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(Priority, priority, path=["response"]) + assert_matches_type(Optional[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(Priority, priority, path=["response"]) + assert_matches_type(Optional[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(Priority, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Item, priority, path=["response"]) + assert_matches_type(Optional[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(Quota, priority, path=["response"]) + assert_matches_type(Optional[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(Quota, priority, path=["response"]) + assert_matches_type(Optional[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(Quota, priority, path=["response"]) + assert_matches_type(Optional[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 327ae61c1bb..9e43e1a22b2 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, cast +from typing import Any, Optional, 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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[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(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[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(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Quota, request, path=["response"]) + assert_matches_type(Optional[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(Quota, request, path=["response"]) + assert_matches_type(Optional[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(Quota, request, path=["response"]) + assert_matches_type(Optional[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(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[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(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[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(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[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(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[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(RequestConstants, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Item, request, path=["response"]) + assert_matches_type(Optional[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(Quota, request, path=["response"]) + assert_matches_type(Optional[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(Quota, request, path=["response"]) + assert_matches_type(Optional[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(Quota, request, path=["response"]) + assert_matches_type(Optional[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(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[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(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[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(RequestTypes, request, path=["response"]) + assert_matches_type(Optional[RequestTypes], request, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/indicator_feeds/test_snapshots.py b/tests/api_resources/intel/indicator_feeds/test_snapshots.py new file mode 100644 index 00000000000..0db382b0f3f --- /dev/null +++ b/tests/api_resources/intel/indicator_feeds/test_snapshots.py @@ -0,0 +1,134 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, Optional, cast + +import pytest + +from cloudflare import Cloudflare, AsyncCloudflare +from tests.utils import assert_matches_type +from cloudflare.types.intel.indicator_feeds import SnapshotUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSnapshots: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_update(self, client: Cloudflare) -> None: + snapshot = client.intel.indicator_feeds.snapshots.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_method_update_with_all_params(self, client: Cloudflare) -> None: + snapshot = client.intel.indicator_feeds.snapshots.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + source="@/Users/me/test.stix2", + ) + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_raw_response_update(self, client: Cloudflare) -> None: + response = client.intel.indicator_feeds.snapshots.with_raw_response.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + snapshot = response.parse() + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_streaming_response_update(self, client: Cloudflare) -> None: + with client.intel.indicator_feeds.snapshots.with_streaming_response.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + snapshot = response.parse() + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + def test_path_params_update(self, client: Cloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.intel.indicator_feeds.snapshots.with_raw_response.update( + 12, + account_id="", + ) + + +class TestAsyncSnapshots: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_update(self, async_client: AsyncCloudflare) -> None: + snapshot = await async_client.intel.indicator_feeds.snapshots.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: + snapshot = await async_client.intel.indicator_feeds.snapshots.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + source="@/Users/me/test.stix2", + ) + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: + response = await async_client.intel.indicator_feeds.snapshots.with_raw_response.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + snapshot = await response.parse() + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: + async with async_client.intel.indicator_feeds.snapshots.with_streaming_response.update( + 12, + account_id="023e105f4ecef8ad9ca31a8372d0c353", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + snapshot = await response.parse() + assert_matches_type(Optional[SnapshotUpdateResponse], snapshot, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="TODO: investigate broken test") + @parametrize + async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.intel.indicator_feeds.snapshots.with_raw_response.update( + 12, + account_id="", + ) diff --git a/tests/api_resources/intel/test_indicator_feeds.py b/tests/api_resources/intel/test_indicator_feeds.py index ec384a7a6fb..e0c1a3dea7a 100644 --- a/tests/api_resources/intel/test_indicator_feeds.py +++ b/tests/api_resources/intel/test_indicator_feeds.py @@ -70,7 +70,6 @@ def test_path_params_create(self, client: Cloudflare) -> None: account_id="", ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update(self, client: Cloudflare) -> None: indicator_feed = client.intel.indicator_feeds.update( @@ -79,17 +78,17 @@ def test_method_update(self, client: Cloudflare) -> None: ) assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_method_update_with_all_params(self, client: Cloudflare) -> None: indicator_feed = client.intel.indicator_feeds.update( 12, account_id="023e105f4ecef8ad9ca31a8372d0c353", - source="@/Users/me/test.stix2", + feed_description="This is an example description", + is_attributable=True, + is_public=True, ) assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_raw_response_update(self, client: Cloudflare) -> None: response = client.intel.indicator_feeds.with_raw_response.update( @@ -102,7 +101,6 @@ def test_raw_response_update(self, client: Cloudflare) -> None: indicator_feed = response.parse() assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_streaming_response_update(self, client: Cloudflare) -> None: with client.intel.indicator_feeds.with_streaming_response.update( @@ -117,7 +115,6 @@ def test_streaming_response_update(self, client: Cloudflare) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize def test_path_params_update(self, client: Cloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -299,7 +296,6 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None: account_id="", ) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update(self, async_client: AsyncCloudflare) -> None: indicator_feed = await async_client.intel.indicator_feeds.update( @@ -308,17 +304,17 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None: indicator_feed = await async_client.intel.indicator_feeds.update( 12, account_id="023e105f4ecef8ad9ca31a8372d0c353", - source="@/Users/me/test.stix2", + feed_description="This is an example description", + is_attributable=True, + is_public=True, ) assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: response = await async_client.intel.indicator_feeds.with_raw_response.update( @@ -331,7 +327,6 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None: indicator_feed = await response.parse() assert_matches_type(Optional[IndicatorFeedUpdateResponse], indicator_feed, path=["response"]) - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None: async with async_client.intel.indicator_feeds.with_streaming_response.update( @@ -346,7 +341,6 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="TODO: investigate broken test") @parametrize async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): diff --git a/tests/api_resources/intel/test_whois.py b/tests/api_resources/intel/test_whois.py index 215bb9b2e3f..c8f0f4035df 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, cast +from typing import Any, Optional, 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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[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(WhoisGetResponse, whois, path=["response"]) + assert_matches_type(Optional[WhoisGetResponse], whois, path=["response"]) assert cast(Any, response.is_closed) is True