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 #312

Merged
merged 1 commit into from
Apr 15, 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
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ from cloudflare.types.zones import DNSSetting, Nameserver

Methods:

- <code title="patch /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zones/dns_setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zones/dns_setting.py">DNSSetting</a></code>
- <code title="get /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zones/dns_setting.py">DNSSetting</a></code>
- <code title="patch /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zones/dns_setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zones/dns_setting.py">Optional</a></code>
- <code title="get /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zones/dns_setting.py">Optional</a></code>

## Settings

Expand Down
18 changes: 9 additions & 9 deletions src/cloudflare/resources/zones/dns_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

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

import httpx

Expand Down Expand Up @@ -51,7 +51,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSetting:
) -> Optional[DNSSetting]:
"""
Update DNS settings for a zone
Expand Down Expand Up @@ -97,7 +97,7 @@ def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]),
)

def get(
Expand All @@ -110,7 +110,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSetting:
) -> Optional[DNSSetting]:
"""
Show DNS settings for a zone
Expand All @@ -136,7 +136,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]),
)


Expand All @@ -163,7 +163,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSetting:
) -> Optional[DNSSetting]:
"""
Update DNS settings for a zone
Expand Down Expand Up @@ -209,7 +209,7 @@ async def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]),
)

async def get(
Expand All @@ -222,7 +222,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSetting:
) -> Optional[DNSSetting]:
"""
Show DNS settings for a zone
Expand All @@ -248,7 +248,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
cast_to=cast(Type[Optional[DNSSetting]], ResultWrapper[DNSSetting]),
)


Expand Down
2 changes: 1 addition & 1 deletion src/cloudflare/types/zones/nameserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@


class Nameserver(BaseModel):
type: Literal["cloudflare.standard", "cloudflare.foundation_dns"]
type: Literal["cloudflare.standard"]
"""Nameserver type"""
2 changes: 1 addition & 1 deletion src/cloudflare/types/zones/nameserver_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@


class NameserverParam(TypedDict, total=False):
type: Required[Literal["cloudflare.standard", "cloudflare.foundation_dns"]]
type: Required[Literal["cloudflare.standard"]]
"""Nameserver type"""
30 changes: 15 additions & 15 deletions tests/api_resources/zones/test_dns_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import os
from typing import Any, cast
from typing import Any, Optional, cast

import pytest

Expand All @@ -23,7 +23,7 @@ def test_method_edit(self, client: Cloudflare) -> None:
dns_setting = client.zones.dns_settings.edit(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -35,7 +35,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
nameservers={"type": "cloudflare.standard"},
secondary_overrides=False,
)
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -47,7 +47,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
dns_setting = response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

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

dns_setting = response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

assert cast(Any, response.is_closed) is True

Expand All @@ -77,7 +77,7 @@ def test_method_get(self, client: Cloudflare) -> None:
dns_setting = client.zones.dns_settings.get(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -89,7 +89,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"
dns_setting = response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

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

dns_setting = response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

assert cast(Any, response.is_closed) is True

Expand All @@ -123,7 +123,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
dns_setting = await async_client.zones.dns_settings.edit(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -135,7 +135,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare)
nameservers={"type": "cloudflare.standard"},
secondary_overrides=False,
)
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -147,7 +147,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
dns_setting = await response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

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

dns_setting = await response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

assert cast(Any, response.is_closed) is True

Expand All @@ -177,7 +177,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
dns_setting = await async_client.zones.dns_settings.get(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

@pytest.mark.skip()
@parametrize
Expand All @@ -189,7 +189,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"
dns_setting = await response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

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

dns_setting = await response.parse()
assert_matches_type(DNSSetting, dns_setting, path=["response"])
assert_matches_type(Optional[DNSSetting], dns_setting, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down