imagekitio 4.9.0 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +1 -1
  4. data/lib/imagekitio/helpers/transformation_utils.rb +1 -0
  5. data/lib/imagekitio/models/accounts/webhook.rb +81 -0
  6. data/lib/imagekitio/models/accounts/webhook_create_params.rb +47 -0
  7. data/lib/imagekitio/models/accounts/webhook_delete_params.rb +24 -0
  8. data/lib/imagekitio/models/accounts/webhook_event_type.rb +32 -0
  9. data/lib/imagekitio/models/accounts/webhook_get_params.rb +24 -0
  10. data/lib/imagekitio/models/accounts/webhook_list_params.rb +16 -0
  11. data/lib/imagekitio/models/accounts/webhook_list_response.rb +10 -0
  12. data/lib/imagekitio/models/accounts/webhook_update_params.rb +54 -0
  13. data/lib/imagekitio/models/asset_list_params.rb +22 -0
  14. data/lib/imagekitio/models/beta/v2/file_upload_params.rb +5 -1
  15. data/lib/imagekitio/models/custom_metadata_field.rb +23 -1
  16. data/lib/imagekitio/models/custom_metadata_field_create_params.rb +4 -0
  17. data/lib/imagekitio/models/file_upload_params.rb +5 -1
  18. data/lib/imagekitio/models/folder.rb +33 -1
  19. data/lib/imagekitio/models/folder_create_event.rb +35 -0
  20. data/lib/imagekitio/models/folder_delete_event.rb +47 -0
  21. data/lib/imagekitio/models/folder_update_event.rb +35 -0
  22. data/lib/imagekitio/models/transformation.rb +33 -1
  23. data/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb +10 -1
  24. data/lib/imagekitio/models/unwrap_webhook_event.rb +10 -1
  25. data/lib/imagekitio/models/update_file_request.rb +5 -0
  26. data/lib/imagekitio/models.rb +6 -0
  27. data/lib/imagekitio/resources/accounts/webhooks.rb +146 -0
  28. data/lib/imagekitio/resources/accounts.rb +4 -0
  29. data/lib/imagekitio/resources/custom_metadata_fields.rb +2 -2
  30. data/lib/imagekitio/resources/files/versions.rb +2 -2
  31. data/lib/imagekitio/resources/files.rb +4 -16
  32. data/lib/imagekitio/resources/folders.rb +2 -8
  33. data/lib/imagekitio/resources/webhooks.rb +2 -2
  34. data/lib/imagekitio/version.rb +1 -1
  35. data/lib/imagekitio.rb +12 -5
  36. data/rbi/imagekitio/models/accounts/webhook.rbi +109 -0
  37. data/rbi/imagekitio/models/accounts/webhook_create_params.rbi +78 -0
  38. data/rbi/imagekitio/models/accounts/webhook_delete_params.rbi +45 -0
  39. data/rbi/imagekitio/models/accounts/webhook_event_type.rbi +101 -0
  40. data/rbi/imagekitio/models/accounts/webhook_get_params.rbi +45 -0
  41. data/rbi/imagekitio/models/accounts/webhook_list_params.rbi +34 -0
  42. data/rbi/imagekitio/models/accounts/webhook_list_response.rbi +13 -0
  43. data/rbi/imagekitio/models/accounts/webhook_update_params.rbi +98 -0
  44. data/rbi/imagekitio/models/asset_list_params.rbi +41 -0
  45. data/rbi/imagekitio/models/beta/v2/file_upload_params.rbi +10 -2
  46. data/rbi/imagekitio/models/custom_metadata_field.rbi +42 -3
  47. data/rbi/imagekitio/models/custom_metadata_field_create_params.rbi +8 -0
  48. data/rbi/imagekitio/models/file_upload_params.rbi +10 -2
  49. data/rbi/imagekitio/models/folder.rbi +49 -0
  50. data/rbi/imagekitio/models/folder_create_event.rbi +53 -0
  51. data/rbi/imagekitio/models/folder_delete_event.rbi +83 -0
  52. data/rbi/imagekitio/models/folder_update_event.rbi +53 -0
  53. data/rbi/imagekitio/models/transformation.rbi +43 -0
  54. data/rbi/imagekitio/models/unsafe_unwrap_webhook_event.rbi +4 -1
  55. data/rbi/imagekitio/models/unwrap_webhook_event.rbi +4 -1
  56. data/rbi/imagekitio/models/update_file_request.rbi +10 -0
  57. data/rbi/imagekitio/models.rbi +6 -0
  58. data/rbi/imagekitio/resources/accounts/webhooks.rbi +113 -0
  59. data/rbi/imagekitio/resources/accounts.rbi +3 -0
  60. data/rbi/imagekitio/resources/assets.rbi +9 -0
  61. data/rbi/imagekitio/resources/beta/v2/files.rbi +5 -1
  62. data/rbi/imagekitio/resources/custom_metadata_fields.rbi +5 -1
  63. data/rbi/imagekitio/resources/files/versions.rbi +1 -1
  64. data/rbi/imagekitio/resources/files.rbi +7 -3
  65. data/rbi/imagekitio/resources/folders.rbi +1 -1
  66. data/rbi/imagekitio/resources/webhooks.rbi +8 -2
  67. data/sig/imagekitio/models/accounts/webhook.rbs +52 -0
  68. data/sig/imagekitio/models/accounts/webhook_create_params.rbs +40 -0
  69. data/sig/imagekitio/models/accounts/webhook_delete_params.rbs +25 -0
  70. data/sig/imagekitio/models/accounts/webhook_event_type.rbs +44 -0
  71. data/sig/imagekitio/models/accounts/webhook_get_params.rbs +25 -0
  72. data/sig/imagekitio/models/accounts/webhook_list_params.rbs +17 -0
  73. data/sig/imagekitio/models/accounts/webhook_list_response.rbs +9 -0
  74. data/sig/imagekitio/models/accounts/webhook_update_params.rbs +51 -0
  75. data/sig/imagekitio/models/asset_list_params.rbs +8 -0
  76. data/sig/imagekitio/models/custom_metadata_field.rbs +10 -3
  77. data/sig/imagekitio/models/folder.rbs +32 -5
  78. data/sig/imagekitio/models/folder_create_event.rbs +32 -0
  79. data/sig/imagekitio/models/folder_delete_event.rbs +48 -0
  80. data/sig/imagekitio/models/folder_update_event.rbs +32 -0
  81. data/sig/imagekitio/models/transformation.rbs +17 -0
  82. data/sig/imagekitio/models/unsafe_unwrap_webhook_event.rbs +3 -0
  83. data/sig/imagekitio/models/unwrap_webhook_event.rbs +3 -0
  84. data/sig/imagekitio/models.rbs +6 -0
  85. data/sig/imagekitio/resources/accounts/webhooks.rbs +38 -0
  86. data/sig/imagekitio/resources/accounts.rbs +2 -0
  87. data/sig/imagekitio/resources/custom_metadata_fields.rbs +1 -4
  88. data/sig/imagekitio/resources/files/versions.rbs +1 -1
  89. data/sig/imagekitio/resources/files.rbs +2 -2
  90. data/sig/imagekitio/resources/folders.rbs +1 -1
  91. data/sig/imagekitio/resources/webhooks.rbs +8 -2
  92. metadata +38 -17
  93. data/lib/imagekitio/models/custom_metadata_field_delete_response.rb +0 -10
  94. data/lib/imagekitio/models/file_copy_response.rb +0 -10
  95. data/lib/imagekitio/models/file_move_response.rb +0 -10
  96. data/lib/imagekitio/models/files/version_delete_response.rb +0 -12
  97. data/lib/imagekitio/models/folder_delete_response.rb +0 -10
  98. data/rbi/imagekitio/models/custom_metadata_field_delete_response.rbi +0 -23
  99. data/rbi/imagekitio/models/file_copy_response.rbi +0 -23
  100. data/rbi/imagekitio/models/file_move_response.rbi +0 -23
  101. data/rbi/imagekitio/models/files/version_delete_response.rbi +0 -25
  102. data/rbi/imagekitio/models/folder_delete_response.rbi +0 -23
  103. data/sig/imagekitio/models/custom_metadata_field_delete_response.rbs +0 -11
  104. data/sig/imagekitio/models/file_copy_response.rbs +0 -11
  105. data/sig/imagekitio/models/file_move_response.rbs +0 -11
  106. data/sig/imagekitio/models/files/version_delete_response.rbs +0 -13
  107. data/sig/imagekitio/models/folder_delete_response.rbs +0 -11
@@ -0,0 +1,78 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ class WebhookCreateParams < Imagekitio::Internal::Type::BaseModel
7
+ extend Imagekitio::Internal::Type::RequestParameters::Converter
8
+ include Imagekitio::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Imagekitio::Accounts::WebhookCreateParams,
14
+ Imagekitio::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # The URL where ImageKit sends webhook events as `POST` requests. Must use the
19
+ # `http` or `https` protocol, and must be unique across all webhooks for your
20
+ # account.
21
+ sig { returns(String) }
22
+ attr_accessor :endpoint
23
+
24
+ # The event types this webhook is subscribed to. ImageKit sends a request to the
25
+ # `endpoint` only for these events.
26
+ sig do
27
+ returns(T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol])
28
+ end
29
+ attr_accessor :events
30
+
31
+ # Whether the webhook is enabled. When `false`, ImageKit doesn't send any events
32
+ # to the `endpoint`.
33
+ sig { returns(T.nilable(T::Boolean)) }
34
+ attr_reader :enabled
35
+
36
+ sig { params(enabled: T::Boolean).void }
37
+ attr_writer :enabled
38
+
39
+ sig do
40
+ params(
41
+ endpoint: String,
42
+ events: T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol],
43
+ enabled: T::Boolean,
44
+ request_options: Imagekitio::RequestOptions::OrHash
45
+ ).returns(T.attached_class)
46
+ end
47
+ def self.new(
48
+ # The URL where ImageKit sends webhook events as `POST` requests. Must use the
49
+ # `http` or `https` protocol, and must be unique across all webhooks for your
50
+ # account.
51
+ endpoint:,
52
+ # The event types this webhook is subscribed to. ImageKit sends a request to the
53
+ # `endpoint` only for these events.
54
+ events:,
55
+ # Whether the webhook is enabled. When `false`, ImageKit doesn't send any events
56
+ # to the `endpoint`.
57
+ enabled: nil,
58
+ request_options: {}
59
+ )
60
+ end
61
+
62
+ sig do
63
+ override.returns(
64
+ {
65
+ endpoint: String,
66
+ events:
67
+ T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol],
68
+ enabled: T::Boolean,
69
+ request_options: Imagekitio::RequestOptions
70
+ }
71
+ )
72
+ end
73
+ def to_hash
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,45 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ class WebhookDeleteParams < Imagekitio::Internal::Type::BaseModel
7
+ extend Imagekitio::Internal::Type::RequestParameters::Converter
8
+ include Imagekitio::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Imagekitio::Accounts::WebhookDeleteParams,
14
+ Imagekitio::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Unique identifier for a webhook.
19
+ sig { returns(String) }
20
+ attr_accessor :id
21
+
22
+ sig do
23
+ params(
24
+ id: String,
25
+ request_options: Imagekitio::RequestOptions::OrHash
26
+ ).returns(T.attached_class)
27
+ end
28
+ def self.new(
29
+ # Unique identifier for a webhook.
30
+ id:,
31
+ request_options: {}
32
+ )
33
+ end
34
+
35
+ sig do
36
+ override.returns(
37
+ { id: String, request_options: Imagekitio::RequestOptions }
38
+ )
39
+ end
40
+ def to_hash
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,101 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ # A webhook event type. Learn more about the payload of each
7
+ # [webhook event](https://imagekit.io/docs/webhooks#list-of-events).
8
+ module WebhookEventType
9
+ extend Imagekitio::Internal::Type::Enum
10
+
11
+ TaggedSymbol =
12
+ T.type_alias { T.all(Symbol, Imagekitio::Accounts::WebhookEventType) }
13
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
14
+
15
+ VIDEO_TRANSFORMATION_ACCEPTED =
16
+ T.let(
17
+ :"video.transformation.accepted",
18
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
19
+ )
20
+ VIDEO_TRANSFORMATION_READY =
21
+ T.let(
22
+ :"video.transformation.ready",
23
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
24
+ )
25
+ VIDEO_TRANSFORMATION_ERROR =
26
+ T.let(
27
+ :"video.transformation.error",
28
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
29
+ )
30
+ UPLOAD_PRE_TRANSFORM_SUCCESS =
31
+ T.let(
32
+ :"upload.pre-transform.success",
33
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
34
+ )
35
+ UPLOAD_PRE_TRANSFORM_ERROR =
36
+ T.let(
37
+ :"upload.pre-transform.error",
38
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
39
+ )
40
+ UPLOAD_POST_TRANSFORM_SUCCESS =
41
+ T.let(
42
+ :"upload.post-transform.success",
43
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
44
+ )
45
+ UPLOAD_POST_TRANSFORM_ERROR =
46
+ T.let(
47
+ :"upload.post-transform.error",
48
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
49
+ )
50
+ FILE_CREATED =
51
+ T.let(
52
+ :"file.created",
53
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
54
+ )
55
+ FILE_UPDATED =
56
+ T.let(
57
+ :"file.updated",
58
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
59
+ )
60
+ FILE_DELETED =
61
+ T.let(
62
+ :"file.deleted",
63
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
64
+ )
65
+ FILE_VERSION_CREATED =
66
+ T.let(
67
+ :"file-version.created",
68
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
69
+ )
70
+ FILE_VERSION_DELETED =
71
+ T.let(
72
+ :"file-version.deleted",
73
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
74
+ )
75
+ FOLDER_CREATED =
76
+ T.let(
77
+ :"folder.created",
78
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
79
+ )
80
+ FOLDER_UPDATED =
81
+ T.let(
82
+ :"folder.updated",
83
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
84
+ )
85
+ FOLDER_DELETED =
86
+ T.let(
87
+ :"folder.deleted",
88
+ Imagekitio::Accounts::WebhookEventType::TaggedSymbol
89
+ )
90
+
91
+ sig do
92
+ override.returns(
93
+ T::Array[Imagekitio::Accounts::WebhookEventType::TaggedSymbol]
94
+ )
95
+ end
96
+ def self.values
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,45 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ class WebhookGetParams < Imagekitio::Internal::Type::BaseModel
7
+ extend Imagekitio::Internal::Type::RequestParameters::Converter
8
+ include Imagekitio::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Imagekitio::Accounts::WebhookGetParams,
14
+ Imagekitio::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Unique identifier for a webhook.
19
+ sig { returns(String) }
20
+ attr_accessor :id
21
+
22
+ sig do
23
+ params(
24
+ id: String,
25
+ request_options: Imagekitio::RequestOptions::OrHash
26
+ ).returns(T.attached_class)
27
+ end
28
+ def self.new(
29
+ # Unique identifier for a webhook.
30
+ id:,
31
+ request_options: {}
32
+ )
33
+ end
34
+
35
+ sig do
36
+ override.returns(
37
+ { id: String, request_options: Imagekitio::RequestOptions }
38
+ )
39
+ end
40
+ def to_hash
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,34 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ class WebhookListParams < Imagekitio::Internal::Type::BaseModel
7
+ extend Imagekitio::Internal::Type::RequestParameters::Converter
8
+ include Imagekitio::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Imagekitio::Accounts::WebhookListParams,
14
+ Imagekitio::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ params(request_options: Imagekitio::RequestOptions::OrHash).returns(
20
+ T.attached_class
21
+ )
22
+ end
23
+ def self.new(request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns({ request_options: Imagekitio::RequestOptions })
28
+ end
29
+ def to_hash
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,13 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ WebhookListResponse =
7
+ T.let(
8
+ Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::Webhook],
9
+ Imagekitio::Internal::Type::Converter
10
+ )
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,98 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ class WebhookUpdateParams < Imagekitio::Internal::Type::BaseModel
7
+ extend Imagekitio::Internal::Type::RequestParameters::Converter
8
+ include Imagekitio::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Imagekitio::Accounts::WebhookUpdateParams,
14
+ Imagekitio::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Unique identifier for a webhook.
19
+ sig { returns(String) }
20
+ attr_accessor :id
21
+
22
+ # Whether the webhook is enabled. Omit to leave the current value unchanged.
23
+ sig { returns(T.nilable(T::Boolean)) }
24
+ attr_reader :enabled
25
+
26
+ sig { params(enabled: T::Boolean).void }
27
+ attr_writer :enabled
28
+
29
+ # The URL where ImageKit sends webhook events as `POST` requests. Must use the
30
+ # `http` or `https` protocol, and must be unique across all webhooks for your
31
+ # account.
32
+ sig { returns(T.nilable(String)) }
33
+ attr_reader :endpoint
34
+
35
+ sig { params(endpoint: String).void }
36
+ attr_writer :endpoint
37
+
38
+ # The event types this webhook is subscribed to. Replaces the existing list. Omit
39
+ # to leave the current value unchanged.
40
+ sig do
41
+ returns(
42
+ T.nilable(
43
+ T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol]
44
+ )
45
+ )
46
+ end
47
+ attr_reader :events
48
+
49
+ sig do
50
+ params(
51
+ events: T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol]
52
+ ).void
53
+ end
54
+ attr_writer :events
55
+
56
+ sig do
57
+ params(
58
+ id: String,
59
+ enabled: T::Boolean,
60
+ endpoint: String,
61
+ events: T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol],
62
+ request_options: Imagekitio::RequestOptions::OrHash
63
+ ).returns(T.attached_class)
64
+ end
65
+ def self.new(
66
+ # Unique identifier for a webhook.
67
+ id:,
68
+ # Whether the webhook is enabled. Omit to leave the current value unchanged.
69
+ enabled: nil,
70
+ # The URL where ImageKit sends webhook events as `POST` requests. Must use the
71
+ # `http` or `https` protocol, and must be unique across all webhooks for your
72
+ # account.
73
+ endpoint: nil,
74
+ # The event types this webhook is subscribed to. Replaces the existing list. Omit
75
+ # to leave the current value unchanged.
76
+ events: nil,
77
+ request_options: {}
78
+ )
79
+ end
80
+
81
+ sig do
82
+ override.returns(
83
+ {
84
+ id: String,
85
+ enabled: T::Boolean,
86
+ endpoint: String,
87
+ events:
88
+ T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol],
89
+ request_options: Imagekitio::RequestOptions
90
+ }
91
+ )
92
+ end
93
+ def to_hash
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -73,6 +73,15 @@ module Imagekitio
73
73
 
74
74
  # Sort the results by one of the supported fields in ascending or descending
75
75
  # 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.
76
85
  sig { returns(T.nilable(Imagekitio::AssetListParams::Sort::OrSymbol)) }
77
86
  attr_reader :sort
78
87
 
@@ -137,6 +146,15 @@ module Imagekitio
137
146
  skip: nil,
138
147
  # Sort the results by one of the supported fields in ascending or descending
139
148
  # order.
149
+ #
150
+ # `ASC_ORIGINAL_CREATION_DATE` and `DESC_ORIGINAL_CREATION_DATE` sort files by the
151
+ # value of the reserved `_internal_original_created_datetime` custom metadata
152
+ # field (labelled "Original creation date" in the dashboard). This field exists
153
+ # only after you enable the original creation date setting under the Custom
154
+ # Metadata tab of the media library settings. Files that have no value set for
155
+ # this field fall back to their upload time, so migrated assets carrying a
156
+ # preserved original date and natively uploaded assets are ordered together in a
157
+ # single timeline.
140
158
  sort: nil,
141
159
  # Filter results by asset type.
142
160
  #
@@ -198,6 +216,15 @@ module Imagekitio
198
216
 
199
217
  # Sort the results by one of the supported fields in ascending or descending
200
218
  # order.
219
+ #
220
+ # `ASC_ORIGINAL_CREATION_DATE` and `DESC_ORIGINAL_CREATION_DATE` sort files by the
221
+ # value of the reserved `_internal_original_created_datetime` custom metadata
222
+ # field (labelled "Original creation date" in the dashboard). This field exists
223
+ # only after you enable the original creation date setting under the Custom
224
+ # Metadata tab of the media library settings. Files that have no value set for
225
+ # this field fall back to their upload time, so migrated assets carrying a
226
+ # preserved original date and natively uploaded assets are ordered together in a
227
+ # single timeline.
201
228
  module Sort
202
229
  extend Imagekitio::Internal::Type::Enum
203
230
 
@@ -236,6 +263,20 @@ module Imagekitio
236
263
  :DESC_RELEVANCE,
237
264
  Imagekitio::AssetListParams::Sort::TaggedSymbol
238
265
  )
266
+ ASC_DURATION =
267
+ T.let(:ASC_DURATION, Imagekitio::AssetListParams::Sort::TaggedSymbol)
268
+ DESC_DURATION =
269
+ T.let(:DESC_DURATION, Imagekitio::AssetListParams::Sort::TaggedSymbol)
270
+ ASC_ORIGINAL_CREATION_DATE =
271
+ T.let(
272
+ :ASC_ORIGINAL_CREATION_DATE,
273
+ Imagekitio::AssetListParams::Sort::TaggedSymbol
274
+ )
275
+ DESC_ORIGINAL_CREATION_DATE =
276
+ T.let(
277
+ :DESC_ORIGINAL_CREATION_DATE,
278
+ Imagekitio::AssetListParams::Sort::TaggedSymbol
279
+ )
239
280
 
240
281
  sig do
241
282
  override.returns(
@@ -75,7 +75,11 @@ module Imagekitio
75
75
  attr_writer :custom_coordinates
76
76
 
77
77
  # JSON key-value pairs to associate with the asset. Create the custom metadata
78
- # fields before setting these values.
78
+ # fields before setting these values. To preserve the original creation date of an
79
+ # asset migrated from another system, set the reserved
80
+ # `_internal_original_created_datetime` key to an ISO 8601 date string. This key
81
+ # is available once the original creation date setting is enabled in the media
82
+ # library settings.
79
83
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
80
84
  attr_reader :custom_metadata
81
85
 
@@ -349,7 +353,11 @@ module Imagekitio
349
353
  # customCoordinates will be removed.
350
354
  custom_coordinates: nil,
351
355
  # JSON key-value pairs to associate with the asset. Create the custom metadata
352
- # fields before setting these values.
356
+ # fields before setting these values. To preserve the original creation date of an
357
+ # asset migrated from another system, set the reserved
358
+ # `_internal_original_created_datetime` key to an ISO 8601 date string. This key
359
+ # is available once the original creation date setting is enabled in the media
360
+ # library settings.
353
361
  custom_metadata: nil,
354
362
  # Optional text to describe the contents of the file.
355
363
  description: nil,
@@ -41,6 +41,27 @@ module Imagekitio
41
41
  sig { params(description: String).void }
42
42
  attr_writer :description
43
43
 
44
+ # Present and set to `true` when the field is reserved, i.e. created and managed
45
+ # by ImageKit rather than by you. Omitted for regular fields.
46
+ #
47
+ # Currently the only reserved field is `_internal_original_created_datetime`
48
+ # (label "Original creation date", type `Date`). ImageKit creates it when you
49
+ # enable the original creation date setting under the Custom Metadata tab of the
50
+ # media library settings in the dashboard. Use it to preserve the original
51
+ # creation date of assets migrated from another system: set its value through the
52
+ # `customMetadata` object in the upload or update file details API, then sort with
53
+ # `ASC_ORIGINAL_CREATION_DATE` or `DESC_ORIGINAL_CREATION_DATE` in the list and
54
+ # search assets API, or filter with
55
+ # `"customMetadata._internal_original_created_datetime"` in `searchQuery`.
56
+ #
57
+ # Reserved fields cannot be deleted, and their name cannot be reused when creating
58
+ # a new field.
59
+ sig { returns(T.nilable(T::Boolean)) }
60
+ attr_reader :reserved
61
+
62
+ sig { params(reserved: T::Boolean).void }
63
+ attr_writer :reserved
64
+
44
65
  # Object containing details of a custom metadata field.
45
66
  sig do
46
67
  params(
@@ -48,7 +69,8 @@ module Imagekitio
48
69
  label: String,
49
70
  name: String,
50
71
  schema: Imagekitio::CustomMetadataField::Schema::OrHash,
51
- description: String
72
+ description: String,
73
+ reserved: T::Boolean
52
74
  ).returns(T.attached_class)
53
75
  end
54
76
  def self.new(
@@ -66,7 +88,23 @@ module Imagekitio
66
88
  # Optional description of the custom metadata field. Only present when a
67
89
  # description has been set. Shown as a hint to the users while setting the field's
68
90
  # value on an asset in the media library UI.
69
- description: nil
91
+ description: nil,
92
+ # Present and set to `true` when the field is reserved, i.e. created and managed
93
+ # by ImageKit rather than by you. Omitted for regular fields.
94
+ #
95
+ # Currently the only reserved field is `_internal_original_created_datetime`
96
+ # (label "Original creation date", type `Date`). ImageKit creates it when you
97
+ # enable the original creation date setting under the Custom Metadata tab of the
98
+ # media library settings in the dashboard. Use it to preserve the original
99
+ # creation date of assets migrated from another system: set its value through the
100
+ # `customMetadata` object in the upload or update file details API, then sort with
101
+ # `ASC_ORIGINAL_CREATION_DATE` or `DESC_ORIGINAL_CREATION_DATE` in the list and
102
+ # search assets API, or filter with
103
+ # `"customMetadata._internal_original_created_datetime"` in `searchQuery`.
104
+ #
105
+ # Reserved fields cannot be deleted, and their name cannot be reused when creating
106
+ # a new field.
107
+ reserved: nil
70
108
  )
71
109
  end
72
110
 
@@ -77,7 +115,8 @@ module Imagekitio
77
115
  label: String,
78
116
  name: String,
79
117
  schema: Imagekitio::CustomMetadataField::Schema,
80
- description: String
118
+ description: String,
119
+ reserved: T::Boolean
81
120
  }
82
121
  )
83
122
  end
@@ -23,6 +23,10 @@ module Imagekitio
23
23
 
24
24
  # API name of the custom metadata field. This should be unique across all
25
25
  # (including deleted) custom metadata fields.
26
+ #
27
+ # `_internal_original_created_datetime` is a reserved name and cannot be used.
28
+ # ImageKit creates that field automatically when you enable the original creation
29
+ # date setting in the media library settings.
26
30
  sig { returns(String) }
27
31
  attr_accessor :name
28
32
 
@@ -62,6 +66,10 @@ module Imagekitio
62
66
  label:,
63
67
  # API name of the custom metadata field. This should be unique across all
64
68
  # (including deleted) custom metadata fields.
69
+ #
70
+ # `_internal_original_created_datetime` is a reserved name and cannot be used.
71
+ # ImageKit creates that field automatically when you enable the original creation
72
+ # date setting in the media library settings.
65
73
  name:,
66
74
  schema:,
67
75
  # Optional description for the custom metadata field. Can be up to 500 characters.
@@ -70,7 +70,11 @@ module Imagekitio
70
70
  attr_writer :custom_coordinates
71
71
 
72
72
  # JSON key-value pairs to associate with the asset. Create the custom metadata
73
- # fields before setting these values.
73
+ # fields before setting these values. To preserve the original creation date of an
74
+ # asset migrated from another system, set the reserved
75
+ # `_internal_original_created_datetime` key to an ISO 8601 date string. This key
76
+ # is available once the original creation date setting is enabled in the media
77
+ # library settings.
74
78
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
75
79
  attr_reader :custom_metadata
76
80
 
@@ -371,7 +375,11 @@ module Imagekitio
371
375
  # customCoordinates will be removed.
372
376
  custom_coordinates: nil,
373
377
  # JSON key-value pairs to associate with the asset. Create the custom metadata
374
- # fields before setting these values.
378
+ # fields before setting these values. To preserve the original creation date of an
379
+ # asset migrated from another system, set the reserved
380
+ # `_internal_original_created_datetime` key to an ISO 8601 date string. This key
381
+ # is available once the original creation date setting is enabled in the media
382
+ # library settings.
375
383
  custom_metadata: nil,
376
384
  # Optional text to describe the contents of the file.
377
385
  description: nil,