Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent b0fa819 commit df9cab4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
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
7 changes: 7 additions & 0 deletions src/cloudflare/types/images/v2/direct_upload_create_params.py
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

0 comments on commit df9cab4

Please sign in to comment.