imagekitio 4.6.0 → 4.8.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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +1 -1
  4. data/lib/imagekitio/internal/transport/base_client.rb +4 -1
  5. data/lib/imagekitio/models/accounts/origin_request.rb +35 -10
  6. data/lib/imagekitio/models/accounts/origin_response.rb +20 -2
  7. data/lib/imagekitio/models/accounts/request_bandwidth_entry.rb +26 -0
  8. data/lib/imagekitio/models/accounts/usage_analytics_get_params.rb +39 -0
  9. data/lib/imagekitio/models/accounts/usage_analytics_response.rb +1044 -0
  10. data/lib/imagekitio/models/transformation.rb +1 -1
  11. data/lib/imagekitio/resources/accounts/usage.rb +6 -0
  12. data/lib/imagekitio/resources/accounts/usage_analytics.rb +55 -0
  13. data/lib/imagekitio/resources/accounts.rb +4 -0
  14. data/lib/imagekitio/version.rb +1 -1
  15. data/lib/imagekitio.rb +4 -0
  16. data/rbi/imagekitio/models/accounts/origin_request.rbi +36 -10
  17. data/rbi/imagekitio/models/accounts/origin_response.rbi +28 -2
  18. data/rbi/imagekitio/models/accounts/request_bandwidth_entry.rbi +44 -0
  19. data/rbi/imagekitio/models/accounts/usage_analytics_get_params.rbi +64 -0
  20. data/rbi/imagekitio/models/accounts/usage_analytics_response.rbi +2097 -0
  21. data/rbi/imagekitio/models/transformation.rbi +2 -2
  22. data/rbi/imagekitio/resources/accounts/usage.rbi +6 -0
  23. data/rbi/imagekitio/resources/accounts/usage_analytics.rbi +46 -0
  24. data/rbi/imagekitio/resources/accounts.rbi +3 -0
  25. data/sig/imagekitio/models/accounts/origin_request.rbs +18 -4
  26. data/sig/imagekitio/models/accounts/origin_response.rbs +18 -4
  27. data/sig/imagekitio/models/accounts/request_bandwidth_entry.rbs +18 -0
  28. data/sig/imagekitio/models/accounts/usage_analytics_get_params.rbs +30 -0
  29. data/sig/imagekitio/models/accounts/usage_analytics_response.rbs +785 -0
  30. data/sig/imagekitio/resources/accounts/usage_analytics.rbs +15 -0
  31. data/sig/imagekitio/resources/accounts.rbs +2 -0
  32. metadata +14 -2
@@ -144,7 +144,7 @@ module Imagekitio
144
144
  #
145
145
  # - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray
146
146
  # color.
147
- # - `in-intensity` - Intensity of the color (0-100). Default is 35. See
147
+ # - `in-intensity` - Intensity of the color (0-100). Default is 100. See
148
148
  # [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize).
149
149
  #
150
150
  # @return [String, nil]
@@ -12,6 +12,12 @@ module Imagekitio
12
12
  # other words, the data covers the period starting from the specified start date
13
13
  # up to, but not including, the end date.
14
14
  #
15
+ # For an agency account, the returned usage is aggregated across the agency and
16
+ # all of its child accounts that are billed to it.
17
+ #
18
+ # The response is cached for 6 hours per account, date range and requested
19
+ # metrics.
20
+ #
15
21
  # @overload get(end_date:, start_date:, request_options: {})
16
22
  #
17
23
  # @param end_date [Date] Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`.
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Imagekitio
4
+ module Resources
5
+ class Accounts
6
+ class UsageAnalytics
7
+ # Some parameter documentations has been truncated, see
8
+ # {Imagekitio::Models::Accounts::UsageAnalyticsGetParams} for more details.
9
+ #
10
+ # **Note:** This API is currently in beta.
11
+ #
12
+ # Get the account analytics data between two dates. The response covers the period
13
+ # from the start date to the end date, both dates inclusive. Both dates are
14
+ # interpreted as UTC calendar days.
15
+ #
16
+ # The returned data is scoped to the requesting account only. Unlike
17
+ # `/v1/accounts/usage`, an agency account's analytics are not aggregated across
18
+ # its child accounts.
19
+ #
20
+ # The response is cached for 5 minutes per account and date range. Use
21
+ # `generatedAt` to check how fresh the returned data is.
22
+ #
23
+ # @overload get(end_date:, start_date:, request_options: {})
24
+ #
25
+ # @param end_date [Date] Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day.
26
+ #
27
+ # @param start_date [Date] Specify a `startDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day.
28
+ #
29
+ # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil]
30
+ #
31
+ # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse]
32
+ #
33
+ # @see Imagekitio::Models::Accounts::UsageAnalyticsGetParams
34
+ def get(params)
35
+ parsed, options = Imagekitio::Accounts::UsageAnalyticsGetParams.dump_request(params)
36
+ query = Imagekitio::Internal::Util.encode_query_params(parsed)
37
+ @client.request(
38
+ method: :get,
39
+ path: "v1/accounts/usage-analytics",
40
+ query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
41
+ model: Imagekitio::Accounts::UsageAnalyticsResponse,
42
+ options: options
43
+ )
44
+ end
45
+
46
+ # @api private
47
+ #
48
+ # @param client [Imagekitio::Client]
49
+ def initialize(client:)
50
+ @client = client
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -6,6 +6,9 @@ module Imagekitio
6
6
  # @return [Imagekitio::Resources::Accounts::Usage]
7
7
  attr_reader :usage
8
8
 
9
+ # @return [Imagekitio::Resources::Accounts::UsageAnalytics]
10
+ attr_reader :usage_analytics
11
+
9
12
  # @return [Imagekitio::Resources::Accounts::Origins]
10
13
  attr_reader :origins
11
14
 
@@ -18,6 +21,7 @@ module Imagekitio
18
21
  def initialize(client:)
19
22
  @client = client
20
23
  @usage = Imagekitio::Resources::Accounts::Usage.new(client: client)
24
+ @usage_analytics = Imagekitio::Resources::Accounts::UsageAnalytics.new(client: client)
21
25
  @origins = Imagekitio::Resources::Accounts::Origins.new(client: client)
22
26
  @url_endpoints = Imagekitio::Resources::Accounts::URLEndpoints.new(client: client)
23
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Imagekitio
4
- VERSION = "4.6.0"
4
+ VERSION = "4.8.0"
5
5
  end
data/lib/imagekitio.rb CHANGED
@@ -55,6 +55,7 @@ require_relative "imagekitio/internal/transport/pooled_net_requester"
55
55
  require_relative "imagekitio/client"
56
56
  require_relative "imagekitio/models/accounts/origin_request"
57
57
  require_relative "imagekitio/models/accounts/url_endpoint_request"
58
+ require_relative "imagekitio/models/accounts/request_bandwidth_entry"
58
59
  require_relative "imagekitio/models/base_webhook_event"
59
60
  require_relative "imagekitio/models/update_file_request"
60
61
  require_relative "imagekitio/models/file"
@@ -74,6 +75,8 @@ require_relative "imagekitio/models/accounts/url_endpoint_list_params"
74
75
  require_relative "imagekitio/models/accounts/url_endpoint_list_response"
75
76
  require_relative "imagekitio/models/accounts/url_endpoint_response"
76
77
  require_relative "imagekitio/models/accounts/url_endpoint_update_params"
78
+ require_relative "imagekitio/models/accounts/usage_analytics_get_params"
79
+ require_relative "imagekitio/models/accounts/usage_analytics_response"
77
80
  require_relative "imagekitio/models/accounts/usage_get_params"
78
81
  require_relative "imagekitio/models/accounts/usage_get_response"
79
82
  require_relative "imagekitio/models/ai_tag"
@@ -185,6 +188,7 @@ require_relative "imagekitio/resources/accounts"
185
188
  require_relative "imagekitio/resources/accounts/origins"
186
189
  require_relative "imagekitio/resources/accounts/url_endpoints"
187
190
  require_relative "imagekitio/resources/accounts/usage"
191
+ require_relative "imagekitio/resources/accounts/usage_analytics"
188
192
  require_relative "imagekitio/resources/assets"
189
193
  require_relative "imagekitio/resources/beta"
190
194
  require_relative "imagekitio/resources/beta/v2"
@@ -30,7 +30,7 @@ module Imagekitio
30
30
  )
31
31
  end
32
32
 
33
- # Access key for the bucket.
33
+ # Access key for the bucket. When `useIAMRole` is `true`, send an empty string.
34
34
  sig { returns(String) }
35
35
  attr_accessor :access_key
36
36
 
@@ -42,7 +42,7 @@ module Imagekitio
42
42
  sig { returns(String) }
43
43
  attr_accessor :name
44
44
 
45
- # Secret key for the bucket.
45
+ # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string.
46
46
  sig { returns(String) }
47
47
  attr_accessor :secret_key
48
48
 
@@ -70,6 +70,14 @@ module Imagekitio
70
70
  sig { params(prefix: String).void }
71
71
  attr_writer :prefix
72
72
 
73
+ # Use IAM role for authentication instead of access/secret keys. When set to
74
+ # `true`, send an empty string for both `accessKey` and `secretKey`.
75
+ sig { returns(T.nilable(T::Boolean)) }
76
+ attr_reader :use_iam_role
77
+
78
+ sig { params(use_iam_role: T::Boolean).void }
79
+ attr_writer :use_iam_role
80
+
73
81
  sig do
74
82
  params(
75
83
  access_key: String,
@@ -79,17 +87,18 @@ module Imagekitio
79
87
  base_url_for_canonical_header: String,
80
88
  include_canonical_header: T::Boolean,
81
89
  prefix: String,
90
+ use_iam_role: T::Boolean,
82
91
  type: Symbol
83
92
  ).returns(T.attached_class)
84
93
  end
85
94
  def self.new(
86
- # Access key for the bucket.
95
+ # Access key for the bucket. When `useIAMRole` is `true`, send an empty string.
87
96
  access_key:,
88
97
  # S3 bucket name.
89
98
  bucket:,
90
99
  # Display name of the origin.
91
100
  name:,
92
- # Secret key for the bucket.
101
+ # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string.
93
102
  secret_key:,
94
103
  # URL used in the Canonical header (if enabled).
95
104
  base_url_for_canonical_header: nil,
@@ -97,6 +106,9 @@ module Imagekitio
97
106
  include_canonical_header: nil,
98
107
  # Path prefix inside the bucket.
99
108
  prefix: nil,
109
+ # Use IAM role for authentication instead of access/secret keys. When set to
110
+ # `true`, send an empty string for both `accessKey` and `secretKey`.
111
+ use_iam_role: nil,
100
112
  type: :S3
101
113
  )
102
114
  end
@@ -111,7 +123,8 @@ module Imagekitio
111
123
  type: Symbol,
112
124
  base_url_for_canonical_header: String,
113
125
  include_canonical_header: T::Boolean,
114
- prefix: String
126
+ prefix: String,
127
+ use_iam_role: T::Boolean
115
128
  }
116
129
  )
117
130
  end
@@ -245,7 +258,7 @@ module Imagekitio
245
258
  )
246
259
  end
247
260
 
248
- # Access key for the bucket.
261
+ # Access key for the bucket. When `useIAMRole` is `true`, send an empty string.
249
262
  sig { returns(String) }
250
263
  attr_accessor :access_key
251
264
 
@@ -257,7 +270,7 @@ module Imagekitio
257
270
  sig { returns(String) }
258
271
  attr_accessor :name
259
272
 
260
- # Secret key for the bucket.
273
+ # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string.
261
274
  sig { returns(String) }
262
275
  attr_accessor :secret_key
263
276
 
@@ -285,6 +298,14 @@ module Imagekitio
285
298
  sig { params(prefix: String).void }
286
299
  attr_writer :prefix
287
300
 
301
+ # Use IAM role for authentication instead of access/secret keys. When set to
302
+ # `true`, send an empty string for both `accessKey` and `secretKey`.
303
+ sig { returns(T.nilable(T::Boolean)) }
304
+ attr_reader :use_iam_role
305
+
306
+ sig { params(use_iam_role: T::Boolean).void }
307
+ attr_writer :use_iam_role
308
+
288
309
  sig do
289
310
  params(
290
311
  access_key: String,
@@ -294,17 +315,18 @@ module Imagekitio
294
315
  base_url_for_canonical_header: String,
295
316
  include_canonical_header: T::Boolean,
296
317
  prefix: String,
318
+ use_iam_role: T::Boolean,
297
319
  type: Symbol
298
320
  ).returns(T.attached_class)
299
321
  end
300
322
  def self.new(
301
- # Access key for the bucket.
323
+ # Access key for the bucket. When `useIAMRole` is `true`, send an empty string.
302
324
  access_key:,
303
325
  # S3 bucket name.
304
326
  bucket:,
305
327
  # Display name of the origin.
306
328
  name:,
307
- # Secret key for the bucket.
329
+ # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string.
308
330
  secret_key:,
309
331
  # URL used in the Canonical header (if enabled).
310
332
  base_url_for_canonical_header: nil,
@@ -312,6 +334,9 @@ module Imagekitio
312
334
  include_canonical_header: nil,
313
335
  # Path prefix inside the bucket.
314
336
  prefix: nil,
337
+ # Use IAM role for authentication instead of access/secret keys. When set to
338
+ # `true`, send an empty string for both `accessKey` and `secretKey`.
339
+ use_iam_role: nil,
315
340
  type: :CLOUDINARY_BACKUP
316
341
  )
317
342
  end
@@ -326,7 +351,8 @@ module Imagekitio
326
351
  type: Symbol,
327
352
  base_url_for_canonical_header: String,
328
353
  include_canonical_header: T::Boolean,
329
- prefix: String
354
+ prefix: String,
355
+ use_iam_role: T::Boolean
330
356
  }
331
357
  )
332
358
  end
@@ -56,6 +56,14 @@ module Imagekitio
56
56
  sig { params(base_url_for_canonical_header: String).void }
57
57
  attr_writer :base_url_for_canonical_header
58
58
 
59
+ # Whether the origin authenticates using an IAM role instead of access/secret
60
+ # keys.
61
+ sig { returns(T.nilable(T::Boolean)) }
62
+ attr_reader :use_iam_role
63
+
64
+ sig { params(use_iam_role: T::Boolean).void }
65
+ attr_writer :use_iam_role
66
+
59
67
  # Unique identifier for the origin. This is generated by ImageKit when you create
60
68
  # a new origin.
61
69
  sig { returns(String) }
@@ -69,6 +77,7 @@ module Imagekitio
69
77
  name: String,
70
78
  prefix: String,
71
79
  base_url_for_canonical_header: String,
80
+ use_iam_role: T::Boolean,
72
81
  type: Symbol
73
82
  ).returns(T.attached_class)
74
83
  end
@@ -86,6 +95,9 @@ module Imagekitio
86
95
  prefix:,
87
96
  # URL used in the Canonical header (if enabled).
88
97
  base_url_for_canonical_header: nil,
98
+ # Whether the origin authenticates using an IAM role instead of access/secret
99
+ # keys.
100
+ use_iam_role: nil,
89
101
  type: :S3
90
102
  )
91
103
  end
@@ -99,7 +111,8 @@ module Imagekitio
99
111
  name: String,
100
112
  prefix: String,
101
113
  type: Symbol,
102
- base_url_for_canonical_header: String
114
+ base_url_for_canonical_header: String,
115
+ use_iam_role: T::Boolean
103
116
  }
104
117
  )
105
118
  end
@@ -244,6 +257,14 @@ module Imagekitio
244
257
  sig { params(base_url_for_canonical_header: String).void }
245
258
  attr_writer :base_url_for_canonical_header
246
259
 
260
+ # Whether the origin authenticates using an IAM role instead of access/secret
261
+ # keys.
262
+ sig { returns(T.nilable(T::Boolean)) }
263
+ attr_reader :use_iam_role
264
+
265
+ sig { params(use_iam_role: T::Boolean).void }
266
+ attr_writer :use_iam_role
267
+
247
268
  # Unique identifier for the origin. This is generated by ImageKit when you create
248
269
  # a new origin.
249
270
  sig { returns(String) }
@@ -257,6 +278,7 @@ module Imagekitio
257
278
  name: String,
258
279
  prefix: String,
259
280
  base_url_for_canonical_header: String,
281
+ use_iam_role: T::Boolean,
260
282
  type: Symbol
261
283
  ).returns(T.attached_class)
262
284
  end
@@ -274,6 +296,9 @@ module Imagekitio
274
296
  prefix:,
275
297
  # URL used in the Canonical header (if enabled).
276
298
  base_url_for_canonical_header: nil,
299
+ # Whether the origin authenticates using an IAM role instead of access/secret
300
+ # keys.
301
+ use_iam_role: nil,
277
302
  type: :CLOUDINARY_BACKUP
278
303
  )
279
304
  end
@@ -287,7 +312,8 @@ module Imagekitio
287
312
  name: String,
288
313
  prefix: String,
289
314
  type: Symbol,
290
- base_url_for_canonical_header: String
315
+ base_url_for_canonical_header: String,
316
+ use_iam_role: T::Boolean
291
317
  }
292
318
  )
293
319
  end
@@ -0,0 +1,44 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ class RequestBandwidthEntry < Imagekitio::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ Imagekitio::Accounts::RequestBandwidthEntry,
11
+ Imagekitio::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # Total bandwidth used in bytes.
16
+ sig { returns(Float) }
17
+ attr_accessor :bandwidth_bytes
18
+
19
+ # Number of requests.
20
+ sig { returns(Float) }
21
+ attr_accessor :request_count
22
+
23
+ sig do
24
+ params(bandwidth_bytes: Float, request_count: Float).returns(
25
+ T.attached_class
26
+ )
27
+ end
28
+ def self.new(
29
+ # Total bandwidth used in bytes.
30
+ bandwidth_bytes:,
31
+ # Number of requests.
32
+ request_count:
33
+ )
34
+ end
35
+
36
+ sig do
37
+ override.returns({ bandwidth_bytes: Float, request_count: Float })
38
+ end
39
+ def to_hash
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,64 @@
1
+ # typed: strong
2
+
3
+ module Imagekitio
4
+ module Models
5
+ module Accounts
6
+ class UsageAnalyticsGetParams < 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::UsageAnalyticsGetParams,
14
+ Imagekitio::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day.
19
+ # It should be after the `startDate`. The difference between `startDate` and
20
+ # `endDate` should be less than 90 days.
21
+ sig { returns(Date) }
22
+ attr_accessor :end_date
23
+
24
+ # Specify a `startDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day.
25
+ # It should be before the `endDate`. The difference between `startDate` and
26
+ # `endDate` should be less than 90 days.
27
+ sig { returns(Date) }
28
+ attr_accessor :start_date
29
+
30
+ sig do
31
+ params(
32
+ end_date: Date,
33
+ start_date: Date,
34
+ request_options: Imagekitio::RequestOptions::OrHash
35
+ ).returns(T.attached_class)
36
+ end
37
+ def self.new(
38
+ # Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day.
39
+ # It should be after the `startDate`. The difference between `startDate` and
40
+ # `endDate` should be less than 90 days.
41
+ end_date:,
42
+ # Specify a `startDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day.
43
+ # It should be before the `endDate`. The difference between `startDate` and
44
+ # `endDate` should be less than 90 days.
45
+ start_date:,
46
+ request_options: {}
47
+ )
48
+ end
49
+
50
+ sig do
51
+ override.returns(
52
+ {
53
+ end_date: Date,
54
+ start_date: Date,
55
+ request_options: Imagekitio::RequestOptions
56
+ }
57
+ )
58
+ end
59
+ def to_hash
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end