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

Merged
merged 1 commit into from
Jun 7, 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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1343
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0053e474edb7f838f2b1d38334a7ccb983db09216cca0173a3c3d5401cadcf82.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-d780b9eb98465e97c30112eb2c9e586883852508d23a6684bd28e5a9cb7da7a1.yml
8 changes: 1 addition & 7 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3498,15 +3498,9 @@ Methods:

### Downloads

Types:

```python
from cloudflare.types.addressing.loa_documents import DownloadGetResponse
```

Methods:

- <code title="get /accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download">client.addressing.loa_documents.downloads.<a href="./src/cloudflare/resources/addressing/loa_documents/downloads.py">get</a>(loa_document_id, \*, account_id) -> <a href="./src/cloudflare/types/addressing/loa_documents/download_get_response.py">object</a></code>
- <code title="get /accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download">client.addressing.loa_documents.downloads.<a href="./src/cloudflare/resources/addressing/loa_documents/downloads.py">get</a>(loa_document_id, \*, account_id) -> BinaryAPIResponse</code>

## Prefixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Type, Optional, cast
from typing import List, Type, Iterable, Optional, cast

import httpx

Expand Down Expand Up @@ -85,6 +85,8 @@ def create(
account_id: str,
description: Optional[str] | NotGiven = NOT_GIVEN,
enabled: Optional[bool] | NotGiven = NOT_GIVEN,
ips: List[str] | NotGiven = NOT_GIVEN,
memberships: Iterable[address_map_create_params.Membership] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -104,6 +106,9 @@ def create(
enabled: Whether the Address Map is enabled or not. Cloudflare's DNS will not respond
with IP addresses on an Address Map until the map is enabled.

memberships: Zones and Accounts which will be assigned IPs on this Address Map. A zone
membership will take priority over an account membership.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -120,6 +125,8 @@ def create(
{
"description": description,
"enabled": enabled,
"ips": ips,
"memberships": memberships,
},
address_map_create_params.AddressMapCreateParams,
),
Expand Down Expand Up @@ -354,6 +361,8 @@ async def create(
account_id: str,
description: Optional[str] | NotGiven = NOT_GIVEN,
enabled: Optional[bool] | NotGiven = NOT_GIVEN,
ips: List[str] | NotGiven = NOT_GIVEN,
memberships: Iterable[address_map_create_params.Membership] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -373,6 +382,9 @@ async def create(
enabled: Whether the Address Map is enabled or not. Cloudflare's DNS will not respond
with IP addresses on an Address Map until the map is enabled.

memberships: Zones and Accounts which will be assigned IPs on this Address Map. A zone
membership will take priority over an account membership.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -389,6 +401,8 @@ async def create(
{
"description": description,
"enabled": enabled,
"ips": ips,
"memberships": memberships,
},
address_map_create_params.AddressMapCreateParams,
),
Expand Down
34 changes: 22 additions & 12 deletions src/cloudflare/resources/addressing/loa_documents/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
BinaryAPIResponse,
AsyncBinaryAPIResponse,
StreamedBinaryAPIResponse,
AsyncStreamedBinaryAPIResponse,
to_custom_raw_response_wrapper,
to_custom_streamed_response_wrapper,
async_to_custom_raw_response_wrapper,
async_to_custom_streamed_response_wrapper,
)
from ...._base_client import (
make_request_options,
Expand Down Expand Up @@ -42,7 +46,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> BinaryAPIResponse:
"""
Download specified LOA document under the account.

Expand All @@ -63,12 +67,13 @@ def get(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not loa_document_id:
raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}")
extra_headers = {"Accept": "application/pdf", **(extra_headers or {})}
return self._get(
f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=object,
cast_to=BinaryAPIResponse,
)


Expand All @@ -92,7 +97,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> object:
) -> AsyncBinaryAPIResponse:
"""
Download specified LOA document under the account.

Expand All @@ -113,46 +118,51 @@ async def get(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not loa_document_id:
raise ValueError(f"Expected a non-empty value for `loa_document_id` but received {loa_document_id!r}")
extra_headers = {"Accept": "application/pdf", **(extra_headers or {})}
return await self._get(
f"/accounts/{account_id}/addressing/loa_documents/{loa_document_id}/download",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=object,
cast_to=AsyncBinaryAPIResponse,
)


class DownloadsResourceWithRawResponse:
def __init__(self, downloads: DownloadsResource) -> None:
self._downloads = downloads

self.get = to_raw_response_wrapper(
self.get = to_custom_raw_response_wrapper(
downloads.get,
BinaryAPIResponse,
)


class AsyncDownloadsResourceWithRawResponse:
def __init__(self, downloads: AsyncDownloadsResource) -> None:
self._downloads = downloads

self.get = async_to_raw_response_wrapper(
self.get = async_to_custom_raw_response_wrapper(
downloads.get,
AsyncBinaryAPIResponse,
)


class DownloadsResourceWithStreamingResponse:
def __init__(self, downloads: DownloadsResource) -> None:
self._downloads = downloads

self.get = to_streamed_response_wrapper(
self.get = to_custom_streamed_response_wrapper(
downloads.get,
StreamedBinaryAPIResponse,
)


class AsyncDownloadsResourceWithStreamingResponse:
def __init__(self, downloads: AsyncDownloadsResource) -> None:
self._downloads = downloads

self.get = async_to_streamed_response_wrapper(
self.get = async_to_custom_streamed_response_wrapper(
downloads.get,
AsyncStreamedBinaryAPIResponse,
)
22 changes: 20 additions & 2 deletions src/cloudflare/types/addressing/address_map_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

from __future__ import annotations

from typing import Optional
from typing import List, Iterable, Optional
from typing_extensions import Required, TypedDict

__all__ = ["AddressMapCreateParams"]
from .kind import Kind

__all__ = ["AddressMapCreateParams", "Membership"]


class AddressMapCreateParams(TypedDict, total=False):
Expand All @@ -24,3 +26,19 @@ class AddressMapCreateParams(TypedDict, total=False):
Cloudflare's DNS will not respond with IP addresses on an Address Map until the
map is enabled.
"""

ips: List[str]

memberships: Iterable[Membership]
"""Zones and Accounts which will be assigned IPs on this Address Map.

A zone membership will take priority over an account membership.
"""


class Membership(TypedDict, total=False):
identifier: str
"""The identifier for the membership (eg. a zone or account tag)."""

kind: Kind
"""The type of the membership."""
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Membership(BaseModel):
created_at: Optional[datetime] = None

identifier: Optional[str] = None
"""Identifier"""
"""The identifier for the membership (eg. a zone or account tag)."""

kind: Optional[Kind] = None
"""The type of the membership."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Membership(BaseModel):
created_at: Optional[datetime] = None

identifier: Optional[str] = None
"""Identifier"""
"""The identifier for the membership (eg. a zone or account tag)."""

kind: Optional[Kind] = None
"""The type of the membership."""
Expand Down
Loading