Skip to content

Commit 06910fd

Browse files
author
stlc-bot
committed
Build SDK
Stainless-Generated-From: 0959c43
1 parent 5307179 commit 06910fd

11 files changed

Lines changed: 105 additions & 9 deletions

‎src/imagekitio/resources/assets.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ def list(
121121
sort: Sort the results by one of the supported fields in ascending or descending
122122
order.
123123
124+
`ASC_ORIGINAL_CREATION_DATE` and `DESC_ORIGINAL_CREATION_DATE` sort files by the
125+
value of the reserved `_internal_original_created_datetime` custom metadata
126+
field (labelled "Original creation date" in the dashboard). This field exists
127+
only after you enable the original creation date setting under the Custom
128+
Metadata tab of the media library settings. Files that have no value set for
129+
this field fall back to their upload time, so migrated assets carrying a
130+
preserved original date and natively uploaded assets are ordered together in a
131+
single timeline.
132+
124133
type: Filter results by asset type.
125134
126135
- `file` — returns only files
@@ -258,6 +267,15 @@ async def list(
258267
sort: Sort the results by one of the supported fields in ascending or descending
259268
order.
260269
270+
`ASC_ORIGINAL_CREATION_DATE` and `DESC_ORIGINAL_CREATION_DATE` sort files by the
271+
value of the reserved `_internal_original_created_datetime` custom metadata
272+
field (labelled "Original creation date" in the dashboard). This field exists
273+
only after you enable the original creation date setting under the Custom
274+
Metadata tab of the media library settings. Files that have no value set for
275+
this field fall back to their upload time, so migrated assets carrying a
276+
preserved original date and natively uploaded assets are ordered together in a
277+
single timeline.
278+
261279
type: Filter results by asset type.
262280
263281
- `file` — returns only files

‎src/imagekitio/resources/beta/v2/files.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ def upload(
172172
customCoordinates will be removed.
173173
174174
custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata
175-
fields before setting these values.
175+
fields before setting these values. To preserve the original creation date of an
176+
asset migrated from another system, set the reserved
177+
`_internal_original_created_datetime` key to an ISO 8601 date string. This key
178+
is available once the original creation date setting is enabled in the media
179+
library settings.
176180
177181
description: Optional text to describe the contents of the file.
178182
@@ -428,7 +432,11 @@ async def upload(
428432
customCoordinates will be removed.
429433
430434
custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata
431-
fields before setting these values.
435+
fields before setting these values. To preserve the original creation date of an
436+
asset migrated from another system, set the reserved
437+
`_internal_original_created_datetime` key to an ISO 8601 date string. This key
438+
is available once the original creation date setting is enabled in the media
439+
library settings.
432440
433441
description: Optional text to describe the contents of the file.
434442

‎src/imagekitio/resources/custom_metadata_fields.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def create(
7777
name: API name of the custom metadata field. This should be unique across all
7878
(including deleted) custom metadata fields.
7979
80+
`_internal_original_created_datetime` is a reserved name and cannot be used.
81+
ImageKit creates that field automatically when you enable the original creation
82+
date setting in the media library settings.
83+
8084
description: Optional description for the custom metadata field. Can be up to 500 characters.
8185
This is shown as a hint to the users while setting the field's value on an asset
8286
in the media library UI.
@@ -309,6 +313,10 @@ async def create(
309313
name: API name of the custom metadata field. This should be unique across all
310314
(including deleted) custom metadata fields.
311315
316+
`_internal_original_created_datetime` is a reserved name and cannot be used.
317+
ImageKit creates that field automatically when you enable the original creation
318+
date setting in the media library settings.
319+
312320
description: Optional description for the custom metadata field. Can be up to 500 characters.
313321
This is shown as a hint to the users while setting the field's value on an asset
314322
in the media library UI.

‎src/imagekitio/resources/files/files.py‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ def update(
137137
value for that key. Before setting any custom metadata on an asset you have to
138138
create the field using custom metadata fields API.
139139
140+
To preserve the original creation date of an asset migrated from another system,
141+
set the reserved `_internal_original_created_datetime` key to an ISO 8601 date
142+
string. This key is available once the original creation date setting is enabled
143+
in the media library settings.
144+
140145
description: Optional text to describe the contents of the file.
141146
142147
extensions: Array of extensions to be applied to the asset. Each extension can be configured
@@ -603,7 +608,11 @@ def upload(
603608
customCoordinates will be removed.
604609
605610
custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata
606-
fields before setting these values.
611+
fields before setting these values. To preserve the original creation date of an
612+
asset migrated from another system, set the reserved
613+
`_internal_original_created_datetime` key to an ISO 8601 date string. This key
614+
is available once the original creation date setting is enabled in the media
615+
library settings.
607616
608617
description: Optional text to describe the contents of the file.
609618
@@ -812,6 +821,11 @@ async def update(
812821
value for that key. Before setting any custom metadata on an asset you have to
813822
create the field using custom metadata fields API.
814823
824+
To preserve the original creation date of an asset migrated from another system,
825+
set the reserved `_internal_original_created_datetime` key to an ISO 8601 date
826+
string. This key is available once the original creation date setting is enabled
827+
in the media library settings.
828+
815829
description: Optional text to describe the contents of the file.
816830
817831
extensions: Array of extensions to be applied to the asset. Each extension can be configured
@@ -1278,7 +1292,11 @@ async def upload(
12781292
customCoordinates will be removed.
12791293
12801294
custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata
1281-
fields before setting these values.
1295+
fields before setting these values. To preserve the original creation date of an
1296+
asset migrated from another system, set the reserved
1297+
`_internal_original_created_datetime` key to an ISO 8601 date string. This key
1298+
is available once the original creation date setting is enabled in the media
1299+
library settings.
12821300
12831301
description: Optional text to describe the contents of the file.
12841302

‎src/imagekitio/types/asset_list_params.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ class AssetListParams(TypedDict, total=False):
7373
"""
7474
Sort the results by one of the supported fields in ascending or descending
7575
order.
76+
77+
`ASC_ORIGINAL_CREATION_DATE` and `DESC_ORIGINAL_CREATION_DATE` sort files by the
78+
value of the reserved `_internal_original_created_datetime` custom metadata
79+
field (labelled "Original creation date" in the dashboard). This field exists
80+
only after you enable the original creation date setting under the Custom
81+
Metadata tab of the media library settings. Files that have no value set for
82+
this field fall back to their upload time, so migrated assets carrying a
83+
preserved original date and natively uploaded assets are ordered together in a
84+
single timeline.
7685
"""
7786

7887
type: Literal["file", "file-version", "folder", "all"]

‎src/imagekitio/types/beta/v2/file_upload_params.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ class FileUploadParams(TypedDict, total=False):
7575
custom_metadata: Annotated[Dict[str, object], PropertyInfo(alias="customMetadata")]
7676
"""JSON key-value pairs to associate with the asset.
7777
78-
Create the custom metadata fields before setting these values.
78+
Create the custom metadata fields before setting these values. To preserve the
79+
original creation date of an asset migrated from another system, set the
80+
reserved `_internal_original_created_datetime` key to an ISO 8601 date string.
81+
This key is available once the original creation date setting is enabled in the
82+
media library settings.
7983
"""
8084

8185
description: str

‎src/imagekitio/types/custom_metadata_field.py‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,20 @@ class CustomMetadataField(BaseModel):
8484
"""
8585

8686
reserved: Optional[bool] = None
87-
"""Present and set to `true` when the field is reserved.
88-
89-
Omitted for regular fields. Reserved fields cannot be deleted.
87+
"""Present and set to `true` when the field is reserved, i.e.
88+
89+
created and managed by ImageKit rather than by you. Omitted for regular fields.
90+
91+
Currently the only reserved field is `_internal_original_created_datetime`
92+
(label "Original creation date", type `Date`). ImageKit creates it when you
93+
enable the original creation date setting under the Custom Metadata tab of the
94+
media library settings in the dashboard. Use it to preserve the original
95+
creation date of assets migrated from another system: set its value through the
96+
`customMetadata` object in the upload or update file details API, then sort with
97+
`ASC_ORIGINAL_CREATION_DATE` or `DESC_ORIGINAL_CREATION_DATE` in the list and
98+
search assets API, or filter with
99+
`"customMetadata._internal_original_created_datetime"` in `searchQuery`.
100+
101+
Reserved fields cannot be deleted, and their name cannot be reused when creating
102+
a new field.
90103
"""

‎src/imagekitio/types/custom_metadata_field_create_params.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class CustomMetadataFieldCreateParams(TypedDict, total=False):
2424
"""API name of the custom metadata field.
2525
2626
This should be unique across all (including deleted) custom metadata fields.
27+
28+
`_internal_original_created_datetime` is a reserved name and cannot be used.
29+
ImageKit creates that field automatically when you enable the original creation
30+
date setting in the media library settings.
2731
"""
2832

2933
schema: Required[Schema]

‎src/imagekitio/types/file_update_params.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class UpdateFileDetails(TypedDict, total=False):
2525
To unset a key, send `null` value for that key. Before setting any custom
2626
metadata on an asset you have to create the field using custom metadata fields
2727
API.
28+
29+
To preserve the original creation date of an asset migrated from another system,
30+
set the reserved `_internal_original_created_datetime` key to an ISO 8601 date
31+
string. This key is available once the original creation date setting is enabled
32+
in the media library settings.
2833
"""
2934

3035
description: str

‎src/imagekitio/types/file_upload_params.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ class FileUploadParams(TypedDict, total=False):
7676
custom_metadata: Annotated[Dict[str, object], PropertyInfo(alias="customMetadata")]
7777
"""JSON key-value pairs to associate with the asset.
7878
79-
Create the custom metadata fields before setting these values.
79+
Create the custom metadata fields before setting these values. To preserve the
80+
original creation date of an asset migrated from another system, set the
81+
reserved `_internal_original_created_datetime` key to an ISO 8601 date string.
82+
This key is available once the original creation date setting is enabled in the
83+
media library settings.
8084
"""
8185

8286
description: str

0 commit comments

Comments
 (0)