mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-17 07:10:37 +00:00
feat(api): OpenAPI spec update via Stainless API (#496)
This commit is contained in:
parent
acd3c505a0
commit
31e8cd3e99
19 changed files with 335 additions and 315 deletions
|
|
@ -1,2 +1,2 @@
|
|||
configured_endpoints: 1281
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-09cd12c71c1bf4d47a96a1b013ea92dfdfbac4647336dd53fdda685632b3c43a.yml
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-233400c5ae165d478f6a8ca3dfc099961cbca90f3b175f1e14b631a7cb298f41.yml
|
||||
|
|
|
|||
27
SECURITY.md
Normal file
27
SECURITY.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Security Policy
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
|
||||
|
||||
To report a security issue, please contact the Stainless team at security@stainlessapi.com.
|
||||
|
||||
## Responsible Disclosure
|
||||
|
||||
We appreciate the efforts of security researchers and individuals who help us maintain the security of
|
||||
SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
|
||||
disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
|
||||
before making any information public.
|
||||
|
||||
## Reporting Non-SDK Related Security Issues
|
||||
|
||||
If you encounter security issues that are not directly related to SDKs but pertain to the services
|
||||
or products provided by Cloudflare please follow the respective company's security reporting guidelines.
|
||||
|
||||
### Cloudflare Terms and Policies
|
||||
|
||||
Please contact api@cloudflare.com for any questions or concerns regarding security of our services.
|
||||
|
||||
---
|
||||
|
||||
Thank you for helping us keep the SDKs and systems they interact with secure.
|
||||
28
api.md
28
api.md
|
|
@ -3657,7 +3657,7 @@ from cloudflare.types.intel import Whois, WhoisGetResponse
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="get /accounts/{account_id}/intel/whois">client.intel.whois.<a href="./src/cloudflare/resources/intel/whois.py">get</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/whois_get_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/whois_get_response.py">WhoisGetResponse</a></code>
|
||||
- <code title="get /accounts/{account_id}/intel/whois">client.intel.whois.<a href="./src/cloudflare/resources/intel/whois.py">get</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/whois_get_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/whois_get_response.py">Optional</a></code>
|
||||
|
||||
## IndicatorFeeds
|
||||
|
||||
|
|
@ -7433,14 +7433,14 @@ from cloudflare.types.cloudforce_one import (
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/new">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">create</a>(account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/request_create_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Item</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">update</a>(request_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/request_update_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Item</a></code>
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/new">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">create</a>(account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/request_create_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Optional</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">update</a>(request_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/request_update_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Optional</a></code>
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">list</a>(account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/request_list_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/list_item.py">SyncV4PagePaginationArray[ListItem]</a></code>
|
||||
- <code title="delete /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">delete</a>(request_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/request_delete_response.py">RequestDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/constants">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">constants</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/request_constants.py">RequestConstants</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">get</a>(request_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Item</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/quota">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">quota</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/quota.py">Quota</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/types">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">types</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/request_types.py">RequestTypes</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/constants">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">constants</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/request_constants.py">Optional</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">get</a>(request_identifier, \*, account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Optional</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/quota">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">quota</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/quota.py">Optional</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/types">client.cloudforce_one.requests.<a href="./src/cloudflare/resources/cloudforce_one/requests/requests.py">types</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/request_types.py">Optional</a></code>
|
||||
|
||||
### Message
|
||||
|
||||
|
|
@ -7456,10 +7456,10 @@ from cloudflare.types.cloudforce_one.requests import (
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/new">client.cloudforce_one.requests.message.<a href="./src/cloudflare/resources/cloudforce_one/requests/message.py">create</a>(request_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/message_create_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/message.py">Message</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}">client.cloudforce_one.requests.message.<a href="./src/cloudflare/resources/cloudforce_one/requests/message.py">update</a>(message_identifer, \*, account_identifier, request_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/message_update_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/message.py">Message</a></code>
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/new">client.cloudforce_one.requests.message.<a href="./src/cloudflare/resources/cloudforce_one/requests/message.py">create</a>(request_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/message_create_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/message.py">Optional</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}">client.cloudforce_one.requests.message.<a href="./src/cloudflare/resources/cloudforce_one/requests/message.py">update</a>(message_identifer, \*, account_identifier, request_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/message_update_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/message.py">Optional</a></code>
|
||||
- <code title="delete /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}">client.cloudforce_one.requests.message.<a href="./src/cloudflare/resources/cloudforce_one/requests/message.py">delete</a>(message_identifer, \*, account_identifier, request_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/requests/message_delete_response.py">MessageDeleteResponse</a></code>
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message">client.cloudforce_one.requests.message.<a href="./src/cloudflare/resources/cloudforce_one/requests/message.py">get</a>(request_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/message_get_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/message_get_response.py">MessageGetResponse</a></code>
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message">client.cloudforce_one.requests.message.<a href="./src/cloudflare/resources/cloudforce_one/requests/message.py">get</a>(request_identifier, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/message_get_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/message_get_response.py">Optional</a></code>
|
||||
|
||||
### Priority
|
||||
|
||||
|
|
@ -7476,11 +7476,11 @@ from cloudflare.types.cloudforce_one.requests import (
|
|||
|
||||
Methods:
|
||||
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/priority/new">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">create</a>(account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/priority_create_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/priority.py">Priority</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">update</a>(priority_identifer, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/priority_update_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Item</a></code>
|
||||
- <code title="post /accounts/{account_identifier}/cloudforce-one/requests/priority/new">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">create</a>(account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/priority_create_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/requests/priority.py">Optional</a></code>
|
||||
- <code title="put /accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">update</a>(priority_identifer, \*, account_identifier, \*\*<a href="src/cloudflare/types/cloudforce_one/requests/priority_update_params.py">params</a>) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Optional</a></code>
|
||||
- <code title="delete /accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">delete</a>(priority_identifer, \*, account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/requests/priority_delete_response.py">PriorityDeleteResponse</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">get</a>(priority_identifer, \*, account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Item</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/priority/quota">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">quota</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/quota.py">Quota</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/priority/{priority_identifer}">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">get</a>(priority_identifer, \*, account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/item.py">Optional</a></code>
|
||||
- <code title="get /accounts/{account_identifier}/cloudforce-one/requests/priority/quota">client.cloudforce_one.requests.priority.<a href="./src/cloudflare/resources/cloudforce_one/requests/priority.py">quota</a>(account_identifier) -> <a href="./src/cloudflare/types/cloudforce_one/quota.py">Optional</a></code>
|
||||
|
||||
# EventNotifications
|
||||
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ pluggy==1.3.0
|
|||
# via pytest
|
||||
py==1.11.0
|
||||
# via pytest
|
||||
pydantic==2.4.2
|
||||
pydantic==2.7.1
|
||||
# via cloudflare
|
||||
pydantic-core==2.10.1
|
||||
pydantic-core==2.18.2
|
||||
# via pydantic
|
||||
pyright==1.1.359
|
||||
pytest==7.1.1
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ httpx==0.25.2
|
|||
idna==3.4
|
||||
# via anyio
|
||||
# via httpx
|
||||
pydantic==2.4.2
|
||||
pydantic==2.7.1
|
||||
# via cloudflare
|
||||
pydantic-core==2.10.1
|
||||
pydantic-core==2.18.2
|
||||
# via pydantic
|
||||
sniffio==1.3.0
|
||||
# via anyio
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ from ._compat import (
|
|||
from ._constants import RAW_RESPONSE_HEADER
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pydantic_core.core_schema import ModelField, ModelFieldsSchema
|
||||
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
|
||||
|
||||
__all__ = ["BaseModel", "GenericModel"]
|
||||
|
||||
|
|
@ -251,7 +251,9 @@ class BaseModel(pydantic.BaseModel):
|
|||
exclude_defaults: bool = False,
|
||||
exclude_none: bool = False,
|
||||
round_trip: bool = False,
|
||||
warnings: bool = True,
|
||||
warnings: bool | Literal["none", "warn", "error"] = True,
|
||||
context: dict[str, Any] | None = None,
|
||||
serialize_as_any: bool = False,
|
||||
) -> dict[str, Any]:
|
||||
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
|
||||
|
||||
|
|
@ -279,6 +281,10 @@ class BaseModel(pydantic.BaseModel):
|
|||
raise ValueError("round_trip is only supported in Pydantic v2")
|
||||
if warnings != True:
|
||||
raise ValueError("warnings is only supported in Pydantic v2")
|
||||
if context is not None:
|
||||
raise ValueError("context is only supported in Pydantic v2")
|
||||
if serialize_as_any != False:
|
||||
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
||||
return super().dict( # pyright: ignore[reportDeprecated]
|
||||
include=include,
|
||||
exclude=exclude,
|
||||
|
|
@ -300,7 +306,9 @@ class BaseModel(pydantic.BaseModel):
|
|||
exclude_defaults: bool = False,
|
||||
exclude_none: bool = False,
|
||||
round_trip: bool = False,
|
||||
warnings: bool = True,
|
||||
warnings: bool | Literal["none", "warn", "error"] = True,
|
||||
context: dict[str, Any] | None = None,
|
||||
serialize_as_any: bool = False,
|
||||
) -> str:
|
||||
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json
|
||||
|
||||
|
|
@ -324,6 +332,10 @@ class BaseModel(pydantic.BaseModel):
|
|||
raise ValueError("round_trip is only supported in Pydantic v2")
|
||||
if warnings != True:
|
||||
raise ValueError("warnings is only supported in Pydantic v2")
|
||||
if context is not None:
|
||||
raise ValueError("context is only supported in Pydantic v2")
|
||||
if serialize_as_any != False:
|
||||
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
||||
return super().json( # type: ignore[reportDeprecated]
|
||||
indent=indent,
|
||||
include=include,
|
||||
|
|
@ -550,7 +562,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|||
field_schema = field["schema"]
|
||||
|
||||
if field_schema["type"] == "literal":
|
||||
for entry in field_schema["expected"]:
|
||||
for entry in cast("LiteralSchema", field_schema)["expected"]:
|
||||
if isinstance(entry, str):
|
||||
mapping[entry] = variant
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -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 @@ class MessageResource(SyncAPIResource):
|
|||
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 @@ class MessageResource(SyncAPIResource):
|
|||
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 @@ class MessageResource(SyncAPIResource):
|
|||
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 @@ class MessageResource(SyncAPIResource):
|
|||
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 @@ class MessageResource(SyncAPIResource):
|
|||
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 @@ class MessageResource(SyncAPIResource):
|
|||
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 @@ class MessageResource(SyncAPIResource):
|
|||
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 @@ class AsyncMessageResource(AsyncAPIResource):
|
|||
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 @@ class AsyncMessageResource(AsyncAPIResource):
|
|||
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 @@ class AsyncMessageResource(AsyncAPIResource):
|
|||
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 @@ class AsyncMessageResource(AsyncAPIResource):
|
|||
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 @@ class AsyncMessageResource(AsyncAPIResource):
|
|||
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 @@ class AsyncMessageResource(AsyncAPIResource):
|
|||
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 @@ class AsyncMessageResource(AsyncAPIResource):
|
|||
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]),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class PriorityResource(SyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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 @@ class AsyncPriorityResource(AsyncAPIResource):
|
|||
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]),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class RequestsResource(SyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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 @@ class AsyncRequestsResource(AsyncAPIResource):
|
|||
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]),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ class WhoisResource(SyncAPIResource):
|
|||
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 @@ class WhoisResource(SyncAPIResource):
|
|||
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 @@ class AsyncWhoisResource(AsyncAPIResource):
|
|||
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 @@ class AsyncWhoisResource(AsyncAPIResource):
|
|||
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]),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
|
|
@ -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 @@ class TestMessage:
|
|||
"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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
"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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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 @@ class TestAsyncMessage:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
"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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
"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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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 @@ class TestAsyncPriority:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
"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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
"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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
"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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
"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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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 @@ class TestAsyncRequests:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ class TestWhois:
|
|||
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 @@ class TestWhois:
|
|||
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 @@ class TestWhois:
|
|||
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 @@ class TestWhois:
|
|||
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 @@ class TestAsyncWhois:
|
|||
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 @@ class TestAsyncWhois:
|
|||
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 @@ class TestAsyncWhois:
|
|||
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 @@ class TestAsyncWhois:
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ def test_directly_nested_model() -> None:
|
|||
|
||||
# mismatched types
|
||||
m = NestedModel.construct(nested="hello!")
|
||||
assert m.nested == "hello!"
|
||||
assert cast(Any, m.nested) == "hello!"
|
||||
|
||||
|
||||
def test_optional_nested_model() -> None:
|
||||
|
|
@ -48,7 +48,7 @@ def test_optional_nested_model() -> None:
|
|||
# mismatched types
|
||||
m3 = NestedModel.construct(nested={"foo"})
|
||||
assert isinstance(cast(Any, m3.nested), set)
|
||||
assert m3.nested == {"foo"}
|
||||
assert cast(Any, m3.nested) == {"foo"}
|
||||
|
||||
|
||||
def test_list_nested_model() -> None:
|
||||
|
|
@ -323,7 +323,7 @@ def test_list_of_unions() -> None:
|
|||
assert len(m.items) == 2
|
||||
assert isinstance(m.items[0], Submodel1)
|
||||
assert m.items[0].level == -1
|
||||
assert m.items[1] == 156
|
||||
assert cast(Any, m.items[1]) == 156
|
||||
|
||||
|
||||
def test_union_of_lists() -> None:
|
||||
|
|
@ -355,7 +355,7 @@ def test_union_of_lists() -> None:
|
|||
assert len(m.items) == 2
|
||||
assert isinstance(m.items[0], SubModel1)
|
||||
assert m.items[0].level == -1
|
||||
assert m.items[1] == 156
|
||||
assert cast(Any, m.items[1]) == 156
|
||||
|
||||
|
||||
def test_dict_of_union() -> None:
|
||||
|
|
|
|||
|
|
@ -260,20 +260,22 @@ class MyModel(BaseModel):
|
|||
@parametrize
|
||||
@pytest.mark.asyncio
|
||||
async def test_pydantic_model_to_dictionary(use_async: bool) -> None:
|
||||
assert await transform(MyModel(foo="hi!"), Any, use_async) == {"foo": "hi!"}
|
||||
assert await transform(MyModel.construct(foo="hi!"), Any, use_async) == {"foo": "hi!"}
|
||||
assert cast(Any, await transform(MyModel(foo="hi!"), Any, use_async)) == {"foo": "hi!"}
|
||||
assert cast(Any, await transform(MyModel.construct(foo="hi!"), Any, use_async)) == {"foo": "hi!"}
|
||||
|
||||
|
||||
@parametrize
|
||||
@pytest.mark.asyncio
|
||||
async def test_pydantic_empty_model(use_async: bool) -> None:
|
||||
assert await transform(MyModel.construct(), Any, use_async) == {}
|
||||
assert cast(Any, await transform(MyModel.construct(), Any, use_async)) == {}
|
||||
|
||||
|
||||
@parametrize
|
||||
@pytest.mark.asyncio
|
||||
async def test_pydantic_unknown_field(use_async: bool) -> None:
|
||||
assert await transform(MyModel.construct(my_untyped_field=True), Any, use_async) == {"my_untyped_field": True}
|
||||
assert cast(Any, await transform(MyModel.construct(my_untyped_field=True), Any, use_async)) == {
|
||||
"my_untyped_field": True
|
||||
}
|
||||
|
||||
|
||||
@parametrize
|
||||
|
|
@ -285,7 +287,7 @@ async def test_pydantic_mismatched_types(use_async: bool) -> None:
|
|||
params = await transform(model, Any, use_async)
|
||||
else:
|
||||
params = await transform(model, Any, use_async)
|
||||
assert params == {"foo": True}
|
||||
assert cast(Any, params) == {"foo": True}
|
||||
|
||||
|
||||
@parametrize
|
||||
|
|
@ -297,7 +299,7 @@ async def test_pydantic_mismatched_object_type(use_async: bool) -> None:
|
|||
params = await transform(model, Any, use_async)
|
||||
else:
|
||||
params = await transform(model, Any, use_async)
|
||||
assert params == {"foo": {"hello": "world"}}
|
||||
assert cast(Any, params) == {"foo": {"hello": "world"}}
|
||||
|
||||
|
||||
class ModelNestedObjects(BaseModel):
|
||||
|
|
@ -309,7 +311,7 @@ class ModelNestedObjects(BaseModel):
|
|||
async def test_pydantic_nested_objects(use_async: bool) -> None:
|
||||
model = ModelNestedObjects.construct(nested={"foo": "stainless"})
|
||||
assert isinstance(model.nested, MyModel)
|
||||
assert await transform(model, Any, use_async) == {"nested": {"foo": "stainless"}}
|
||||
assert cast(Any, await transform(model, Any, use_async)) == {"nested": {"foo": "stainless"}}
|
||||
|
||||
|
||||
class ModelWithDefaultField(BaseModel):
|
||||
|
|
@ -325,19 +327,19 @@ async def test_pydantic_default_field(use_async: bool) -> None:
|
|||
model = ModelWithDefaultField.construct()
|
||||
assert model.with_none_default is None
|
||||
assert model.with_str_default == "foo"
|
||||
assert await transform(model, Any, use_async) == {}
|
||||
assert cast(Any, await transform(model, Any, use_async)) == {}
|
||||
|
||||
# should be included when the default value is explicitly given
|
||||
model = ModelWithDefaultField.construct(with_none_default=None, with_str_default="foo")
|
||||
assert model.with_none_default is None
|
||||
assert model.with_str_default == "foo"
|
||||
assert await transform(model, Any, use_async) == {"with_none_default": None, "with_str_default": "foo"}
|
||||
assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": None, "with_str_default": "foo"}
|
||||
|
||||
# should be included when a non-default value is explicitly given
|
||||
model = ModelWithDefaultField.construct(with_none_default="bar", with_str_default="baz")
|
||||
assert model.with_none_default == "bar"
|
||||
assert model.with_str_default == "baz"
|
||||
assert await transform(model, Any, use_async) == {"with_none_default": "bar", "with_str_default": "baz"}
|
||||
assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": "bar", "with_str_default": "baz"}
|
||||
|
||||
|
||||
class TypedDictIterableUnion(TypedDict):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue