imagekitio 4.10.0 → 4.12.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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/README.md +28 -1
  4. data/lib/imagekitio/client.rb +4 -0
  5. data/lib/imagekitio/internal/tag_cursor.rb +86 -0
  6. data/lib/imagekitio/models/accounts/contract_get_params.rb +16 -0
  7. data/lib/imagekitio/models/accounts/contract_get_response.rb +82 -0
  8. data/lib/imagekitio/models/accounts/contract_units.rb +42 -0
  9. data/lib/imagekitio/models/accounts/url_endpoint_request.rb +17 -1
  10. data/lib/imagekitio/models/accounts/url_endpoint_response.rb +17 -1
  11. data/lib/imagekitio/models/accounts/webhook.rb +81 -0
  12. data/lib/imagekitio/models/accounts/webhook_create_params.rb +47 -0
  13. data/lib/imagekitio/models/accounts/webhook_delete_params.rb +24 -0
  14. data/lib/imagekitio/models/accounts/webhook_event_type.rb +32 -0
  15. data/lib/imagekitio/models/accounts/webhook_get_params.rb +24 -0
  16. data/lib/imagekitio/models/accounts/webhook_list_params.rb +16 -0
  17. data/lib/imagekitio/models/accounts/webhook_list_response.rb +10 -0
  18. data/lib/imagekitio/models/accounts/webhook_update_params.rb +54 -0
  19. data/lib/imagekitio/models/asset_list_params.rb +18 -0
  20. data/lib/imagekitio/models/beta/v2/file_upload_params.rb +5 -1
  21. data/lib/imagekitio/models/custom_metadata_field.rb +16 -3
  22. data/lib/imagekitio/models/custom_metadata_field_create_params.rb +4 -0
  23. data/lib/imagekitio/models/file_upload_params.rb +5 -1
  24. data/lib/imagekitio/models/folder.rb +33 -1
  25. data/lib/imagekitio/models/folder_create_event.rb +35 -0
  26. data/lib/imagekitio/models/folder_delete_event.rb +47 -0
  27. data/lib/imagekitio/models/folder_update_event.rb +35 -0
  28. data/lib/imagekitio/models/tag.rb +52 -0
  29. data/lib/imagekitio/models/tag_list_params.rb +143 -0
  30. data/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb +10 -1
  31. data/lib/imagekitio/models/unwrap_webhook_event.rb +10 -1
  32. data/lib/imagekitio/models/update_file_request.rb +5 -0
  33. data/lib/imagekitio/models.rb +10 -0
  34. data/lib/imagekitio/resources/accounts/contract.rb +47 -0
  35. data/lib/imagekitio/resources/accounts/webhooks.rb +146 -0
  36. data/lib/imagekitio/resources/accounts.rb +8 -0
  37. data/lib/imagekitio/resources/custom_metadata_fields.rb +2 -2
  38. data/lib/imagekitio/resources/files/versions.rb +2 -2
  39. data/lib/imagekitio/resources/files.rb +4 -16
  40. data/lib/imagekitio/resources/folders.rb +2 -8
  41. data/lib/imagekitio/resources/tags.rb +65 -0
  42. data/lib/imagekitio/resources/webhooks.rb +2 -2
  43. data/lib/imagekitio/version.rb +1 -1
  44. data/lib/imagekitio.rb +20 -5
  45. data/rbi/imagekitio/client.rbi +3 -0
  46. data/rbi/imagekitio/internal/tag_cursor.rbi +22 -0
  47. data/rbi/imagekitio/models/accounts/contract_get_params.rbi +34 -0
  48. data/rbi/imagekitio/models/accounts/contract_get_response.rbi +126 -0
  49. data/rbi/imagekitio/models/accounts/contract_units.rbi +66 -0
  50. data/rbi/imagekitio/models/accounts/url_endpoint_request.rbi +19 -1
  51. data/rbi/imagekitio/models/accounts/url_endpoint_response.rbi +19 -1
  52. data/rbi/imagekitio/models/accounts/webhook.rbi +109 -0
  53. data/rbi/imagekitio/models/accounts/webhook_create_params.rbi +78 -0
  54. data/rbi/imagekitio/models/accounts/webhook_delete_params.rbi +45 -0
  55. data/rbi/imagekitio/models/accounts/webhook_event_type.rbi +101 -0
  56. data/rbi/imagekitio/models/accounts/webhook_get_params.rbi +45 -0
  57. data/rbi/imagekitio/models/accounts/webhook_list_params.rbi +34 -0
  58. data/rbi/imagekitio/models/accounts/webhook_list_response.rbi +13 -0
  59. data/rbi/imagekitio/models/accounts/webhook_update_params.rbi +98 -0
  60. data/rbi/imagekitio/models/asset_list_params.rbi +27 -0
  61. data/rbi/imagekitio/models/beta/v2/file_upload_params.rbi +10 -2
  62. data/rbi/imagekitio/models/custom_metadata_field.rbi +30 -4
  63. data/rbi/imagekitio/models/custom_metadata_field_create_params.rbi +8 -0
  64. data/rbi/imagekitio/models/file_upload_params.rbi +10 -2
  65. data/rbi/imagekitio/models/folder.rbi +49 -0
  66. data/rbi/imagekitio/models/folder_create_event.rbi +53 -0
  67. data/rbi/imagekitio/models/folder_delete_event.rbi +83 -0
  68. data/rbi/imagekitio/models/folder_update_event.rbi +53 -0
  69. data/rbi/imagekitio/models/tag.rbi +71 -0
  70. data/rbi/imagekitio/models/tag_list_params.rbi +236 -0
  71. data/rbi/imagekitio/models/unsafe_unwrap_webhook_event.rbi +4 -1
  72. data/rbi/imagekitio/models/unwrap_webhook_event.rbi +4 -1
  73. data/rbi/imagekitio/models/update_file_request.rbi +10 -0
  74. data/rbi/imagekitio/models.rbi +10 -0
  75. data/rbi/imagekitio/resources/accounts/contract.rbi +36 -0
  76. data/rbi/imagekitio/resources/accounts/webhooks.rbi +113 -0
  77. data/rbi/imagekitio/resources/accounts.rbi +6 -0
  78. data/rbi/imagekitio/resources/assets.rbi +9 -0
  79. data/rbi/imagekitio/resources/beta/v2/files.rbi +5 -1
  80. data/rbi/imagekitio/resources/custom_metadata_fields.rbi +5 -1
  81. data/rbi/imagekitio/resources/files/versions.rbi +1 -1
  82. data/rbi/imagekitio/resources/files.rbi +7 -3
  83. data/rbi/imagekitio/resources/folders.rbi +1 -1
  84. data/rbi/imagekitio/resources/tags.rbi +74 -0
  85. data/rbi/imagekitio/resources/webhooks.rbi +8 -2
  86. data/sig/imagekitio/client.rbs +2 -0
  87. data/sig/imagekitio/internal/tag_cursor.rbs +13 -0
  88. data/sig/imagekitio/models/accounts/contract_get_params.rbs +17 -0
  89. data/sig/imagekitio/models/accounts/contract_get_response.rbs +73 -0
  90. data/sig/imagekitio/models/accounts/contract_units.rbs +37 -0
  91. data/sig/imagekitio/models/accounts/url_endpoint_request.rbs +12 -2
  92. data/sig/imagekitio/models/accounts/url_endpoint_response.rbs +12 -2
  93. data/sig/imagekitio/models/accounts/webhook.rbs +52 -0
  94. data/sig/imagekitio/models/accounts/webhook_create_params.rbs +40 -0
  95. data/sig/imagekitio/models/accounts/webhook_delete_params.rbs +25 -0
  96. data/sig/imagekitio/models/accounts/webhook_event_type.rbs +44 -0
  97. data/sig/imagekitio/models/accounts/webhook_get_params.rbs +25 -0
  98. data/sig/imagekitio/models/accounts/webhook_list_params.rbs +17 -0
  99. data/sig/imagekitio/models/accounts/webhook_list_response.rbs +9 -0
  100. data/sig/imagekitio/models/accounts/webhook_update_params.rbs +51 -0
  101. data/sig/imagekitio/models/folder.rbs +32 -5
  102. data/sig/imagekitio/models/folder_create_event.rbs +32 -0
  103. data/sig/imagekitio/models/folder_delete_event.rbs +48 -0
  104. data/sig/imagekitio/models/folder_update_event.rbs +32 -0
  105. data/sig/imagekitio/models/tag.rbs +30 -0
  106. data/sig/imagekitio/models/tag_list_params.rbs +114 -0
  107. data/sig/imagekitio/models/unsafe_unwrap_webhook_event.rbs +3 -0
  108. data/sig/imagekitio/models/unwrap_webhook_event.rbs +3 -0
  109. data/sig/imagekitio/models.rbs +10 -0
  110. data/sig/imagekitio/resources/accounts/contract.rbs +13 -0
  111. data/sig/imagekitio/resources/accounts/webhooks.rbs +38 -0
  112. data/sig/imagekitio/resources/accounts.rbs +4 -0
  113. data/sig/imagekitio/resources/custom_metadata_fields.rbs +1 -4
  114. data/sig/imagekitio/resources/files/versions.rbs +1 -1
  115. data/sig/imagekitio/resources/files.rbs +2 -2
  116. data/sig/imagekitio/resources/folders.rbs +1 -1
  117. data/sig/imagekitio/resources/tags.rbs +18 -0
  118. data/sig/imagekitio/resources/webhooks.rbs +8 -2
  119. metadata +62 -17
  120. data/lib/imagekitio/models/custom_metadata_field_delete_response.rb +0 -10
  121. data/lib/imagekitio/models/file_copy_response.rb +0 -10
  122. data/lib/imagekitio/models/file_move_response.rb +0 -10
  123. data/lib/imagekitio/models/files/version_delete_response.rb +0 -12
  124. data/lib/imagekitio/models/folder_delete_response.rb +0 -10
  125. data/rbi/imagekitio/models/custom_metadata_field_delete_response.rbi +0 -23
  126. data/rbi/imagekitio/models/file_copy_response.rbi +0 -23
  127. data/rbi/imagekitio/models/file_move_response.rbi +0 -23
  128. data/rbi/imagekitio/models/files/version_delete_response.rbi +0 -25
  129. data/rbi/imagekitio/models/folder_delete_response.rbi +0 -23
  130. data/sig/imagekitio/models/custom_metadata_field_delete_response.rbs +0 -11
  131. data/sig/imagekitio/models/file_copy_response.rbs +0 -11
  132. data/sig/imagekitio/models/file_move_response.rbs +0 -11
  133. data/sig/imagekitio/models/files/version_delete_response.rbs +0 -13
  134. data/sig/imagekitio/models/folder_delete_response.rbs +0 -11
@@ -0,0 +1,236 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ class TagListParams < Imagekitio::Internal::Type::BaseModel
6
+ extend Imagekitio::Internal::Type::RequestParameters::Converter
7
+ include Imagekitio::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Imagekitio::TagListParams, Imagekitio::Internal::AnyHash)
12
+ end
13
+
14
+ # The `nextCursor` value from the previous response, to fetch the next page. A
15
+ # cursor is bound to the `tagSource`, `fileType`, `sort`, `search` and `prefix` it
16
+ # was issued with; sending it with different values returns a 400.
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :cursor
19
+
20
+ sig { params(cursor: String).void }
21
+ attr_writer :cursor
22
+
23
+ # Filter tags by the type of asset they are applied to.
24
+ #
25
+ # - `image` — tags in use on images
26
+ # - `video` — tags in use on videos
27
+ # - `static` — tags in use on any other file, such as documents, scripts and
28
+ # stylesheets
29
+ # - `all` — tags in use on any asset
30
+ sig { returns(T.nilable(Imagekitio::TagListParams::FileType::OrSymbol)) }
31
+ attr_reader :file_type
32
+
33
+ sig do
34
+ params(file_type: Imagekitio::TagListParams::FileType::OrSymbol).void
35
+ end
36
+ attr_writer :file_type
37
+
38
+ # The maximum number of tags to return in response.
39
+ sig { returns(T.nilable(Integer)) }
40
+ attr_reader :limit
41
+
42
+ sig { params(limit: Integer).void }
43
+ attr_writer :limit
44
+
45
+ # Only return tags that begin with this value. Matching is case-insensitive.
46
+ sig { returns(T.nilable(String)) }
47
+ attr_reader :prefix
48
+
49
+ sig { params(prefix: String).void }
50
+ attr_writer :prefix
51
+
52
+ # Only return tags that contain this text. Every word in the value must appear in
53
+ # the tag and the last word may be incomplete, which suits search-as-you-type.
54
+ # Matching is case-insensitive.
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :search
57
+
58
+ sig { params(search: String).void }
59
+ attr_writer :search
60
+
61
+ # Sort the results.
62
+ #
63
+ # - `ASC_NAME` / `DESC_NAME` — by `name`
64
+ # - `ASC_LAST_USED` / `DESC_LAST_USED` — by `lastUsedAt` within the requested
65
+ # `tagSource` and `fileType`, ties broken by `name`
66
+ sig { returns(T.nilable(Imagekitio::TagListParams::Sort::OrSymbol)) }
67
+ attr_reader :sort
68
+
69
+ sig { params(sort: Imagekitio::TagListParams::Sort::OrSymbol).void }
70
+ attr_writer :sort
71
+
72
+ # Filter tags by who added them.
73
+ #
74
+ # - `user` — tags added by users through the dashboard or the API
75
+ # - `ai` — tags added by AI auto-tagging extensions
76
+ # - `all` — both
77
+ sig { returns(T.nilable(Imagekitio::TagListParams::TagSource::OrSymbol)) }
78
+ attr_reader :tag_source
79
+
80
+ sig do
81
+ params(tag_source: Imagekitio::TagListParams::TagSource::OrSymbol).void
82
+ end
83
+ attr_writer :tag_source
84
+
85
+ sig do
86
+ params(
87
+ cursor: String,
88
+ file_type: Imagekitio::TagListParams::FileType::OrSymbol,
89
+ limit: Integer,
90
+ prefix: String,
91
+ search: String,
92
+ sort: Imagekitio::TagListParams::Sort::OrSymbol,
93
+ tag_source: Imagekitio::TagListParams::TagSource::OrSymbol,
94
+ request_options: Imagekitio::RequestOptions::OrHash
95
+ ).returns(T.attached_class)
96
+ end
97
+ def self.new(
98
+ # The `nextCursor` value from the previous response, to fetch the next page. A
99
+ # cursor is bound to the `tagSource`, `fileType`, `sort`, `search` and `prefix` it
100
+ # was issued with; sending it with different values returns a 400.
101
+ cursor: nil,
102
+ # Filter tags by the type of asset they are applied to.
103
+ #
104
+ # - `image` — tags in use on images
105
+ # - `video` — tags in use on videos
106
+ # - `static` — tags in use on any other file, such as documents, scripts and
107
+ # stylesheets
108
+ # - `all` — tags in use on any asset
109
+ file_type: nil,
110
+ # The maximum number of tags to return in response.
111
+ limit: nil,
112
+ # Only return tags that begin with this value. Matching is case-insensitive.
113
+ prefix: nil,
114
+ # Only return tags that contain this text. Every word in the value must appear in
115
+ # the tag and the last word may be incomplete, which suits search-as-you-type.
116
+ # Matching is case-insensitive.
117
+ search: nil,
118
+ # Sort the results.
119
+ #
120
+ # - `ASC_NAME` / `DESC_NAME` — by `name`
121
+ # - `ASC_LAST_USED` / `DESC_LAST_USED` — by `lastUsedAt` within the requested
122
+ # `tagSource` and `fileType`, ties broken by `name`
123
+ sort: nil,
124
+ # Filter tags by who added them.
125
+ #
126
+ # - `user` — tags added by users through the dashboard or the API
127
+ # - `ai` — tags added by AI auto-tagging extensions
128
+ # - `all` — both
129
+ tag_source: nil,
130
+ request_options: {}
131
+ )
132
+ end
133
+
134
+ sig do
135
+ override.returns(
136
+ {
137
+ cursor: String,
138
+ file_type: Imagekitio::TagListParams::FileType::OrSymbol,
139
+ limit: Integer,
140
+ prefix: String,
141
+ search: String,
142
+ sort: Imagekitio::TagListParams::Sort::OrSymbol,
143
+ tag_source: Imagekitio::TagListParams::TagSource::OrSymbol,
144
+ request_options: Imagekitio::RequestOptions
145
+ }
146
+ )
147
+ end
148
+ def to_hash
149
+ end
150
+
151
+ # Filter tags by the type of asset they are applied to.
152
+ #
153
+ # - `image` — tags in use on images
154
+ # - `video` — tags in use on videos
155
+ # - `static` — tags in use on any other file, such as documents, scripts and
156
+ # stylesheets
157
+ # - `all` — tags in use on any asset
158
+ module FileType
159
+ extend Imagekitio::Internal::Type::Enum
160
+
161
+ TaggedSymbol =
162
+ T.type_alias { T.all(Symbol, Imagekitio::TagListParams::FileType) }
163
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
164
+
165
+ IMAGE = T.let(:image, Imagekitio::TagListParams::FileType::TaggedSymbol)
166
+ VIDEO = T.let(:video, Imagekitio::TagListParams::FileType::TaggedSymbol)
167
+ STATIC =
168
+ T.let(:static, Imagekitio::TagListParams::FileType::TaggedSymbol)
169
+ ALL = T.let(:all, Imagekitio::TagListParams::FileType::TaggedSymbol)
170
+
171
+ sig do
172
+ override.returns(
173
+ T::Array[Imagekitio::TagListParams::FileType::TaggedSymbol]
174
+ )
175
+ end
176
+ def self.values
177
+ end
178
+ end
179
+
180
+ # Sort the results.
181
+ #
182
+ # - `ASC_NAME` / `DESC_NAME` — by `name`
183
+ # - `ASC_LAST_USED` / `DESC_LAST_USED` — by `lastUsedAt` within the requested
184
+ # `tagSource` and `fileType`, ties broken by `name`
185
+ module Sort
186
+ extend Imagekitio::Internal::Type::Enum
187
+
188
+ TaggedSymbol =
189
+ T.type_alias { T.all(Symbol, Imagekitio::TagListParams::Sort) }
190
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
191
+
192
+ ASC_NAME =
193
+ T.let(:ASC_NAME, Imagekitio::TagListParams::Sort::TaggedSymbol)
194
+ DESC_NAME =
195
+ T.let(:DESC_NAME, Imagekitio::TagListParams::Sort::TaggedSymbol)
196
+ ASC_LAST_USED =
197
+ T.let(:ASC_LAST_USED, Imagekitio::TagListParams::Sort::TaggedSymbol)
198
+ DESC_LAST_USED =
199
+ T.let(:DESC_LAST_USED, Imagekitio::TagListParams::Sort::TaggedSymbol)
200
+
201
+ sig do
202
+ override.returns(
203
+ T::Array[Imagekitio::TagListParams::Sort::TaggedSymbol]
204
+ )
205
+ end
206
+ def self.values
207
+ end
208
+ end
209
+
210
+ # Filter tags by who added them.
211
+ #
212
+ # - `user` — tags added by users through the dashboard or the API
213
+ # - `ai` — tags added by AI auto-tagging extensions
214
+ # - `all` — both
215
+ module TagSource
216
+ extend Imagekitio::Internal::Type::Enum
217
+
218
+ TaggedSymbol =
219
+ T.type_alias { T.all(Symbol, Imagekitio::TagListParams::TagSource) }
220
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
221
+
222
+ USER = T.let(:user, Imagekitio::TagListParams::TagSource::TaggedSymbol)
223
+ AI = T.let(:ai, Imagekitio::TagListParams::TagSource::TaggedSymbol)
224
+ ALL = T.let(:all, Imagekitio::TagListParams::TagSource::TaggedSymbol)
225
+
226
+ sig do
227
+ override.returns(
228
+ T::Array[Imagekitio::TagListParams::TagSource::TaggedSymbol]
229
+ )
230
+ end
231
+ def self.values
232
+ end
233
+ end
234
+ end
235
+ end
236
+ end
@@ -22,7 +22,10 @@ module Imagekitio
22
22
  Imagekitio::FileUpdateEvent,
23
23
  Imagekitio::FileDeleteEvent,
24
24
  Imagekitio::FileVersionCreateEvent,
25
- Imagekitio::FileVersionDeleteEvent
25
+ Imagekitio::FileVersionDeleteEvent,
26
+ Imagekitio::FolderCreateEvent,
27
+ Imagekitio::FolderUpdateEvent,
28
+ Imagekitio::FolderDeleteEvent
26
29
  )
27
30
  end
28
31
 
@@ -22,7 +22,10 @@ module Imagekitio
22
22
  Imagekitio::FileUpdateEvent,
23
23
  Imagekitio::FileDeleteEvent,
24
24
  Imagekitio::FileVersionCreateEvent,
25
- Imagekitio::FileVersionDeleteEvent
25
+ Imagekitio::FileVersionDeleteEvent,
26
+ Imagekitio::FolderCreateEvent,
27
+ Imagekitio::FolderUpdateEvent,
28
+ Imagekitio::FolderDeleteEvent
26
29
  )
27
30
  end
28
31
 
@@ -31,6 +31,11 @@ module Imagekitio
31
31
  # A key-value data to be associated with the asset. To unset a key, send `null`
32
32
  # value for that key. Before setting any custom metadata on an asset you have to
33
33
  # create the field using custom metadata fields API.
34
+ #
35
+ # To preserve the original creation date of an asset migrated from another system,
36
+ # set the reserved `_internal_original_created_datetime` key to an ISO 8601 date
37
+ # string. This key is available once the original creation date setting is enabled
38
+ # in the media library settings.
34
39
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
35
40
  attr_reader :custom_metadata
36
41
 
@@ -135,6 +140,11 @@ module Imagekitio
135
140
  # A key-value data to be associated with the asset. To unset a key, send `null`
136
141
  # value for that key. Before setting any custom metadata on an asset you have to
137
142
  # create the field using custom metadata fields API.
143
+ #
144
+ # To preserve the original creation date of an asset migrated from another system,
145
+ # set the reserved `_internal_original_created_datetime` key to an ISO 8601 date
146
+ # string. This key is available once the original creation date setting is enabled
147
+ # in the media library settings.
138
148
  custom_metadata: nil,
139
149
  # Optional text to describe the contents of the file.
140
150
  description: nil,
@@ -80,8 +80,12 @@ module Imagekitio
80
80
 
81
81
  FolderCopyParams = Imagekitio::Models::FolderCopyParams
82
82
 
83
+ FolderCreateEvent = Imagekitio::Models::FolderCreateEvent
84
+
83
85
  FolderCreateParams = Imagekitio::Models::FolderCreateParams
84
86
 
87
+ FolderDeleteEvent = Imagekitio::Models::FolderDeleteEvent
88
+
85
89
  FolderDeleteParams = Imagekitio::Models::FolderDeleteParams
86
90
 
87
91
  FolderMoveParams = Imagekitio::Models::FolderMoveParams
@@ -90,6 +94,8 @@ module Imagekitio
90
94
 
91
95
  Folders = Imagekitio::Models::Folders
92
96
 
97
+ FolderUpdateEvent = Imagekitio::Models::FolderUpdateEvent
98
+
93
99
  GetImageAttributesOptions = Imagekitio::Models::GetImageAttributesOptions
94
100
 
95
101
  ImageOverlay = Imagekitio::Models::ImageOverlay
@@ -155,6 +161,10 @@ module Imagekitio
155
161
  SubtitleOverlayTransformation =
156
162
  Imagekitio::Models::SubtitleOverlayTransformation
157
163
 
164
+ Tag = Imagekitio::Models::Tag
165
+
166
+ TagListParams = Imagekitio::Models::TagListParams
167
+
158
168
  TextOverlay = Imagekitio::Models::TextOverlay
159
169
 
160
170
  TextOverlayTransformation = Imagekitio::Models::TextOverlayTransformation
@@ -0,0 +1,36 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Resources
5
+ class Accounts
6
+ class Contract
7
+ # Get the account's contract terms and the usage consumed against them in the
8
+ # current contract term. Bandwidth is in bytes; video processing units, extension
9
+ # units and purge cache requests are counts.
10
+ #
11
+ # For an agency account, consumption includes the child accounts billed to it. A
12
+ # child account billed to its parent cannot call this endpoint; call it with the
13
+ # parent account's credentials instead.
14
+ #
15
+ # Contract terms are read live; consumption is refreshed periodically, not on
16
+ # every request. Use `asOf` to check how fresh it is. Contracts of one month or
17
+ # less are reported as `hasContract: false`. The response is cached for 5 minutes
18
+ # per account.
19
+ #
20
+ # Requires an API key with account management access.
21
+ sig do
22
+ params(request_options: Imagekitio::RequestOptions::OrHash).returns(
23
+ Imagekitio::Models::Accounts::ContractGetResponse
24
+ )
25
+ end
26
+ def get(request_options: {})
27
+ end
28
+
29
+ # @api private
30
+ sig { params(client: Imagekitio::Client).returns(T.attached_class) }
31
+ def self.new(client:)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,113 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Resources
5
+ class Accounts
6
+ class Webhooks
7
+ # Creates a new webhook and returns the created object, including the generated
8
+ # signing `secret`.
9
+ #
10
+ # ImageKit sends a `POST` request to the webhook `endpoint` whenever one of the
11
+ # subscribed `events` occurs. Use the `secret` to verify the signature of each
12
+ # request. Learn more about [webhooks](https://imagekit.io/docs/webhooks).
13
+ #
14
+ # You can create up to 3 webhooks per account.
15
+ sig do
16
+ params(
17
+ endpoint: String,
18
+ events: T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol],
19
+ enabled: T::Boolean,
20
+ request_options: Imagekitio::RequestOptions::OrHash
21
+ ).returns(Imagekitio::Accounts::Webhook)
22
+ end
23
+ def create(
24
+ # The URL where ImageKit sends webhook events as `POST` requests. Must use the
25
+ # `http` or `https` protocol, and must be unique across all webhooks for your
26
+ # account.
27
+ endpoint:,
28
+ # The event types this webhook is subscribed to. ImageKit sends a request to the
29
+ # `endpoint` only for these events.
30
+ events:,
31
+ # Whether the webhook is enabled. When `false`, ImageKit doesn't send any events
32
+ # to the `endpoint`.
33
+ enabled: nil,
34
+ request_options: {}
35
+ )
36
+ end
37
+
38
+ # Updates the webhook identified by `id` and returns the updated object. Only the
39
+ # fields included in the request body are changed.
40
+ #
41
+ # When `events` is provided, it replaces the existing list of subscribed events.
42
+ # The signing `secret` can't be changed.
43
+ sig do
44
+ params(
45
+ id: String,
46
+ enabled: T::Boolean,
47
+ endpoint: String,
48
+ events: T::Array[Imagekitio::Accounts::WebhookEventType::OrSymbol],
49
+ request_options: Imagekitio::RequestOptions::OrHash
50
+ ).returns(Imagekitio::Accounts::Webhook)
51
+ end
52
+ def update(
53
+ # Unique identifier for a webhook.
54
+ id,
55
+ # Whether the webhook is enabled. Omit to leave the current value unchanged.
56
+ enabled: nil,
57
+ # The URL where ImageKit sends webhook events as `POST` requests. Must use the
58
+ # `http` or `https` protocol, and must be unique across all webhooks for your
59
+ # account.
60
+ endpoint: nil,
61
+ # The event types this webhook is subscribed to. Replaces the existing list. Omit
62
+ # to leave the current value unchanged.
63
+ events: nil,
64
+ request_options: {}
65
+ )
66
+ end
67
+
68
+ # Returns an array of all webhooks configured for your account.
69
+ sig do
70
+ params(request_options: Imagekitio::RequestOptions::OrHash).returns(
71
+ T::Array[Imagekitio::Accounts::Webhook]
72
+ )
73
+ end
74
+ def list(request_options: {})
75
+ end
76
+
77
+ # Permanently deletes the webhook identified by `id`. ImageKit stops sending
78
+ # events to its endpoint.
79
+ sig do
80
+ params(
81
+ id: String,
82
+ request_options: Imagekitio::RequestOptions::OrHash
83
+ ).void
84
+ end
85
+ def delete(
86
+ # Unique identifier for a webhook.
87
+ id,
88
+ request_options: {}
89
+ )
90
+ end
91
+
92
+ # Retrieves the webhook identified by `id`.
93
+ sig do
94
+ params(
95
+ id: String,
96
+ request_options: Imagekitio::RequestOptions::OrHash
97
+ ).returns(Imagekitio::Accounts::Webhook)
98
+ end
99
+ def get(
100
+ # Unique identifier for a webhook.
101
+ id,
102
+ request_options: {}
103
+ )
104
+ end
105
+
106
+ # @api private
107
+ sig { params(client: Imagekitio::Client).returns(T.attached_class) }
108
+ def self.new(client:)
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -9,12 +9,18 @@ module Imagekitio
9
9
  sig { returns(Imagekitio::Resources::Accounts::UsageAnalytics) }
10
10
  attr_reader :usage_analytics
11
11
 
12
+ sig { returns(Imagekitio::Resources::Accounts::Contract) }
13
+ attr_reader :contract
14
+
12
15
  sig { returns(Imagekitio::Resources::Accounts::Origins) }
13
16
  attr_reader :origins
14
17
 
15
18
  sig { returns(Imagekitio::Resources::Accounts::URLEndpoints) }
16
19
  attr_reader :url_endpoints
17
20
 
21
+ sig { returns(Imagekitio::Resources::Accounts::Webhooks) }
22
+ attr_reader :webhooks
23
+
18
24
  # @api private
19
25
  sig { params(client: Imagekitio::Client).returns(T.attached_class) }
20
26
  def self.new(client:)
@@ -53,6 +53,15 @@ module Imagekitio
53
53
  skip: nil,
54
54
  # Sort the results by one of the supported fields in ascending or descending
55
55
  # order.
56
+ #
57
+ # `ASC_ORIGINAL_CREATION_DATE` and `DESC_ORIGINAL_CREATION_DATE` sort files by the
58
+ # value of the reserved `_internal_original_created_datetime` custom metadata
59
+ # field (labelled "Original creation date" in the dashboard). This field exists
60
+ # only after you enable the original creation date setting under the Custom
61
+ # Metadata tab of the media library settings. Files that have no value set for
62
+ # this field fall back to their upload time, so migrated assets carrying a
63
+ # preserved original date and natively uploaded assets are ordered together in a
64
+ # single timeline.
56
65
  sort: nil,
57
66
  # Filter results by asset type.
58
67
  #
@@ -112,7 +112,11 @@ module Imagekitio
112
112
  # customCoordinates will be removed.
113
113
  custom_coordinates: nil,
114
114
  # JSON key-value pairs to associate with the asset. Create the custom metadata
115
- # fields before setting these values.
115
+ # fields before setting these values. To preserve the original creation date of an
116
+ # asset migrated from another system, set the reserved
117
+ # `_internal_original_created_datetime` key to an ISO 8601 date string. This key
118
+ # is available once the original creation date setting is enabled in the media
119
+ # library settings.
116
120
  custom_metadata: nil,
117
121
  # Optional text to describe the contents of the file.
118
122
  description: nil,
@@ -24,6 +24,10 @@ module Imagekitio
24
24
  label:,
25
25
  # API name of the custom metadata field. This should be unique across all
26
26
  # (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.
27
31
  name:,
28
32
  schema:,
29
33
  # Optional description for the custom metadata field. Can be up to 500 characters.
@@ -100,7 +104,7 @@ module Imagekitio
100
104
  params(
101
105
  id: String,
102
106
  request_options: Imagekitio::RequestOptions::OrHash
103
- ).returns(Imagekitio::Models::CustomMetadataFieldDeleteResponse)
107
+ ).void
104
108
  end
105
109
  def delete(
106
110
  # Should be a valid custom metadata field id.
@@ -28,7 +28,7 @@ module Imagekitio
28
28
  version_id: String,
29
29
  file_id: String,
30
30
  request_options: Imagekitio::RequestOptions::OrHash
31
- ).returns(Imagekitio::Models::Files::VersionDeleteResponse)
31
+ ).void
32
32
  end
33
33
  def delete(
34
34
  # The unique `versionId` of the uploaded file. `versionId` is returned in list and
@@ -66,7 +66,7 @@ module Imagekitio
66
66
  source_file_path: String,
67
67
  include_file_versions: T::Boolean,
68
68
  request_options: Imagekitio::RequestOptions::OrHash
69
- ).returns(Imagekitio::Models::FileCopyResponse)
69
+ ).void
70
70
  end
71
71
  def copy(
72
72
  # Full path to the folder you want to copy the above file into.
@@ -106,7 +106,7 @@ module Imagekitio
106
106
  destination_path: String,
107
107
  source_file_path: String,
108
108
  request_options: Imagekitio::RequestOptions::OrHash
109
- ).returns(Imagekitio::Models::FileMoveResponse)
109
+ ).void
110
110
  end
111
111
  def move(
112
112
  # Full path to the folder you want to move the above file into.
@@ -268,7 +268,11 @@ module Imagekitio
268
268
  # customCoordinates will be removed.
269
269
  custom_coordinates: nil,
270
270
  # JSON key-value pairs to associate with the asset. Create the custom metadata
271
- # fields before setting these values.
271
+ # fields before setting these values. To preserve the original creation date of an
272
+ # asset migrated from another system, set the reserved
273
+ # `_internal_original_created_datetime` key to an ISO 8601 date string. This key
274
+ # is available once the original creation date setting is enabled in the media
275
+ # library settings.
272
276
  custom_metadata: nil,
273
277
  # Optional text to describe the contents of the file.
274
278
  description: nil,
@@ -40,7 +40,7 @@ module Imagekitio
40
40
  params(
41
41
  folder_path: String,
42
42
  request_options: Imagekitio::RequestOptions::OrHash
43
- ).returns(Imagekitio::Models::FolderDeleteResponse)
43
+ ).void
44
44
  end
45
45
  def delete(
46
46
  # Full path to the folder you want to delete. For example `/folder/to/delete/`.
@@ -0,0 +1,74 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Resources
5
+ class Tags
6
+ # This API lists the distinct tags in use across your media library, with the
7
+ # number of assets each tag is applied to and when it was last used. Tags are
8
+ # matched case-insensitively, so `Summer` and `summer` are one entry: `name` is
9
+ # the lowercased form and `label` is the spelling that was used most recently.
10
+ #
11
+ # Use `tagSource` and `fileType` to list only the tags in use on matching assets.
12
+ # `lastUsedAt` and the `ASC_LAST_USED` / `DESC_LAST_USED` sorts follow those
13
+ # filters, while `assetCount` always counts every asset carrying the tag. Use
14
+ # `search` or `prefix` to narrow the listing and `cursor` to page through it.
15
+ #
16
+ # Tag counts are updated asynchronously. Changes to a file's tags usually appear
17
+ # in this list within about a minute, but can take longer during heavy tagging
18
+ # activity, so a tag you just added or removed may not be reflected immediately.
19
+ sig do
20
+ params(
21
+ cursor: String,
22
+ file_type: Imagekitio::TagListParams::FileType::OrSymbol,
23
+ limit: Integer,
24
+ prefix: String,
25
+ search: String,
26
+ sort: Imagekitio::TagListParams::Sort::OrSymbol,
27
+ tag_source: Imagekitio::TagListParams::TagSource::OrSymbol,
28
+ request_options: Imagekitio::RequestOptions::OrHash
29
+ ).returns(Imagekitio::Internal::TagCursor[Imagekitio::Tag])
30
+ end
31
+ def list(
32
+ # The `nextCursor` value from the previous response, to fetch the next page. A
33
+ # cursor is bound to the `tagSource`, `fileType`, `sort`, `search` and `prefix` it
34
+ # was issued with; sending it with different values returns a 400.
35
+ cursor: nil,
36
+ # Filter tags by the type of asset they are applied to.
37
+ #
38
+ # - `image` — tags in use on images
39
+ # - `video` — tags in use on videos
40
+ # - `static` — tags in use on any other file, such as documents, scripts and
41
+ # stylesheets
42
+ # - `all` — tags in use on any asset
43
+ file_type: nil,
44
+ # The maximum number of tags to return in response.
45
+ limit: nil,
46
+ # Only return tags that begin with this value. Matching is case-insensitive.
47
+ prefix: nil,
48
+ # Only return tags that contain this text. Every word in the value must appear in
49
+ # the tag and the last word may be incomplete, which suits search-as-you-type.
50
+ # Matching is case-insensitive.
51
+ search: nil,
52
+ # Sort the results.
53
+ #
54
+ # - `ASC_NAME` / `DESC_NAME` — by `name`
55
+ # - `ASC_LAST_USED` / `DESC_LAST_USED` — by `lastUsedAt` within the requested
56
+ # `tagSource` and `fileType`, ties broken by `name`
57
+ sort: nil,
58
+ # Filter tags by who added them.
59
+ #
60
+ # - `user` — tags added by users through the dashboard or the API
61
+ # - `ai` — tags added by AI auto-tagging extensions
62
+ # - `all` — both
63
+ tag_source: nil,
64
+ request_options: {}
65
+ )
66
+ end
67
+
68
+ # @api private
69
+ sig { params(client: Imagekitio::Client).returns(T.attached_class) }
70
+ def self.new(client:)
71
+ end
72
+ end
73
+ end
74
+ end