imagekitio 4.11.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +28 -1
- data/lib/imagekitio/client.rb +4 -0
- data/lib/imagekitio/internal/tag_cursor.rb +86 -0
- data/lib/imagekitio/models/accounts/contract_get_params.rb +16 -0
- data/lib/imagekitio/models/accounts/contract_get_response.rb +82 -0
- data/lib/imagekitio/models/accounts/contract_units.rb +42 -0
- data/lib/imagekitio/models/accounts/url_endpoint_request.rb +17 -1
- data/lib/imagekitio/models/accounts/url_endpoint_response.rb +17 -1
- data/lib/imagekitio/models/tag.rb +52 -0
- data/lib/imagekitio/models/tag_list_params.rb +143 -0
- data/lib/imagekitio/models.rb +4 -0
- data/lib/imagekitio/resources/accounts/contract.rb +47 -0
- data/lib/imagekitio/resources/accounts.rb +4 -0
- data/lib/imagekitio/resources/tags.rb +65 -0
- data/lib/imagekitio/version.rb +1 -1
- data/lib/imagekitio.rb +8 -0
- data/rbi/imagekitio/client.rbi +3 -0
- data/rbi/imagekitio/internal/tag_cursor.rbi +22 -0
- data/rbi/imagekitio/models/accounts/contract_get_params.rbi +34 -0
- data/rbi/imagekitio/models/accounts/contract_get_response.rbi +126 -0
- data/rbi/imagekitio/models/accounts/contract_units.rbi +66 -0
- data/rbi/imagekitio/models/accounts/url_endpoint_request.rbi +19 -1
- data/rbi/imagekitio/models/accounts/url_endpoint_response.rbi +19 -1
- data/rbi/imagekitio/models/tag.rbi +71 -0
- data/rbi/imagekitio/models/tag_list_params.rbi +236 -0
- data/rbi/imagekitio/models.rbi +4 -0
- data/rbi/imagekitio/resources/accounts/contract.rbi +36 -0
- data/rbi/imagekitio/resources/accounts.rbi +3 -0
- data/rbi/imagekitio/resources/tags.rbi +74 -0
- data/sig/imagekitio/client.rbs +2 -0
- data/sig/imagekitio/internal/tag_cursor.rbs +13 -0
- data/sig/imagekitio/models/accounts/contract_get_params.rbs +17 -0
- data/sig/imagekitio/models/accounts/contract_get_response.rbs +73 -0
- data/sig/imagekitio/models/accounts/contract_units.rbs +37 -0
- data/sig/imagekitio/models/accounts/url_endpoint_request.rbs +12 -2
- data/sig/imagekitio/models/accounts/url_endpoint_response.rbs +12 -2
- data/sig/imagekitio/models/tag.rbs +30 -0
- data/sig/imagekitio/models/tag_list_params.rbs +114 -0
- data/sig/imagekitio/models.rbs +4 -0
- data/sig/imagekitio/resources/accounts/contract.rbs +13 -0
- data/sig/imagekitio/resources/accounts.rbs +2 -0
- data/sig/imagekitio/resources/tags.rbs +18 -0
- metadata +26 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 425a67eafb2d65176f5a8ec57e0d6e8a2581334cc6d0aaa1bd77c13ad1489d3b
|
|
4
|
+
data.tar.gz: abab5f7bac6a4454e4a8d34b608b245a419843dc37a718b57e62d450890e8fe3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a4bb7581cbe9a754e1495b3e5afe797843ec62f707fba51650f161441b1a8a42b39365375ed808dcef08a04eb904d7ac5c6d53ca0e402a15d49cbc72e3a2230
|
|
7
|
+
data.tar.gz: 69a6ad2f87957b2d6e945a3268498aecdbe28d534af684a287c3a787994f05f692d4dae06cb7e549cc9ee4d6375f696b9727328010dbda1ae9fff1b37c6fe42e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.12.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.11.0...v4.12.0) (2026-11-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add GET /v1/tags to list media library tags ([e1a42da](https://github.com/imagekit-developer/imagekit-ruby/commit/e1a42da77bb7da5541197d121437e36ef8d50216))
|
|
9
|
+
* **api:** add accounts.contract.get() for contract consumption ([c80613e](https://github.com/imagekit-developer/imagekit-ruby/commit/c80613eab38b19ecebdfa21574fa31efa9e82033))
|
|
10
|
+
* **api:** add useImprovedLayerSpec to the Cloudinary URL rewriter ([c80613e](https://github.com/imagekit-developer/imagekit-ruby/commit/c80613eab38b19ecebdfa21574fa31efa9e82033))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Documentation
|
|
14
|
+
|
|
15
|
+
* add pagination example ([e77d60d](https://github.com/imagekit-developer/imagekit-ruby/commit/e77d60d1fc979b8c781298b7b6a64421c5033b6d))
|
|
16
|
+
|
|
3
17
|
## [4.11.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.10.0...v4.11.0) (2026-10-19)
|
|
4
18
|
|
|
5
19
|
|
data/README.md
CHANGED
|
@@ -13,6 +13,7 @@ If you're using Ruby on Rails, the [ImageKit Rails gem](https://github.com/image
|
|
|
13
13
|
- [Documentation](#documentation)
|
|
14
14
|
- [Installation](#installation)
|
|
15
15
|
- [Usage](#usage)
|
|
16
|
+
- [Pagination](#pagination)
|
|
16
17
|
- [File uploads](#file-uploads)
|
|
17
18
|
- [URL Generation](#url-generation)
|
|
18
19
|
- [Basic URL generation](#basic-url-generation)
|
|
@@ -46,7 +47,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
46
47
|
<!-- x-release-please-start-version -->
|
|
47
48
|
|
|
48
49
|
```ruby
|
|
49
|
-
gem "imagekitio", "~> 4.
|
|
50
|
+
gem "imagekitio", "~> 4.12.0"
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
<!-- x-release-please-end -->
|
|
@@ -68,6 +69,32 @@ response = image_kit.files.upload(
|
|
|
68
69
|
puts(response.file_id)
|
|
69
70
|
```
|
|
70
71
|
|
|
72
|
+
### Pagination
|
|
73
|
+
|
|
74
|
+
The `tags.list` method is paginated. This library provides auto-paginating iterators, so you do not have to request successive pages manually:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
page = image_kit.tags.list
|
|
78
|
+
|
|
79
|
+
# Fetch single item from page.
|
|
80
|
+
tag = page.tags[0]
|
|
81
|
+
puts(tag.asset_count)
|
|
82
|
+
|
|
83
|
+
# Automatically fetches more pages as needed.
|
|
84
|
+
page.auto_paging_each do |tag|
|
|
85
|
+
puts(tag.asset_count)
|
|
86
|
+
end
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Alternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
if page.next_page?
|
|
93
|
+
new_page = page.next_page
|
|
94
|
+
puts(new_page.tags[0].asset_count)
|
|
95
|
+
end
|
|
96
|
+
```
|
|
97
|
+
|
|
71
98
|
### File uploads
|
|
72
99
|
|
|
73
100
|
Request parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, or an `IO` stream.
|
data/lib/imagekitio/client.rb
CHANGED
|
@@ -47,6 +47,9 @@ module Imagekitio
|
|
|
47
47
|
# @return [Imagekitio::Resources::Assets]
|
|
48
48
|
attr_reader :assets
|
|
49
49
|
|
|
50
|
+
# @return [Imagekitio::Resources::Tags]
|
|
51
|
+
attr_reader :tags
|
|
52
|
+
|
|
50
53
|
# @return [Imagekitio::Resources::Cache]
|
|
51
54
|
attr_reader :cache
|
|
52
55
|
|
|
@@ -154,6 +157,7 @@ module Imagekitio
|
|
|
154
157
|
@saved_extensions = Imagekitio::Resources::SavedExtensions.new(client: self)
|
|
155
158
|
@named_transformations = Imagekitio::Resources::NamedTransformations.new(client: self)
|
|
156
159
|
@assets = Imagekitio::Resources::Assets.new(client: self)
|
|
160
|
+
@tags = Imagekitio::Resources::Tags.new(client: self)
|
|
157
161
|
@cache = Imagekitio::Resources::Cache.new(client: self)
|
|
158
162
|
@folders = Imagekitio::Resources::Folders.new(client: self)
|
|
159
163
|
@accounts = Imagekitio::Resources::Accounts.new(client: self)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Imagekitio
|
|
4
|
+
module Internal
|
|
5
|
+
# @generic Elem
|
|
6
|
+
#
|
|
7
|
+
# @example
|
|
8
|
+
# if tag_cursor.has_next?
|
|
9
|
+
# tag_cursor = tag_cursor.next_page
|
|
10
|
+
# end
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# tag_cursor.auto_paging_each do |tag|
|
|
14
|
+
# puts(tag)
|
|
15
|
+
# end
|
|
16
|
+
class TagCursor
|
|
17
|
+
include Imagekitio::Internal::Type::BasePage
|
|
18
|
+
|
|
19
|
+
# @return [Array<generic<Elem>>, nil]
|
|
20
|
+
attr_accessor :tags
|
|
21
|
+
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
attr_accessor :next_cursor
|
|
24
|
+
|
|
25
|
+
# @return [Boolean]
|
|
26
|
+
def next_page?
|
|
27
|
+
!tags.to_a.empty? && !next_cursor.to_s.empty?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @raise [Imagekitio::HTTP::Error]
|
|
31
|
+
# @return [self]
|
|
32
|
+
def next_page
|
|
33
|
+
unless next_page?
|
|
34
|
+
message = "No more pages available. Please check #next_page? before calling ##{__method__}"
|
|
35
|
+
raise RuntimeError.new(message)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
req = Imagekitio::Internal::Util.deep_merge(@req, {query: {cursor: next_cursor}})
|
|
39
|
+
@client.request(req)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @param blk [Proc]
|
|
43
|
+
#
|
|
44
|
+
# @yieldparam [generic<Elem>]
|
|
45
|
+
def auto_paging_each(&blk)
|
|
46
|
+
unless block_given?
|
|
47
|
+
raise ArgumentError.new("A block must be given to ##{__method__}")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
page = self
|
|
51
|
+
loop do
|
|
52
|
+
page.tags&.each(&blk)
|
|
53
|
+
|
|
54
|
+
break unless page.next_page?
|
|
55
|
+
page = page.next_page
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @api private
|
|
60
|
+
#
|
|
61
|
+
# @param client [Imagekitio::Internal::Transport::BaseClient]
|
|
62
|
+
# @param req [Hash{Symbol=>Object}]
|
|
63
|
+
# @param headers [Hash{String=>String}]
|
|
64
|
+
# @param page_data [Hash{Symbol=>Object}]
|
|
65
|
+
def initialize(client:, req:, headers:, page_data:)
|
|
66
|
+
super
|
|
67
|
+
|
|
68
|
+
case page_data
|
|
69
|
+
in {tags: Array => tags}
|
|
70
|
+
@tags = tags.map { Imagekitio::Internal::Type::Converter.coerce(@model, _1) }
|
|
71
|
+
else
|
|
72
|
+
end
|
|
73
|
+
@next_cursor = page_data[:nextCursor]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# @api private
|
|
77
|
+
#
|
|
78
|
+
# @return [String]
|
|
79
|
+
def inspect
|
|
80
|
+
model = Imagekitio::Internal::Type::Converter.inspect(@model, depth: 1)
|
|
81
|
+
|
|
82
|
+
"#<#{self.class}[#{model}]:0x#{object_id.to_s(16)} next_cursor=#{next_cursor.inspect}>"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Imagekitio
|
|
4
|
+
module Models
|
|
5
|
+
module Accounts
|
|
6
|
+
# @see Imagekitio::Resources::Accounts::Contract#get
|
|
7
|
+
class ContractGetParams < Imagekitio::Internal::Type::BaseModel
|
|
8
|
+
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
9
|
+
include Imagekitio::Internal::Type::RequestParameters
|
|
10
|
+
|
|
11
|
+
# @!method initialize(request_options: {})
|
|
12
|
+
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Imagekitio
|
|
4
|
+
module Models
|
|
5
|
+
module Accounts
|
|
6
|
+
# @see Imagekitio::Resources::Accounts::Contract#get
|
|
7
|
+
class ContractGetResponse < Imagekitio::Internal::Type::BaseModel
|
|
8
|
+
# @!attribute has_contract
|
|
9
|
+
# Whether the account has an active contract. The other fields are present only
|
|
10
|
+
# when it does.
|
|
11
|
+
#
|
|
12
|
+
# @return [Boolean]
|
|
13
|
+
required :has_contract, Imagekitio::Internal::Type::Boolean, api_name: :hasContract
|
|
14
|
+
|
|
15
|
+
# @!attribute as_of
|
|
16
|
+
# When `consumed` was last computed. `null` if it has not been computed for the
|
|
17
|
+
# contract yet; `consumed` is then all zeros.
|
|
18
|
+
#
|
|
19
|
+
# @return [Time, nil]
|
|
20
|
+
optional :as_of, Time, api_name: :asOf, nil?: true
|
|
21
|
+
|
|
22
|
+
# @!attribute consumed
|
|
23
|
+
# Usage consumed in the current contract term. For an agency account, this
|
|
24
|
+
# includes the child accounts billed to it.
|
|
25
|
+
#
|
|
26
|
+
# @return [Imagekitio::Models::Accounts::ContractUnits, nil]
|
|
27
|
+
optional :consumed, -> { Imagekitio::Accounts::ContractUnits }
|
|
28
|
+
|
|
29
|
+
# @!attribute contract_months
|
|
30
|
+
# Length of each contract term in months.
|
|
31
|
+
#
|
|
32
|
+
# @return [Integer, nil]
|
|
33
|
+
optional :contract_months, Integer, api_name: :contractMonths
|
|
34
|
+
|
|
35
|
+
# @!attribute effective_contract_end_date
|
|
36
|
+
# End date of the current contract term.
|
|
37
|
+
#
|
|
38
|
+
# @return [Date, nil]
|
|
39
|
+
optional :effective_contract_end_date, Date, api_name: :effectiveContractEndDate
|
|
40
|
+
|
|
41
|
+
# @!attribute effective_contract_start_date
|
|
42
|
+
# Start date of the current contract term. It moves forward when the contract
|
|
43
|
+
# renews.
|
|
44
|
+
#
|
|
45
|
+
# @return [Date, nil]
|
|
46
|
+
optional :effective_contract_start_date, Date, api_name: :effectiveContractStartDate
|
|
47
|
+
|
|
48
|
+
# @!attribute original_contract_start_date
|
|
49
|
+
# Start date of the first contract term.
|
|
50
|
+
#
|
|
51
|
+
# @return [Date, nil]
|
|
52
|
+
optional :original_contract_start_date, Date, api_name: :originalContractStartDate
|
|
53
|
+
|
|
54
|
+
# @!attribute quota
|
|
55
|
+
# Usage included in the current contract term.
|
|
56
|
+
#
|
|
57
|
+
# @return [Imagekitio::Models::Accounts::ContractUnits, nil]
|
|
58
|
+
optional :quota, -> { Imagekitio::Accounts::ContractUnits }
|
|
59
|
+
|
|
60
|
+
# @!method initialize(has_contract:, as_of: nil, consumed: nil, contract_months: nil, effective_contract_end_date: nil, effective_contract_start_date: nil, original_contract_start_date: nil, quota: nil)
|
|
61
|
+
# Some parameter documentations has been truncated, see
|
|
62
|
+
# {Imagekitio::Models::Accounts::ContractGetResponse} for more details.
|
|
63
|
+
#
|
|
64
|
+
# @param has_contract [Boolean] Whether the account has an active contract. The other fields are present only wh
|
|
65
|
+
#
|
|
66
|
+
# @param as_of [Time, nil] When `consumed` was last computed. `null` if it has not been computed for the co
|
|
67
|
+
#
|
|
68
|
+
# @param consumed [Imagekitio::Models::Accounts::ContractUnits] Usage consumed in the current contract term. For an agency account, this include
|
|
69
|
+
#
|
|
70
|
+
# @param contract_months [Integer] Length of each contract term in months.
|
|
71
|
+
#
|
|
72
|
+
# @param effective_contract_end_date [Date] End date of the current contract term.
|
|
73
|
+
#
|
|
74
|
+
# @param effective_contract_start_date [Date] Start date of the current contract term. It moves forward when the contract rene
|
|
75
|
+
#
|
|
76
|
+
# @param original_contract_start_date [Date] Start date of the first contract term.
|
|
77
|
+
#
|
|
78
|
+
# @param quota [Imagekitio::Models::Accounts::ContractUnits] Usage included in the current contract term.
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Imagekitio
|
|
4
|
+
module Models
|
|
5
|
+
module Accounts
|
|
6
|
+
class ContractUnits < Imagekitio::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute bandwidth_bytes
|
|
8
|
+
# Bandwidth in bytes.
|
|
9
|
+
#
|
|
10
|
+
# @return [Integer]
|
|
11
|
+
required :bandwidth_bytes, Integer, api_name: :bandwidthBytes
|
|
12
|
+
|
|
13
|
+
# @!attribute extension_units_count
|
|
14
|
+
# Number of extension units.
|
|
15
|
+
#
|
|
16
|
+
# @return [Integer]
|
|
17
|
+
required :extension_units_count, Integer, api_name: :extensionUnitsCount
|
|
18
|
+
|
|
19
|
+
# @!attribute purge_cache_requests
|
|
20
|
+
# Number of purge cache requests.
|
|
21
|
+
#
|
|
22
|
+
# @return [Integer]
|
|
23
|
+
required :purge_cache_requests, Integer, api_name: :purgeCacheRequests
|
|
24
|
+
|
|
25
|
+
# @!attribute video_processing_units_count
|
|
26
|
+
# Number of video processing units.
|
|
27
|
+
#
|
|
28
|
+
# @return [Integer]
|
|
29
|
+
required :video_processing_units_count, Integer, api_name: :videoProcessingUnitsCount
|
|
30
|
+
|
|
31
|
+
# @!method initialize(bandwidth_bytes:, extension_units_count:, purge_cache_requests:, video_processing_units_count:)
|
|
32
|
+
# @param bandwidth_bytes [Integer] Bandwidth in bytes.
|
|
33
|
+
#
|
|
34
|
+
# @param extension_units_count [Integer] Number of extension units.
|
|
35
|
+
#
|
|
36
|
+
# @param purge_cache_requests [Integer] Number of purge cache requests.
|
|
37
|
+
#
|
|
38
|
+
# @param video_processing_units_count [Integer] Number of video processing units.
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -75,9 +75,25 @@ module Imagekitio
|
|
|
75
75
|
Imagekitio::Internal::Type::Boolean,
|
|
76
76
|
api_name: :preserveAssetDeliveryTypes
|
|
77
77
|
|
|
78
|
-
# @!
|
|
78
|
+
# @!attribute use_improved_layer_spec
|
|
79
|
+
# Whether to always rewrite Cloudinary layers to the improved ImageKit layer
|
|
80
|
+
# specification (`l-image`, `l-text`, ..., `l-end`). When `false` or omitted, the
|
|
81
|
+
# improved specification is used only for transformations that require it.
|
|
82
|
+
#
|
|
83
|
+
# @return [Boolean, nil]
|
|
84
|
+
optional :use_improved_layer_spec,
|
|
85
|
+
Imagekitio::Internal::Type::Boolean,
|
|
86
|
+
api_name: :useImprovedLayerSpec
|
|
87
|
+
|
|
88
|
+
# @!method initialize(preserve_asset_delivery_types: nil, use_improved_layer_spec: nil, type: :CLOUDINARY)
|
|
89
|
+
# Some parameter documentations has been truncated, see
|
|
90
|
+
# {Imagekitio::Models::Accounts::URLEndpointRequest::URLRewriter::Cloudinary} for
|
|
91
|
+
# more details.
|
|
92
|
+
#
|
|
79
93
|
# @param preserve_asset_delivery_types [Boolean] Whether to preserve `<asset_type>/<delivery_type>` in the rewritten URL.
|
|
80
94
|
#
|
|
95
|
+
# @param use_improved_layer_spec [Boolean] Whether to always rewrite Cloudinary layers to the improved ImageKit layer speci
|
|
96
|
+
#
|
|
81
97
|
# @param type [Symbol, :CLOUDINARY]
|
|
82
98
|
end
|
|
83
99
|
|
|
@@ -88,9 +88,25 @@ module Imagekitio
|
|
|
88
88
|
# @return [Symbol, :CLOUDINARY]
|
|
89
89
|
required :type, const: :CLOUDINARY
|
|
90
90
|
|
|
91
|
-
# @!
|
|
91
|
+
# @!attribute use_improved_layer_spec
|
|
92
|
+
# Whether to always rewrite Cloudinary layers to the improved ImageKit layer
|
|
93
|
+
# specification (`l-image`, `l-text`, ..., `l-end`). When `false` or omitted, the
|
|
94
|
+
# improved specification is used only for transformations that require it.
|
|
95
|
+
#
|
|
96
|
+
# @return [Boolean, nil]
|
|
97
|
+
optional :use_improved_layer_spec,
|
|
98
|
+
Imagekitio::Internal::Type::Boolean,
|
|
99
|
+
api_name: :useImprovedLayerSpec
|
|
100
|
+
|
|
101
|
+
# @!method initialize(preserve_asset_delivery_types:, use_improved_layer_spec: nil, type: :CLOUDINARY)
|
|
102
|
+
# Some parameter documentations has been truncated, see
|
|
103
|
+
# {Imagekitio::Models::Accounts::URLEndpointResponse::URLRewriter::Cloudinary} for
|
|
104
|
+
# more details.
|
|
105
|
+
#
|
|
92
106
|
# @param preserve_asset_delivery_types [Boolean] Whether to preserve `<asset_type>/<delivery_type>` in the rewritten URL.
|
|
93
107
|
#
|
|
108
|
+
# @param use_improved_layer_spec [Boolean] Whether to always rewrite Cloudinary layers to the improved ImageKit layer speci
|
|
109
|
+
#
|
|
94
110
|
# @param type [Symbol, :CLOUDINARY]
|
|
95
111
|
end
|
|
96
112
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Imagekitio
|
|
4
|
+
module Models
|
|
5
|
+
# @see Imagekitio::Resources::Tags#list
|
|
6
|
+
class Tag < Imagekitio::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute asset_count
|
|
8
|
+
# The number of assets carrying the tag, counted across both tag sources
|
|
9
|
+
# (user-generated tags and AI-generated tags) and all file types regardless of the
|
|
10
|
+
# request's filters.
|
|
11
|
+
#
|
|
12
|
+
# @return [Integer]
|
|
13
|
+
required :asset_count, Integer, api_name: :assetCount
|
|
14
|
+
|
|
15
|
+
# @!attribute label
|
|
16
|
+
# The tag as it was spelled when it was last applied to any asset. Use it for
|
|
17
|
+
# display.
|
|
18
|
+
#
|
|
19
|
+
# @return [String]
|
|
20
|
+
required :label, String
|
|
21
|
+
|
|
22
|
+
# @!attribute last_used_at
|
|
23
|
+
# When the tag was last applied to an asset matching the `tagSource` and
|
|
24
|
+
# `fileType` filters of the request, in ISO 8601 format.
|
|
25
|
+
#
|
|
26
|
+
# @return [Time]
|
|
27
|
+
required :last_used_at, Time, api_name: :lastUsedAt
|
|
28
|
+
|
|
29
|
+
# @!attribute name
|
|
30
|
+
# The tag in lowercase. Tags are case-insensitive, so this is the unique key of
|
|
31
|
+
# the tag within your account.
|
|
32
|
+
#
|
|
33
|
+
# @return [String]
|
|
34
|
+
required :name, String
|
|
35
|
+
|
|
36
|
+
# @!method initialize(asset_count:, label:, last_used_at:, name:)
|
|
37
|
+
# Some parameter documentations has been truncated, see {Imagekitio::Models::Tag}
|
|
38
|
+
# for more details.
|
|
39
|
+
#
|
|
40
|
+
# A tag in use in your media library, aggregated case-insensitively across the
|
|
41
|
+
# assets that carry it.
|
|
42
|
+
#
|
|
43
|
+
# @param asset_count [Integer] The number of assets carrying the tag, counted across both tag sources (user-gen
|
|
44
|
+
#
|
|
45
|
+
# @param label [String] The tag as it was spelled when it was last applied to any asset. Use it for disp
|
|
46
|
+
#
|
|
47
|
+
# @param last_used_at [Time] When the tag was last applied to an asset matching the `tagSource` and `fileType
|
|
48
|
+
#
|
|
49
|
+
# @param name [String] The tag in lowercase. Tags are case-insensitive, so this is the unique key of th
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Imagekitio
|
|
4
|
+
module Models
|
|
5
|
+
# @see Imagekitio::Resources::Tags#list
|
|
6
|
+
class TagListParams < Imagekitio::Internal::Type::BaseModel
|
|
7
|
+
extend Imagekitio::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Imagekitio::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute cursor
|
|
11
|
+
# The `nextCursor` value from the previous response, to fetch the next page. A
|
|
12
|
+
# cursor is bound to the `tagSource`, `fileType`, `sort`, `search` and `prefix` it
|
|
13
|
+
# was issued with; sending it with different values returns a 400.
|
|
14
|
+
#
|
|
15
|
+
# @return [String, nil]
|
|
16
|
+
optional :cursor, String
|
|
17
|
+
|
|
18
|
+
# @!attribute file_type
|
|
19
|
+
# Filter tags by the type of asset they are applied to.
|
|
20
|
+
#
|
|
21
|
+
# - `image` — tags in use on images
|
|
22
|
+
# - `video` — tags in use on videos
|
|
23
|
+
# - `static` — tags in use on any other file, such as documents, scripts and
|
|
24
|
+
# stylesheets
|
|
25
|
+
# - `all` — tags in use on any asset
|
|
26
|
+
#
|
|
27
|
+
# @return [Symbol, Imagekitio::Models::TagListParams::FileType, nil]
|
|
28
|
+
optional :file_type, enum: -> { Imagekitio::TagListParams::FileType }
|
|
29
|
+
|
|
30
|
+
# @!attribute limit
|
|
31
|
+
# The maximum number of tags to return in response.
|
|
32
|
+
#
|
|
33
|
+
# @return [Integer, nil]
|
|
34
|
+
optional :limit, Integer
|
|
35
|
+
|
|
36
|
+
# @!attribute prefix
|
|
37
|
+
# Only return tags that begin with this value. Matching is case-insensitive.
|
|
38
|
+
#
|
|
39
|
+
# @return [String, nil]
|
|
40
|
+
optional :prefix, String
|
|
41
|
+
|
|
42
|
+
# @!attribute search
|
|
43
|
+
# Only return tags that contain this text. Every word in the value must appear in
|
|
44
|
+
# the tag and the last word may be incomplete, which suits search-as-you-type.
|
|
45
|
+
# Matching is case-insensitive.
|
|
46
|
+
#
|
|
47
|
+
# @return [String, nil]
|
|
48
|
+
optional :search, String
|
|
49
|
+
|
|
50
|
+
# @!attribute sort
|
|
51
|
+
# Sort the results.
|
|
52
|
+
#
|
|
53
|
+
# - `ASC_NAME` / `DESC_NAME` — by `name`
|
|
54
|
+
# - `ASC_LAST_USED` / `DESC_LAST_USED` — by `lastUsedAt` within the requested
|
|
55
|
+
# `tagSource` and `fileType`, ties broken by `name`
|
|
56
|
+
#
|
|
57
|
+
# @return [Symbol, Imagekitio::Models::TagListParams::Sort, nil]
|
|
58
|
+
optional :sort, enum: -> { Imagekitio::TagListParams::Sort }
|
|
59
|
+
|
|
60
|
+
# @!attribute tag_source
|
|
61
|
+
# Filter tags by who added them.
|
|
62
|
+
#
|
|
63
|
+
# - `user` — tags added by users through the dashboard or the API
|
|
64
|
+
# - `ai` — tags added by AI auto-tagging extensions
|
|
65
|
+
# - `all` — both
|
|
66
|
+
#
|
|
67
|
+
# @return [Symbol, Imagekitio::Models::TagListParams::TagSource, nil]
|
|
68
|
+
optional :tag_source, enum: -> { Imagekitio::TagListParams::TagSource }
|
|
69
|
+
|
|
70
|
+
# @!method initialize(cursor: nil, file_type: nil, limit: nil, prefix: nil, search: nil, sort: nil, tag_source: nil, request_options: {})
|
|
71
|
+
# Some parameter documentations has been truncated, see
|
|
72
|
+
# {Imagekitio::Models::TagListParams} for more details.
|
|
73
|
+
#
|
|
74
|
+
# @param cursor [String] The `nextCursor` value from the previous response, to fetch the next page. A cur
|
|
75
|
+
#
|
|
76
|
+
# @param file_type [Symbol, Imagekitio::Models::TagListParams::FileType] Filter tags by the type of asset they are applied to.
|
|
77
|
+
#
|
|
78
|
+
# @param limit [Integer] The maximum number of tags to return in response.
|
|
79
|
+
#
|
|
80
|
+
# @param prefix [String] Only return tags that begin with this value. Matching is case-insensitive.
|
|
81
|
+
#
|
|
82
|
+
# @param search [String] Only return tags that contain this text. Every word in the value must appear in
|
|
83
|
+
#
|
|
84
|
+
# @param sort [Symbol, Imagekitio::Models::TagListParams::Sort] Sort the results.
|
|
85
|
+
#
|
|
86
|
+
# @param tag_source [Symbol, Imagekitio::Models::TagListParams::TagSource] Filter tags by who added them.
|
|
87
|
+
#
|
|
88
|
+
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}]
|
|
89
|
+
|
|
90
|
+
# Filter tags by the type of asset they are applied to.
|
|
91
|
+
#
|
|
92
|
+
# - `image` — tags in use on images
|
|
93
|
+
# - `video` — tags in use on videos
|
|
94
|
+
# - `static` — tags in use on any other file, such as documents, scripts and
|
|
95
|
+
# stylesheets
|
|
96
|
+
# - `all` — tags in use on any asset
|
|
97
|
+
module FileType
|
|
98
|
+
extend Imagekitio::Internal::Type::Enum
|
|
99
|
+
|
|
100
|
+
IMAGE = :image
|
|
101
|
+
VIDEO = :video
|
|
102
|
+
STATIC = :static
|
|
103
|
+
ALL = :all
|
|
104
|
+
|
|
105
|
+
# @!method self.values
|
|
106
|
+
# @return [Array<Symbol>]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Sort the results.
|
|
110
|
+
#
|
|
111
|
+
# - `ASC_NAME` / `DESC_NAME` — by `name`
|
|
112
|
+
# - `ASC_LAST_USED` / `DESC_LAST_USED` — by `lastUsedAt` within the requested
|
|
113
|
+
# `tagSource` and `fileType`, ties broken by `name`
|
|
114
|
+
module Sort
|
|
115
|
+
extend Imagekitio::Internal::Type::Enum
|
|
116
|
+
|
|
117
|
+
ASC_NAME = :ASC_NAME
|
|
118
|
+
DESC_NAME = :DESC_NAME
|
|
119
|
+
ASC_LAST_USED = :ASC_LAST_USED
|
|
120
|
+
DESC_LAST_USED = :DESC_LAST_USED
|
|
121
|
+
|
|
122
|
+
# @!method self.values
|
|
123
|
+
# @return [Array<Symbol>]
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Filter tags by who added them.
|
|
127
|
+
#
|
|
128
|
+
# - `user` — tags added by users through the dashboard or the API
|
|
129
|
+
# - `ai` — tags added by AI auto-tagging extensions
|
|
130
|
+
# - `all` — both
|
|
131
|
+
module TagSource
|
|
132
|
+
extend Imagekitio::Internal::Type::Enum
|
|
133
|
+
|
|
134
|
+
USER = :user
|
|
135
|
+
AI = :ai
|
|
136
|
+
ALL = :all
|
|
137
|
+
|
|
138
|
+
# @!method self.values
|
|
139
|
+
# @return [Array<Symbol>]
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
data/lib/imagekitio/models.rb
CHANGED
|
@@ -179,6 +179,10 @@ module Imagekitio
|
|
|
179
179
|
|
|
180
180
|
SubtitleOverlayTransformation = Imagekitio::Models::SubtitleOverlayTransformation
|
|
181
181
|
|
|
182
|
+
Tag = Imagekitio::Models::Tag
|
|
183
|
+
|
|
184
|
+
TagListParams = Imagekitio::Models::TagListParams
|
|
185
|
+
|
|
182
186
|
TextOverlay = Imagekitio::Models::TextOverlay
|
|
183
187
|
|
|
184
188
|
TextOverlayTransformation = Imagekitio::Models::TextOverlayTransformation
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
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
|
+
#
|
|
22
|
+
# @overload get(request_options: {})
|
|
23
|
+
#
|
|
24
|
+
# @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
25
|
+
#
|
|
26
|
+
# @return [Imagekitio::Models::Accounts::ContractGetResponse]
|
|
27
|
+
#
|
|
28
|
+
# @see Imagekitio::Models::Accounts::ContractGetParams
|
|
29
|
+
def get(params = {})
|
|
30
|
+
@client.request(
|
|
31
|
+
method: :get,
|
|
32
|
+
path: "v1/accounts/contract",
|
|
33
|
+
model: Imagekitio::Models::Accounts::ContractGetResponse,
|
|
34
|
+
options: params[:request_options]
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @api private
|
|
39
|
+
#
|
|
40
|
+
# @param client [Imagekitio::Client]
|
|
41
|
+
def initialize(client:)
|
|
42
|
+
@client = client
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -9,6 +9,9 @@ module Imagekitio
|
|
|
9
9
|
# @return [Imagekitio::Resources::Accounts::UsageAnalytics]
|
|
10
10
|
attr_reader :usage_analytics
|
|
11
11
|
|
|
12
|
+
# @return [Imagekitio::Resources::Accounts::Contract]
|
|
13
|
+
attr_reader :contract
|
|
14
|
+
|
|
12
15
|
# @return [Imagekitio::Resources::Accounts::Origins]
|
|
13
16
|
attr_reader :origins
|
|
14
17
|
|
|
@@ -25,6 +28,7 @@ module Imagekitio
|
|
|
25
28
|
@client = client
|
|
26
29
|
@usage = Imagekitio::Resources::Accounts::Usage.new(client: client)
|
|
27
30
|
@usage_analytics = Imagekitio::Resources::Accounts::UsageAnalytics.new(client: client)
|
|
31
|
+
@contract = Imagekitio::Resources::Accounts::Contract.new(client: client)
|
|
28
32
|
@origins = Imagekitio::Resources::Accounts::Origins.new(client: client)
|
|
29
33
|
@url_endpoints = Imagekitio::Resources::Accounts::URLEndpoints.new(client: client)
|
|
30
34
|
@webhooks = Imagekitio::Resources::Accounts::Webhooks.new(client: client)
|