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

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
12 changes: 12 additions & 0 deletions src/cloudflare/resources/images/v2/direct_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def create(
self,
*,
account_id: str,
id: str | NotGiven = NOT_GIVEN,
expiry: Union[str, datetime] | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
require_signed_urls: bool | NotGiven = NOT_GIVEN,
Expand All @@ -65,6 +66,10 @@ def create(
Args:
account_id: Account identifier tag.

id: Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths,
and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a
UUID.

expiry: The date after which the upload will not be accepted. Minimum: Now + 2 minutes.
Maximum: Now + 6 hours.

Expand All @@ -87,6 +92,7 @@ def create(
f"/accounts/{account_id}/images/v2/direct_upload",
body=maybe_transform(
{
"id": id,
"expiry": expiry,
"metadata": metadata,
"require_signed_urls": require_signed_urls,
Expand Down Expand Up @@ -117,6 +123,7 @@ async def create(
self,
*,
account_id: str,
id: str | NotGiven = NOT_GIVEN,
expiry: Union[str, datetime] | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
require_signed_urls: bool | NotGiven = NOT_GIVEN,
Expand All @@ -140,6 +147,10 @@ async def create(
Args:
account_id: Account identifier tag.

id: Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths,
and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a
UUID.

expiry: The date after which the upload will not be accepted. Minimum: Now + 2 minutes.
Maximum: Now + 6 hours.

Expand All @@ -162,6 +173,7 @@ async def create(
f"/accounts/{account_id}/images/v2/direct_upload",
body=await async_maybe_transform(
{
"id": id,
"expiry": expiry,
"metadata": metadata,
"require_signed_urls": require_signed_urls,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ class DirectUploadCreateParams(TypedDict, total=False):
account_id: Required[str]
"""Account identifier tag."""

id: str
"""Optional Image Custom ID.

Up to 1024 chars. Can include any number of subpaths, and utf8 characters.
Cannot start nor end with a / (forward slash). Cannot be a UUID.
"""

expiry: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
"""The date after which the upload will not be accepted.

Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/images/v2/test_direct_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_method_create(self, client: Cloudflare) -> None:
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
direct_upload = client.images.v2.direct_uploads.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
id="this/is/my-customid",
expiry=parse_datetime("2021-01-02T02:20:00Z"),
metadata={},
require_signed_urls=True,
Expand Down Expand Up @@ -88,6 +89,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
direct_upload = await async_client.images.v2.direct_uploads.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
id="this/is/my-customid",
expiry=parse_datetime("2021-01-02T02:20:00Z"),
metadata={},
require_signed_urls=True,
Expand Down