diff --git a/src/cloudflare/resources/images/v2/direct_uploads.py b/src/cloudflare/resources/images/v2/direct_uploads.py index abefd7e4502..a0fc5fb1f32 100644 --- a/src/cloudflare/resources/images/v2/direct_uploads.py +++ b/src/cloudflare/resources/images/v2/direct_uploads.py @@ -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, @@ -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. @@ -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, @@ -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, @@ -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. @@ -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, diff --git a/src/cloudflare/types/images/v2/direct_upload_create_params.py b/src/cloudflare/types/images/v2/direct_upload_create_params.py index 80e7b17b65b..477b46c0e38 100644 --- a/src/cloudflare/types/images/v2/direct_upload_create_params.py +++ b/src/cloudflare/types/images/v2/direct_upload_create_params.py @@ -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. diff --git a/tests/api_resources/images/v2/test_direct_uploads.py b/tests/api_resources/images/v2/test_direct_uploads.py index 8a826f37875..a9ed5cc45d6 100644 --- a/tests/api_resources/images/v2/test_direct_uploads.py +++ b/tests/api_resources/images/v2/test_direct_uploads.py @@ -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, @@ -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,