diff --git a/api.md b/api.md index 2fd9d1c23e8a..c92fa2a6d89c 100644 --- a/api.md +++ b/api.md @@ -2050,7 +2050,7 @@ from cloudflare.types.logpush.datasets import JobGetResponse Methods: -- client.logpush.datasets.jobs.get(dataset_id, \*, account_id, zone_id) -> JobGetResponse +- client.logpush.datasets.jobs.get(dataset_id, \*, account_id, zone_id) -> Optional ## Edge @@ -2063,7 +2063,7 @@ from cloudflare.types.logpush import InstantLogpushJob, EdgeGetResponse Methods: - client.logpush.edge.create(\*, zone_id, \*\*params) -> Optional -- client.logpush.edge.get(\*, zone_id) -> EdgeGetResponse +- client.logpush.edge.get(\*, zone_id) -> Optional ## Jobs @@ -2078,7 +2078,7 @@ Methods: - client.logpush.jobs.create(\*, account_id, zone_id, \*\*params) -> Optional - client.logpush.jobs.update(job_id, \*, account_id, zone_id, \*\*params) -> Optional - client.logpush.jobs.list(\*, account_id, zone_id) -> SyncSinglePage[Optional] -- client.logpush.jobs.delete(job_id, \*, account_id, zone_id, \*\*params) -> Optional +- client.logpush.jobs.delete(job_id, \*, account_id, zone_id, \*\*params) -> object - client.logpush.jobs.get(job_id, \*, account_id, zone_id) -> Optional ## Ownership diff --git a/src/cloudflare/resources/logpush/datasets/jobs.py b/src/cloudflare/resources/logpush/datasets/jobs.py index b6ce88278f4c..0f2629ce3351 100644 --- a/src/cloudflare/resources/logpush/datasets/jobs.py +++ b/src/cloudflare/resources/logpush/datasets/jobs.py @@ -45,7 +45,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobGetResponse: + ) -> Optional[JobGetResponse]: """ Lists Logpush jobs for an account or zone for a dataset. @@ -87,7 +87,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]), + cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]), ) @@ -112,7 +112,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobGetResponse: + ) -> Optional[JobGetResponse]: """ Lists Logpush jobs for an account or zone for a dataset. @@ -154,7 +154,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]), + cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]), ) diff --git a/src/cloudflare/resources/logpush/edge.py b/src/cloudflare/resources/logpush/edge.py index 6d7d106f081f..0f6f8459d42c 100644 --- a/src/cloudflare/resources/logpush/edge.py +++ b/src/cloudflare/resources/logpush/edge.py @@ -105,7 +105,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EdgeGetResponse: + ) -> Optional[EdgeGetResponse]: """ Lists Instant Logs jobs for a zone. @@ -131,7 +131,7 @@ def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EdgeGetResponse], ResultWrapper[EdgeGetResponse]), + cast_to=cast(Type[Optional[EdgeGetResponse]], ResultWrapper[EdgeGetResponse]), ) @@ -212,7 +212,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EdgeGetResponse: + ) -> Optional[EdgeGetResponse]: """ Lists Instant Logs jobs for a zone. @@ -238,7 +238,7 @@ async def get( timeout=timeout, post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[EdgeGetResponse], ResultWrapper[EdgeGetResponse]), + cast_to=cast(Type[Optional[EdgeGetResponse]], ResultWrapper[EdgeGetResponse]), ) diff --git a/src/cloudflare/resources/logpush/jobs.py b/src/cloudflare/resources/logpush/jobs.py index 575b0beee35c..ebb078e3439b 100644 --- a/src/cloudflare/resources/logpush/jobs.py +++ b/src/cloudflare/resources/logpush/jobs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -28,7 +28,6 @@ ) from ...types.logpush import ( LogpushJob, - JobDeleteResponse, OutputOptionsParam, job_create_params, job_delete_params, @@ -302,7 +301,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[JobDeleteResponse]: + ) -> object: """ Deletes a Logpush job. @@ -333,22 +332,17 @@ def delete( account_or_zone = "zones" account_or_zone_id = zone_id - return cast( - Optional[JobDeleteResponse], - self._delete( - f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", - body=maybe_transform(body, job_delete_params.JobDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[JobDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return self._delete( + f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", + body=maybe_transform(body, job_delete_params.JobDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) def get( @@ -671,7 +665,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[JobDeleteResponse]: + ) -> object: """ Deletes a Logpush job. @@ -702,22 +696,17 @@ async def delete( account_or_zone = "zones" account_or_zone_id = zone_id - return cast( - Optional[JobDeleteResponse], - await self._delete( - f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", - body=await async_maybe_transform(body, job_delete_params.JobDeleteParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Any, ResultWrapper[JobDeleteResponse] - ), # Union types cannot be passed in as arguments in the type system + return await self._delete( + f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}", + body=await async_maybe_transform(body, job_delete_params.JobDeleteParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + post_parser=ResultWrapper._unwrapper, ), + cast_to=cast(Type[object], ResultWrapper[object]), ) async def get( diff --git a/src/cloudflare/types/logpush/__init__.py b/src/cloudflare/types/logpush/__init__.py index 3cb4874d6830..e3eaa13d9d20 100644 --- a/src/cloudflare/types/logpush/__init__.py +++ b/src/cloudflare/types/logpush/__init__.py @@ -10,7 +10,6 @@ from .job_update_params import JobUpdateParams as JobUpdateParams from .edge_create_params import EdgeCreateParams as EdgeCreateParams from .instant_logpush_job import InstantLogpushJob as InstantLogpushJob -from .job_delete_response import JobDeleteResponse as JobDeleteResponse from .output_options_param import OutputOptionsParam as OutputOptionsParam from .ownership_validation import OwnershipValidation as OwnershipValidation from .validate_origin_params import ValidateOriginParams as ValidateOriginParams diff --git a/src/cloudflare/types/logpush/job_delete_response.py b/src/cloudflare/types/logpush/job_delete_response.py deleted file mode 100644 index fef20041b3f0..000000000000 --- a/src/cloudflare/types/logpush/job_delete_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union - -__all__ = ["JobDeleteResponse"] - -JobDeleteResponse = Union[List[object], str, object, None] diff --git a/src/cloudflare/types/secondary_dns/outgoing_status.py b/src/cloudflare/types/secondary_dns/outgoing_status.py index 2d58b2c27143..df54f14d58a3 100644 --- a/src/cloudflare/types/secondary_dns/outgoing_status.py +++ b/src/cloudflare/types/secondary_dns/outgoing_status.py @@ -1,8 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional -from typing_extensions import Literal __all__ = ["OutgoingStatus"] -OutgoingStatus = Optional[Literal] +OutgoingStatus = Optional[str] diff --git a/tests/api_resources/logpush/datasets/test_jobs.py b/tests/api_resources/logpush/datasets/test_jobs.py index 39c7401990e0..d15c3873dd52 100644 --- a/tests/api_resources/logpush/datasets/test_jobs.py +++ b/tests/api_resources/logpush/datasets/test_jobs.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, cast +from typing import Any, Optional, cast import pytest @@ -25,7 +25,7 @@ def test_method_get(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +35,7 @@ def test_method_get_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) assert cast(Any, response.is_closed) is True @@ -103,7 +103,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +113,7 @@ async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) - account_id="string", zone_id="string", ) - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -127,7 +127,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -141,7 +141,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(JobGetResponse, job, path=["response"]) + assert_matches_type(Optional[JobGetResponse], job, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/logpush/test_edge.py b/tests/api_resources/logpush/test_edge.py index 3c0826f48f8d..b1bdf576c704 100644 --- a/tests/api_resources/logpush/test_edge.py +++ b/tests/api_resources/logpush/test_edge.py @@ -76,7 +76,7 @@ def test_method_get(self, client: Cloudflare) -> None: edge = client.logpush.edge.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +88,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" edge = response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" edge = response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) assert cast(Any, response.is_closed) is True @@ -175,7 +175,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: edge = await async_client.logpush.edge.get( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +187,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" edge = await response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) @pytest.mark.skip() @parametrize @@ -199,7 +199,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" edge = await response.parse() - assert_matches_type(EdgeGetResponse, edge, path=["response"]) + assert_matches_type(Optional[EdgeGetResponse], edge, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/logpush/test_jobs.py b/tests/api_resources/logpush/test_jobs.py index ced0fa8530c1..00c5ac7f89aa 100644 --- a/tests/api_resources/logpush/test_jobs.py +++ b/tests/api_resources/logpush/test_jobs.py @@ -10,10 +10,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.pagination import SyncSinglePage, AsyncSinglePage -from cloudflare.types.logpush import ( - LogpushJob, - JobDeleteResponse, -) +from cloudflare.types.logpush import LogpushJob base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -264,7 +261,7 @@ def test_method_delete(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize @@ -275,7 +272,7 @@ def test_method_delete_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize @@ -290,7 +287,7 @@ def test_raw_response_delete(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize @@ -305,7 +302,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) assert cast(Any, response.is_closed) is True @@ -642,7 +639,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize @@ -653,7 +650,7 @@ async def test_method_delete_with_all_params(self, async_client: AsyncCloudflare account_id="string", zone_id="string", ) - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize @@ -668,7 +665,7 @@ async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) @pytest.mark.skip() @parametrize @@ -683,7 +680,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(Optional[JobDeleteResponse], job, path=["response"]) + assert_matches_type(object, job, path=["response"]) assert cast(Any, response.is_closed) is True