Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #327

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,7 @@ from cloudflare.types.logs.control.cmb import CmbConfig, ConfigDeleteResponse
Methods:

- <code title="post /accounts/{account_id}/logs/control/cmb/config">client.logs.control.cmb.config.<a href="./src/cloudflare/resources/logs/control/cmb/config.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/logs/control/cmb/config_create_params.py">params</a>) -> <a href="./src/cloudflare/types/logs/control/cmb/cmb_config.py">Optional</a></code>
- <code title="delete /accounts/{account_id}/logs/control/cmb/config">client.logs.control.cmb.config.<a href="./src/cloudflare/resources/logs/control/cmb/config.py">delete</a>(\*, account_id, \*\*<a href="src/cloudflare/types/logs/control/cmb/config_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/logs/control/cmb/config_delete_response.py">Optional</a></code>
- <code title="delete /accounts/{account_id}/logs/control/cmb/config">client.logs.control.cmb.config.<a href="./src/cloudflare/resources/logs/control/cmb/config.py">delete</a>(\*, account_id, \*\*<a href="src/cloudflare/types/logs/control/cmb/config_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/logs/control/cmb/config_delete_response.py">object</a></code>
- <code title="get /accounts/{account_id}/logs/control/cmb/config">client.logs.control.cmb.config.<a href="./src/cloudflare/resources/logs/control/cmb/config.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/logs/control/cmb/cmb_config.py">Optional</a></code>

## RayID
Expand Down
58 changes: 24 additions & 34 deletions src/cloudflare/resources/logs/control/cmb/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Any, Type, Optional, cast
from typing import Type, Optional, cast

import httpx

Expand All @@ -23,7 +23,7 @@
from ....._base_client import (
make_request_options,
)
from .....types.logs.control.cmb import CmbConfig, ConfigDeleteResponse, config_create_params, config_delete_params
from .....types.logs.control.cmb import CmbConfig, config_create_params, config_delete_params

__all__ = ["Config", "AsyncConfig"]

Expand Down Expand Up @@ -91,7 +91,7 @@ def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ConfigDeleteResponse]:
) -> object:
"""
Deletes CMB config.

Expand All @@ -108,22 +108,17 @@ def delete(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return cast(
Optional[ConfigDeleteResponse],
self._delete(
f"/accounts/{account_id}/logs/control/cmb/config",
body=maybe_transform(body, config_delete_params.ConfigDeleteParams),
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[ConfigDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return self._delete(
f"/accounts/{account_id}/logs/control/cmb/config",
body=maybe_transform(body, config_delete_params.ConfigDeleteParams),
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(
Expand Down Expand Up @@ -229,7 +224,7 @@ async def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[ConfigDeleteResponse]:
) -> object:
"""
Deletes CMB config.

Expand All @@ -246,22 +241,17 @@ async def delete(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return cast(
Optional[ConfigDeleteResponse],
await self._delete(
f"/accounts/{account_id}/logs/control/cmb/config",
body=await async_maybe_transform(body, config_delete_params.ConfigDeleteParams),
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[ConfigDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._delete(
f"/accounts/{account_id}/logs/control/cmb/config",
body=await async_maybe_transform(body, config_delete_params.ConfigDeleteParams),
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(
Expand Down
1 change: 0 additions & 1 deletion src/cloudflare/types/logs/control/cmb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
from .cmb_config import CmbConfig as CmbConfig
from .config_create_params import ConfigCreateParams as ConfigCreateParams
from .config_delete_params import ConfigDeleteParams as ConfigDeleteParams
from .config_delete_response import ConfigDeleteResponse as ConfigDeleteResponse

This file was deleted.

17 changes: 7 additions & 10 deletions tests/api_resources/logs/control/cmb/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.types.logs.control.cmb import (
CmbConfig,
ConfigDeleteResponse,
)
from cloudflare.types.logs.control.cmb import CmbConfig

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Expand Down Expand Up @@ -78,7 +75,7 @@ def test_method_delete(self, client: Cloudflare) -> None:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={},
)
assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"])
assert_matches_type(object, config, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -91,7 +88,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"
config = response.parse()
assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"])
assert_matches_type(object, config, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -104,7 +101,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

config = response.parse()
assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"])
assert_matches_type(object, config, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -221,7 +218,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={},
)
assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"])
assert_matches_type(object, config, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -234,7 +231,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"
config = await response.parse()
assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"])
assert_matches_type(object, config, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -247,7 +244,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

config = await response.parse()
assert_matches_type(Optional[ConfigDeleteResponse], config, path=["response"])
assert_matches_type(object, config, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down