diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 127ac87..3b4c2d4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.0.0" + ".": "4.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ae3aead..dc3fb53 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-9d184cb502ab32a85db2889c796cdfebe812f2a55a604df79c85dd4b5e7e2add.yml -openapi_spec_hash: a9aa620376fce66532c84f9364209b0b -config_hash: eb4cf65a4c6b26a2901076eff5810d5d +configured_endpoints: 47 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-c028a7584d3508f268ce5c5b824b50af88eaa140620dd03a1b35f409f510603c.yml +openapi_spec_hash: f9b780b2398a87678a13355e48cd515f +config_hash: aeb6eb949d73382270bbd8bbf2e4cf2a diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c7579..b7edcc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## 4.1.0 (2026-01-15) + +Full Changelog: [v4.0.0...v4.1.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.0.0...v4.1.0) + +### Features + +* add layer_mode property to overlays and new transformation options ([97042ce](https://github.com/imagekit-developer/imagekit-ruby/commit/97042ce9bffaf101ab98dd7394caaf4df9a873ea)) +* **api:** Add saved extensions API and enhance transformation options ([f1dc75e](https://github.com/imagekit-developer/imagekit-ruby/commit/f1dc75ecbe0a4a39472fdc10e9dc8f02e75ddc07)) + + +### Bug Fixes + +* add ai-tasks property to response schemas with enum values ([aad5e54](https://github.com/imagekit-developer/imagekit-ruby/commit/aad5e5413676af916e8149f07ae78aaff7c5c313)) +* better thread safety via early initializing SSL store during HTTP client creation ([2bc0835](https://github.com/imagekit-developer/imagekit-ruby/commit/2bc0835981c29b717f0ad3a7d78c3c78027874e0)) +* calling `break` out of streams should be instantaneous ([55bf4a9](https://github.com/imagekit-developer/imagekit-ruby/commit/55bf4a9b768f18f4adad903b2c9d93178a670151)) +* issue where json.parse errors when receiving HTTP 204 with nobody ([dd32cb1](https://github.com/imagekit-developer/imagekit-ruby/commit/dd32cb1572bc155db85ed898011374889996b3fd)) + + +### Chores + +* bump dependency version and update sorbet types ([8d89fb2](https://github.com/imagekit-developer/imagekit-ruby/commit/8d89fb2c1654420f83bb7efedcc9056c5a7e3c79)) +* **client:** send user-agent header ([796027d](https://github.com/imagekit-developer/imagekit-ruby/commit/796027d185c93067c32bac98323d8a82aeaf9bfe)) +* explicitly require "base64" gem ([1b4181d](https://github.com/imagekit-developer/imagekit-ruby/commit/1b4181d4e57d2c12306f6d3f43b832f63ab68053)) +* **internal:** codegen related update ([3a93def](https://github.com/imagekit-developer/imagekit-ruby/commit/3a93def2d09609b359824a627183833ae59d74e1)) +* **internal:** codegen related update ([4c161f0](https://github.com/imagekit-developer/imagekit-ruby/commit/4c161f048927df137a12d33a5a1b79af1c561b8b)) +* move `cgi` into dependencies for ruby 4 ([54261ef](https://github.com/imagekit-developer/imagekit-ruby/commit/54261ef9f24e206d2180dc0a205464154af4c3ed)) + + +### Documentation + +* prominently feature MCP server setup in root SDK readmes ([777f8cf](https://github.com/imagekit-developer/imagekit-ruby/commit/777f8cf5cc692eed3e8f6217caf25a85d17201f7)) +* remove MCP Server section from README ([db0f71c](https://github.com/imagekit-developer/imagekit-ruby/commit/db0f71cce159f4c395fe8c7c0526d4108934fc6b)) + ## 4.0.0 (2025-11-03) Full Changelog: [v0.0.1...v4.0.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v0.0.1...v4.0.0) diff --git a/Gemfile b/Gemfile index 0d76364..1be178c 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,7 @@ group :development do gem "sorbet" gem "steep" gem "syntax_tree" - # TODO: using a fork for now, the prettier below has a bug - gem "syntax_tree-rbs", github: "stainless-api/syntax_tree-rbs", branch: "main" + gem "syntax_tree-rbs", github: "ruby-syntax-tree/syntax_tree-rbs", branch: "main" gem "tapioca" end diff --git a/Gemfile.lock b/Gemfile.lock index 5831c83..57454ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT - remote: https://github.com/stainless-api/syntax_tree-rbs.git - revision: c30b50219918be7cfe3ef803a00b59d1e77fcada + remote: https://github.com/ruby-syntax-tree/syntax_tree-rbs.git + revision: f94bc3060682ffbd126e4d5086ffedc89073d626 branch: main specs: syntax_tree-rbs (1.0.0) @@ -11,7 +11,8 @@ GIT PATH remote: . specs: - imagekitio (4.0.0) + imagekitio (4.1.0) + cgi connection_pool GEM @@ -42,6 +43,7 @@ GEM base64 (0.3.0) benchmark (0.5.0) bigdecimal (3.3.1) + cgi (0.5.1) concurrent-ruby (1.3.5) connection_pool (2.5.4) console (1.34.2) diff --git a/LICENSE b/LICENSE index 6c27689..2027861 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 ImageKit + Copyright 2026 Image Kit Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 17f8041..bc9c97f 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "imagekitio", "~> 4.0.0" +gem "imagekitio", "~> 4.1.0" ``` diff --git a/imagekitio.gemspec b/imagekitio.gemspec index c5fb4d7..32c565a 100644 --- a/imagekitio.gemspec +++ b/imagekitio.gemspec @@ -24,5 +24,6 @@ Gem::Specification.new do |s| ".ignore" ] s.extra_rdoc_files = ["README.md"] + s.add_dependency "cgi" s.add_dependency "connection_pool" end diff --git a/lib/imagekitio.rb b/lib/imagekitio.rb index 317c9b3..54bef31 100644 --- a/lib/imagekitio.rb +++ b/lib/imagekitio.rb @@ -3,12 +3,14 @@ # Standard libraries. # rubocop:disable Lint/RedundantRequireStatement require "English" +require "base64" require "cgi" require "date" require "erb" require "etc" require "json" require "net/http" +require "openssl" require "pathname" require "rbconfig" require "securerandom" @@ -89,6 +91,7 @@ require_relative "imagekitio/models/custom_metadata_field_list_params" require_relative "imagekitio/models/custom_metadata_field_list_response" require_relative "imagekitio/models/custom_metadata_field_update_params" +require_relative "imagekitio/models/extension_config" require_relative "imagekitio/models/extensions" require_relative "imagekitio/models/file_copy_params" require_relative "imagekitio/models/file_copy_response" @@ -138,6 +141,13 @@ require_relative "imagekitio/models/overlay_position" require_relative "imagekitio/models/overlay_timing" require_relative "imagekitio/models/responsive_image_attributes" +require_relative "imagekitio/models/saved_extension" +require_relative "imagekitio/models/saved_extension_create_params" +require_relative "imagekitio/models/saved_extension_delete_params" +require_relative "imagekitio/models/saved_extension_get_params" +require_relative "imagekitio/models/saved_extension_list_params" +require_relative "imagekitio/models/saved_extension_list_response" +require_relative "imagekitio/models/saved_extension_update_params" require_relative "imagekitio/models/solid_color_overlay" require_relative "imagekitio/models/solid_color_overlay_transformation" require_relative "imagekitio/models/streaming_resolution" @@ -177,5 +187,6 @@ require_relative "imagekitio/resources/files/versions" require_relative "imagekitio/resources/folders" require_relative "imagekitio/resources/folders/job" +require_relative "imagekitio/resources/saved_extensions" require_relative "imagekitio/resources/webhooks" require_relative "imagekitio/helpers/helper" diff --git a/lib/imagekitio/client.rb b/lib/imagekitio/client.rb index 3f5b787..2992be4 100644 --- a/lib/imagekitio/client.rb +++ b/lib/imagekitio/client.rb @@ -31,6 +31,9 @@ class Client < Imagekitio::Internal::Transport::BaseClient # @return [Imagekitio::Resources::Files] attr_reader :files + # @return [Imagekitio::Resources::SavedExtensions] + attr_reader :saved_extensions + # @return [Imagekitio::Resources::Assets] attr_reader :assets @@ -117,6 +120,7 @@ def initialize( @custom_metadata_fields = Imagekitio::Resources::CustomMetadataFields.new(client: self) @files = Imagekitio::Resources::Files.new(client: self) + @saved_extensions = Imagekitio::Resources::SavedExtensions.new(client: self) @assets = Imagekitio::Resources::Assets.new(client: self) @cache = Imagekitio::Resources::Cache.new(client: self) @folders = Imagekitio::Resources::Folders.new(client: self) diff --git a/lib/imagekitio/helpers/helper.rb b/lib/imagekitio/helpers/helper.rb index 2da2f3c..6fec9fd 100644 --- a/lib/imagekitio/helpers/helper.rb +++ b/lib/imagekitio/helpers/helper.rb @@ -626,6 +626,10 @@ def safe_get(obj, key) # Add overlay properties like position, timing, transformations (matching Node.js) def add_overlay_properties(parts, overlay) + # Add layer_mode property + layer_mode = safe_get(overlay, :layer_mode) + parts << "lm-#{layer_mode}" if layer_mode + # Add position properties position = safe_get(overlay, :position) if position diff --git a/lib/imagekitio/helpers/transformation_utils.rb b/lib/imagekitio/helpers/transformation_utils.rb index 3e7a431..45c02a0 100644 --- a/lib/imagekitio/helpers/transformation_utils.rb +++ b/lib/imagekitio/helpers/transformation_utils.rb @@ -82,6 +82,9 @@ module TransformationUtils "unsharp_mask" => "e-usm", "unsharpMask" => "e-usm", "gradient" => "e-gradient", + "color_replace" => "cr", + "colorReplace" => "cr", + "distort" => "e-distort", # Other flags & finishing "progressive" => "pr", @@ -109,6 +112,10 @@ module TransformationUtils "line_height" => "lh", "lineHeight" => "lh", + # Overlay transformations + "layer_mode" => "lm", + "layerMode" => "lm", + # Subtitles transformations "font_outline" => "fol", "fontOutline" => "fol", diff --git a/lib/imagekitio/internal/transport/base_client.rb b/lib/imagekitio/internal/transport/base_client.rb index 6e613d4..e9c0aea 100644 --- a/lib/imagekitio/internal/transport/base_client.rb +++ b/lib/imagekitio/internal/transport/base_client.rb @@ -201,7 +201,8 @@ def initialize( self.class::PLATFORM_HEADERS, { "accept" => "application/json", - "content-type" => "application/json" + "content-type" => "application/json", + "user-agent" => user_agent }, headers ) @@ -219,6 +220,11 @@ def initialize( # @return [Hash{String=>String}] private def auth_headers = {} + # @api private + # + # @return [String] + private def user_agent = "#{self.class.name}/Ruby #{Imagekitio::VERSION}" + # @api private # # @return [String] diff --git a/lib/imagekitio/internal/transport/pooled_net_requester.rb b/lib/imagekitio/internal/transport/pooled_net_requester.rb index 41f5319..fa32384 100644 --- a/lib/imagekitio/internal/transport/pooled_net_requester.rb +++ b/lib/imagekitio/internal/transport/pooled_net_requester.rb @@ -16,10 +16,11 @@ class PooledNetRequester class << self # @api private # + # @param cert_store [OpenSSL::X509::Store] # @param url [URI::Generic] # # @return [Net::HTTP] - def connect(url) + def connect(cert_store:, url:) port = case [url.port, url.scheme] in [Integer, _] @@ -34,18 +35,7 @@ def connect(url) _1.use_ssl = %w[https wss].include?(url.scheme) _1.max_retries = 0 - # Temporary workaround for SSL verification issue on some - # platforms. Similar to: https://github.com/stripe/stripe-ruby/pull/397 - # Without this fix you may see errors like: - # .rbenv/versions/3.2.0/lib/ruby/3.2.0/net/protocol.rb:46:in `connect_nonblock': - # SSL_connect returned=1 errno=0 peeraddr=52.23.130.57:443 state=error: - # certificate verify failed (unable to get certificate CRL) (OpenSSL::SSL::SSLError) - if _1.use_ssl? - cert_store = OpenSSL::X509::Store.new - cert_store.set_default_paths - _1.cert_store = cert_store - _1.verify_mode = OpenSSL::SSL::VERIFY_PEER - end + (_1.cert_store = cert_store) if _1.use_ssl? end end @@ -115,7 +105,7 @@ def build_request(request, &blk) pool = @mutex.synchronize do @pools[origin] ||= ConnectionPool.new(size: @size) do - self.class.connect(url) + self.class.connect(cert_store: @cert_store, url: url) end end @@ -163,17 +153,19 @@ def execute(request) end self.class.calibrate_socket_timeout(conn, deadline) - conn.request(req) do |rsp| - y << [req, rsp] - break if finished - - rsp.read_body do |bytes| - y << bytes.force_encoding(Encoding::BINARY) - break if finished - - self.class.calibrate_socket_timeout(conn, deadline) + ::Kernel.catch(:jump) do + conn.request(req) do |rsp| + y << [req, rsp] + ::Kernel.throw(:jump) if finished + + rsp.read_body do |bytes| + y << bytes.force_encoding(Encoding::BINARY) + ::Kernel.throw(:jump) if finished + + self.class.calibrate_socket_timeout(conn, deadline) + end + eof = true end - eof = true end end ensure @@ -205,6 +197,7 @@ def execute(request) def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS) @mutex = Mutex.new @size = size + @cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths) @pools = {} end diff --git a/lib/imagekitio/internal/type/base_model.rb b/lib/imagekitio/internal/type/base_model.rb index a7dd52d..907a0f3 100644 --- a/lib/imagekitio/internal/type/base_model.rb +++ b/lib/imagekitio/internal/type/base_model.rb @@ -440,6 +440,7 @@ def deep_to_h = self.class.recursively_to_h(@data, convert: false) # @example # # `base_overlay` is a `Imagekitio::BaseOverlay` # base_overlay => { + # layer_mode: layer_mode, # position: position, # timing: timing # } diff --git a/lib/imagekitio/internal/type/union.rb b/lib/imagekitio/internal/type/union.rb index 47fdfd0..bb649ab 100644 --- a/lib/imagekitio/internal/type/union.rb +++ b/lib/imagekitio/internal/type/union.rb @@ -6,16 +6,28 @@ module Type # @api private # # @example - # # `overlay` is a `Imagekitio::Overlay` - # case overlay - # when Imagekitio::TextOverlay - # # ... - # when Imagekitio::ImageOverlay - # # ... - # when Imagekitio::VideoOverlay + # # `extension_config` is a `Imagekitio::ExtensionConfig` + # case extension_config + # when Imagekitio::ExtensionConfig::RemoveBg + # puts(extension_config.name) + # when Imagekitio::ExtensionConfig::AIAutoDescription + # puts(extension_config.name) + # when Imagekitio::ExtensionConfig::AITasks + # puts(extension_config.tasks) + # else + # puts(extension_config) + # end + # + # @example + # case extension_config + # in {name: :"remove-bg", options: options} + # puts(options) + # in {name: :"ai-auto-description"} # # ... + # in {name: :"ai-tasks", tasks: tasks} + # puts(tasks) # else - # puts(overlay) + # puts(extension_config) # end module Union include Imagekitio::Internal::Type::Converter diff --git a/lib/imagekitio/internal/util.rb b/lib/imagekitio/internal/util.rb index 77125ec..1dd7d34 100644 --- a/lib/imagekitio/internal/util.rb +++ b/lib/imagekitio/internal/util.rb @@ -657,7 +657,8 @@ def force_charset!(content_type, text:) def decode_content(headers, stream:, suppress_error: false) case (content_type = headers["content-type"]) in Imagekitio::Internal::Util::JSON_CONTENT - json = stream.to_a.join + return nil if (json = stream.to_a.join).empty? + begin JSON.parse(json, symbolize_names: true) rescue JSON::ParserError => e @@ -667,7 +668,11 @@ def decode_content(headers, stream:, suppress_error: false) in Imagekitio::Internal::Util::JSONL_CONTENT lines = decode_lines(stream) chain_fused(lines) do |y| - lines.each { y << JSON.parse(_1, symbolize_names: true) } + lines.each do + next if _1.empty? + + y << JSON.parse(_1, symbolize_names: true) + end end in %r{^text/event-stream} lines = decode_lines(stream) diff --git a/lib/imagekitio/models.rb b/lib/imagekitio/models.rb index 06ffc0c..bc8f57a 100644 --- a/lib/imagekitio/models.rb +++ b/lib/imagekitio/models.rb @@ -61,6 +61,8 @@ module Imagekitio CustomMetadataFieldUpdateParams = Imagekitio::Models::CustomMetadataFieldUpdateParams + ExtensionConfig = Imagekitio::Models::ExtensionConfig + ExtensionItem = Imagekitio::Models::ExtensionItem # @type [Imagekitio::Internal::Type::Converter] @@ -112,6 +114,18 @@ module Imagekitio ResponsiveImageAttributes = Imagekitio::Models::ResponsiveImageAttributes + SavedExtension = Imagekitio::Models::SavedExtension + + SavedExtensionCreateParams = Imagekitio::Models::SavedExtensionCreateParams + + SavedExtensionDeleteParams = Imagekitio::Models::SavedExtensionDeleteParams + + SavedExtensionGetParams = Imagekitio::Models::SavedExtensionGetParams + + SavedExtensionListParams = Imagekitio::Models::SavedExtensionListParams + + SavedExtensionUpdateParams = Imagekitio::Models::SavedExtensionUpdateParams + SolidColorOverlay = Imagekitio::Models::SolidColorOverlay SolidColorOverlayTransformation = Imagekitio::Models::SolidColorOverlayTransformation diff --git a/lib/imagekitio/models/base_overlay.rb b/lib/imagekitio/models/base_overlay.rb index d48136f..fb89539 100644 --- a/lib/imagekitio/models/base_overlay.rb +++ b/lib/imagekitio/models/base_overlay.rb @@ -3,19 +3,89 @@ module Imagekitio module Models class BaseOverlay < Imagekitio::Internal::Type::BaseModel + # @!attribute layer_mode + # Controls how the layer blends with the base image or underlying content. Maps to + # `lm` in the URL. By default, layers completely cover the base image beneath + # them. Layer modes change this behavior: + # + # - `multiply`: Multiplies the pixel values of the layer with the base image. The + # result is always darker than the original images. This is ideal for applying + # shadows or color tints. + # - `displace`: Uses the layer as a displacement map to distort pixels in the base + # image. The red channel controls horizontal displacement, and the green channel + # controls vertical displacement. Requires `x` or `y` parameter to control + # displacement magnitude. + # - `cutout`: Acts as an inverse mask where opaque areas of the layer turn the + # base image transparent, while transparent areas leave the base image + # unchanged. This mode functions like a hole-punch, effectively cutting the + # shape of the layer out of the underlying image. + # - `cutter`: Acts as a shape mask where only the parts of the base image that + # fall inside the opaque area of the layer are preserved. This mode functions + # like a cookie-cutter, trimming the base image to match the specific dimensions + # and shape of the layer. See + # [Layer modes](https://imagekit.io/docs/add-overlays-on-images#layer-modes). + # + # @return [Symbol, Imagekitio::Models::BaseOverlay::LayerMode, nil] + optional :layer_mode, enum: -> { Imagekitio::BaseOverlay::LayerMode }, api_name: :layerMode + # @!attribute position + # Specifies the overlay's position relative to the parent asset. See + # [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer). # # @return [Imagekitio::Models::OverlayPosition, nil] optional :position, -> { Imagekitio::OverlayPosition } # @!attribute timing + # Specifies timing information for the overlay (only applicable if the base asset + # is a video). See + # [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer). # # @return [Imagekitio::Models::OverlayTiming, nil] optional :timing, -> { Imagekitio::OverlayTiming } - # @!method initialize(position: nil, timing: nil) - # @param position [Imagekitio::Models::OverlayPosition] - # @param timing [Imagekitio::Models::OverlayTiming] + # @!method initialize(layer_mode: nil, position: nil, timing: nil) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::BaseOverlay} for more details. + # + # @param layer_mode [Symbol, Imagekitio::Models::BaseOverlay::LayerMode] Controls how the layer blends with the base image or underlying content. Maps to + # + # @param position [Imagekitio::Models::OverlayPosition] Specifies the overlay's position relative to the parent asset. + # + # @param timing [Imagekitio::Models::OverlayTiming] Specifies timing information for the overlay (only applicable if the base asset + + # Controls how the layer blends with the base image or underlying content. Maps to + # `lm` in the URL. By default, layers completely cover the base image beneath + # them. Layer modes change this behavior: + # + # - `multiply`: Multiplies the pixel values of the layer with the base image. The + # result is always darker than the original images. This is ideal for applying + # shadows or color tints. + # - `displace`: Uses the layer as a displacement map to distort pixels in the base + # image. The red channel controls horizontal displacement, and the green channel + # controls vertical displacement. Requires `x` or `y` parameter to control + # displacement magnitude. + # - `cutout`: Acts as an inverse mask where opaque areas of the layer turn the + # base image transparent, while transparent areas leave the base image + # unchanged. This mode functions like a hole-punch, effectively cutting the + # shape of the layer out of the underlying image. + # - `cutter`: Acts as a shape mask where only the parts of the base image that + # fall inside the opaque area of the layer are preserved. This mode functions + # like a cookie-cutter, trimming the base image to match the specific dimensions + # and shape of the layer. See + # [Layer modes](https://imagekit.io/docs/add-overlays-on-images#layer-modes). + # + # @see Imagekitio::Models::BaseOverlay#layer_mode + module LayerMode + extend Imagekitio::Internal::Type::Enum + + MULTIPLY = :multiply + CUTTER = :cutter + CUTOUT = :cutout + DISPLACE = :displace + + # @!method self.values + # @return [Array] + end end end end diff --git a/lib/imagekitio/models/beta/v2/file_upload_params.rb b/lib/imagekitio/models/beta/v2/file_upload_params.rb index a2a6cf2..c348da3 100644 --- a/lib/imagekitio/models/beta/v2/file_upload_params.rb +++ b/lib/imagekitio/models/beta/v2/file_upload_params.rb @@ -149,7 +149,7 @@ def self.serialize_upload_options(upload_options) # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # - # @return [Array, nil] + # @return [Array, nil] optional :extensions, -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::ExtensionItem] } # @!attribute folder @@ -286,7 +286,7 @@ def self.serialize_upload_options(upload_options) # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekitio/models/beta/v2/file_upload_response.rb b/lib/imagekitio/models/beta/v2/file_upload_response.rb index e9e6906..1fe9248 100644 --- a/lib/imagekitio/models/beta/v2/file_upload_response.rb +++ b/lib/imagekitio/models/beta/v2/file_upload_response.rb @@ -299,6 +299,13 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel enum: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription }, api_name: :"ai-auto-description" + # @!attribute ai_tasks + # + # @return [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks, nil] + optional :ai_tasks, + enum: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks }, + api_name: :"ai-tasks" + # @!attribute aws_auto_tagging # # @return [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging, nil] @@ -320,7 +327,7 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel enum: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg }, api_name: :"remove-bg" - # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # @!method initialize(ai_auto_description: nil, ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) # Extension names with their processing status at the time of completion of the # request. It could have one of the following status values: # @@ -332,6 +339,7 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel # If no extension was requested, then this parameter is not returned. # # @param ai_auto_description [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription] + # @param ai_tasks [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks] # @param aws_auto_tagging [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging] # @param google_auto_tagging [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging] # @param remove_bg [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg] @@ -348,6 +356,18 @@ module AIAutoDescription # @return [Array] end + # @see Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus#ai_tasks + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + # @see Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus#aws_auto_tagging module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/models/extension_config.rb b/lib/imagekitio/models/extension_config.rb new file mode 100644 index 0000000..5b86286 --- /dev/null +++ b/lib/imagekitio/models/extension_config.rb @@ -0,0 +1,674 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # Configuration object for an extension (base extensions only, not saved extension + # references). + module ExtensionConfig + extend Imagekitio::Internal::Type::Union + + discriminator :name + + variant :"remove-bg", -> { Imagekitio::ExtensionConfig::RemoveBg } + + variant :"ai-auto-description", -> { Imagekitio::ExtensionConfig::AIAutoDescription } + + variant :"ai-tasks", -> { Imagekitio::ExtensionConfig::AITasks } + + variant -> { Imagekitio::ExtensionConfig::AutoTaggingExtension } + + class RemoveBg < Imagekitio::Internal::Type::BaseModel + # @!attribute name + # Specifies the background removal extension. + # + # @return [Symbol, :"remove-bg"] + required :name, const: :"remove-bg" + + # @!attribute options + # + # @return [Imagekitio::Models::ExtensionConfig::RemoveBg::Options, nil] + optional :options, -> { Imagekitio::ExtensionConfig::RemoveBg::Options } + + # @!method initialize(options: nil, name: :"remove-bg") + # @param options [Imagekitio::Models::ExtensionConfig::RemoveBg::Options] + # + # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. + + # @see Imagekitio::Models::ExtensionConfig::RemoveBg#options + class Options < Imagekitio::Internal::Type::BaseModel + # @!attribute add_shadow + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + # + # @return [Boolean, nil] + optional :add_shadow, Imagekitio::Internal::Type::Boolean + + # @!attribute bg_color + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + # + # @return [String, nil] + optional :bg_color, String + + # @!attribute bg_image_url + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + # + # @return [String, nil] + optional :bg_image_url, String + + # @!attribute semitransparency + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + # + # @return [Boolean, nil] + optional :semitransparency, Imagekitio::Internal::Type::Boolean + + # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionConfig::RemoveBg::Options} for more details. + # + # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin + # + # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col + # + # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be + # + # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp + end + end + + class AutoTaggingExtension < Imagekitio::Internal::Type::BaseModel + # @!attribute max_tags + # Maximum number of tags to attach to the asset. + # + # @return [Integer] + required :max_tags, Integer, api_name: :maxTags + + # @!attribute min_confidence + # Minimum confidence level for tags to be considered valid. + # + # @return [Integer] + required :min_confidence, Integer, api_name: :minConfidence + + # @!attribute name + # Specifies the auto-tagging extension used. + # + # @return [Symbol, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension::Name] + required :name, enum: -> { Imagekitio::ExtensionConfig::AutoTaggingExtension::Name } + + # @!method initialize(max_tags:, min_confidence:, name:) + # @param max_tags [Integer] Maximum number of tags to attach to the asset. + # + # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. + # + # @param name [Symbol, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. + + # Specifies the auto-tagging extension used. + # + # @see Imagekitio::Models::ExtensionConfig::AutoTaggingExtension#name + module Name + extend Imagekitio::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING = :"google-auto-tagging" + AWS_AUTO_TAGGING = :"aws-auto-tagging" + + # @!method self.values + # @return [Array] + end + end + + class AIAutoDescription < Imagekitio::Internal::Type::BaseModel + # @!attribute name + # Specifies the auto description extension. + # + # @return [Symbol, :"ai-auto-description"] + required :name, const: :"ai-auto-description" + + # @!method initialize(name: :"ai-auto-description") + # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. + end + + class AITasks < Imagekitio::Internal::Type::BaseModel + # @!attribute name + # Specifies the AI tasks extension for automated image analysis using AI models. + # + # @return [Symbol, :"ai-tasks"] + required :name, const: :"ai-tasks" + + # @!attribute tasks + # Array of task objects defining AI operations to perform on the asset. + # + # @return [Array] + required :tasks, + -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::ExtensionConfig::AITasks::Task] } + + # @!method initialize(tasks:, name: :"ai-tasks") + # @param tasks [Array] Array of task objects defining AI operations to perform on the asset. + # + # @param name [Symbol, :"ai-tasks"] Specifies the AI tasks extension for automated image analysis using AI models. + + module Task + extend Imagekitio::Internal::Type::Union + + discriminator :type + + variant :select_tags, -> { Imagekitio::ExtensionConfig::AITasks::Task::SelectTags } + + variant :select_metadata, -> { Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata } + + variant :yes_no, -> { Imagekitio::ExtensionConfig::AITasks::Task::YesNo } + + class SelectTags < Imagekitio::Internal::Type::BaseModel + # @!attribute instruction + # The question or instruction for the AI to analyze the image. + # + # @return [String] + required :instruction, String + + # @!attribute type + # Task type that analyzes the image and adds matching tags from a vocabulary. + # + # @return [Symbol, :select_tags] + required :type, const: :select_tags + + # @!attribute vocabulary + # Array of possible tag values. Combined length of all strings must not exceed 500 + # characters. Cannot contain the `%` character. + # + # @return [Array] + required :vocabulary, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute max_selections + # Maximum number of tags to select from the vocabulary. + # + # @return [Integer, nil] + optional :max_selections, Integer + + # @!attribute min_selections + # Minimum number of tags to select from the vocabulary. + # + # @return [Integer, nil] + optional :min_selections, Integer + + # @!method initialize(instruction:, vocabulary:, max_selections: nil, min_selections: nil, type: :select_tags) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectTags} for more + # details. + # + # @param instruction [String] The question or instruction for the AI to analyze the image. + # + # @param vocabulary [Array] Array of possible tag values. Combined length of all strings must not exceed 500 + # + # @param max_selections [Integer] Maximum number of tags to select from the vocabulary. + # + # @param min_selections [Integer] Minimum number of tags to select from the vocabulary. + # + # @param type [Symbol, :select_tags] Task type that analyzes the image and adds matching tags from a vocabulary. + end + + class SelectMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. The field must exist in your account. + # + # @return [String] + required :field, String + + # @!attribute instruction + # The question or instruction for the AI to analyze the image. + # + # @return [String] + required :instruction, String + + # @!attribute type + # Task type that analyzes the image and sets a custom metadata field value from a + # vocabulary. + # + # @return [Symbol, :select_metadata] + required :type, const: :select_metadata + + # @!attribute max_selections + # Maximum number of values to select from the vocabulary. + # + # @return [Integer, nil] + optional :max_selections, Integer + + # @!attribute min_selections + # Minimum number of values to select from the vocabulary. + # + # @return [Integer, nil] + optional :min_selections, Integer + + # @!attribute vocabulary + # Array of possible values matching the custom metadata field type. + # + # @return [Array, nil] + optional :vocabulary, + -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata::Vocabulary] } + + # @!method initialize(field:, instruction:, max_selections: nil, min_selections: nil, vocabulary: nil, type: :select_metadata) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata} for more + # details. + # + # @param field [String] Name of the custom metadata field to set. The field must exist in your account. + # + # @param instruction [String] The question or instruction for the AI to analyze the image. + # + # @param max_selections [Integer] Maximum number of values to select from the vocabulary. + # + # @param min_selections [Integer] Minimum number of values to select from the vocabulary. + # + # @param vocabulary [Array] Array of possible values matching the custom metadata field type. + # + # @param type [Symbol, :select_metadata] Task type that analyzes the image and sets a custom metadata field value from a + + module Vocabulary + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + end + + class YesNo < Imagekitio::Internal::Type::BaseModel + # @!attribute instruction + # The yes/no question for the AI to answer about the image. + # + # @return [String] + required :instruction, String + + # @!attribute type + # Task type that asks a yes/no question and executes actions based on the answer. + # + # @return [Symbol, :yes_no] + required :type, const: :yes_no + + # @!attribute on_no + # Actions to execute if the AI answers no. + # + # @return [Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo, nil] + optional :on_no, -> { Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo } + + # @!attribute on_unknown + # Actions to execute if the AI cannot determine the answer. + # + # @return [Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown, nil] + optional :on_unknown, -> { Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown } + + # @!attribute on_yes + # Actions to execute if the AI answers yes. + # + # @return [Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes, nil] + optional :on_yes, -> { Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes } + + # @!method initialize(instruction:, on_no: nil, on_unknown: nil, on_yes: nil, type: :yes_no) + # @param instruction [String] The yes/no question for the AI to answer about the image. + # + # @param on_no [Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo] Actions to execute if the AI answers no. + # + # @param on_unknown [Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown] Actions to execute if the AI cannot determine the answer. + # + # @param on_yes [Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes] Actions to execute if the AI answers yes. + # + # @param type [Symbol, :yes_no] Task type that asks a yes/no question and executes actions based on the answer. + + # @see Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo#on_no + class OnNo < Imagekitio::Internal::Type::BaseModel + # @!attribute add_tags + # Array of tag strings to add to the asset. + # + # @return [Array, nil] + optional :add_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute remove_tags + # Array of tag strings to remove from the asset. + # + # @return [Array, nil] + optional :remove_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute set_metadata + # Array of custom metadata field updates. + # + # @return [Array, nil] + optional :set_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata] } + + # @!attribute unset_metadata + # Array of custom metadata fields to remove. + # + # @return [Array, nil] + optional :unset_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata] } + + # @!method initialize(add_tags: nil, remove_tags: nil, set_metadata: nil, unset_metadata: nil) + # Actions to execute if the AI answers no. + # + # @param add_tags [Array] Array of tag strings to add to the asset. + # + # @param remove_tags [Array] Array of tag strings to remove from the asset. + # + # @param set_metadata [Array] Array of custom metadata field updates. + # + # @param unset_metadata [Array] Array of custom metadata fields to remove. + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. + # + # @return [String] + required :field, String + + # @!attribute value + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @return [String, Float, Boolean, Array] + required :value, union: -> { Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value } + + # @!method initialize(field:, value:) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata} + # for more details. + # + # @param field [String] Name of the custom metadata field to set. + # + # @param value [String, Float, Boolean, Array] Value to set for the custom metadata field. The value type should match the cust + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @see Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata#value + module Value + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + variant -> { Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::MixedArray } + + module Mixed + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekitio::Internal::Type::Converter] + MixedArray = + Imagekitio::Internal::Type::ArrayOf[union: -> { + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed + }] + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to remove. + # + # @return [String] + required :field, String + + # @!method initialize(field:) + # @param field [String] Name of the custom metadata field to remove. + end + end + + # @see Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo#on_unknown + class OnUnknown < Imagekitio::Internal::Type::BaseModel + # @!attribute add_tags + # Array of tag strings to add to the asset. + # + # @return [Array, nil] + optional :add_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute remove_tags + # Array of tag strings to remove from the asset. + # + # @return [Array, nil] + optional :remove_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute set_metadata + # Array of custom metadata field updates. + # + # @return [Array, nil] + optional :set_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata] } + + # @!attribute unset_metadata + # Array of custom metadata fields to remove. + # + # @return [Array, nil] + optional :unset_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] } + + # @!method initialize(add_tags: nil, remove_tags: nil, set_metadata: nil, unset_metadata: nil) + # Actions to execute if the AI cannot determine the answer. + # + # @param add_tags [Array] Array of tag strings to add to the asset. + # + # @param remove_tags [Array] Array of tag strings to remove from the asset. + # + # @param set_metadata [Array] Array of custom metadata field updates. + # + # @param unset_metadata [Array] Array of custom metadata fields to remove. + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. + # + # @return [String] + required :field, String + + # @!attribute value + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @return [String, Float, Boolean, Array] + required :value, + union: -> { Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value } + + # @!method initialize(field:, value:) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata} + # for more details. + # + # @param field [String] Name of the custom metadata field to set. + # + # @param value [String, Float, Boolean, Array] Value to set for the custom metadata field. The value type should match the cust + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @see Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata#value + module Value + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + variant -> { Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::MixedArray } + + module Mixed + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekitio::Internal::Type::Converter] + MixedArray = + Imagekitio::Internal::Type::ArrayOf[union: -> { + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed + }] + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to remove. + # + # @return [String] + required :field, String + + # @!method initialize(field:) + # @param field [String] Name of the custom metadata field to remove. + end + end + + # @see Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo#on_yes + class OnYes < Imagekitio::Internal::Type::BaseModel + # @!attribute add_tags + # Array of tag strings to add to the asset. + # + # @return [Array, nil] + optional :add_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute remove_tags + # Array of tag strings to remove from the asset. + # + # @return [Array, nil] + optional :remove_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute set_metadata + # Array of custom metadata field updates. + # + # @return [Array, nil] + optional :set_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata] } + + # @!attribute unset_metadata + # Array of custom metadata fields to remove. + # + # @return [Array, nil] + optional :unset_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata] } + + # @!method initialize(add_tags: nil, remove_tags: nil, set_metadata: nil, unset_metadata: nil) + # Actions to execute if the AI answers yes. + # + # @param add_tags [Array] Array of tag strings to add to the asset. + # + # @param remove_tags [Array] Array of tag strings to remove from the asset. + # + # @param set_metadata [Array] Array of custom metadata field updates. + # + # @param unset_metadata [Array] Array of custom metadata fields to remove. + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. + # + # @return [String] + required :field, String + + # @!attribute value + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @return [String, Float, Boolean, Array] + required :value, + union: -> { Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value } + + # @!method initialize(field:, value:) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata} + # for more details. + # + # @param field [String] Name of the custom metadata field to set. + # + # @param value [String, Float, Boolean, Array] Value to set for the custom metadata field. The value type should match the cust + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @see Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata#value + module Value + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + variant -> { Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::MixedArray } + + module Mixed + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekitio::Internal::Type::Converter] + MixedArray = + Imagekitio::Internal::Type::ArrayOf[union: -> { + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed + }] + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to remove. + # + # @return [String] + required :field, String + + # @!method initialize(field:) + # @param field [String] Name of the custom metadata field to remove. + end + end + end + + # @!method self.variants + # @return [Array(Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectTags, Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata, Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo)] + end + end + + # @!method self.variants + # @return [Array(Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension)] + end + end +end diff --git a/lib/imagekitio/models/extensions.rb b/lib/imagekitio/models/extensions.rb index b71af51..10c21ee 100644 --- a/lib/imagekitio/models/extensions.rb +++ b/lib/imagekitio/models/extensions.rb @@ -11,6 +11,10 @@ module ExtensionItem variant :"ai-auto-description", -> { Imagekitio::ExtensionItem::AIAutoDescription } + variant :"ai-tasks", -> { Imagekitio::ExtensionItem::AITasks } + + variant :"saved-extension", -> { Imagekitio::ExtensionItem::SavedExtension } + variant -> { Imagekitio::ExtensionItem::AutoTaggingExtension } class RemoveBg < Imagekitio::Internal::Type::BaseModel @@ -126,8 +130,562 @@ class AIAutoDescription < Imagekitio::Internal::Type::BaseModel # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. end + class AITasks < Imagekitio::Internal::Type::BaseModel + # @!attribute name + # Specifies the AI tasks extension for automated image analysis using AI models. + # + # @return [Symbol, :"ai-tasks"] + required :name, const: :"ai-tasks" + + # @!attribute tasks + # Array of task objects defining AI operations to perform on the asset. + # + # @return [Array] + required :tasks, + -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::ExtensionItem::AITasks::Task] } + + # @!method initialize(tasks:, name: :"ai-tasks") + # @param tasks [Array] Array of task objects defining AI operations to perform on the asset. + # + # @param name [Symbol, :"ai-tasks"] Specifies the AI tasks extension for automated image analysis using AI models. + + module Task + extend Imagekitio::Internal::Type::Union + + discriminator :type + + variant :select_tags, -> { Imagekitio::ExtensionItem::AITasks::Task::SelectTags } + + variant :select_metadata, -> { Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata } + + variant :yes_no, -> { Imagekitio::ExtensionItem::AITasks::Task::YesNo } + + class SelectTags < Imagekitio::Internal::Type::BaseModel + # @!attribute instruction + # The question or instruction for the AI to analyze the image. + # + # @return [String] + required :instruction, String + + # @!attribute type + # Task type that analyzes the image and adds matching tags from a vocabulary. + # + # @return [Symbol, :select_tags] + required :type, const: :select_tags + + # @!attribute vocabulary + # Array of possible tag values. Combined length of all strings must not exceed 500 + # characters. Cannot contain the `%` character. + # + # @return [Array] + required :vocabulary, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute max_selections + # Maximum number of tags to select from the vocabulary. + # + # @return [Integer, nil] + optional :max_selections, Integer + + # @!attribute min_selections + # Minimum number of tags to select from the vocabulary. + # + # @return [Integer, nil] + optional :min_selections, Integer + + # @!method initialize(instruction:, vocabulary:, max_selections: nil, min_selections: nil, type: :select_tags) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionItem::AITasks::Task::SelectTags} for more details. + # + # @param instruction [String] The question or instruction for the AI to analyze the image. + # + # @param vocabulary [Array] Array of possible tag values. Combined length of all strings must not exceed 500 + # + # @param max_selections [Integer] Maximum number of tags to select from the vocabulary. + # + # @param min_selections [Integer] Minimum number of tags to select from the vocabulary. + # + # @param type [Symbol, :select_tags] Task type that analyzes the image and adds matching tags from a vocabulary. + end + + class SelectMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. The field must exist in your account. + # + # @return [String] + required :field, String + + # @!attribute instruction + # The question or instruction for the AI to analyze the image. + # + # @return [String] + required :instruction, String + + # @!attribute type + # Task type that analyzes the image and sets a custom metadata field value from a + # vocabulary. + # + # @return [Symbol, :select_metadata] + required :type, const: :select_metadata + + # @!attribute max_selections + # Maximum number of values to select from the vocabulary. + # + # @return [Integer, nil] + optional :max_selections, Integer + + # @!attribute min_selections + # Minimum number of values to select from the vocabulary. + # + # @return [Integer, nil] + optional :min_selections, Integer + + # @!attribute vocabulary + # Array of possible values matching the custom metadata field type. + # + # @return [Array, nil] + optional :vocabulary, + -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata::Vocabulary] } + + # @!method initialize(field:, instruction:, max_selections: nil, min_selections: nil, vocabulary: nil, type: :select_metadata) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata} for more + # details. + # + # @param field [String] Name of the custom metadata field to set. The field must exist in your account. + # + # @param instruction [String] The question or instruction for the AI to analyze the image. + # + # @param max_selections [Integer] Maximum number of values to select from the vocabulary. + # + # @param min_selections [Integer] Minimum number of values to select from the vocabulary. + # + # @param vocabulary [Array] Array of possible values matching the custom metadata field type. + # + # @param type [Symbol, :select_metadata] Task type that analyzes the image and sets a custom metadata field value from a + + module Vocabulary + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + end + + class YesNo < Imagekitio::Internal::Type::BaseModel + # @!attribute instruction + # The yes/no question for the AI to answer about the image. + # + # @return [String] + required :instruction, String + + # @!attribute type + # Task type that asks a yes/no question and executes actions based on the answer. + # + # @return [Symbol, :yes_no] + required :type, const: :yes_no + + # @!attribute on_no + # Actions to execute if the AI answers no. + # + # @return [Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo, nil] + optional :on_no, -> { Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo } + + # @!attribute on_unknown + # Actions to execute if the AI cannot determine the answer. + # + # @return [Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown, nil] + optional :on_unknown, -> { Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown } + + # @!attribute on_yes + # Actions to execute if the AI answers yes. + # + # @return [Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes, nil] + optional :on_yes, -> { Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes } + + # @!method initialize(instruction:, on_no: nil, on_unknown: nil, on_yes: nil, type: :yes_no) + # @param instruction [String] The yes/no question for the AI to answer about the image. + # + # @param on_no [Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo] Actions to execute if the AI answers no. + # + # @param on_unknown [Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown] Actions to execute if the AI cannot determine the answer. + # + # @param on_yes [Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes] Actions to execute if the AI answers yes. + # + # @param type [Symbol, :yes_no] Task type that asks a yes/no question and executes actions based on the answer. + + # @see Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo#on_no + class OnNo < Imagekitio::Internal::Type::BaseModel + # @!attribute add_tags + # Array of tag strings to add to the asset. + # + # @return [Array, nil] + optional :add_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute remove_tags + # Array of tag strings to remove from the asset. + # + # @return [Array, nil] + optional :remove_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute set_metadata + # Array of custom metadata field updates. + # + # @return [Array, nil] + optional :set_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata] } + + # @!attribute unset_metadata + # Array of custom metadata fields to remove. + # + # @return [Array, nil] + optional :unset_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata] } + + # @!method initialize(add_tags: nil, remove_tags: nil, set_metadata: nil, unset_metadata: nil) + # Actions to execute if the AI answers no. + # + # @param add_tags [Array] Array of tag strings to add to the asset. + # + # @param remove_tags [Array] Array of tag strings to remove from the asset. + # + # @param set_metadata [Array] Array of custom metadata field updates. + # + # @param unset_metadata [Array] Array of custom metadata fields to remove. + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. + # + # @return [String] + required :field, String + + # @!attribute value + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @return [String, Float, Boolean, Array] + required :value, union: -> { Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value } + + # @!method initialize(field:, value:) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata} for + # more details. + # + # @param field [String] Name of the custom metadata field to set. + # + # @param value [String, Float, Boolean, Array] Value to set for the custom metadata field. The value type should match the cust + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @see Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata#value + module Value + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + variant -> { Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::MixedArray } + + module Mixed + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekitio::Internal::Type::Converter] + MixedArray = + Imagekitio::Internal::Type::ArrayOf[union: -> { + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed + }] + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to remove. + # + # @return [String] + required :field, String + + # @!method initialize(field:) + # @param field [String] Name of the custom metadata field to remove. + end + end + + # @see Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo#on_unknown + class OnUnknown < Imagekitio::Internal::Type::BaseModel + # @!attribute add_tags + # Array of tag strings to add to the asset. + # + # @return [Array, nil] + optional :add_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute remove_tags + # Array of tag strings to remove from the asset. + # + # @return [Array, nil] + optional :remove_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute set_metadata + # Array of custom metadata field updates. + # + # @return [Array, nil] + optional :set_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata] } + + # @!attribute unset_metadata + # Array of custom metadata fields to remove. + # + # @return [Array, nil] + optional :unset_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] } + + # @!method initialize(add_tags: nil, remove_tags: nil, set_metadata: nil, unset_metadata: nil) + # Actions to execute if the AI cannot determine the answer. + # + # @param add_tags [Array] Array of tag strings to add to the asset. + # + # @param remove_tags [Array] Array of tag strings to remove from the asset. + # + # @param set_metadata [Array] Array of custom metadata field updates. + # + # @param unset_metadata [Array] Array of custom metadata fields to remove. + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. + # + # @return [String] + required :field, String + + # @!attribute value + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @return [String, Float, Boolean, Array] + required :value, + union: -> { Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value } + + # @!method initialize(field:, value:) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata} + # for more details. + # + # @param field [String] Name of the custom metadata field to set. + # + # @param value [String, Float, Boolean, Array] Value to set for the custom metadata field. The value type should match the cust + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @see Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata#value + module Value + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + variant -> { Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::MixedArray } + + module Mixed + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekitio::Internal::Type::Converter] + MixedArray = + Imagekitio::Internal::Type::ArrayOf[union: -> { + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed + }] + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to remove. + # + # @return [String] + required :field, String + + # @!method initialize(field:) + # @param field [String] Name of the custom metadata field to remove. + end + end + + # @see Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo#on_yes + class OnYes < Imagekitio::Internal::Type::BaseModel + # @!attribute add_tags + # Array of tag strings to add to the asset. + # + # @return [Array, nil] + optional :add_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute remove_tags + # Array of tag strings to remove from the asset. + # + # @return [Array, nil] + optional :remove_tags, Imagekitio::Internal::Type::ArrayOf[String] + + # @!attribute set_metadata + # Array of custom metadata field updates. + # + # @return [Array, nil] + optional :set_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata] } + + # @!attribute unset_metadata + # Array of custom metadata fields to remove. + # + # @return [Array, nil] + optional :unset_metadata, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata] } + + # @!method initialize(add_tags: nil, remove_tags: nil, set_metadata: nil, unset_metadata: nil) + # Actions to execute if the AI answers yes. + # + # @param add_tags [Array] Array of tag strings to add to the asset. + # + # @param remove_tags [Array] Array of tag strings to remove from the asset. + # + # @param set_metadata [Array] Array of custom metadata field updates. + # + # @param unset_metadata [Array] Array of custom metadata fields to remove. + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to set. + # + # @return [String] + required :field, String + + # @!attribute value + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @return [String, Float, Boolean, Array] + required :value, union: -> { Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value } + + # @!method initialize(field:, value:) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata} + # for more details. + # + # @param field [String] Name of the custom metadata field to set. + # + # @param value [String, Float, Boolean, Array] Value to set for the custom metadata field. The value type should match the cust + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + # + # @see Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata#value + module Value + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + variant -> { Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::MixedArray } + + module Mixed + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekitio::Internal::Type::Converter] + MixedArray = + Imagekitio::Internal::Type::ArrayOf[union: -> { + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed + }] + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + # @!attribute field + # Name of the custom metadata field to remove. + # + # @return [String] + required :field, String + + # @!method initialize(field:) + # @param field [String] Name of the custom metadata field to remove. + end + end + end + + # @!method self.variants + # @return [Array(Imagekitio::Models::ExtensionItem::AITasks::Task::SelectTags, Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata, Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo)] + end + end + + class SavedExtension < Imagekitio::Internal::Type::BaseModel + # @!attribute id + # The unique ID of the saved extension to apply. + # + # @return [String] + required :id, String + + # @!attribute name + # Indicates this is a reference to a saved extension. + # + # @return [Symbol, :"saved-extension"] + required :name, const: :"saved-extension" + + # @!method initialize(id:, name: :"saved-extension") + # @param id [String] The unique ID of the saved extension to apply. + # + # @param name [Symbol, :"saved-extension"] Indicates this is a reference to a saved extension. + end + # @!method self.variants - # @return [Array(Imagekitio::Models::ExtensionItem::RemoveBg, Imagekitio::Models::ExtensionItem::AIAutoDescription, Imagekitio::Models::ExtensionItem::AutoTaggingExtension)] + # @return [Array(Imagekitio::Models::ExtensionItem::RemoveBg, Imagekitio::Models::ExtensionItem::AIAutoDescription, Imagekitio::Models::ExtensionItem::AITasks, Imagekitio::Models::ExtensionItem::SavedExtension, Imagekitio::Models::ExtensionItem::AutoTaggingExtension)] end # @type [Imagekitio::Internal::Type::Converter] diff --git a/lib/imagekitio/models/file_update_response.rb b/lib/imagekitio/models/file_update_response.rb index 225df77..c25d3e2 100644 --- a/lib/imagekitio/models/file_update_response.rb +++ b/lib/imagekitio/models/file_update_response.rb @@ -24,6 +24,13 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel enum: -> { Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription }, api_name: :"ai-auto-description" + # @!attribute ai_tasks + # + # @return [Symbol, Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks, nil] + optional :ai_tasks, + enum: -> { Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks }, + api_name: :"ai-tasks" + # @!attribute aws_auto_tagging # # @return [Symbol, Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging, nil] @@ -45,8 +52,9 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel enum: -> { Imagekitio::Models::FileUpdateResponse::ExtensionStatus::RemoveBg }, api_name: :"remove-bg" - # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # @!method initialize(ai_auto_description: nil, ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) # @param ai_auto_description [Symbol, Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription] + # @param ai_tasks [Symbol, Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks] # @param aws_auto_tagging [Symbol, Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging] # @param google_auto_tagging [Symbol, Imagekitio::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging] # @param remove_bg [Symbol, Imagekitio::Models::FileUpdateResponse::ExtensionStatus::RemoveBg] @@ -63,6 +71,18 @@ module AIAutoDescription # @return [Array] end + # @see Imagekitio::Models::FileUpdateResponse::ExtensionStatus#ai_tasks + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + # @see Imagekitio::Models::FileUpdateResponse::ExtensionStatus#aws_auto_tagging module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/models/file_upload_params.rb b/lib/imagekitio/models/file_upload_params.rb index 7939d51..b758651 100644 --- a/lib/imagekitio/models/file_upload_params.rb +++ b/lib/imagekitio/models/file_upload_params.rb @@ -156,7 +156,7 @@ def self.serialize_upload_options(upload_options) # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # - # @return [Array, nil] + # @return [Array, nil] optional :extensions, -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::ExtensionItem] } # @!attribute folder @@ -317,7 +317,7 @@ def self.serialize_upload_options(upload_options) # # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekitio/models/file_upload_response.rb b/lib/imagekitio/models/file_upload_response.rb index d5a95f9..04f81b0 100644 --- a/lib/imagekitio/models/file_upload_response.rb +++ b/lib/imagekitio/models/file_upload_response.rb @@ -295,6 +295,13 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel enum: -> { Imagekitio::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription }, api_name: :"ai-auto-description" + # @!attribute ai_tasks + # + # @return [Symbol, Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks, nil] + optional :ai_tasks, + enum: -> { Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks }, + api_name: :"ai-tasks" + # @!attribute aws_auto_tagging # # @return [Symbol, Imagekitio::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging, nil] @@ -316,7 +323,7 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel enum: -> { Imagekitio::Models::FileUploadResponse::ExtensionStatus::RemoveBg }, api_name: :"remove-bg" - # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # @!method initialize(ai_auto_description: nil, ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) # Extension names with their processing status at the time of completion of the # request. It could have one of the following status values: # @@ -328,6 +335,7 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel # If no extension was requested, then this parameter is not returned. # # @param ai_auto_description [Symbol, Imagekitio::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription] + # @param ai_tasks [Symbol, Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks] # @param aws_auto_tagging [Symbol, Imagekitio::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging] # @param google_auto_tagging [Symbol, Imagekitio::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging] # @param remove_bg [Symbol, Imagekitio::Models::FileUploadResponse::ExtensionStatus::RemoveBg] @@ -344,6 +352,18 @@ module AIAutoDescription # @return [Array] end + # @see Imagekitio::Models::FileUploadResponse::ExtensionStatus#ai_tasks + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + # @see Imagekitio::Models::FileUploadResponse::ExtensionStatus#aws_auto_tagging module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/models/image_overlay.rb b/lib/imagekitio/models/image_overlay.rb index 401b77e..60e7406 100644 --- a/lib/imagekitio/models/image_overlay.rb +++ b/lib/imagekitio/models/image_overlay.rb @@ -21,6 +21,12 @@ class ImageOverlay < Imagekitio::Models::BaseOverlay # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. + # # @return [Symbol, Imagekitio::Models::ImageOverlay::Encoding, nil] optional :encoding, enum: -> { Imagekitio::ImageOverlay::Encoding } @@ -51,6 +57,12 @@ class ImageOverlay < Imagekitio::Models::BaseOverlay # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/models/saved_extension.rb b/lib/imagekitio/models/saved_extension.rb new file mode 100644 index 0000000..cbceaaa --- /dev/null +++ b/lib/imagekitio/models/saved_extension.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class SavedExtension < Imagekitio::Internal::Type::BaseModel + # @!attribute id + # Unique identifier of the saved extension. + # + # @return [String, nil] + optional :id, String + + # @!attribute config + # Configuration object for an extension (base extensions only, not saved extension + # references). + # + # @return [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension, nil] + optional :config, union: -> { Imagekitio::ExtensionConfig } + + # @!attribute created_at + # Timestamp when the saved extension was created. + # + # @return [Time, nil] + optional :created_at, Time, api_name: :createdAt + + # @!attribute description + # Description of the saved extension. + # + # @return [String, nil] + optional :description, String + + # @!attribute name + # Name of the saved extension. + # + # @return [String, nil] + optional :name, String + + # @!attribute updated_at + # Timestamp when the saved extension was last updated. + # + # @return [Time, nil] + optional :updated_at, Time, api_name: :updatedAt + + # @!method initialize(id: nil, config: nil, created_at: nil, description: nil, name: nil, updated_at: nil) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SavedExtension} for more details. + # + # Saved extension object containing extension configuration. + # + # @param id [String] Unique identifier of the saved extension. + # + # @param config [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension] Configuration object for an extension (base extensions only, not saved extension + # + # @param created_at [Time] Timestamp when the saved extension was created. + # + # @param description [String] Description of the saved extension. + # + # @param name [String] Name of the saved extension. + # + # @param updated_at [Time] Timestamp when the saved extension was last updated. + end + end +end diff --git a/lib/imagekitio/models/saved_extension_create_params.rb b/lib/imagekitio/models/saved_extension_create_params.rb new file mode 100644 index 0000000..3a1c518 --- /dev/null +++ b/lib/imagekitio/models/saved_extension_create_params.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::SavedExtensions#create + class SavedExtensionCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute config + # Configuration object for an extension (base extensions only, not saved extension + # references). + # + # @return [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension] + required :config, union: -> { Imagekitio::ExtensionConfig } + + # @!attribute description + # Description of what the saved extension does. + # + # @return [String] + required :description, String + + # @!attribute name + # Name of the saved extension. + # + # @return [String] + required :name, String + + # @!method initialize(config:, description:, name:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SavedExtensionCreateParams} for more details. + # + # @param config [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension] Configuration object for an extension (base extensions only, not saved extension + # + # @param description [String] Description of what the saved extension does. + # + # @param name [String] Name of the saved extension. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/saved_extension_delete_params.rb b/lib/imagekitio/models/saved_extension_delete_params.rb new file mode 100644 index 0000000..bf28667 --- /dev/null +++ b/lib/imagekitio/models/saved_extension_delete_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::SavedExtensions#delete + class SavedExtensionDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/saved_extension_get_params.rb b/lib/imagekitio/models/saved_extension_get_params.rb new file mode 100644 index 0000000..0ee0763 --- /dev/null +++ b/lib/imagekitio/models/saved_extension_get_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::SavedExtensions#get + class SavedExtensionGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/saved_extension_list_params.rb b/lib/imagekitio/models/saved_extension_list_params.rb new file mode 100644 index 0000000..da4762b --- /dev/null +++ b/lib/imagekitio/models/saved_extension_list_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::SavedExtensions#list + class SavedExtensionListParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/saved_extension_list_response.rb b/lib/imagekitio/models/saved_extension_list_response.rb new file mode 100644 index 0000000..d6fc028 --- /dev/null +++ b/lib/imagekitio/models/saved_extension_list_response.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @type [Imagekitio::Internal::Type::Converter] + SavedExtensionListResponse = Imagekitio::Internal::Type::ArrayOf[-> { Imagekitio::SavedExtension }] + end +end diff --git a/lib/imagekitio/models/saved_extension_update_params.rb b/lib/imagekitio/models/saved_extension_update_params.rb new file mode 100644 index 0000000..809b83e --- /dev/null +++ b/lib/imagekitio/models/saved_extension_update_params.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::SavedExtensions#update + class SavedExtensionUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute config + # Configuration object for an extension (base extensions only, not saved extension + # references). + # + # @return [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension, nil] + optional :config, union: -> { Imagekitio::ExtensionConfig } + + # @!attribute description + # Updated description of the saved extension. + # + # @return [String, nil] + optional :description, String + + # @!attribute name + # Updated name of the saved extension. + # + # @return [String, nil] + optional :name, String + + # @!method initialize(config: nil, description: nil, name: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SavedExtensionUpdateParams} for more details. + # + # @param config [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension] Configuration object for an extension (base extensions only, not saved extension + # + # @param description [String] Updated description of the saved extension. + # + # @param name [String] Updated name of the saved extension. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/solid_color_overlay_transformation.rb b/lib/imagekitio/models/solid_color_overlay_transformation.rb index a68593b..a39e8d6 100644 --- a/lib/imagekitio/models/solid_color_overlay_transformation.rb +++ b/lib/imagekitio/models/solid_color_overlay_transformation.rb @@ -4,8 +4,8 @@ module Imagekitio module Models class SolidColorOverlayTransformation < Imagekitio::Internal::Type::BaseModel # @!attribute alpha - # Specifies the transparency level of the solid color overlay. Accepts integers - # from `1` to `9`. + # Specifies the transparency level of the overlaid solid color layer. Supports + # integers from `1` to `9`. # # @return [Float, nil] optional :alpha, Float @@ -35,11 +35,16 @@ class SolidColorOverlayTransformation < Imagekitio::Internal::Type::BaseModel optional :height, union: -> { Imagekitio::SolidColorOverlayTransformation::Height } # @!attribute radius - # Specifies the corner radius of the solid color overlay. Set to `max` for - # circular or oval shape. See - # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius of the solid color overlay. # - # @return [Float, Symbol, :max, nil] + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # + # @return [Float, Symbol, :max, String, nil] optional :radius, union: -> { Imagekitio::SolidColorOverlayTransformation::Radius } # @!attribute width @@ -54,7 +59,7 @@ class SolidColorOverlayTransformation < Imagekitio::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Imagekitio::Models::SolidColorOverlayTransformation} for more details. # - # @param alpha [Float] Specifies the transparency level of the solid color overlay. Accepts integers fr + # @param alpha [Float] Specifies the transparency level of the overlaid solid color layer. Supports int # # @param background [String] Specifies the background color of the solid color overlay. Accepts an RGB hex co # @@ -62,7 +67,7 @@ class SolidColorOverlayTransformation < Imagekitio::Internal::Type::BaseModel # # @param height [Float, String] Controls the height of the solid color overlay. Accepts a numeric value or an ar # - # @param radius [Float, Symbol, :max] Specifies the corner radius of the solid color overlay. Set to `max` for circula + # @param radius [Float, Symbol, :max, String] Specifies the corner radius of the solid color overlay. # # @param width [Float, String] Controls the width of the solid color overlay. Accepts a numeric value or an ari @@ -99,9 +104,14 @@ module Height # @return [Array(Float, String)] end - # Specifies the corner radius of the solid color overlay. Set to `max` for - # circular or oval shape. See - # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius of the solid color overlay. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). # # @see Imagekitio::Models::SolidColorOverlayTransformation#radius module Radius @@ -111,8 +121,10 @@ module Radius variant const: :max + variant String + # @!method self.variants - # @return [Array(Float, Symbol, :max)] + # @return [Array(Float, Symbol, :max, String)] end # Controls the width of the solid color overlay. Accepts a numeric value or an diff --git a/lib/imagekitio/models/subtitle_overlay.rb b/lib/imagekitio/models/subtitle_overlay.rb index 70694b9..67d0c10 100644 --- a/lib/imagekitio/models/subtitle_overlay.rb +++ b/lib/imagekitio/models/subtitle_overlay.rb @@ -21,6 +21,12 @@ class SubtitleOverlay < Imagekitio::Models::BaseOverlay # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. + # # @return [Symbol, Imagekitio::Models::SubtitleOverlay::Encoding, nil] optional :encoding, enum: -> { Imagekitio::SubtitleOverlay::Encoding } @@ -49,6 +55,12 @@ class SubtitleOverlay < Imagekitio::Models::BaseOverlay # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/models/subtitle_overlay_transformation.rb b/lib/imagekitio/models/subtitle_overlay_transformation.rb index 1e06adb..0ad4e0b 100644 --- a/lib/imagekitio/models/subtitle_overlay_transformation.rb +++ b/lib/imagekitio/models/subtitle_overlay_transformation.rb @@ -22,8 +22,9 @@ class SubtitleOverlayTransformation < Imagekitio::Internal::Type::BaseModel optional :color, String # @!attribute font_family - # Font family for subtitles. Refer to the - # [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list). + # Sets the font family of subtitle text. Refer to the + # [supported fonts documented](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list) + # in the ImageKit transformations guide. # # @return [String, nil] optional :font_family, String, api_name: :fontFamily @@ -82,7 +83,7 @@ class SubtitleOverlayTransformation < Imagekitio::Internal::Type::BaseModel # # @param color [String] Sets the font color of the subtitle text using a standard color name, an RGB col # - # @param font_family [String] Font family for subtitles. Refer to the [supported fonts](https://imagekit.io/do + # @param font_family [String] Sets the font family of subtitle text. # # @param font_outline [String] Sets the font outline of the subtitle text. # diff --git a/lib/imagekitio/models/text_overlay.rb b/lib/imagekitio/models/text_overlay.rb index 3f022e8..5b64be8 100644 --- a/lib/imagekitio/models/text_overlay.rb +++ b/lib/imagekitio/models/text_overlay.rb @@ -22,6 +22,9 @@ class TextOverlay < Imagekitio::Models::BaseOverlay # (`ie-{base64}`), set this parameter to `base64`. To always use plain text # (`i-{input}`), set it to `plain`. # + # Regardless of the encoding method, the input text is always percent-encoded to + # ensure it is URL-safe. + # # @return [Symbol, Imagekitio::Models::TextOverlay::Encoding, nil] optional :encoding, enum: -> { Imagekitio::TextOverlay::Encoding } @@ -50,6 +53,9 @@ class TextOverlay < Imagekitio::Models::BaseOverlay # appropriate format based on the input text. To always use base64 # (`ie-{base64}`), set this parameter to `base64`. To always use plain text # (`i-{input}`), set it to `plain`. + # + # Regardless of the encoding method, the input text is always percent-encoded to + # ensure it is URL-safe. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/models/text_overlay_transformation.rb b/lib/imagekitio/models/text_overlay_transformation.rb index 3a2f4d4..fdfb1e3 100644 --- a/lib/imagekitio/models/text_overlay_transformation.rb +++ b/lib/imagekitio/models/text_overlay_transformation.rb @@ -18,7 +18,9 @@ class TextOverlayTransformation < Imagekitio::Internal::Type::BaseModel optional :background, String # @!attribute flip - # Flip the text overlay horizontally, vertically, or both. + # Flip/mirror the text horizontally, vertically, or in both directions. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. # # @return [Symbol, Imagekitio::Models::TextOverlayTransformation::Flip, nil] optional :flip, enum: -> { Imagekitio::TextOverlayTransformation::Flip } @@ -57,10 +59,9 @@ class TextOverlayTransformation < Imagekitio::Internal::Type::BaseModel api_name: :innerAlignment # @!attribute line_height - # Specifies the line height of the text overlay. Accepts integer values - # representing line height in points. It can also accept - # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) - # such as `bw_mul_0.2`, or `bh_div_20`. + # Specifies the line height for multi-line text overlays. It will come into effect + # only if the text wraps over multiple lines. Accepts either an integer value or + # an arithmetic expression. # # @return [Float, String, nil] optional :line_height, @@ -76,10 +77,16 @@ class TextOverlayTransformation < Imagekitio::Internal::Type::BaseModel optional :padding, union: -> { Imagekitio::TextOverlayTransformation::Padding } # @!attribute radius - # Specifies the corner radius of the text overlay. Set to `max` to achieve a - # circular or oval shape. + # Specifies the corner radius: # - # @return [Float, Symbol, :max, nil] + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # + # @return [Float, Symbol, :max, String, nil] optional :radius, union: -> { Imagekitio::TextOverlayTransformation::Radius } # @!attribute rotation @@ -116,7 +123,7 @@ class TextOverlayTransformation < Imagekitio::Internal::Type::BaseModel # # @param background [String] Specifies the background color of the text overlay. # - # @param flip [Symbol, Imagekitio::Models::TextOverlayTransformation::Flip] Flip the text overlay horizontally, vertically, or both. + # @param flip [Symbol, Imagekitio::Models::TextOverlayTransformation::Flip] Flip/mirror the text horizontally, vertically, or in both directions. # # @param font_color [String] Specifies the font color of the overlaid text. Accepts an RGB hex code (e.g., `F # @@ -126,11 +133,11 @@ class TextOverlayTransformation < Imagekitio::Internal::Type::BaseModel # # @param inner_alignment [Symbol, Imagekitio::Models::TextOverlayTransformation::InnerAlignment] Specifies the inner alignment of the text when width is more than the text lengt # - # @param line_height [Float, String] Specifies the line height of the text overlay. + # @param line_height [Float, String] Specifies the line height for multi-line text overlays. It will come into effect # # @param padding [Float, String] Specifies the padding around the overlaid text. # - # @param radius [Float, Symbol, :max] Specifies the corner radius of the text overlay. + # @param radius [Float, Symbol, :max, String] Specifies the corner radius: # # @param rotation [Float, String] Specifies the rotation angle of the text overlay. # @@ -138,7 +145,9 @@ class TextOverlayTransformation < Imagekitio::Internal::Type::BaseModel # # @param width [Float, String] Specifies the maximum width (in pixels) of the overlaid text. The text wraps aut - # Flip the text overlay horizontally, vertically, or both. + # Flip/mirror the text horizontally, vertically, or in both directions. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. # # @see Imagekitio::Models::TextOverlayTransformation#flip module Flip @@ -183,10 +192,9 @@ module InnerAlignment # @return [Array] end - # Specifies the line height of the text overlay. Accepts integer values - # representing line height in points. It can also accept - # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) - # such as `bw_mul_0.2`, or `bh_div_20`. + # Specifies the line height for multi-line text overlays. It will come into effect + # only if the text wraps over multiple lines. Accepts either an integer value or + # an arithmetic expression. # # @see Imagekitio::Models::TextOverlayTransformation#line_height module LineHeight @@ -216,8 +224,14 @@ module Padding # @return [Array(Float, String)] end - # Specifies the corner radius of the text overlay. Set to `max` to achieve a - # circular or oval shape. + # Specifies the corner radius: + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). # # @see Imagekitio::Models::TextOverlayTransformation#radius module Radius @@ -227,8 +241,10 @@ module Radius variant const: :max + variant String + # @!method self.variants - # @return [Array(Float, Symbol, :max)] + # @return [Array(Float, Symbol, :max, String)] end # Specifies the rotation angle of the text overlay. Accepts a numeric value for diff --git a/lib/imagekitio/models/transformation.rb b/lib/imagekitio/models/transformation.rb index 7fe5deb..160d809 100644 --- a/lib/imagekitio/models/transformation.rb +++ b/lib/imagekitio/models/transformation.rb @@ -104,6 +104,12 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # # - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See # [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background). + # - Dominant color: `dominant` extracts the dominant color from the image. See + # [Dominant color background](https://imagekit.io/docs/effects-and-enhancements#dominant-color-background). + # - Gradient: `gradient_dominant` or `gradient_dominant_2` creates a gradient + # using the dominant colors. Optionally specify palette size (2 or 4), e.g., + # `gradient_dominant_4`. See + # [Gradient background](https://imagekit.io/docs/effects-and-enhancements#gradient-background). # - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See # [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background). # - Expand the image boundaries using generative fill: `genfill`. Not supported @@ -139,6 +145,19 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # @return [Boolean, nil] optional :color_profile, Imagekitio::Internal::Type::Boolean, api_name: :colorProfile + # @!attribute color_replace + # Replaces colors in the image. Supports three formats: + # + # - `toColor` - Replace dominant color with the specified color. + # - `toColor_tolerance` - Replace dominant color with specified tolerance (0-100). + # - `toColor_tolerance_fromColor` - Replace a specific color with another within + # tolerance range. Colors can be hex codes (e.g., `FF0022`) or names (e.g., + # `red`, `blue`). See + # [Color replacement](https://imagekit.io/docs/effects-and-enhancements#color-replace---cr). + # + # @return [String, nil] + optional :color_replace, String, api_name: :colorReplace + # @!attribute contrast_stretch # Automatically enhances the contrast of an image (contrast stretch). See # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). @@ -170,10 +189,25 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # @return [String, nil] optional :default_image, String, api_name: :defaultImage + # @!attribute distort + # Distorts the shape of an image. Supports two modes: + # + # - Perspective distortion: `p-x1_y1_x2_y2_x3_y3_x4_y4` changes the position of + # the four corners starting clockwise from top-left. + # - Arc distortion: `a-degrees` curves the image upwards (positive values) or + # downwards (negative values). See + # [Distort effect](https://imagekit.io/docs/effects-and-enhancements#distort---e-distort). + # + # @return [String, nil] + optional :distort, String + # @!attribute dpr # Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio - # (DPR) calculation. See - # [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). + # (DPR) calculation. Also accepts arithmetic expressions. + # + # - Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). # # @return [Float, nil] optional :dpr, Float @@ -330,11 +364,16 @@ class Transformation < Imagekitio::Internal::Type::BaseModel optional :quality, Float # @!attribute radius - # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular - # or oval shape. See - # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius for rounded corners. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). # - # @return [Float, Symbol, :max, nil] + # @return [Float, Symbol, :max, String, nil] optional :radius, union: -> { Imagekitio::Transformation::Radius } # @!attribute raw @@ -459,7 +498,7 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # @return [Float, nil] optional :zoom, Float - # @!method initialize(ai_change_background: nil, ai_drop_shadow: nil, ai_edit: nil, ai_remove_background: nil, ai_remove_background_external: nil, ai_retouch: nil, ai_upscale: nil, ai_variation: nil, aspect_ratio: nil, audio_codec: nil, background: nil, blur: nil, border: nil, color_profile: nil, contrast_stretch: nil, crop: nil, crop_mode: nil, default_image: nil, dpr: nil, duration: nil, end_offset: nil, flip: nil, focus: nil, format_: nil, gradient: nil, grayscale: nil, height: nil, lossless: nil, metadata: nil, named: nil, opacity: nil, original: nil, overlay: nil, page: nil, progressive: nil, quality: nil, radius: nil, raw: nil, rotation: nil, shadow: nil, sharpen: nil, start_offset: nil, streaming_resolutions: nil, trim: nil, unsharp_mask: nil, video_codec: nil, width: nil, x: nil, x_center: nil, y_: nil, y_center: nil, zoom: nil) + # @!method initialize(ai_change_background: nil, ai_drop_shadow: nil, ai_edit: nil, ai_remove_background: nil, ai_remove_background_external: nil, ai_retouch: nil, ai_upscale: nil, ai_variation: nil, aspect_ratio: nil, audio_codec: nil, background: nil, blur: nil, border: nil, color_profile: nil, color_replace: nil, contrast_stretch: nil, crop: nil, crop_mode: nil, default_image: nil, distort: nil, dpr: nil, duration: nil, end_offset: nil, flip: nil, focus: nil, format_: nil, gradient: nil, grayscale: nil, height: nil, lossless: nil, metadata: nil, named: nil, opacity: nil, original: nil, overlay: nil, page: nil, progressive: nil, quality: nil, radius: nil, raw: nil, rotation: nil, shadow: nil, sharpen: nil, start_offset: nil, streaming_resolutions: nil, trim: nil, unsharp_mask: nil, video_codec: nil, width: nil, x: nil, x_center: nil, y_: nil, y_center: nil, zoom: nil) # Some parameter documentations has been truncated, see # {Imagekitio::Models::Transformation} for more details. # @@ -498,6 +537,8 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # # @param color_profile [Boolean] Indicates whether the output image should retain the original color profile. # + # @param color_replace [String] Replaces colors in the image. Supports three formats: + # # @param contrast_stretch [Boolean, Imagekitio::Models::Transformation::ContrastStretch] Automatically enhances the contrast of an image (contrast stretch). # # @param crop [Symbol, Imagekitio::Models::Transformation::Crop] Crop modes for image resizing. See [Crop modes & focus](https://imagekit.io/docs @@ -506,6 +547,8 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # # @param default_image [String] Specifies a fallback image if the resource is not found, e.g., a URL or file pat # + # @param distort [String] Distorts the shape of an image. Supports two modes: + # # @param dpr [Float] Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio (DP # # @param duration [Float, String] Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. @@ -542,7 +585,7 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # # @param quality [Float] Specifies the quality of the output image for lossy formats such as JPEG, WebP, # - # @param radius [Float, Symbol, :max] Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular + # @param radius [Float, Symbol, :max, String] Specifies the corner radius for rounded corners. # # @param raw [String] Pass any transformation not directly supported by the SDK. # @@ -886,9 +929,14 @@ module Page # @return [Array(Float, String)] end - # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular - # or oval shape. See - # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius for rounded corners. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). # # @see Imagekitio::Models::Transformation#radius module Radius @@ -898,8 +946,10 @@ module Radius variant const: :max + variant String + # @!method self.variants - # @return [Array(Float, Symbol, :max)] + # @return [Array(Float, Symbol, :max, String)] end # Specifies the rotation angle in degrees. Positive values rotate the image diff --git a/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb b/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb index 3ae76ef..11c26bf 100644 --- a/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb +++ b/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb @@ -8,6 +8,8 @@ module Models module UnsafeUnwrapWebhookEvent extend Imagekitio::Internal::Type::Union + discriminator :type + # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. variant -> { Imagekitio::VideoTransformationAcceptedEvent } diff --git a/lib/imagekitio/models/unwrap_webhook_event.rb b/lib/imagekitio/models/unwrap_webhook_event.rb index ebbdfd8..c9f71bc 100644 --- a/lib/imagekitio/models/unwrap_webhook_event.rb +++ b/lib/imagekitio/models/unwrap_webhook_event.rb @@ -8,6 +8,8 @@ module Models module UnwrapWebhookEvent extend Imagekitio::Internal::Type::Union + discriminator :type + # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. variant -> { Imagekitio::VideoTransformationAcceptedEvent } diff --git a/lib/imagekitio/models/update_file_request.rb b/lib/imagekitio/models/update_file_request.rb index 1e030a0..8012e5f 100644 --- a/lib/imagekitio/models/update_file_request.rb +++ b/lib/imagekitio/models/update_file_request.rb @@ -38,7 +38,7 @@ class UpdateFileDetails < Imagekitio::Internal::Type::BaseModel # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # - # @return [Array, nil] + # @return [Array, nil] optional :extensions, -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::ExtensionItem] } # @!attribute remove_ai_tags @@ -82,7 +82,7 @@ class UpdateFileDetails < Imagekitio::Internal::Type::BaseModel # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car # diff --git a/lib/imagekitio/models/upload_pre_transform_success_event.rb b/lib/imagekitio/models/upload_pre_transform_success_event.rb index b247426..3e6d4a6 100644 --- a/lib/imagekitio/models/upload_pre_transform_success_event.rb +++ b/lib/imagekitio/models/upload_pre_transform_success_event.rb @@ -339,6 +339,13 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel }, api_name: :"ai-auto-description" + # @!attribute ai_tasks + # + # @return [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks, nil] + optional :ai_tasks, + enum: -> { Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks }, + api_name: :"ai-tasks" + # @!attribute aws_auto_tagging # # @return [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging, nil] @@ -364,7 +371,7 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel enum: -> { Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg }, api_name: :"remove-bg" - # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # @!method initialize(ai_auto_description: nil, ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) # Extension names with their processing status at the time of completion of the # request. It could have one of the following status values: # @@ -376,6 +383,7 @@ class ExtensionStatus < Imagekitio::Internal::Type::BaseModel # If no extension was requested, then this parameter is not returned. # # @param ai_auto_description [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription] + # @param ai_tasks [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks] # @param aws_auto_tagging [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging] # @param google_auto_tagging [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging] # @param remove_bg [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg] @@ -392,6 +400,18 @@ module AIAutoDescription # @return [Array] end + # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus#ai_tasks + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus#aws_auto_tagging module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/models/video_overlay.rb b/lib/imagekitio/models/video_overlay.rb index ef76510..ebe83df 100644 --- a/lib/imagekitio/models/video_overlay.rb +++ b/lib/imagekitio/models/video_overlay.rb @@ -21,6 +21,12 @@ class VideoOverlay < Imagekitio::Models::BaseOverlay # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. + # # @return [Symbol, Imagekitio::Models::VideoOverlay::Encoding, nil] optional :encoding, enum: -> { Imagekitio::VideoOverlay::Encoding } @@ -49,6 +55,12 @@ class VideoOverlay < Imagekitio::Models::BaseOverlay # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/lib/imagekitio/resources/beta/v2/files.rb b/lib/imagekitio/resources/beta/v2/files.rb index b5f5da3..678ca31 100644 --- a/lib/imagekitio/resources/beta/v2/files.rb +++ b/lib/imagekitio/resources/beta/v2/files.rb @@ -52,7 +52,7 @@ class Files # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekitio/resources/files.rb b/lib/imagekitio/resources/files.rb index ab7db3a..7e961f4 100644 --- a/lib/imagekitio/resources/files.rb +++ b/lib/imagekitio/resources/files.rb @@ -242,7 +242,7 @@ def rename(params) # # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekitio/resources/files/metadata.rb b/lib/imagekitio/resources/files/metadata.rb index 1e902b0..f732ab3 100644 --- a/lib/imagekitio/resources/files/metadata.rb +++ b/lib/imagekitio/resources/files/metadata.rb @@ -50,7 +50,7 @@ def get_from_url(params) parsed, options = Imagekitio::Files::MetadataGetFromURLParams.dump_request(params) @client.request( method: :get, - path: "v1/files/metadata", + path: "v1/metadata", query: parsed, model: Imagekitio::Metadata, options: options diff --git a/lib/imagekitio/resources/saved_extensions.rb b/lib/imagekitio/resources/saved_extensions.rb new file mode 100644 index 0000000..ff8e1a7 --- /dev/null +++ b/lib/imagekitio/resources/saved_extensions.rb @@ -0,0 +1,146 @@ +# frozen_string_literal: true + +module Imagekitio + module Resources + class SavedExtensions + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SavedExtensionCreateParams} for more details. + # + # This API creates a new saved extension. Saved extensions allow you to save + # complex extension configurations (like AI tasks) and reuse them by referencing + # the ID in upload or update file APIs. + # + # **Saved extension limit** \ + # You can create a maximum of 100 saved extensions per account. + # + # @overload create(config:, description:, name:, request_options: {}) + # + # @param config [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension] Configuration object for an extension (base extensions only, not saved extension + # + # @param description [String] Description of what the saved extension does. + # + # @param name [String] Name of the saved extension. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::SavedExtension] + # + # @see Imagekitio::Models::SavedExtensionCreateParams + def create(params) + parsed, options = Imagekitio::SavedExtensionCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/saved-extensions", + body: parsed, + model: Imagekitio::SavedExtension, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SavedExtensionUpdateParams} for more details. + # + # This API updates an existing saved extension. You can update the name, + # description, or config. + # + # @overload update(id, config: nil, description: nil, name: nil, request_options: {}) + # + # @param id [String] The unique ID of the saved extension. + # + # @param config [Imagekitio::Models::ExtensionConfig::RemoveBg, Imagekitio::Models::ExtensionConfig::AIAutoDescription, Imagekitio::Models::ExtensionConfig::AITasks, Imagekitio::Models::ExtensionConfig::AutoTaggingExtension] Configuration object for an extension (base extensions only, not saved extension + # + # @param description [String] Updated description of the saved extension. + # + # @param name [String] Updated name of the saved extension. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::SavedExtension] + # + # @see Imagekitio::Models::SavedExtensionUpdateParams + def update(id, params = {}) + parsed, options = Imagekitio::SavedExtensionUpdateParams.dump_request(params) + @client.request( + method: :patch, + path: ["v1/saved-extensions/%1$s", id], + body: parsed, + model: Imagekitio::SavedExtension, + options: options + ) + end + + # This API returns an array of all saved extensions for your account. Saved + # extensions allow you to save complex extension configurations and reuse them by + # referencing them by ID in upload or update file APIs. + # + # @overload list(request_options: {}) + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekitio::Models::SavedExtensionListParams + def list(params = {}) + @client.request( + method: :get, + path: "v1/saved-extensions", + model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::SavedExtension], + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SavedExtensionDeleteParams} for more details. + # + # This API deletes a saved extension permanently. + # + # @overload delete(id, request_options: {}) + # + # @param id [String] The unique ID of the saved extension. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Imagekitio::Models::SavedExtensionDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["v1/saved-extensions/%1$s", id], + model: NilClass, + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SavedExtensionGetParams} for more details. + # + # This API returns details of a specific saved extension by ID. + # + # @overload get(id, request_options: {}) + # + # @param id [String] The unique ID of the saved extension. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::SavedExtension] + # + # @see Imagekitio::Models::SavedExtensionGetParams + def get(id, params = {}) + @client.request( + method: :get, + path: ["v1/saved-extensions/%1$s", id], + model: Imagekitio::SavedExtension, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekitio::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/imagekitio/version.rb b/lib/imagekitio/version.rb index 5c1df80..c63ab70 100644 --- a/lib/imagekitio/version.rb +++ b/lib/imagekitio/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Imagekitio - VERSION = "4.0.0" + VERSION = "4.1.0" end diff --git a/manifest.yaml b/manifest.yaml index 556686f..a1fd74a 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -1,11 +1,13 @@ dependencies: - English + - base64 - cgi - date - erb - etc - json - net/http + - openssl - pathname - rbconfig - securerandom diff --git a/rbi/imagekitio/client.rbi b/rbi/imagekitio/client.rbi index 5d72af7..ad74d65 100644 --- a/rbi/imagekitio/client.rbi +++ b/rbi/imagekitio/client.rbi @@ -26,6 +26,9 @@ module Imagekitio sig { returns(Imagekitio::Resources::Files) } attr_reader :files + sig { returns(Imagekitio::Resources::SavedExtensions) } + attr_reader :saved_extensions + sig { returns(Imagekitio::Resources::Assets) } attr_reader :assets diff --git a/rbi/imagekitio/internal/transport/base_client.rbi b/rbi/imagekitio/internal/transport/base_client.rbi index 445a414..1c48424 100644 --- a/rbi/imagekitio/internal/transport/base_client.rbi +++ b/rbi/imagekitio/internal/transport/base_client.rbi @@ -178,6 +178,11 @@ module Imagekitio private def auth_headers end + # @api private + sig { returns(String) } + private def user_agent + end + # @api private sig { returns(String) } private def generate_idempotency_key diff --git a/rbi/imagekitio/internal/transport/pooled_net_requester.rbi b/rbi/imagekitio/internal/transport/pooled_net_requester.rbi index e0c582f..7f93342 100644 --- a/rbi/imagekitio/internal/transport/pooled_net_requester.rbi +++ b/rbi/imagekitio/internal/transport/pooled_net_requester.rbi @@ -26,8 +26,12 @@ module Imagekitio class << self # @api private - sig { params(url: URI::Generic).returns(Net::HTTP) } - def connect(url) + sig do + params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns( + Net::HTTP + ) + end + def connect(cert_store:, url:) end # @api private diff --git a/rbi/imagekitio/internal/type/base_model.rbi b/rbi/imagekitio/internal/type/base_model.rbi index c8686a2..36e668f 100644 --- a/rbi/imagekitio/internal/type/base_model.rbi +++ b/rbi/imagekitio/internal/type/base_model.rbi @@ -31,7 +31,7 @@ module Imagekitio # # Assumes superclass fields are totally defined before fields are accessed / # defined on subclasses. - sig { params(child: T.self_type).void } + sig { params(child: Imagekitio::Internal::Type::BaseModel).void } def inherited(child) end @@ -276,9 +276,13 @@ module Imagekitio # Create a new instance of a model. sig do - params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns( - T.attached_class - ) + params( + data: + T.any( + T::Hash[Symbol, T.anything], + Imagekitio::Internal::Type::BaseModel + ) + ).returns(T.attached_class) end def self.new(data = {}) end diff --git a/rbi/imagekitio/models.rbi b/rbi/imagekitio/models.rbi index 5e425cc..0d06104 100644 --- a/rbi/imagekitio/models.rbi +++ b/rbi/imagekitio/models.rbi @@ -27,6 +27,8 @@ module Imagekitio CustomMetadataFieldUpdateParams = Imagekitio::Models::CustomMetadataFieldUpdateParams + ExtensionConfig = Imagekitio::Models::ExtensionConfig + ExtensionItem = Imagekitio::Models::ExtensionItem Extensions = @@ -78,6 +80,18 @@ module Imagekitio ResponsiveImageAttributes = Imagekitio::Models::ResponsiveImageAttributes + SavedExtension = Imagekitio::Models::SavedExtension + + SavedExtensionCreateParams = Imagekitio::Models::SavedExtensionCreateParams + + SavedExtensionDeleteParams = Imagekitio::Models::SavedExtensionDeleteParams + + SavedExtensionGetParams = Imagekitio::Models::SavedExtensionGetParams + + SavedExtensionListParams = Imagekitio::Models::SavedExtensionListParams + + SavedExtensionUpdateParams = Imagekitio::Models::SavedExtensionUpdateParams + SolidColorOverlay = Imagekitio::Models::SolidColorOverlay SolidColorOverlayTransformation = diff --git a/rbi/imagekitio/models/base_overlay.rbi b/rbi/imagekitio/models/base_overlay.rbi index 30cca96..73e1b53 100644 --- a/rbi/imagekitio/models/base_overlay.rbi +++ b/rbi/imagekitio/models/base_overlay.rbi @@ -8,12 +8,45 @@ module Imagekitio T.any(Imagekitio::BaseOverlay, Imagekitio::Internal::AnyHash) end + # Controls how the layer blends with the base image or underlying content. Maps to + # `lm` in the URL. By default, layers completely cover the base image beneath + # them. Layer modes change this behavior: + # + # - `multiply`: Multiplies the pixel values of the layer with the base image. The + # result is always darker than the original images. This is ideal for applying + # shadows or color tints. + # - `displace`: Uses the layer as a displacement map to distort pixels in the base + # image. The red channel controls horizontal displacement, and the green channel + # controls vertical displacement. Requires `x` or `y` parameter to control + # displacement magnitude. + # - `cutout`: Acts as an inverse mask where opaque areas of the layer turn the + # base image transparent, while transparent areas leave the base image + # unchanged. This mode functions like a hole-punch, effectively cutting the + # shape of the layer out of the underlying image. + # - `cutter`: Acts as a shape mask where only the parts of the base image that + # fall inside the opaque area of the layer are preserved. This mode functions + # like a cookie-cutter, trimming the base image to match the specific dimensions + # and shape of the layer. See + # [Layer modes](https://imagekit.io/docs/add-overlays-on-images#layer-modes). + sig { returns(T.nilable(Imagekitio::BaseOverlay::LayerMode::OrSymbol)) } + attr_reader :layer_mode + + sig do + params(layer_mode: Imagekitio::BaseOverlay::LayerMode::OrSymbol).void + end + attr_writer :layer_mode + + # Specifies the overlay's position relative to the parent asset. See + # [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer). sig { returns(T.nilable(Imagekitio::OverlayPosition)) } attr_reader :position sig { params(position: Imagekitio::OverlayPosition::OrHash).void } attr_writer :position + # Specifies timing information for the overlay (only applicable if the base asset + # is a video). See + # [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer). sig { returns(T.nilable(Imagekitio::OverlayTiming)) } attr_reader :timing @@ -22,16 +55,47 @@ module Imagekitio sig do params( + layer_mode: Imagekitio::BaseOverlay::LayerMode::OrSymbol, position: Imagekitio::OverlayPosition::OrHash, timing: Imagekitio::OverlayTiming::OrHash ).returns(T.attached_class) end - def self.new(position: nil, timing: nil) + def self.new( + # Controls how the layer blends with the base image or underlying content. Maps to + # `lm` in the URL. By default, layers completely cover the base image beneath + # them. Layer modes change this behavior: + # + # - `multiply`: Multiplies the pixel values of the layer with the base image. The + # result is always darker than the original images. This is ideal for applying + # shadows or color tints. + # - `displace`: Uses the layer as a displacement map to distort pixels in the base + # image. The red channel controls horizontal displacement, and the green channel + # controls vertical displacement. Requires `x` or `y` parameter to control + # displacement magnitude. + # - `cutout`: Acts as an inverse mask where opaque areas of the layer turn the + # base image transparent, while transparent areas leave the base image + # unchanged. This mode functions like a hole-punch, effectively cutting the + # shape of the layer out of the underlying image. + # - `cutter`: Acts as a shape mask where only the parts of the base image that + # fall inside the opaque area of the layer are preserved. This mode functions + # like a cookie-cutter, trimming the base image to match the specific dimensions + # and shape of the layer. See + # [Layer modes](https://imagekit.io/docs/add-overlays-on-images#layer-modes). + layer_mode: nil, + # Specifies the overlay's position relative to the parent asset. See + # [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer). + position: nil, + # Specifies timing information for the overlay (only applicable if the base asset + # is a video). See + # [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer). + timing: nil + ) end sig do override.returns( { + layer_mode: Imagekitio::BaseOverlay::LayerMode::OrSymbol, position: Imagekitio::OverlayPosition, timing: Imagekitio::OverlayTiming } @@ -39,6 +103,51 @@ module Imagekitio end def to_hash end + + # Controls how the layer blends with the base image or underlying content. Maps to + # `lm` in the URL. By default, layers completely cover the base image beneath + # them. Layer modes change this behavior: + # + # - `multiply`: Multiplies the pixel values of the layer with the base image. The + # result is always darker than the original images. This is ideal for applying + # shadows or color tints. + # - `displace`: Uses the layer as a displacement map to distort pixels in the base + # image. The red channel controls horizontal displacement, and the green channel + # controls vertical displacement. Requires `x` or `y` parameter to control + # displacement magnitude. + # - `cutout`: Acts as an inverse mask where opaque areas of the layer turn the + # base image transparent, while transparent areas leave the base image + # unchanged. This mode functions like a hole-punch, effectively cutting the + # shape of the layer out of the underlying image. + # - `cutter`: Acts as a shape mask where only the parts of the base image that + # fall inside the opaque area of the layer are preserved. This mode functions + # like a cookie-cutter, trimming the base image to match the specific dimensions + # and shape of the layer. See + # [Layer modes](https://imagekit.io/docs/add-overlays-on-images#layer-modes). + module LayerMode + extend Imagekitio::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekitio::BaseOverlay::LayerMode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MULTIPLY = + T.let(:multiply, Imagekitio::BaseOverlay::LayerMode::TaggedSymbol) + CUTTER = + T.let(:cutter, Imagekitio::BaseOverlay::LayerMode::TaggedSymbol) + CUTOUT = + T.let(:cutout, Imagekitio::BaseOverlay::LayerMode::TaggedSymbol) + DISPLACE = + T.let(:displace, Imagekitio::BaseOverlay::LayerMode::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekitio::BaseOverlay::LayerMode::TaggedSymbol] + ) + end + def self.values + end + end end end end diff --git a/rbi/imagekitio/models/beta/v2/file_upload_params.rbi b/rbi/imagekitio/models/beta/v2/file_upload_params.rbi index cb35010..a760924 100644 --- a/rbi/imagekitio/models/beta/v2/file_upload_params.rbi +++ b/rbi/imagekitio/models/beta/v2/file_upload_params.rbi @@ -98,6 +98,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg, Imagekitio::ExtensionItem::AIAutoDescription, + Imagekitio::ExtensionItem::AITasks, + Imagekitio::ExtensionItem::SavedExtension, Imagekitio::ExtensionItem::AutoTaggingExtension ) ] @@ -113,6 +115,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ] @@ -280,6 +284,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ], @@ -431,6 +437,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg, Imagekitio::ExtensionItem::AIAutoDescription, + Imagekitio::ExtensionItem::AITasks, + Imagekitio::ExtensionItem::SavedExtension, Imagekitio::ExtensionItem::AutoTaggingExtension ) ], diff --git a/rbi/imagekitio/models/beta/v2/file_upload_response.rbi b/rbi/imagekitio/models/beta/v2/file_upload_response.rbi index 2c472e7..c89e24c 100644 --- a/rbi/imagekitio/models/beta/v2/file_upload_response.rbi +++ b/rbi/imagekitio/models/beta/v2/file_upload_response.rbi @@ -516,6 +516,23 @@ module Imagekitio end attr_writer :ai_auto_description + sig do + returns( + T.nilable( + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + ) + end + attr_reader :ai_tasks + + sig do + params( + ai_tasks: + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::OrSymbol + ).void + end + attr_writer :ai_tasks + sig do returns( T.nilable( @@ -580,6 +597,8 @@ module Imagekitio params( ai_auto_description: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::OrSymbol, + ai_tasks: + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::OrSymbol, aws_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::OrSymbol, google_auto_tagging: @@ -590,6 +609,7 @@ module Imagekitio end def self.new( ai_auto_description: nil, + ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil @@ -601,6 +621,8 @@ module Imagekitio { ai_auto_description: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol, + ai_tasks: + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol, aws_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol, google_auto_tagging: @@ -652,6 +674,45 @@ module Imagekitio end end + module AITasks + extend Imagekitio::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ] + ) + end + def self.values + end + end + module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/models/extension_config.rbi b/rbi/imagekitio/models/extension_config.rbi new file mode 100644 index 0000000..e83e8fe --- /dev/null +++ b/rbi/imagekitio/models/extension_config.rbi @@ -0,0 +1,1403 @@ +# typed: strong + +module Imagekitio + module Models + # Configuration object for an extension (base extensions only, not saved extension + # references). + module ExtensionConfig + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::RemoveBg, + Imagekitio::ExtensionConfig::AIAutoDescription, + Imagekitio::ExtensionConfig::AITasks, + Imagekitio::ExtensionConfig::AutoTaggingExtension + ) + end + + class RemoveBg < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::RemoveBg, + Imagekitio::Internal::AnyHash + ) + end + + # Specifies the background removal extension. + sig { returns(Symbol) } + attr_accessor :name + + sig do + returns(T.nilable(Imagekitio::ExtensionConfig::RemoveBg::Options)) + end + attr_reader :options + + sig do + params( + options: Imagekitio::ExtensionConfig::RemoveBg::Options::OrHash + ).void + end + attr_writer :options + + sig do + params( + options: Imagekitio::ExtensionConfig::RemoveBg::Options::OrHash, + name: Symbol + ).returns(T.attached_class) + end + def self.new( + options: nil, + # Specifies the background removal extension. + name: :"remove-bg" + ) + end + + sig do + override.returns( + { + name: Symbol, + options: Imagekitio::ExtensionConfig::RemoveBg::Options + } + ) + end + def to_hash + end + + class Options < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::RemoveBg::Options, + Imagekitio::Internal::AnyHash + ) + end + + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :add_shadow + + sig { params(add_shadow: T::Boolean).void } + attr_writer :add_shadow + + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_color + + sig { params(bg_color: String).void } + attr_writer :bg_color + + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_image_url + + sig { params(bg_image_url: String).void } + attr_writer :bg_image_url + + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :semitransparency + + sig { params(semitransparency: T::Boolean).void } + attr_writer :semitransparency + + sig do + params( + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + add_shadow: nil, + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + bg_color: nil, + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + bg_image_url: nil, + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + semitransparency: nil + ) + end + + sig do + override.returns( + { + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + } + ) + end + def to_hash + end + end + end + + class AutoTaggingExtension < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AutoTaggingExtension, + Imagekitio::Internal::AnyHash + ) + end + + # Maximum number of tags to attach to the asset. + sig { returns(Integer) } + attr_accessor :max_tags + + # Minimum confidence level for tags to be considered valid. + sig { returns(Integer) } + attr_accessor :min_confidence + + # Specifies the auto-tagging extension used. + sig do + returns( + Imagekitio::ExtensionConfig::AutoTaggingExtension::Name::OrSymbol + ) + end + attr_accessor :name + + sig do + params( + max_tags: Integer, + min_confidence: Integer, + name: + Imagekitio::ExtensionConfig::AutoTaggingExtension::Name::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Maximum number of tags to attach to the asset. + max_tags:, + # Minimum confidence level for tags to be considered valid. + min_confidence:, + # Specifies the auto-tagging extension used. + name: + ) + end + + sig do + override.returns( + { + max_tags: Integer, + min_confidence: Integer, + name: + Imagekitio::ExtensionConfig::AutoTaggingExtension::Name::OrSymbol + } + ) + end + def to_hash + end + + # Specifies the auto-tagging extension used. + module Name + extend Imagekitio::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekitio::ExtensionConfig::AutoTaggingExtension::Name + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GOOGLE_AUTO_TAGGING = + T.let( + :"google-auto-tagging", + Imagekitio::ExtensionConfig::AutoTaggingExtension::Name::TaggedSymbol + ) + AWS_AUTO_TAGGING = + T.let( + :"aws-auto-tagging", + Imagekitio::ExtensionConfig::AutoTaggingExtension::Name::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AutoTaggingExtension::Name::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class AIAutoDescription < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AIAutoDescription, + Imagekitio::Internal::AnyHash + ) + end + + # Specifies the auto description extension. + sig { returns(Symbol) } + attr_accessor :name + + sig { params(name: Symbol).returns(T.attached_class) } + def self.new( + # Specifies the auto description extension. + name: :"ai-auto-description" + ) + end + + sig { override.returns({ name: Symbol }) } + def to_hash + end + end + + class AITasks < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks, + Imagekitio::Internal::AnyHash + ) + end + + # Specifies the AI tasks extension for automated image analysis using AI models. + sig { returns(Symbol) } + attr_accessor :name + + # Array of task objects defining AI operations to perform on the asset. + sig do + returns( + T::Array[ + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::SelectTags, + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata, + Imagekitio::ExtensionConfig::AITasks::Task::YesNo + ) + ] + ) + end + attr_accessor :tasks + + sig do + params( + tasks: + T::Array[ + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::SelectTags::OrHash, + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata::OrHash, + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OrHash + ) + ], + name: Symbol + ).returns(T.attached_class) + end + def self.new( + # Array of task objects defining AI operations to perform on the asset. + tasks:, + # Specifies the AI tasks extension for automated image analysis using AI models. + name: :"ai-tasks" + ) + end + + sig do + override.returns( + { + name: Symbol, + tasks: + T::Array[ + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::SelectTags, + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata, + Imagekitio::ExtensionConfig::AITasks::Task::YesNo + ) + ] + } + ) + end + def to_hash + end + + module Task + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::SelectTags, + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata, + Imagekitio::ExtensionConfig::AITasks::Task::YesNo + ) + end + + class SelectTags < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::SelectTags, + Imagekitio::Internal::AnyHash + ) + end + + # The question or instruction for the AI to analyze the image. + sig { returns(String) } + attr_accessor :instruction + + # Task type that analyzes the image and adds matching tags from a vocabulary. + sig { returns(Symbol) } + attr_accessor :type + + # Array of possible tag values. Combined length of all strings must not exceed 500 + # characters. Cannot contain the `%` character. + sig { returns(T::Array[String]) } + attr_accessor :vocabulary + + # Maximum number of tags to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :max_selections + + sig { params(max_selections: Integer).void } + attr_writer :max_selections + + # Minimum number of tags to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :min_selections + + sig { params(min_selections: Integer).void } + attr_writer :min_selections + + sig do + params( + instruction: String, + vocabulary: T::Array[String], + max_selections: Integer, + min_selections: Integer, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The question or instruction for the AI to analyze the image. + instruction:, + # Array of possible tag values. Combined length of all strings must not exceed 500 + # characters. Cannot contain the `%` character. + vocabulary:, + # Maximum number of tags to select from the vocabulary. + max_selections: nil, + # Minimum number of tags to select from the vocabulary. + min_selections: nil, + # Task type that analyzes the image and adds matching tags from a vocabulary. + type: :select_tags + ) + end + + sig do + override.returns( + { + instruction: String, + type: Symbol, + vocabulary: T::Array[String], + max_selections: Integer, + min_selections: Integer + } + ) + end + def to_hash + end + end + + class SelectMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. The field must exist in your account. + sig { returns(String) } + attr_accessor :field + + # The question or instruction for the AI to analyze the image. + sig { returns(String) } + attr_accessor :instruction + + # Task type that analyzes the image and sets a custom metadata field value from a + # vocabulary. + sig { returns(Symbol) } + attr_accessor :type + + # Maximum number of values to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :max_selections + + sig { params(max_selections: Integer).void } + attr_writer :max_selections + + # Minimum number of values to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :min_selections + + sig { params(min_selections: Integer).void } + attr_writer :min_selections + + # Array of possible values matching the custom metadata field type. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + ) + ) + end + attr_reader :vocabulary + + sig do + params( + vocabulary: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + ).void + end + attr_writer :vocabulary + + sig do + params( + field: String, + instruction: String, + max_selections: Integer, + min_selections: Integer, + vocabulary: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata::Vocabulary::Variants + ], + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. The field must exist in your account. + field:, + # The question or instruction for the AI to analyze the image. + instruction:, + # Maximum number of values to select from the vocabulary. + max_selections: nil, + # Minimum number of values to select from the vocabulary. + min_selections: nil, + # Array of possible values matching the custom metadata field type. + vocabulary: nil, + # Task type that analyzes the image and sets a custom metadata field value from a + # vocabulary. + type: :select_metadata + ) + end + + sig do + override.returns( + { + field: String, + instruction: String, + type: Symbol, + max_selections: Integer, + min_selections: Integer, + vocabulary: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + } + ) + end + def to_hash + end + + module Vocabulary + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + ) + end + def self.variants + end + end + end + + class YesNo < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo, + Imagekitio::Internal::AnyHash + ) + end + + # The yes/no question for the AI to answer about the image. + sig { returns(String) } + attr_accessor :instruction + + # Task type that asks a yes/no question and executes actions based on the answer. + sig { returns(Symbol) } + attr_accessor :type + + # Actions to execute if the AI answers no. + sig do + returns( + T.nilable( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo + ) + ) + end + attr_reader :on_no + + sig do + params( + on_no: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::OrHash + ).void + end + attr_writer :on_no + + # Actions to execute if the AI cannot determine the answer. + sig do + returns( + T.nilable( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown + ) + ) + end + attr_reader :on_unknown + + sig do + params( + on_unknown: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::OrHash + ).void + end + attr_writer :on_unknown + + # Actions to execute if the AI answers yes. + sig do + returns( + T.nilable( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes + ) + ) + end + attr_reader :on_yes + + sig do + params( + on_yes: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::OrHash + ).void + end + attr_writer :on_yes + + sig do + params( + instruction: String, + on_no: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::OrHash, + on_unknown: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::OrHash, + on_yes: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The yes/no question for the AI to answer about the image. + instruction:, + # Actions to execute if the AI answers no. + on_no: nil, + # Actions to execute if the AI cannot determine the answer. + on_unknown: nil, + # Actions to execute if the AI answers yes. + on_yes: nil, + # Task type that asks a yes/no question and executes actions based on the answer. + type: :yes_no + ) + end + + sig do + override.returns( + { + instruction: String, + type: Symbol, + on_no: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo, + on_unknown: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown, + on_yes: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes + } + ) + end + def to_hash + end + + class OnNo < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo, + Imagekitio::Internal::AnyHash + ) + end + + # Array of tag strings to add to the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :add_tags + + sig { params(add_tags: T::Array[String]).void } + attr_writer :add_tags + + # Array of tag strings to remove from the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :remove_tags + + sig { params(remove_tags: T::Array[String]).void } + attr_writer :remove_tags + + # Array of custom metadata field updates. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata + ] + ) + ) + end + attr_reader :set_metadata + + sig do + params( + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::OrHash + ] + ).void + end + attr_writer :set_metadata + + # Array of custom metadata fields to remove. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata + ] + ) + ) + end + attr_reader :unset_metadata + + sig do + params( + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata::OrHash + ] + ).void + end + attr_writer :unset_metadata + + # Actions to execute if the AI answers no. + sig do + params( + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::OrHash + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # Array of tag strings to add to the asset. + add_tags: nil, + # Array of tag strings to remove from the asset. + remove_tags: nil, + # Array of custom metadata field updates. + set_metadata: nil, + # Array of custom metadata fields to remove. + unset_metadata: nil + ) + end + + sig do + override.returns( + { + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata + ] + } + ) + end + def to_hash + end + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. + sig { returns(String) } + attr_accessor :field + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + sig do + returns( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + ) + end + attr_accessor :value + + sig do + params( + field: String, + value: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. + field:, + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + value: + ) + end + + sig do + override.returns( + { + field: String, + value: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + } + ) + end + def to_hash + end + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + module Value + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekitio::Internal::Type::ArrayOf[ + union: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed + ], + Imagekitio::Internal::Type::Converter + ) + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to remove. + sig { returns(String) } + attr_accessor :field + + sig { params(field: String).returns(T.attached_class) } + def self.new( + # Name of the custom metadata field to remove. + field: + ) + end + + sig { override.returns({ field: String }) } + def to_hash + end + end + end + + class OnUnknown < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown, + Imagekitio::Internal::AnyHash + ) + end + + # Array of tag strings to add to the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :add_tags + + sig { params(add_tags: T::Array[String]).void } + attr_writer :add_tags + + # Array of tag strings to remove from the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :remove_tags + + sig { params(remove_tags: T::Array[String]).void } + attr_writer :remove_tags + + # Array of custom metadata field updates. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata + ] + ) + ) + end + attr_reader :set_metadata + + sig do + params( + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::OrHash + ] + ).void + end + attr_writer :set_metadata + + # Array of custom metadata fields to remove. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata + ] + ) + ) + end + attr_reader :unset_metadata + + sig do + params( + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata::OrHash + ] + ).void + end + attr_writer :unset_metadata + + # Actions to execute if the AI cannot determine the answer. + sig do + params( + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::OrHash + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # Array of tag strings to add to the asset. + add_tags: nil, + # Array of tag strings to remove from the asset. + remove_tags: nil, + # Array of custom metadata field updates. + set_metadata: nil, + # Array of custom metadata fields to remove. + unset_metadata: nil + ) + end + + sig do + override.returns( + { + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata + ] + } + ) + end + def to_hash + end + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. + sig { returns(String) } + attr_accessor :field + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + sig do + returns( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + ) + end + attr_accessor :value + + sig do + params( + field: String, + value: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. + field:, + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + value: + ) + end + + sig do + override.returns( + { + field: String, + value: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + } + ) + end + def to_hash + end + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + module Value + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekitio::Internal::Type::ArrayOf[ + union: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed + ], + Imagekitio::Internal::Type::Converter + ) + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to remove. + sig { returns(String) } + attr_accessor :field + + sig { params(field: String).returns(T.attached_class) } + def self.new( + # Name of the custom metadata field to remove. + field: + ) + end + + sig { override.returns({ field: String }) } + def to_hash + end + end + end + + class OnYes < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes, + Imagekitio::Internal::AnyHash + ) + end + + # Array of tag strings to add to the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :add_tags + + sig { params(add_tags: T::Array[String]).void } + attr_writer :add_tags + + # Array of tag strings to remove from the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :remove_tags + + sig { params(remove_tags: T::Array[String]).void } + attr_writer :remove_tags + + # Array of custom metadata field updates. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata + ] + ) + ) + end + attr_reader :set_metadata + + sig do + params( + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::OrHash + ] + ).void + end + attr_writer :set_metadata + + # Array of custom metadata fields to remove. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata + ] + ) + ) + end + attr_reader :unset_metadata + + sig do + params( + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata::OrHash + ] + ).void + end + attr_writer :unset_metadata + + # Actions to execute if the AI answers yes. + sig do + params( + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::OrHash + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # Array of tag strings to add to the asset. + add_tags: nil, + # Array of tag strings to remove from the asset. + remove_tags: nil, + # Array of custom metadata field updates. + set_metadata: nil, + # Array of custom metadata fields to remove. + unset_metadata: nil + ) + end + + sig do + override.returns( + { + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata + ] + } + ) + end + def to_hash + end + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. + sig { returns(String) } + attr_accessor :field + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + sig do + returns( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + ) + end + attr_accessor :value + + sig do + params( + field: String, + value: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. + field:, + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + value: + ) + end + + sig do + override.returns( + { + field: String, + value: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + } + ) + end + def to_hash + end + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + module Value + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekitio::Internal::Type::ArrayOf[ + union: + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed + ], + Imagekitio::Internal::Type::Converter + ) + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to remove. + sig { returns(String) } + attr_accessor :field + + sig { params(field: String).returns(T.attached_class) } + def self.new( + # Name of the custom metadata field to remove. + field: + ) + end + + sig { override.returns({ field: String }) } + def to_hash + end + end + end + end + + sig do + override.returns( + T::Array[Imagekitio::ExtensionConfig::AITasks::Task::Variants] + ) + end + def self.variants + end + end + end + + sig { override.returns(T::Array[Imagekitio::ExtensionConfig::Variants]) } + def self.variants + end + end + end +end diff --git a/rbi/imagekitio/models/extensions.rbi b/rbi/imagekitio/models/extensions.rbi index e93e473..8940a32 100644 --- a/rbi/imagekitio/models/extensions.rbi +++ b/rbi/imagekitio/models/extensions.rbi @@ -10,6 +10,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg, Imagekitio::ExtensionItem::AIAutoDescription, + Imagekitio::ExtensionItem::AITasks, + Imagekitio::ExtensionItem::SavedExtension, Imagekitio::ExtensionItem::AutoTaggingExtension ) end @@ -260,6 +262,1163 @@ module Imagekitio end end + class AITasks < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks, + Imagekitio::Internal::AnyHash + ) + end + + # Specifies the AI tasks extension for automated image analysis using AI models. + sig { returns(Symbol) } + attr_accessor :name + + # Array of task objects defining AI operations to perform on the asset. + sig do + returns( + T::Array[ + T.any( + Imagekitio::ExtensionItem::AITasks::Task::SelectTags, + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata, + Imagekitio::ExtensionItem::AITasks::Task::YesNo + ) + ] + ) + end + attr_accessor :tasks + + sig do + params( + tasks: + T::Array[ + T.any( + Imagekitio::ExtensionItem::AITasks::Task::SelectTags::OrHash, + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata::OrHash, + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OrHash + ) + ], + name: Symbol + ).returns(T.attached_class) + end + def self.new( + # Array of task objects defining AI operations to perform on the asset. + tasks:, + # Specifies the AI tasks extension for automated image analysis using AI models. + name: :"ai-tasks" + ) + end + + sig do + override.returns( + { + name: Symbol, + tasks: + T::Array[ + T.any( + Imagekitio::ExtensionItem::AITasks::Task::SelectTags, + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata, + Imagekitio::ExtensionItem::AITasks::Task::YesNo + ) + ] + } + ) + end + def to_hash + end + + module Task + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::SelectTags, + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata, + Imagekitio::ExtensionItem::AITasks::Task::YesNo + ) + end + + class SelectTags < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::SelectTags, + Imagekitio::Internal::AnyHash + ) + end + + # The question or instruction for the AI to analyze the image. + sig { returns(String) } + attr_accessor :instruction + + # Task type that analyzes the image and adds matching tags from a vocabulary. + sig { returns(Symbol) } + attr_accessor :type + + # Array of possible tag values. Combined length of all strings must not exceed 500 + # characters. Cannot contain the `%` character. + sig { returns(T::Array[String]) } + attr_accessor :vocabulary + + # Maximum number of tags to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :max_selections + + sig { params(max_selections: Integer).void } + attr_writer :max_selections + + # Minimum number of tags to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :min_selections + + sig { params(min_selections: Integer).void } + attr_writer :min_selections + + sig do + params( + instruction: String, + vocabulary: T::Array[String], + max_selections: Integer, + min_selections: Integer, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The question or instruction for the AI to analyze the image. + instruction:, + # Array of possible tag values. Combined length of all strings must not exceed 500 + # characters. Cannot contain the `%` character. + vocabulary:, + # Maximum number of tags to select from the vocabulary. + max_selections: nil, + # Minimum number of tags to select from the vocabulary. + min_selections: nil, + # Task type that analyzes the image and adds matching tags from a vocabulary. + type: :select_tags + ) + end + + sig do + override.returns( + { + instruction: String, + type: Symbol, + vocabulary: T::Array[String], + max_selections: Integer, + min_selections: Integer + } + ) + end + def to_hash + end + end + + class SelectMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. The field must exist in your account. + sig { returns(String) } + attr_accessor :field + + # The question or instruction for the AI to analyze the image. + sig { returns(String) } + attr_accessor :instruction + + # Task type that analyzes the image and sets a custom metadata field value from a + # vocabulary. + sig { returns(Symbol) } + attr_accessor :type + + # Maximum number of values to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :max_selections + + sig { params(max_selections: Integer).void } + attr_writer :max_selections + + # Minimum number of values to select from the vocabulary. + sig { returns(T.nilable(Integer)) } + attr_reader :min_selections + + sig { params(min_selections: Integer).void } + attr_writer :min_selections + + # Array of possible values matching the custom metadata field type. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + ) + ) + end + attr_reader :vocabulary + + sig do + params( + vocabulary: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + ).void + end + attr_writer :vocabulary + + sig do + params( + field: String, + instruction: String, + max_selections: Integer, + min_selections: Integer, + vocabulary: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata::Vocabulary::Variants + ], + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. The field must exist in your account. + field:, + # The question or instruction for the AI to analyze the image. + instruction:, + # Maximum number of values to select from the vocabulary. + max_selections: nil, + # Minimum number of values to select from the vocabulary. + min_selections: nil, + # Array of possible values matching the custom metadata field type. + vocabulary: nil, + # Task type that analyzes the image and sets a custom metadata field value from a + # vocabulary. + type: :select_metadata + ) + end + + sig do + override.returns( + { + field: String, + instruction: String, + type: Symbol, + max_selections: Integer, + min_selections: Integer, + vocabulary: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + } + ) + end + def to_hash + end + + module Vocabulary + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata::Vocabulary::Variants + ] + ) + end + def self.variants + end + end + end + + class YesNo < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo, + Imagekitio::Internal::AnyHash + ) + end + + # The yes/no question for the AI to answer about the image. + sig { returns(String) } + attr_accessor :instruction + + # Task type that asks a yes/no question and executes actions based on the answer. + sig { returns(Symbol) } + attr_accessor :type + + # Actions to execute if the AI answers no. + sig do + returns( + T.nilable(Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo) + ) + end + attr_reader :on_no + + sig do + params( + on_no: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::OrHash + ).void + end + attr_writer :on_no + + # Actions to execute if the AI cannot determine the answer. + sig do + returns( + T.nilable( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown + ) + ) + end + attr_reader :on_unknown + + sig do + params( + on_unknown: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::OrHash + ).void + end + attr_writer :on_unknown + + # Actions to execute if the AI answers yes. + sig do + returns( + T.nilable( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes + ) + ) + end + attr_reader :on_yes + + sig do + params( + on_yes: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::OrHash + ).void + end + attr_writer :on_yes + + sig do + params( + instruction: String, + on_no: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::OrHash, + on_unknown: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::OrHash, + on_yes: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # The yes/no question for the AI to answer about the image. + instruction:, + # Actions to execute if the AI answers no. + on_no: nil, + # Actions to execute if the AI cannot determine the answer. + on_unknown: nil, + # Actions to execute if the AI answers yes. + on_yes: nil, + # Task type that asks a yes/no question and executes actions based on the answer. + type: :yes_no + ) + end + + sig do + override.returns( + { + instruction: String, + type: Symbol, + on_no: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo, + on_unknown: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown, + on_yes: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes + } + ) + end + def to_hash + end + + class OnNo < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo, + Imagekitio::Internal::AnyHash + ) + end + + # Array of tag strings to add to the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :add_tags + + sig { params(add_tags: T::Array[String]).void } + attr_writer :add_tags + + # Array of tag strings to remove from the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :remove_tags + + sig { params(remove_tags: T::Array[String]).void } + attr_writer :remove_tags + + # Array of custom metadata field updates. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata + ] + ) + ) + end + attr_reader :set_metadata + + sig do + params( + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::OrHash + ] + ).void + end + attr_writer :set_metadata + + # Array of custom metadata fields to remove. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata + ] + ) + ) + end + attr_reader :unset_metadata + + sig do + params( + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata::OrHash + ] + ).void + end + attr_writer :unset_metadata + + # Actions to execute if the AI answers no. + sig do + params( + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::OrHash + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # Array of tag strings to add to the asset. + add_tags: nil, + # Array of tag strings to remove from the asset. + remove_tags: nil, + # Array of custom metadata field updates. + set_metadata: nil, + # Array of custom metadata fields to remove. + unset_metadata: nil + ) + end + + sig do + override.returns( + { + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata + ] + } + ) + end + def to_hash + end + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. + sig { returns(String) } + attr_accessor :field + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + sig do + returns( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + ) + end + attr_accessor :value + + sig do + params( + field: String, + value: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. + field:, + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + value: + ) + end + + sig do + override.returns( + { + field: String, + value: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + } + ) + end + def to_hash + end + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + module Value + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekitio::Internal::Type::ArrayOf[ + union: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::Mixed + ], + Imagekitio::Internal::Type::Converter + ) + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to remove. + sig { returns(String) } + attr_accessor :field + + sig { params(field: String).returns(T.attached_class) } + def self.new( + # Name of the custom metadata field to remove. + field: + ) + end + + sig { override.returns({ field: String }) } + def to_hash + end + end + end + + class OnUnknown < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown, + Imagekitio::Internal::AnyHash + ) + end + + # Array of tag strings to add to the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :add_tags + + sig { params(add_tags: T::Array[String]).void } + attr_writer :add_tags + + # Array of tag strings to remove from the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :remove_tags + + sig { params(remove_tags: T::Array[String]).void } + attr_writer :remove_tags + + # Array of custom metadata field updates. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata + ] + ) + ) + end + attr_reader :set_metadata + + sig do + params( + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::OrHash + ] + ).void + end + attr_writer :set_metadata + + # Array of custom metadata fields to remove. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata + ] + ) + ) + end + attr_reader :unset_metadata + + sig do + params( + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata::OrHash + ] + ).void + end + attr_writer :unset_metadata + + # Actions to execute if the AI cannot determine the answer. + sig do + params( + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::OrHash + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # Array of tag strings to add to the asset. + add_tags: nil, + # Array of tag strings to remove from the asset. + remove_tags: nil, + # Array of custom metadata field updates. + set_metadata: nil, + # Array of custom metadata fields to remove. + unset_metadata: nil + ) + end + + sig do + override.returns( + { + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata + ] + } + ) + end + def to_hash + end + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. + sig { returns(String) } + attr_accessor :field + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + sig do + returns( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + ) + end + attr_accessor :value + + sig do + params( + field: String, + value: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. + field:, + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + value: + ) + end + + sig do + override.returns( + { + field: String, + value: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + } + ) + end + def to_hash + end + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + module Value + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekitio::Internal::Type::ArrayOf[ + union: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::Mixed + ], + Imagekitio::Internal::Type::Converter + ) + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to remove. + sig { returns(String) } + attr_accessor :field + + sig { params(field: String).returns(T.attached_class) } + def self.new( + # Name of the custom metadata field to remove. + field: + ) + end + + sig { override.returns({ field: String }) } + def to_hash + end + end + end + + class OnYes < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes, + Imagekitio::Internal::AnyHash + ) + end + + # Array of tag strings to add to the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :add_tags + + sig { params(add_tags: T::Array[String]).void } + attr_writer :add_tags + + # Array of tag strings to remove from the asset. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :remove_tags + + sig { params(remove_tags: T::Array[String]).void } + attr_writer :remove_tags + + # Array of custom metadata field updates. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata + ] + ) + ) + end + attr_reader :set_metadata + + sig do + params( + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::OrHash + ] + ).void + end + attr_writer :set_metadata + + # Array of custom metadata fields to remove. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata + ] + ) + ) + end + attr_reader :unset_metadata + + sig do + params( + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata::OrHash + ] + ).void + end + attr_writer :unset_metadata + + # Actions to execute if the AI answers yes. + sig do + params( + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::OrHash + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # Array of tag strings to add to the asset. + add_tags: nil, + # Array of tag strings to remove from the asset. + remove_tags: nil, + # Array of custom metadata field updates. + set_metadata: nil, + # Array of custom metadata fields to remove. + unset_metadata: nil + ) + end + + sig do + override.returns( + { + add_tags: T::Array[String], + remove_tags: T::Array[String], + set_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata + ], + unset_metadata: + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata + ] + } + ) + end + def to_hash + end + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to set. + sig { returns(String) } + attr_accessor :field + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + sig do + returns( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + ) + end + attr_accessor :value + + sig do + params( + field: String, + value: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + ).returns(T.attached_class) + end + def self.new( + # Name of the custom metadata field to set. + field:, + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + value: + ) + end + + sig do + override.returns( + { + field: String, + value: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + } + ) + end + def to_hash + end + + # Value to set for the custom metadata field. The value type should match the + # custom metadata field type. + module Value + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekitio::Internal::Type::ArrayOf[ + union: + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::Mixed + ], + Imagekitio::Internal::Type::Converter + ) + end + end + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the custom metadata field to remove. + sig { returns(String) } + attr_accessor :field + + sig { params(field: String).returns(T.attached_class) } + def self.new( + # Name of the custom metadata field to remove. + field: + ) + end + + sig { override.returns({ field: String }) } + def to_hash + end + end + end + end + + sig do + override.returns( + T::Array[Imagekitio::ExtensionItem::AITasks::Task::Variants] + ) + end + def self.variants + end + end + end + + class SavedExtension < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::ExtensionItem::SavedExtension, + Imagekitio::Internal::AnyHash + ) + end + + # The unique ID of the saved extension to apply. + sig { returns(String) } + attr_accessor :id + + # Indicates this is a reference to a saved extension. + sig { returns(Symbol) } + attr_accessor :name + + sig { params(id: String, name: Symbol).returns(T.attached_class) } + def self.new( + # The unique ID of the saved extension to apply. + id:, + # Indicates this is a reference to a saved extension. + name: :"saved-extension" + ) + end + + sig { override.returns({ id: String, name: Symbol }) } + def to_hash + end + end + sig { override.returns(T::Array[Imagekitio::ExtensionItem::Variants]) } def self.variants end diff --git a/rbi/imagekitio/models/file_update_response.rbi b/rbi/imagekitio/models/file_update_response.rbi index 3db28ab..fc4461b 100644 --- a/rbi/imagekitio/models/file_update_response.rbi +++ b/rbi/imagekitio/models/file_update_response.rbi @@ -73,6 +73,23 @@ module Imagekitio end attr_writer :ai_auto_description + sig do + returns( + T.nilable( + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + ) + end + attr_reader :ai_tasks + + sig do + params( + ai_tasks: + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::OrSymbol + ).void + end + attr_writer :ai_tasks + sig do returns( T.nilable( @@ -128,6 +145,8 @@ module Imagekitio params( ai_auto_description: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::OrSymbol, + ai_tasks: + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::OrSymbol, aws_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::OrSymbol, google_auto_tagging: @@ -138,6 +157,7 @@ module Imagekitio end def self.new( ai_auto_description: nil, + ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil @@ -149,6 +169,8 @@ module Imagekitio { ai_auto_description: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol, + ai_tasks: + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::TaggedSymbol, aws_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol, google_auto_tagging: @@ -200,6 +222,45 @@ module Imagekitio end end + module AITasks + extend Imagekitio::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::AITasks::TaggedSymbol + ] + ) + end + def self.values + end + end + module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/models/file_upload_params.rbi b/rbi/imagekitio/models/file_upload_params.rbi index 064e4c3..7e6ae63 100644 --- a/rbi/imagekitio/models/file_upload_params.rbi +++ b/rbi/imagekitio/models/file_upload_params.rbi @@ -103,6 +103,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg, Imagekitio::ExtensionItem::AIAutoDescription, + Imagekitio::ExtensionItem::AITasks, + Imagekitio::ExtensionItem::SavedExtension, Imagekitio::ExtensionItem::AutoTaggingExtension ) ] @@ -118,6 +120,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ] @@ -303,6 +307,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ], @@ -475,6 +481,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg, Imagekitio::ExtensionItem::AIAutoDescription, + Imagekitio::ExtensionItem::AITasks, + Imagekitio::ExtensionItem::SavedExtension, Imagekitio::ExtensionItem::AutoTaggingExtension ) ], diff --git a/rbi/imagekitio/models/file_upload_response.rbi b/rbi/imagekitio/models/file_upload_response.rbi index 0e88ee7..5db0236 100644 --- a/rbi/imagekitio/models/file_upload_response.rbi +++ b/rbi/imagekitio/models/file_upload_response.rbi @@ -497,6 +497,23 @@ module Imagekitio end attr_writer :ai_auto_description + sig do + returns( + T.nilable( + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + ) + end + attr_reader :ai_tasks + + sig do + params( + ai_tasks: + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::OrSymbol + ).void + end + attr_writer :ai_tasks + sig do returns( T.nilable( @@ -561,6 +578,8 @@ module Imagekitio params( ai_auto_description: Imagekitio::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::OrSymbol, + ai_tasks: + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::OrSymbol, aws_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::OrSymbol, google_auto_tagging: @@ -571,6 +590,7 @@ module Imagekitio end def self.new( ai_auto_description: nil, + ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil @@ -582,6 +602,8 @@ module Imagekitio { ai_auto_description: Imagekitio::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol, + ai_tasks: + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol, aws_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol, google_auto_tagging: @@ -633,6 +655,45 @@ module Imagekitio end end + module AITasks + extend Imagekitio::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekitio::Models::FileUploadResponse::ExtensionStatus::AITasks::TaggedSymbol + ] + ) + end + def self.values + end + end + module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/models/image_overlay.rbi b/rbi/imagekitio/models/image_overlay.rbi index fda4e3f..6b11207 100644 --- a/rbi/imagekitio/models/image_overlay.rbi +++ b/rbi/imagekitio/models/image_overlay.rbi @@ -20,6 +20,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. sig { returns(T.nilable(Imagekitio::ImageOverlay::Encoding::OrSymbol)) } attr_reader :encoding @@ -55,6 +61,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. encoding: nil, # Array of transformations to be applied to the overlay image. Supported # transformations depends on the base/parent asset. See overlays on @@ -84,6 +96,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/models/saved_extension.rbi b/rbi/imagekitio/models/saved_extension.rbi new file mode 100644 index 0000000..1185481 --- /dev/null +++ b/rbi/imagekitio/models/saved_extension.rbi @@ -0,0 +1,114 @@ +# typed: strong + +module Imagekitio + module Models + class SavedExtension < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekitio::SavedExtension, Imagekitio::Internal::AnyHash) + end + + # Unique identifier of the saved extension. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Configuration object for an extension (base extensions only, not saved extension + # references). + sig { returns(T.nilable(Imagekitio::ExtensionConfig::Variants)) } + attr_reader :config + + sig do + params( + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg::OrHash, + Imagekitio::ExtensionConfig::AIAutoDescription::OrHash, + Imagekitio::ExtensionConfig::AITasks::OrHash, + Imagekitio::ExtensionConfig::AutoTaggingExtension::OrHash + ) + ).void + end + attr_writer :config + + # Timestamp when the saved extension was created. + sig { returns(T.nilable(Time)) } + attr_reader :created_at + + sig { params(created_at: Time).void } + attr_writer :created_at + + # Description of the saved extension. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Name of the saved extension. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Timestamp when the saved extension was last updated. + sig { returns(T.nilable(Time)) } + attr_reader :updated_at + + sig { params(updated_at: Time).void } + attr_writer :updated_at + + # Saved extension object containing extension configuration. + sig do + params( + id: String, + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg::OrHash, + Imagekitio::ExtensionConfig::AIAutoDescription::OrHash, + Imagekitio::ExtensionConfig::AITasks::OrHash, + Imagekitio::ExtensionConfig::AutoTaggingExtension::OrHash + ), + created_at: Time, + description: String, + name: String, + updated_at: Time + ).returns(T.attached_class) + end + def self.new( + # Unique identifier of the saved extension. + id: nil, + # Configuration object for an extension (base extensions only, not saved extension + # references). + config: nil, + # Timestamp when the saved extension was created. + created_at: nil, + # Description of the saved extension. + description: nil, + # Name of the saved extension. + name: nil, + # Timestamp when the saved extension was last updated. + updated_at: nil + ) + end + + sig do + override.returns( + { + id: String, + config: Imagekitio::ExtensionConfig::Variants, + created_at: Time, + description: String, + name: String, + updated_at: Time + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/saved_extension_create_params.rbi b/rbi/imagekitio/models/saved_extension_create_params.rbi new file mode 100644 index 0000000..240dca6 --- /dev/null +++ b/rbi/imagekitio/models/saved_extension_create_params.rbi @@ -0,0 +1,85 @@ +# typed: strong + +module Imagekitio + module Models + class SavedExtensionCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::SavedExtensionCreateParams, + Imagekitio::Internal::AnyHash + ) + end + + # Configuration object for an extension (base extensions only, not saved extension + # references). + sig do + returns( + T.any( + Imagekitio::ExtensionConfig::RemoveBg, + Imagekitio::ExtensionConfig::AIAutoDescription, + Imagekitio::ExtensionConfig::AITasks, + Imagekitio::ExtensionConfig::AutoTaggingExtension + ) + ) + end + attr_accessor :config + + # Description of what the saved extension does. + sig { returns(String) } + attr_accessor :description + + # Name of the saved extension. + sig { returns(String) } + attr_accessor :name + + sig do + params( + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg::OrHash, + Imagekitio::ExtensionConfig::AIAutoDescription::OrHash, + Imagekitio::ExtensionConfig::AITasks::OrHash, + Imagekitio::ExtensionConfig::AutoTaggingExtension::OrHash + ), + description: String, + name: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Configuration object for an extension (base extensions only, not saved extension + # references). + config:, + # Description of what the saved extension does. + description:, + # Name of the saved extension. + name:, + request_options: {} + ) + end + + sig do + override.returns( + { + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg, + Imagekitio::ExtensionConfig::AIAutoDescription, + Imagekitio::ExtensionConfig::AITasks, + Imagekitio::ExtensionConfig::AutoTaggingExtension + ), + description: String, + name: String, + request_options: Imagekitio::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/saved_extension_delete_params.rbi b/rbi/imagekitio/models/saved_extension_delete_params.rbi new file mode 100644 index 0000000..b56c4d2 --- /dev/null +++ b/rbi/imagekitio/models/saved_extension_delete_params.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Imagekitio + module Models + class SavedExtensionDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::SavedExtensionDeleteParams, + Imagekitio::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekitio::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekitio::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/saved_extension_get_params.rbi b/rbi/imagekitio/models/saved_extension_get_params.rbi new file mode 100644 index 0000000..9f76947 --- /dev/null +++ b/rbi/imagekitio/models/saved_extension_get_params.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Imagekitio + module Models + class SavedExtensionGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::SavedExtensionGetParams, + Imagekitio::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekitio::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekitio::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/saved_extension_list_params.rbi b/rbi/imagekitio/models/saved_extension_list_params.rbi new file mode 100644 index 0000000..f113d93 --- /dev/null +++ b/rbi/imagekitio/models/saved_extension_list_params.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Imagekitio + module Models + class SavedExtensionListParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::SavedExtensionListParams, + Imagekitio::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekitio::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekitio::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/saved_extension_list_response.rbi b/rbi/imagekitio/models/saved_extension_list_response.rbi new file mode 100644 index 0000000..2da98fd --- /dev/null +++ b/rbi/imagekitio/models/saved_extension_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Imagekitio + module Models + SavedExtensionListResponse = + T.let( + Imagekitio::Internal::Type::ArrayOf[Imagekitio::SavedExtension], + Imagekitio::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekitio/models/saved_extension_update_params.rbi b/rbi/imagekitio/models/saved_extension_update_params.rbi new file mode 100644 index 0000000..fe83797 --- /dev/null +++ b/rbi/imagekitio/models/saved_extension_update_params.rbi @@ -0,0 +1,106 @@ +# typed: strong + +module Imagekitio + module Models + class SavedExtensionUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::SavedExtensionUpdateParams, + Imagekitio::Internal::AnyHash + ) + end + + # Configuration object for an extension (base extensions only, not saved extension + # references). + sig do + returns( + T.nilable( + T.any( + Imagekitio::ExtensionConfig::RemoveBg, + Imagekitio::ExtensionConfig::AIAutoDescription, + Imagekitio::ExtensionConfig::AITasks, + Imagekitio::ExtensionConfig::AutoTaggingExtension + ) + ) + ) + end + attr_reader :config + + sig do + params( + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg::OrHash, + Imagekitio::ExtensionConfig::AIAutoDescription::OrHash, + Imagekitio::ExtensionConfig::AITasks::OrHash, + Imagekitio::ExtensionConfig::AutoTaggingExtension::OrHash + ) + ).void + end + attr_writer :config + + # Updated description of the saved extension. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Updated name of the saved extension. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig do + params( + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg::OrHash, + Imagekitio::ExtensionConfig::AIAutoDescription::OrHash, + Imagekitio::ExtensionConfig::AITasks::OrHash, + Imagekitio::ExtensionConfig::AutoTaggingExtension::OrHash + ), + description: String, + name: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Configuration object for an extension (base extensions only, not saved extension + # references). + config: nil, + # Updated description of the saved extension. + description: nil, + # Updated name of the saved extension. + name: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg, + Imagekitio::ExtensionConfig::AIAutoDescription, + Imagekitio::ExtensionConfig::AITasks, + Imagekitio::ExtensionConfig::AutoTaggingExtension + ), + description: String, + name: String, + request_options: Imagekitio::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/solid_color_overlay_transformation.rbi b/rbi/imagekitio/models/solid_color_overlay_transformation.rbi index 7c62ded..6db4577 100644 --- a/rbi/imagekitio/models/solid_color_overlay_transformation.rbi +++ b/rbi/imagekitio/models/solid_color_overlay_transformation.rbi @@ -11,8 +11,8 @@ module Imagekitio ) end - # Specifies the transparency level of the solid color overlay. Accepts integers - # from `1` to `9`. + # Specifies the transparency level of the overlaid solid color layer. Supports + # integers from `1` to `9`. sig { returns(T.nilable(Float)) } attr_reader :alpha @@ -56,13 +56,18 @@ module Imagekitio end attr_writer :height - # Specifies the corner radius of the solid color overlay. Set to `max` for - # circular or oval shape. See - # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). - sig { returns(T.nilable(T.any(Float, Symbol))) } + # Specifies the corner radius of the solid color overlay. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + sig { returns(T.nilable(T.any(Float, Symbol, String))) } attr_reader :radius - sig { params(radius: T.any(Float, Symbol)).void } + sig { params(radius: T.any(Float, Symbol, String)).void } attr_writer :radius # Controls the width of the solid color overlay. Accepts a numeric value or an @@ -90,13 +95,13 @@ module Imagekitio background: String, gradient: T.any(T::Boolean, String), height: Imagekitio::SolidColorOverlayTransformation::Height::Variants, - radius: T.any(Float, Symbol), + radius: T.any(Float, Symbol, String), width: Imagekitio::SolidColorOverlayTransformation::Width::Variants ).returns(T.attached_class) end def self.new( - # Specifies the transparency level of the solid color overlay. Accepts integers - # from `1` to `9`. + # Specifies the transparency level of the overlaid solid color layer. Supports + # integers from `1` to `9`. alpha: nil, # Specifies the background color of the solid color overlay. Accepts an RGB hex # code (e.g., `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. @@ -110,9 +115,14 @@ module Imagekitio # arithmetic expression. Learn about # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). height: nil, - # Specifies the corner radius of the solid color overlay. Set to `max` for - # circular or oval shape. See - # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius of the solid color overlay. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). radius: nil, # Controls the width of the solid color overlay. Accepts a numeric value or an # arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about @@ -129,7 +139,7 @@ module Imagekitio gradient: T.any(T::Boolean, String), height: Imagekitio::SolidColorOverlayTransformation::Height::Variants, - radius: T.any(Float, Symbol), + radius: T.any(Float, Symbol, String), width: Imagekitio::SolidColorOverlayTransformation::Width::Variants } ) @@ -176,13 +186,18 @@ module Imagekitio end end - # Specifies the corner radius of the solid color overlay. Set to `max` for - # circular or oval shape. See - # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius of the solid color overlay. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). module Radius extend Imagekitio::Internal::Type::Union - Variants = T.type_alias { T.any(Float, Symbol) } + Variants = T.type_alias { T.any(Float, Symbol, String) } sig do override.returns( diff --git a/rbi/imagekitio/models/subtitle_overlay.rbi b/rbi/imagekitio/models/subtitle_overlay.rbi index dd1cb00..fb15246 100644 --- a/rbi/imagekitio/models/subtitle_overlay.rbi +++ b/rbi/imagekitio/models/subtitle_overlay.rbi @@ -20,6 +20,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. sig do returns(T.nilable(Imagekitio::SubtitleOverlay::Encoding::OrSymbol)) end @@ -62,6 +68,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. encoding: nil, # Control styling of the subtitle. See # [Styling subtitles](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer). @@ -88,6 +100,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/models/subtitle_overlay_transformation.rbi b/rbi/imagekitio/models/subtitle_overlay_transformation.rbi index 1c089c5..da374e5 100644 --- a/rbi/imagekitio/models/subtitle_overlay_transformation.rbi +++ b/rbi/imagekitio/models/subtitle_overlay_transformation.rbi @@ -31,8 +31,9 @@ module Imagekitio sig { params(color: String).void } attr_writer :color - # Font family for subtitles. Refer to the - # [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list). + # Sets the font family of subtitle text. Refer to the + # [supported fonts documented](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list) + # in the ImageKit transformations guide. sig { returns(T.nilable(String)) } attr_reader :font_family @@ -122,8 +123,9 @@ module Imagekitio # # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) color: nil, - # Font family for subtitles. Refer to the - # [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list). + # Sets the font family of subtitle text. Refer to the + # [supported fonts documented](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list) + # in the ImageKit transformations guide. font_family: nil, # Sets the font outline of the subtitle text. Requires the outline width (an # integer) and the outline color (as an RGB color code, RGBA color code, or diff --git a/rbi/imagekitio/models/text_overlay.rbi b/rbi/imagekitio/models/text_overlay.rbi index fe63540..edecb8e 100644 --- a/rbi/imagekitio/models/text_overlay.rbi +++ b/rbi/imagekitio/models/text_overlay.rbi @@ -21,6 +21,9 @@ module Imagekitio # appropriate format based on the input text. To always use base64 # (`ie-{base64}`), set this parameter to `base64`. To always use plain text # (`i-{input}`), set it to `plain`. + # + # Regardless of the encoding method, the input text is always percent-encoded to + # ensure it is URL-safe. sig { returns(T.nilable(Imagekitio::TextOverlay::Encoding::OrSymbol)) } attr_reader :encoding @@ -60,6 +63,9 @@ module Imagekitio # appropriate format based on the input text. To always use base64 # (`ie-{base64}`), set this parameter to `base64`. To always use plain text # (`i-{input}`), set it to `plain`. + # + # Regardless of the encoding method, the input text is always percent-encoded to + # ensure it is URL-safe. encoding: nil, # Control styling of the text overlay. See # [Text overlays](https://imagekit.io/docs/add-overlays-on-images#text-overlay). @@ -86,6 +92,9 @@ module Imagekitio # appropriate format based on the input text. To always use base64 # (`ie-{base64}`), set this parameter to `base64`. To always use plain text # (`i-{input}`), set it to `plain`. + # + # Regardless of the encoding method, the input text is always percent-encoded to + # ensure it is URL-safe. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/models/text_overlay_transformation.rbi b/rbi/imagekitio/models/text_overlay_transformation.rbi index bc1f85b..24fcdb7 100644 --- a/rbi/imagekitio/models/text_overlay_transformation.rbi +++ b/rbi/imagekitio/models/text_overlay_transformation.rbi @@ -27,7 +27,9 @@ module Imagekitio sig { params(background: String).void } attr_writer :background - # Flip the text overlay horizontally, vertically, or both. + # Flip/mirror the text horizontally, vertically, or in both directions. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. sig do returns( T.nilable(Imagekitio::TextOverlayTransformation::Flip::OrSymbol) @@ -94,10 +96,9 @@ module Imagekitio end attr_writer :inner_alignment - # Specifies the line height of the text overlay. Accepts integer values - # representing line height in points. It can also accept - # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) - # such as `bw_mul_0.2`, or `bh_div_20`. + # Specifies the line height for multi-line text overlays. It will come into effect + # only if the text wraps over multiple lines. Accepts either an integer value or + # an arithmetic expression. sig do returns( T.nilable(Imagekitio::TextOverlayTransformation::LineHeight::Variants) @@ -130,12 +131,18 @@ module Imagekitio end attr_writer :padding - # Specifies the corner radius of the text overlay. Set to `max` to achieve a - # circular or oval shape. - sig { returns(T.nilable(T.any(Float, Symbol))) } + # Specifies the corner radius: + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + sig { returns(T.nilable(T.any(Float, Symbol, String))) } attr_reader :radius - sig { params(radius: T.any(Float, Symbol)).void } + sig { params(radius: T.any(Float, Symbol, String)).void } attr_writer :radius # Specifies the rotation angle of the text overlay. Accepts a numeric value for @@ -196,7 +203,7 @@ module Imagekitio line_height: Imagekitio::TextOverlayTransformation::LineHeight::Variants, padding: Imagekitio::TextOverlayTransformation::Padding::Variants, - radius: T.any(Float, Symbol), + radius: T.any(Float, Symbol, String), rotation: Imagekitio::TextOverlayTransformation::Rotation::Variants, typography: String, width: Imagekitio::TextOverlayTransformation::Width::Variants @@ -209,7 +216,9 @@ module Imagekitio # Specifies the background color of the text overlay. Accepts an RGB hex code, an # RGBA code, or a color name. background: nil, - # Flip the text overlay horizontally, vertically, or both. + # Flip/mirror the text horizontally, vertically, or in both directions. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. flip: nil, # Specifies the font color of the overlaid text. Accepts an RGB hex code (e.g., # `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. @@ -226,17 +235,22 @@ module Imagekitio # Specifies the inner alignment of the text when width is more than the text # length. inner_alignment: nil, - # Specifies the line height of the text overlay. Accepts integer values - # representing line height in points. It can also accept - # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) - # such as `bw_mul_0.2`, or `bh_div_20`. + # Specifies the line height for multi-line text overlays. It will come into effect + # only if the text wraps over multiple lines. Accepts either an integer value or + # an arithmetic expression. line_height: nil, # Specifies the padding around the overlaid text. Can be provided as a single # positive integer or multiple values separated by underscores (following CSS # shorthand order). Arithmetic expressions are also accepted. padding: nil, - # Specifies the corner radius of the text overlay. Set to `max` to achieve a - # circular or oval shape. + # Specifies the corner radius: + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). radius: nil, # Specifies the rotation angle of the text overlay. Accepts a numeric value for # clockwise rotation or a string prefixed with "N" for counter-clockwise rotation. @@ -270,7 +284,7 @@ module Imagekitio line_height: Imagekitio::TextOverlayTransformation::LineHeight::Variants, padding: Imagekitio::TextOverlayTransformation::Padding::Variants, - radius: T.any(Float, Symbol), + radius: T.any(Float, Symbol, String), rotation: Imagekitio::TextOverlayTransformation::Rotation::Variants, typography: String, width: Imagekitio::TextOverlayTransformation::Width::Variants @@ -280,7 +294,9 @@ module Imagekitio def to_hash end - # Flip the text overlay horizontally, vertically, or both. + # Flip/mirror the text horizontally, vertically, or in both directions. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. module Flip extend Imagekitio::Internal::Type::Enum @@ -360,10 +376,9 @@ module Imagekitio end end - # Specifies the line height of the text overlay. Accepts integer values - # representing line height in points. It can also accept - # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) - # such as `bw_mul_0.2`, or `bh_div_20`. + # Specifies the line height for multi-line text overlays. It will come into effect + # only if the text wraps over multiple lines. Accepts either an integer value or + # an arithmetic expression. module LineHeight extend Imagekitio::Internal::Type::Union @@ -397,12 +412,18 @@ module Imagekitio end end - # Specifies the corner radius of the text overlay. Set to `max` to achieve a - # circular or oval shape. + # Specifies the corner radius: + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). module Radius extend Imagekitio::Internal::Type::Union - Variants = T.type_alias { T.any(Float, Symbol) } + Variants = T.type_alias { T.any(Float, Symbol, String) } sig do override.returns( diff --git a/rbi/imagekitio/models/transformation.rbi b/rbi/imagekitio/models/transformation.rbi index 0978362..607451a 100644 --- a/rbi/imagekitio/models/transformation.rbi +++ b/rbi/imagekitio/models/transformation.rbi @@ -160,6 +160,12 @@ module Imagekitio # # - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See # [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background). + # - Dominant color: `dominant` extracts the dominant color from the image. See + # [Dominant color background](https://imagekit.io/docs/effects-and-enhancements#dominant-color-background). + # - Gradient: `gradient_dominant` or `gradient_dominant_2` creates a gradient + # using the dominant colors. Optionally specify palette size (2 or 4), e.g., + # `gradient_dominant_4`. See + # [Gradient background](https://imagekit.io/docs/effects-and-enhancements#gradient-background). # - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See # [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background). # - Expand the image boundaries using generative fill: `genfill`. Not supported @@ -200,6 +206,20 @@ module Imagekitio sig { params(color_profile: T::Boolean).void } attr_writer :color_profile + # Replaces colors in the image. Supports three formats: + # + # - `toColor` - Replace dominant color with the specified color. + # - `toColor_tolerance` - Replace dominant color with specified tolerance (0-100). + # - `toColor_tolerance_fromColor` - Replace a specific color with another within + # tolerance range. Colors can be hex codes (e.g., `FF0022`) or names (e.g., + # `red`, `blue`). See + # [Color replacement](https://imagekit.io/docs/effects-and-enhancements#color-replace---cr). + sig { returns(T.nilable(String)) } + attr_reader :color_replace + + sig { params(color_replace: String).void } + attr_writer :color_replace + # Automatically enhances the contrast of an image (contrast stretch). See # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). sig do @@ -244,9 +264,25 @@ module Imagekitio sig { params(default_image: String).void } attr_writer :default_image + # Distorts the shape of an image. Supports two modes: + # + # - Perspective distortion: `p-x1_y1_x2_y2_x3_y3_x4_y4` changes the position of + # the four corners starting clockwise from top-left. + # - Arc distortion: `a-degrees` curves the image upwards (positive values) or + # downwards (negative values). See + # [Distort effect](https://imagekit.io/docs/effects-and-enhancements#distort---e-distort). + sig { returns(T.nilable(String)) } + attr_reader :distort + + sig { params(distort: String).void } + attr_writer :distort + # Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio - # (DPR) calculation. See - # [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). + # (DPR) calculation. Also accepts arithmetic expressions. + # + # - Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). sig { returns(T.nilable(Float)) } attr_reader :dpr @@ -431,13 +467,18 @@ module Imagekitio sig { params(quality: Float).void } attr_writer :quality - # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular - # or oval shape. See - # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). - sig { returns(T.nilable(T.any(Float, Symbol))) } + # Specifies the corner radius for rounded corners. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + sig { returns(T.nilable(T.any(Float, Symbol, String))) } attr_reader :radius - sig { params(radius: T.any(Float, Symbol)).void } + sig { params(radius: T.any(Float, Symbol, String)).void } attr_writer :radius # Pass any transformation not directly supported by the SDK. This transformation @@ -624,11 +665,13 @@ module Imagekitio blur: Float, border: String, color_profile: T::Boolean, + color_replace: String, contrast_stretch: Imagekitio::Transformation::ContrastStretch::OrBoolean, crop: Imagekitio::Transformation::Crop::OrSymbol, crop_mode: Imagekitio::Transformation::CropMode::OrSymbol, default_image: String, + distort: String, dpr: Float, duration: Imagekitio::Transformation::Duration::Variants, end_offset: Imagekitio::Transformation::EndOffset::Variants, @@ -647,7 +690,7 @@ module Imagekitio page: Imagekitio::Transformation::Page::Variants, progressive: T::Boolean, quality: Float, - radius: T.any(Float, Symbol), + radius: T.any(Float, Symbol, String), raw: String, rotation: Imagekitio::Transformation::Rotation::Variants, shadow: T.any(T::Boolean, String), @@ -719,6 +762,12 @@ module Imagekitio # # - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See # [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background). + # - Dominant color: `dominant` extracts the dominant color from the image. See + # [Dominant color background](https://imagekit.io/docs/effects-and-enhancements#dominant-color-background). + # - Gradient: `gradient_dominant` or `gradient_dominant_2` creates a gradient + # using the dominant colors. Optionally specify palette size (2 or 4), e.g., + # `gradient_dominant_4`. See + # [Gradient background](https://imagekit.io/docs/effects-and-enhancements#gradient-background). # - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See # [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background). # - Expand the image boundaries using generative fill: `genfill`. Not supported @@ -739,6 +788,15 @@ module Imagekitio # Indicates whether the output image should retain the original color profile. See # [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). color_profile: nil, + # Replaces colors in the image. Supports three formats: + # + # - `toColor` - Replace dominant color with the specified color. + # - `toColor_tolerance` - Replace dominant color with specified tolerance (0-100). + # - `toColor_tolerance_fromColor` - Replace a specific color with another within + # tolerance range. Colors can be hex codes (e.g., `FF0022`) or names (e.g., + # `red`, `blue`). See + # [Color replacement](https://imagekit.io/docs/effects-and-enhancements#color-replace---cr). + color_replace: nil, # Automatically enhances the contrast of an image (contrast stretch). See # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). contrast_stretch: nil, @@ -752,9 +810,20 @@ module Imagekitio # path. See # [Default image](https://imagekit.io/docs/image-transformation#default-image---di). default_image: nil, + # Distorts the shape of an image. Supports two modes: + # + # - Perspective distortion: `p-x1_y1_x2_y2_x3_y3_x4_y4` changes the position of + # the four corners starting clockwise from top-left. + # - Arc distortion: `a-degrees` curves the image upwards (positive values) or + # downwards (negative values). See + # [Distort effect](https://imagekit.io/docs/effects-and-enhancements#distort---e-distort). + distort: nil, # Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio - # (DPR) calculation. See - # [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). + # (DPR) calculation. Also accepts arithmetic expressions. + # + # - Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). dpr: nil, # Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. # Typically used with startOffset to indicate the length from the start offset. @@ -839,9 +908,14 @@ module Imagekitio # quality, while a lower value produces a smaller file size with reduced quality. # See [Quality](https://imagekit.io/docs/image-optimization#quality---q). quality: nil, - # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular - # or oval shape. See - # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius for rounded corners. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). radius: nil, # Pass any transformation not directly supported by the SDK. This transformation # string is appended to the URL as provided. @@ -925,11 +999,13 @@ module Imagekitio blur: Float, border: String, color_profile: T::Boolean, + color_replace: String, contrast_stretch: Imagekitio::Transformation::ContrastStretch::OrBoolean, crop: Imagekitio::Transformation::Crop::OrSymbol, crop_mode: Imagekitio::Transformation::CropMode::OrSymbol, default_image: String, + distort: String, dpr: Float, duration: Imagekitio::Transformation::Duration::Variants, end_offset: Imagekitio::Transformation::EndOffset::Variants, @@ -948,7 +1024,7 @@ module Imagekitio page: Imagekitio::Transformation::Page::Variants, progressive: T::Boolean, quality: Float, - radius: T.any(Float, Symbol), + radius: T.any(Float, Symbol, String), raw: String, rotation: Imagekitio::Transformation::Rotation::Variants, shadow: T.any(T::Boolean, String), @@ -1417,13 +1493,18 @@ module Imagekitio end end - # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular - # or oval shape. See - # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # Specifies the corner radius for rounded corners. + # + # - Single value (positive integer): Applied to all corners (e.g., `20`). + # - `max`: Creates a circular or oval shape. + # - Per-corner array: Provide four underscore-separated values representing + # top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., + # `10_20_30_40`). See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). module Radius extend Imagekitio::Internal::Type::Union - Variants = T.type_alias { T.any(Float, Symbol) } + Variants = T.type_alias { T.any(Float, Symbol, String) } sig do override.returns( diff --git a/rbi/imagekitio/models/update_file_request.rbi b/rbi/imagekitio/models/update_file_request.rbi index 3a818c9..a2ad206 100644 --- a/rbi/imagekitio/models/update_file_request.rbi +++ b/rbi/imagekitio/models/update_file_request.rbi @@ -53,6 +53,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg, Imagekitio::ExtensionItem::AIAutoDescription, + Imagekitio::ExtensionItem::AITasks, + Imagekitio::ExtensionItem::SavedExtension, Imagekitio::ExtensionItem::AutoTaggingExtension ) ] @@ -68,6 +70,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ] @@ -114,6 +118,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ], @@ -166,6 +172,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg, Imagekitio::ExtensionItem::AIAutoDescription, + Imagekitio::ExtensionItem::AITasks, + Imagekitio::ExtensionItem::SavedExtension, Imagekitio::ExtensionItem::AutoTaggingExtension ) ], diff --git a/rbi/imagekitio/models/upload_pre_transform_success_event.rbi b/rbi/imagekitio/models/upload_pre_transform_success_event.rbi index f989dd6..d20ff55 100644 --- a/rbi/imagekitio/models/upload_pre_transform_success_event.rbi +++ b/rbi/imagekitio/models/upload_pre_transform_success_event.rbi @@ -583,6 +583,23 @@ module Imagekitio end attr_writer :ai_auto_description + sig do + returns( + T.nilable( + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::TaggedSymbol + ) + ) + end + attr_reader :ai_tasks + + sig do + params( + ai_tasks: + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::OrSymbol + ).void + end + attr_writer :ai_tasks + sig do returns( T.nilable( @@ -647,6 +664,8 @@ module Imagekitio params( ai_auto_description: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::OrSymbol, + ai_tasks: + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::OrSymbol, aws_auto_tagging: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::OrSymbol, google_auto_tagging: @@ -657,6 +676,7 @@ module Imagekitio end def self.new( ai_auto_description: nil, + ai_tasks: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil @@ -668,6 +688,8 @@ module Imagekitio { ai_auto_description: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::TaggedSymbol, + ai_tasks: + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::TaggedSymbol, aws_auto_tagging: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::TaggedSymbol, google_auto_tagging: @@ -719,6 +741,45 @@ module Imagekitio end end + module AITasks + extend Imagekitio::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AITasks::TaggedSymbol + ] + ) + end + def self.values + end + end + module AwsAutoTagging extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/models/video_overlay.rbi b/rbi/imagekitio/models/video_overlay.rbi index 14469c2..5b64d5f 100644 --- a/rbi/imagekitio/models/video_overlay.rbi +++ b/rbi/imagekitio/models/video_overlay.rbi @@ -20,6 +20,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. sig { returns(T.nilable(Imagekitio::VideoOverlay::Encoding::OrSymbol)) } attr_reader :encoding @@ -53,6 +59,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. encoding: nil, # Array of transformation to be applied to the overlay video. Except # `streamingResolutions`, all other video transformations are supported. See @@ -80,6 +92,12 @@ module Imagekitio # format automatically. To always use base64 encoding (`ie-{base64}`), set this # parameter to `base64`. To always use plain text (`i-{input}`), set it to # `plain`. + # + # Regardless of the encoding method: + # + # - Leading and trailing slashes are removed. + # - Remaining slashes within the path are replaced with `@@` when using plain + # text. module Encoding extend Imagekitio::Internal::Type::Enum diff --git a/rbi/imagekitio/resources/beta/v2/files.rbi b/rbi/imagekitio/resources/beta/v2/files.rbi index 3991c1e..1a8bba3 100644 --- a/rbi/imagekitio/resources/beta/v2/files.rbi +++ b/rbi/imagekitio/resources/beta/v2/files.rbi @@ -46,6 +46,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ], diff --git a/rbi/imagekitio/resources/files.rbi b/rbi/imagekitio/resources/files.rbi index d44448c..d8a7ec4 100644 --- a/rbi/imagekitio/resources/files.rbi +++ b/rbi/imagekitio/resources/files.rbi @@ -199,6 +199,8 @@ module Imagekitio T.any( Imagekitio::ExtensionItem::RemoveBg::OrHash, Imagekitio::ExtensionItem::AIAutoDescription::OrHash, + Imagekitio::ExtensionItem::AITasks::OrHash, + Imagekitio::ExtensionItem::SavedExtension::OrHash, Imagekitio::ExtensionItem::AutoTaggingExtension::OrHash ) ], diff --git a/rbi/imagekitio/resources/saved_extensions.rbi b/rbi/imagekitio/resources/saved_extensions.rbi new file mode 100644 index 0000000..0bf359b --- /dev/null +++ b/rbi/imagekitio/resources/saved_extensions.rbi @@ -0,0 +1,114 @@ +# typed: strong + +module Imagekitio + module Resources + class SavedExtensions + # This API creates a new saved extension. Saved extensions allow you to save + # complex extension configurations (like AI tasks) and reuse them by referencing + # the ID in upload or update file APIs. + # + # **Saved extension limit** \ + # You can create a maximum of 100 saved extensions per account. + sig do + params( + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg::OrHash, + Imagekitio::ExtensionConfig::AIAutoDescription::OrHash, + Imagekitio::ExtensionConfig::AITasks::OrHash, + Imagekitio::ExtensionConfig::AutoTaggingExtension::OrHash + ), + description: String, + name: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::SavedExtension) + end + def create( + # Configuration object for an extension (base extensions only, not saved extension + # references). + config:, + # Description of what the saved extension does. + description:, + # Name of the saved extension. + name:, + request_options: {} + ) + end + + # This API updates an existing saved extension. You can update the name, + # description, or config. + sig do + params( + id: String, + config: + T.any( + Imagekitio::ExtensionConfig::RemoveBg::OrHash, + Imagekitio::ExtensionConfig::AIAutoDescription::OrHash, + Imagekitio::ExtensionConfig::AITasks::OrHash, + Imagekitio::ExtensionConfig::AutoTaggingExtension::OrHash + ), + description: String, + name: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::SavedExtension) + end + def update( + # The unique ID of the saved extension. + id, + # Configuration object for an extension (base extensions only, not saved extension + # references). + config: nil, + # Updated description of the saved extension. + description: nil, + # Updated name of the saved extension. + name: nil, + request_options: {} + ) + end + + # This API returns an array of all saved extensions for your account. Saved + # extensions allow you to save complex extension configurations and reuse them by + # referencing them by ID in upload or update file APIs. + sig do + params(request_options: Imagekitio::RequestOptions::OrHash).returns( + T::Array[Imagekitio::SavedExtension] + ) + end + def list(request_options: {}) + end + + # This API deletes a saved extension permanently. + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).void + end + def delete( + # The unique ID of the saved extension. + id, + request_options: {} + ) + end + + # This API returns details of a specific saved extension by ID. + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::SavedExtension) + end + def get( + # The unique ID of the saved extension. + id, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekitio::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/sig/imagekitio/client.rbs b/sig/imagekitio/client.rbs index 59c0568..216a8c6 100644 --- a/sig/imagekitio/client.rbs +++ b/sig/imagekitio/client.rbs @@ -16,6 +16,8 @@ module Imagekitio attr_reader files: Imagekitio::Resources::Files + attr_reader saved_extensions: Imagekitio::Resources::SavedExtensions + attr_reader assets: Imagekitio::Resources::Assets attr_reader cache: Imagekitio::Resources::Cache diff --git a/sig/imagekitio/internal/transport/base_client.rbs b/sig/imagekitio/internal/transport/base_client.rbs index 9ab9fe5..dfaab83 100644 --- a/sig/imagekitio/internal/transport/base_client.rbs +++ b/sig/imagekitio/internal/transport/base_client.rbs @@ -87,6 +87,8 @@ module Imagekitio private def auth_headers: -> ::Hash[String, String] + private def user_agent: -> String + private def generate_idempotency_key: -> String private def build_request: ( diff --git a/sig/imagekitio/internal/transport/pooled_net_requester.rbs b/sig/imagekitio/internal/transport/pooled_net_requester.rbs index 6ef7c00..801c5eb 100644 --- a/sig/imagekitio/internal/transport/pooled_net_requester.rbs +++ b/sig/imagekitio/internal/transport/pooled_net_requester.rbs @@ -17,7 +17,10 @@ module Imagekitio DEFAULT_MAX_CONNECTIONS: Integer - def self.connect: (URI::Generic url) -> top + def self.connect: ( + cert_store: OpenSSL::X509::Store, + url: URI::Generic + ) -> top def self.calibrate_socket_timeout: (top conn, Float deadline) -> void diff --git a/sig/imagekitio/models.rbs b/sig/imagekitio/models.rbs index 2bb9e2d..37031be 100644 --- a/sig/imagekitio/models.rbs +++ b/sig/imagekitio/models.rbs @@ -23,6 +23,8 @@ module Imagekitio type extension_item = Imagekitio::Models::extension_item + module ExtensionConfig = Imagekitio::Models::ExtensionConfig + Extensions: Imagekitio::Internal::Type::Converter class File = Imagekitio::Models::File @@ -71,6 +73,18 @@ module Imagekitio class ResponsiveImageAttributes = Imagekitio::Models::ResponsiveImageAttributes + class SavedExtension = Imagekitio::Models::SavedExtension + + class SavedExtensionCreateParams = Imagekitio::Models::SavedExtensionCreateParams + + class SavedExtensionDeleteParams = Imagekitio::Models::SavedExtensionDeleteParams + + class SavedExtensionGetParams = Imagekitio::Models::SavedExtensionGetParams + + class SavedExtensionListParams = Imagekitio::Models::SavedExtensionListParams + + class SavedExtensionUpdateParams = Imagekitio::Models::SavedExtensionUpdateParams + class SolidColorOverlay = Imagekitio::Models::SolidColorOverlay class SolidColorOverlayTransformation = Imagekitio::Models::SolidColorOverlayTransformation diff --git a/sig/imagekitio/models/base_overlay.rbs b/sig/imagekitio/models/base_overlay.rbs index 04461b0..6146710 100644 --- a/sig/imagekitio/models/base_overlay.rbs +++ b/sig/imagekitio/models/base_overlay.rbs @@ -2,11 +2,18 @@ module Imagekitio module Models type base_overlay = { + layer_mode: Imagekitio::Models::BaseOverlay::layer_mode, position: Imagekitio::OverlayPosition, timing: Imagekitio::OverlayTiming } class BaseOverlay < Imagekitio::Internal::Type::BaseModel + attr_reader layer_mode: Imagekitio::Models::BaseOverlay::layer_mode? + + def layer_mode=: ( + Imagekitio::Models::BaseOverlay::layer_mode + ) -> Imagekitio::Models::BaseOverlay::layer_mode + attr_reader position: Imagekitio::OverlayPosition? def position=: ( @@ -18,14 +25,29 @@ module Imagekitio def timing=: (Imagekitio::OverlayTiming) -> Imagekitio::OverlayTiming def initialize: ( + ?layer_mode: Imagekitio::Models::BaseOverlay::layer_mode, ?position: Imagekitio::OverlayPosition, ?timing: Imagekitio::OverlayTiming ) -> void def to_hash: -> { + layer_mode: Imagekitio::Models::BaseOverlay::layer_mode, position: Imagekitio::OverlayPosition, timing: Imagekitio::OverlayTiming } + + type layer_mode = :multiply | :cutter | :cutout | :displace + + module LayerMode + extend Imagekitio::Internal::Type::Enum + + MULTIPLY: :multiply + CUTTER: :cutter + CUTOUT: :cutout + DISPLACE: :displace + + def self?.values: -> ::Array[Imagekitio::Models::BaseOverlay::layer_mode] + end end end end diff --git a/sig/imagekitio/models/beta/v2/file_upload_response.rbs b/sig/imagekitio/models/beta/v2/file_upload_response.rbs index 3a4f392..f552c5a 100644 --- a/sig/imagekitio/models/beta/v2/file_upload_response.rbs +++ b/sig/imagekitio/models/beta/v2/file_upload_response.rbs @@ -215,6 +215,7 @@ module Imagekitio type extension_status = { ai_auto_description: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg @@ -227,6 +228,12 @@ module Imagekitio Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description ) -> Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description + attr_reader ai_tasks: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_tasks? + + def ai_tasks=: ( + Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_tasks + ) -> Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_tasks + attr_reader aws_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging? def aws_auto_tagging=: ( @@ -247,6 +254,7 @@ module Imagekitio def initialize: ( ?ai_auto_description: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description, + ?ai_tasks: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_tasks, ?aws_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging, ?google_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging, ?remove_bg: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg @@ -254,6 +262,7 @@ module Imagekitio def to_hash: -> { ai_auto_description: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg @@ -271,6 +280,18 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description] end + type ai_tasks = :success | :pending | :failed + + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_tasks] + end + type aws_auto_tagging = :success | :pending | :failed module AwsAutoTagging diff --git a/sig/imagekitio/models/extension_config.rbs b/sig/imagekitio/models/extension_config.rbs new file mode 100644 index 0000000..6d73816 --- /dev/null +++ b/sig/imagekitio/models/extension_config.rbs @@ -0,0 +1,604 @@ +module Imagekitio + module Models + type extension_config = + Imagekitio::ExtensionConfig::RemoveBg + | Imagekitio::ExtensionConfig::AIAutoDescription + | Imagekitio::ExtensionConfig::AITasks + | Imagekitio::ExtensionConfig::AutoTaggingExtension + + module ExtensionConfig + extend Imagekitio::Internal::Type::Union + + type remove_bg = + { + name: :"remove-bg", + options: Imagekitio::ExtensionConfig::RemoveBg::Options + } + + class RemoveBg < Imagekitio::Internal::Type::BaseModel + attr_accessor name: :"remove-bg" + + attr_reader options: Imagekitio::ExtensionConfig::RemoveBg::Options? + + def options=: ( + Imagekitio::ExtensionConfig::RemoveBg::Options + ) -> Imagekitio::ExtensionConfig::RemoveBg::Options + + def initialize: ( + ?options: Imagekitio::ExtensionConfig::RemoveBg::Options, + ?name: :"remove-bg" + ) -> void + + def to_hash: -> { + name: :"remove-bg", + options: Imagekitio::ExtensionConfig::RemoveBg::Options + } + + type options = + { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + + class Options < Imagekitio::Internal::Type::BaseModel + attr_reader add_shadow: bool? + + def add_shadow=: (bool) -> bool + + attr_reader bg_color: String? + + def bg_color=: (String) -> String + + attr_reader bg_image_url: String? + + def bg_image_url=: (String) -> String + + attr_reader semitransparency: bool? + + def semitransparency=: (bool) -> bool + + def initialize: ( + ?add_shadow: bool, + ?bg_color: String, + ?bg_image_url: String, + ?semitransparency: bool + ) -> void + + def to_hash: -> { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + end + end + + type auto_tagging_extension = + { + max_tags: Integer, + min_confidence: Integer, + name: Imagekitio::Models::ExtensionConfig::AutoTaggingExtension::name_ + } + + class AutoTaggingExtension < Imagekitio::Internal::Type::BaseModel + attr_accessor max_tags: Integer + + attr_accessor min_confidence: Integer + + attr_accessor name: Imagekitio::Models::ExtensionConfig::AutoTaggingExtension::name_ + + def initialize: ( + max_tags: Integer, + min_confidence: Integer, + name: Imagekitio::Models::ExtensionConfig::AutoTaggingExtension::name_ + ) -> void + + def to_hash: -> { + max_tags: Integer, + min_confidence: Integer, + name: Imagekitio::Models::ExtensionConfig::AutoTaggingExtension::name_ + } + + type name_ = :"google-auto-tagging" | :"aws-auto-tagging" + + module Name + extend Imagekitio::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING: :"google-auto-tagging" + AWS_AUTO_TAGGING: :"aws-auto-tagging" + + def self?.values: -> ::Array[Imagekitio::Models::ExtensionConfig::AutoTaggingExtension::name_] + end + end + + type ai_auto_description = { name: :"ai-auto-description" } + + class AIAutoDescription < Imagekitio::Internal::Type::BaseModel + attr_accessor name: :"ai-auto-description" + + def initialize: (?name: :"ai-auto-description") -> void + + def to_hash: -> { name: :"ai-auto-description" } + end + + type ai_tasks = + { + name: :"ai-tasks", + tasks: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::task] + } + + class AITasks < Imagekitio::Internal::Type::BaseModel + attr_accessor name: :"ai-tasks" + + attr_accessor tasks: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::task] + + def initialize: ( + tasks: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::task], + ?name: :"ai-tasks" + ) -> void + + def to_hash: -> { + name: :"ai-tasks", + tasks: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::task] + } + + type task = + Imagekitio::ExtensionConfig::AITasks::Task::SelectTags + | Imagekitio::ExtensionConfig::AITasks::Task::SelectMetadata + | Imagekitio::ExtensionConfig::AITasks::Task::YesNo + + module Task + extend Imagekitio::Internal::Type::Union + + type select_tags = + { + instruction: String, + type: :select_tags, + vocabulary: ::Array[String], + max_selections: Integer, + min_selections: Integer + } + + class SelectTags < Imagekitio::Internal::Type::BaseModel + attr_accessor instruction: String + + attr_accessor type: :select_tags + + attr_accessor vocabulary: ::Array[String] + + attr_reader max_selections: Integer? + + def max_selections=: (Integer) -> Integer + + attr_reader min_selections: Integer? + + def min_selections=: (Integer) -> Integer + + def initialize: ( + instruction: String, + vocabulary: ::Array[String], + ?max_selections: Integer, + ?min_selections: Integer, + ?type: :select_tags + ) -> void + + def to_hash: -> { + instruction: String, + type: :select_tags, + vocabulary: ::Array[String], + max_selections: Integer, + min_selections: Integer + } + end + + type select_metadata = + { + field: String, + instruction: String, + type: :select_metadata, + max_selections: Integer, + min_selections: Integer, + vocabulary: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata::vocabulary] + } + + class SelectMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor instruction: String + + attr_accessor type: :select_metadata + + attr_reader max_selections: Integer? + + def max_selections=: (Integer) -> Integer + + attr_reader min_selections: Integer? + + def min_selections=: (Integer) -> Integer + + attr_reader vocabulary: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata::vocabulary]? + + def vocabulary=: ( + ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata::vocabulary] + ) -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata::vocabulary] + + def initialize: ( + field: String, + instruction: String, + ?max_selections: Integer, + ?min_selections: Integer, + ?vocabulary: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata::vocabulary], + ?type: :select_metadata + ) -> void + + def to_hash: -> { + field: String, + instruction: String, + type: :select_metadata, + max_selections: Integer, + min_selections: Integer, + vocabulary: ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata::vocabulary] + } + + type vocabulary = String | Float | bool + + module Vocabulary + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::SelectMetadata::vocabulary] + end + end + + type yes_no = + { + instruction: String, + type: :yes_no, + on_no: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo, + on_unknown: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown, + on_yes: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes + } + + class YesNo < Imagekitio::Internal::Type::BaseModel + attr_accessor instruction: String + + attr_accessor type: :yes_no + + attr_reader on_no: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo? + + def on_no=: ( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo + ) -> Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo + + attr_reader on_unknown: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown? + + def on_unknown=: ( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown + ) -> Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown + + attr_reader on_yes: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes? + + def on_yes=: ( + Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes + ) -> Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes + + def initialize: ( + instruction: String, + ?on_no: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo, + ?on_unknown: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown, + ?on_yes: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes, + ?type: :yes_no + ) -> void + + def to_hash: -> { + instruction: String, + type: :yes_no, + on_no: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo, + on_unknown: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown, + on_yes: Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes + } + + type on_no = + { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata] + } + + class OnNo < Imagekitio::Internal::Type::BaseModel + attr_reader add_tags: ::Array[String]? + + def add_tags=: (::Array[String]) -> ::Array[String] + + attr_reader remove_tags: ::Array[String]? + + def remove_tags=: (::Array[String]) -> ::Array[String] + + attr_reader set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata]? + + def set_metadata=: ( + ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata] + ) -> ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata] + + attr_reader unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata]? + + def unset_metadata=: ( + ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata] + ) -> ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata] + + def initialize: ( + ?add_tags: ::Array[String], + ?remove_tags: ::Array[String], + ?set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata], + ?unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata] + ) -> void + + def to_hash: -> { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnNo::UnsetMetadata] + } + + type set_metadata = + { + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::value + } + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::value + + def initialize: ( + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::value + ) -> void + + def to_hash: -> { + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::value + } + + type value = + String + | Float + | bool + | ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::mixed] + + module Value + extend Imagekitio::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::Value::mixed] + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnNo::SetMetadata::value] + + MixedArray: Imagekitio::Internal::Type::Converter + end + end + + type unset_metadata = { field: String } + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + def initialize: (field: String) -> void + + def to_hash: -> { field: String } + end + end + + type on_unknown = + { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + } + + class OnUnknown < Imagekitio::Internal::Type::BaseModel + attr_reader add_tags: ::Array[String]? + + def add_tags=: (::Array[String]) -> ::Array[String] + + attr_reader remove_tags: ::Array[String]? + + def remove_tags=: (::Array[String]) -> ::Array[String] + + attr_reader set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata]? + + def set_metadata=: ( + ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata] + ) -> ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata] + + attr_reader unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata]? + + def unset_metadata=: ( + ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + ) -> ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + + def initialize: ( + ?add_tags: ::Array[String], + ?remove_tags: ::Array[String], + ?set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata], + ?unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + ) -> void + + def to_hash: -> { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + } + + type set_metadata = + { + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + } + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + + def initialize: ( + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + ) -> void + + def to_hash: -> { + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + } + + type value = + String + | Float + | bool + | ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::mixed] + + module Value + extend Imagekitio::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::mixed] + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnUnknown::SetMetadata::value] + + MixedArray: Imagekitio::Internal::Type::Converter + end + end + + type unset_metadata = { field: String } + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + def initialize: (field: String) -> void + + def to_hash: -> { field: String } + end + end + + type on_yes = + { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata] + } + + class OnYes < Imagekitio::Internal::Type::BaseModel + attr_reader add_tags: ::Array[String]? + + def add_tags=: (::Array[String]) -> ::Array[String] + + attr_reader remove_tags: ::Array[String]? + + def remove_tags=: (::Array[String]) -> ::Array[String] + + attr_reader set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata]? + + def set_metadata=: ( + ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata] + ) -> ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata] + + attr_reader unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata]? + + def unset_metadata=: ( + ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata] + ) -> ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata] + + def initialize: ( + ?add_tags: ::Array[String], + ?remove_tags: ::Array[String], + ?set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata], + ?unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata] + ) -> void + + def to_hash: -> { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionConfig::AITasks::Task::YesNo::OnYes::UnsetMetadata] + } + + type set_metadata = + { + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::value + } + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::value + + def initialize: ( + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::value + ) -> void + + def to_hash: -> { + field: String, + value: Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::value + } + + type value = + String + | Float + | bool + | ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::mixed] + + module Value + extend Imagekitio::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::Value::mixed] + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::Task::YesNo::OnYes::SetMetadata::value] + + MixedArray: Imagekitio::Internal::Type::Converter + end + end + + type unset_metadata = { field: String } + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + def initialize: (field: String) -> void + + def to_hash: -> { field: String } + end + end + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionConfig::AITasks::task] + end + end + + def self?.variants: -> ::Array[Imagekitio::Models::extension_config] + end + end +end diff --git a/sig/imagekitio/models/extensions.rbs b/sig/imagekitio/models/extensions.rbs index 00a0c4c..746d0bf 100644 --- a/sig/imagekitio/models/extensions.rbs +++ b/sig/imagekitio/models/extensions.rbs @@ -3,6 +3,8 @@ module Imagekitio type extension_item = ExtensionItem::RemoveBg | ExtensionItem::AIAutoDescription + | ExtensionItem::AITasks + | ExtensionItem::SavedExtension | ExtensionItem::AutoTaggingExtension module ExtensionItem @@ -122,6 +124,493 @@ module Imagekitio def to_hash: -> { name: :"ai-auto-description" } end + type ai_tasks = + { + name: :"ai-tasks", + tasks: ::Array[Imagekitio::Models::ExtensionItem::AITasks::task] + } + + class AITasks < Imagekitio::Internal::Type::BaseModel + attr_accessor name: :"ai-tasks" + + attr_accessor tasks: ::Array[Imagekitio::Models::ExtensionItem::AITasks::task] + + def initialize: ( + tasks: ::Array[Imagekitio::Models::ExtensionItem::AITasks::task], + ?name: :"ai-tasks" + ) -> void + + def to_hash: -> { + name: :"ai-tasks", + tasks: ::Array[Imagekitio::Models::ExtensionItem::AITasks::task] + } + + type task = + Imagekitio::ExtensionItem::AITasks::Task::SelectTags + | Imagekitio::ExtensionItem::AITasks::Task::SelectMetadata + | Imagekitio::ExtensionItem::AITasks::Task::YesNo + + module Task + extend Imagekitio::Internal::Type::Union + + type select_tags = + { + instruction: String, + type: :select_tags, + vocabulary: ::Array[String], + max_selections: Integer, + min_selections: Integer + } + + class SelectTags < Imagekitio::Internal::Type::BaseModel + attr_accessor instruction: String + + attr_accessor type: :select_tags + + attr_accessor vocabulary: ::Array[String] + + attr_reader max_selections: Integer? + + def max_selections=: (Integer) -> Integer + + attr_reader min_selections: Integer? + + def min_selections=: (Integer) -> Integer + + def initialize: ( + instruction: String, + vocabulary: ::Array[String], + ?max_selections: Integer, + ?min_selections: Integer, + ?type: :select_tags + ) -> void + + def to_hash: -> { + instruction: String, + type: :select_tags, + vocabulary: ::Array[String], + max_selections: Integer, + min_selections: Integer + } + end + + type select_metadata = + { + field: String, + instruction: String, + type: :select_metadata, + max_selections: Integer, + min_selections: Integer, + vocabulary: ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata::vocabulary] + } + + class SelectMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor instruction: String + + attr_accessor type: :select_metadata + + attr_reader max_selections: Integer? + + def max_selections=: (Integer) -> Integer + + attr_reader min_selections: Integer? + + def min_selections=: (Integer) -> Integer + + attr_reader vocabulary: ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata::vocabulary]? + + def vocabulary=: ( + ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata::vocabulary] + ) -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata::vocabulary] + + def initialize: ( + field: String, + instruction: String, + ?max_selections: Integer, + ?min_selections: Integer, + ?vocabulary: ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata::vocabulary], + ?type: :select_metadata + ) -> void + + def to_hash: -> { + field: String, + instruction: String, + type: :select_metadata, + max_selections: Integer, + min_selections: Integer, + vocabulary: ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata::vocabulary] + } + + type vocabulary = String | Float | bool + + module Vocabulary + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::SelectMetadata::vocabulary] + end + end + + type yes_no = + { + instruction: String, + type: :yes_no, + on_no: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo, + on_unknown: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown, + on_yes: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes + } + + class YesNo < Imagekitio::Internal::Type::BaseModel + attr_accessor instruction: String + + attr_accessor type: :yes_no + + attr_reader on_no: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo? + + def on_no=: ( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo + ) -> Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo + + attr_reader on_unknown: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown? + + def on_unknown=: ( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown + ) -> Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown + + attr_reader on_yes: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes? + + def on_yes=: ( + Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes + ) -> Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes + + def initialize: ( + instruction: String, + ?on_no: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo, + ?on_unknown: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown, + ?on_yes: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes, + ?type: :yes_no + ) -> void + + def to_hash: -> { + instruction: String, + type: :yes_no, + on_no: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo, + on_unknown: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown, + on_yes: Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes + } + + type on_no = + { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata] + } + + class OnNo < Imagekitio::Internal::Type::BaseModel + attr_reader add_tags: ::Array[String]? + + def add_tags=: (::Array[String]) -> ::Array[String] + + attr_reader remove_tags: ::Array[String]? + + def remove_tags=: (::Array[String]) -> ::Array[String] + + attr_reader set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata]? + + def set_metadata=: ( + ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata] + ) -> ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata] + + attr_reader unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata]? + + def unset_metadata=: ( + ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata] + ) -> ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata] + + def initialize: ( + ?add_tags: ::Array[String], + ?remove_tags: ::Array[String], + ?set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata], + ?unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata] + ) -> void + + def to_hash: -> { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnNo::UnsetMetadata] + } + + type set_metadata = + { + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::value + } + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::value + + def initialize: ( + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::value + ) -> void + + def to_hash: -> { + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::value + } + + type value = + String + | Float + | bool + | ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::mixed] + + module Value + extend Imagekitio::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::Value::mixed] + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnNo::SetMetadata::value] + + MixedArray: Imagekitio::Internal::Type::Converter + end + end + + type unset_metadata = { field: String } + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + def initialize: (field: String) -> void + + def to_hash: -> { field: String } + end + end + + type on_unknown = + { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + } + + class OnUnknown < Imagekitio::Internal::Type::BaseModel + attr_reader add_tags: ::Array[String]? + + def add_tags=: (::Array[String]) -> ::Array[String] + + attr_reader remove_tags: ::Array[String]? + + def remove_tags=: (::Array[String]) -> ::Array[String] + + attr_reader set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata]? + + def set_metadata=: ( + ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata] + ) -> ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata] + + attr_reader unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata]? + + def unset_metadata=: ( + ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + ) -> ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + + def initialize: ( + ?add_tags: ::Array[String], + ?remove_tags: ::Array[String], + ?set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata], + ?unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + ) -> void + + def to_hash: -> { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnUnknown::UnsetMetadata] + } + + type set_metadata = + { + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + } + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + + def initialize: ( + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + ) -> void + + def to_hash: -> { + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::value + } + + type value = + String + | Float + | bool + | ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::mixed] + + module Value + extend Imagekitio::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::Value::mixed] + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnUnknown::SetMetadata::value] + + MixedArray: Imagekitio::Internal::Type::Converter + end + end + + type unset_metadata = { field: String } + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + def initialize: (field: String) -> void + + def to_hash: -> { field: String } + end + end + + type on_yes = + { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata] + } + + class OnYes < Imagekitio::Internal::Type::BaseModel + attr_reader add_tags: ::Array[String]? + + def add_tags=: (::Array[String]) -> ::Array[String] + + attr_reader remove_tags: ::Array[String]? + + def remove_tags=: (::Array[String]) -> ::Array[String] + + attr_reader set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata]? + + def set_metadata=: ( + ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata] + ) -> ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata] + + attr_reader unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata]? + + def unset_metadata=: ( + ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata] + ) -> ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata] + + def initialize: ( + ?add_tags: ::Array[String], + ?remove_tags: ::Array[String], + ?set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata], + ?unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata] + ) -> void + + def to_hash: -> { + add_tags: ::Array[String], + remove_tags: ::Array[String], + set_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata], + unset_metadata: ::Array[Imagekitio::ExtensionItem::AITasks::Task::YesNo::OnYes::UnsetMetadata] + } + + type set_metadata = + { + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::value + } + + class SetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + attr_accessor value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::value + + def initialize: ( + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::value + ) -> void + + def to_hash: -> { + field: String, + value: Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::value + } + + type value = + String + | Float + | bool + | ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::mixed] + + module Value + extend Imagekitio::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::Value::mixed] + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::Task::YesNo::OnYes::SetMetadata::value] + + MixedArray: Imagekitio::Internal::Type::Converter + end + end + + type unset_metadata = { field: String } + + class UnsetMetadata < Imagekitio::Internal::Type::BaseModel + attr_accessor field: String + + def initialize: (field: String) -> void + + def to_hash: -> { field: String } + end + end + end + + def self?.variants: -> ::Array[Imagekitio::Models::ExtensionItem::AITasks::task] + end + end + + type saved_extension = { id: String, name: :"saved-extension" } + + class SavedExtension < Imagekitio::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor name: :"saved-extension" + + def initialize: (id: String, ?name: :"saved-extension") -> void + + def to_hash: -> { id: String, name: :"saved-extension" } + end + def self?.variants: -> ::Array[Imagekitio::Models::extension_item] end diff --git a/sig/imagekitio/models/file_update_response.rbs b/sig/imagekitio/models/file_update_response.rbs index 8086d9a..038cf9c 100644 --- a/sig/imagekitio/models/file_update_response.rbs +++ b/sig/imagekitio/models/file_update_response.rbs @@ -23,6 +23,7 @@ module Imagekitio type extension_status = { ai_auto_description: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::remove_bg @@ -35,6 +36,12 @@ module Imagekitio Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description ) -> Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description + attr_reader ai_tasks: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_tasks? + + def ai_tasks=: ( + Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_tasks + ) -> Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_tasks + attr_reader aws_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging? def aws_auto_tagging=: ( @@ -55,6 +62,7 @@ module Imagekitio def initialize: ( ?ai_auto_description: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description, + ?ai_tasks: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_tasks, ?aws_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging, ?google_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging, ?remove_bg: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::remove_bg @@ -62,6 +70,7 @@ module Imagekitio def to_hash: -> { ai_auto_description: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::FileUpdateResponse::ExtensionStatus::remove_bg @@ -79,6 +88,18 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description] end + type ai_tasks = :success | :pending | :failed + + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekitio::Models::FileUpdateResponse::ExtensionStatus::ai_tasks] + end + type aws_auto_tagging = :success | :pending | :failed module AwsAutoTagging diff --git a/sig/imagekitio/models/file_upload_response.rbs b/sig/imagekitio/models/file_upload_response.rbs index b94fc13..abb9c68 100644 --- a/sig/imagekitio/models/file_upload_response.rbs +++ b/sig/imagekitio/models/file_upload_response.rbs @@ -213,6 +213,7 @@ module Imagekitio type extension_status = { ai_auto_description: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::FileUploadResponse::ExtensionStatus::remove_bg @@ -225,6 +226,12 @@ module Imagekitio Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_auto_description ) -> Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_auto_description + attr_reader ai_tasks: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_tasks? + + def ai_tasks=: ( + Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_tasks + ) -> Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_tasks + attr_reader aws_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging? def aws_auto_tagging=: ( @@ -245,6 +252,7 @@ module Imagekitio def initialize: ( ?ai_auto_description: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_auto_description, + ?ai_tasks: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_tasks, ?aws_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging, ?google_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging, ?remove_bg: Imagekitio::Models::FileUploadResponse::ExtensionStatus::remove_bg @@ -252,6 +260,7 @@ module Imagekitio def to_hash: -> { ai_auto_description: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::FileUploadResponse::ExtensionStatus::remove_bg @@ -269,6 +278,18 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_auto_description] end + type ai_tasks = :success | :pending | :failed + + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_tasks] + end + type aws_auto_tagging = :success | :pending | :failed module AwsAutoTagging diff --git a/sig/imagekitio/models/saved_extension.rbs b/sig/imagekitio/models/saved_extension.rbs new file mode 100644 index 0000000..ad3736b --- /dev/null +++ b/sig/imagekitio/models/saved_extension.rbs @@ -0,0 +1,59 @@ +module Imagekitio + module Models + type saved_extension = + { + id: String, + config: Imagekitio::Models::extension_config, + created_at: Time, + description: String, + name: String, + updated_at: Time + } + + class SavedExtension < Imagekitio::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + attr_reader config: Imagekitio::Models::extension_config? + + def config=: ( + Imagekitio::Models::extension_config + ) -> Imagekitio::Models::extension_config + + attr_reader created_at: Time? + + def created_at=: (Time) -> Time + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader updated_at: Time? + + def updated_at=: (Time) -> Time + + def initialize: ( + ?id: String, + ?config: Imagekitio::Models::extension_config, + ?created_at: Time, + ?description: String, + ?name: String, + ?updated_at: Time + ) -> void + + def to_hash: -> { + id: String, + config: Imagekitio::Models::extension_config, + created_at: Time, + description: String, + name: String, + updated_at: Time + } + end + end +end diff --git a/sig/imagekitio/models/saved_extension_create_params.rbs b/sig/imagekitio/models/saved_extension_create_params.rbs new file mode 100644 index 0000000..6f2590a --- /dev/null +++ b/sig/imagekitio/models/saved_extension_create_params.rbs @@ -0,0 +1,36 @@ +module Imagekitio + module Models + type saved_extension_create_params = + { + config: Imagekitio::Models::extension_config, + description: String, + name: String + } + & Imagekitio::Internal::Type::request_parameters + + class SavedExtensionCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor config: Imagekitio::Models::extension_config + + attr_accessor description: String + + attr_accessor name: String + + def initialize: ( + config: Imagekitio::Models::extension_config, + description: String, + name: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + config: Imagekitio::Models::extension_config, + description: String, + name: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/saved_extension_delete_params.rbs b/sig/imagekitio/models/saved_extension_delete_params.rbs new file mode 100644 index 0000000..2c88e22 --- /dev/null +++ b/sig/imagekitio/models/saved_extension_delete_params.rbs @@ -0,0 +1,15 @@ +module Imagekitio + module Models + type saved_extension_delete_params = + { } & Imagekitio::Internal::Type::request_parameters + + class SavedExtensionDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekitio::request_opts) -> void + + def to_hash: -> { request_options: Imagekitio::RequestOptions } + end + end +end diff --git a/sig/imagekitio/models/saved_extension_get_params.rbs b/sig/imagekitio/models/saved_extension_get_params.rbs new file mode 100644 index 0000000..7a6be9b --- /dev/null +++ b/sig/imagekitio/models/saved_extension_get_params.rbs @@ -0,0 +1,15 @@ +module Imagekitio + module Models + type saved_extension_get_params = + { } & Imagekitio::Internal::Type::request_parameters + + class SavedExtensionGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekitio::request_opts) -> void + + def to_hash: -> { request_options: Imagekitio::RequestOptions } + end + end +end diff --git a/sig/imagekitio/models/saved_extension_list_params.rbs b/sig/imagekitio/models/saved_extension_list_params.rbs new file mode 100644 index 0000000..beb26b6 --- /dev/null +++ b/sig/imagekitio/models/saved_extension_list_params.rbs @@ -0,0 +1,15 @@ +module Imagekitio + module Models + type saved_extension_list_params = + { } & Imagekitio::Internal::Type::request_parameters + + class SavedExtensionListParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekitio::request_opts) -> void + + def to_hash: -> { request_options: Imagekitio::RequestOptions } + end + end +end diff --git a/sig/imagekitio/models/saved_extension_list_response.rbs b/sig/imagekitio/models/saved_extension_list_response.rbs new file mode 100644 index 0000000..88fd74c --- /dev/null +++ b/sig/imagekitio/models/saved_extension_list_response.rbs @@ -0,0 +1,7 @@ +module Imagekitio + module Models + type saved_extension_list_response = ::Array[Imagekitio::SavedExtension] + + SavedExtensionListResponse: Imagekitio::Internal::Type::Converter + end +end diff --git a/sig/imagekitio/models/saved_extension_update_params.rbs b/sig/imagekitio/models/saved_extension_update_params.rbs new file mode 100644 index 0000000..33dfa08 --- /dev/null +++ b/sig/imagekitio/models/saved_extension_update_params.rbs @@ -0,0 +1,44 @@ +module Imagekitio + module Models + type saved_extension_update_params = + { + config: Imagekitio::Models::extension_config, + description: String, + name: String + } + & Imagekitio::Internal::Type::request_parameters + + class SavedExtensionUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_reader config: Imagekitio::Models::extension_config? + + def config=: ( + Imagekitio::Models::extension_config + ) -> Imagekitio::Models::extension_config + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + def initialize: ( + ?config: Imagekitio::Models::extension_config, + ?description: String, + ?name: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + config: Imagekitio::Models::extension_config, + description: String, + name: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/solid_color_overlay_transformation.rbs b/sig/imagekitio/models/solid_color_overlay_transformation.rbs index a287767..ffce656 100644 --- a/sig/imagekitio/models/solid_color_overlay_transformation.rbs +++ b/sig/imagekitio/models/solid_color_overlay_transformation.rbs @@ -77,7 +77,7 @@ module Imagekitio def self?.variants: -> ::Array[Imagekitio::Models::SolidColorOverlayTransformation::height] end - type radius = Float | :max + type radius = Float | :max | String module Radius extend Imagekitio::Internal::Type::Union diff --git a/sig/imagekitio/models/text_overlay_transformation.rbs b/sig/imagekitio/models/text_overlay_transformation.rbs index ab82788..12bd97d 100644 --- a/sig/imagekitio/models/text_overlay_transformation.rbs +++ b/sig/imagekitio/models/text_overlay_transformation.rbs @@ -167,7 +167,7 @@ module Imagekitio def self?.variants: -> ::Array[Imagekitio::Models::TextOverlayTransformation::padding] end - type radius = Float | :max + type radius = Float | :max | String module Radius extend Imagekitio::Internal::Type::Union diff --git a/sig/imagekitio/models/transformation.rbs b/sig/imagekitio/models/transformation.rbs index 8b3f463..80be008 100644 --- a/sig/imagekitio/models/transformation.rbs +++ b/sig/imagekitio/models/transformation.rbs @@ -16,10 +16,12 @@ module Imagekitio blur: Float, border: String, color_profile: bool, + color_replace: String, contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch, crop: Imagekitio::Models::Transformation::crop, crop_mode: Imagekitio::Models::Transformation::crop_mode, default_image: String, + distort: String, dpr: Float, duration: Imagekitio::Models::Transformation::duration, end_offset: Imagekitio::Models::Transformation::end_offset, @@ -129,6 +131,10 @@ module Imagekitio def color_profile=: (bool) -> bool + attr_reader color_replace: String? + + def color_replace=: (String) -> String + attr_reader contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch? def contrast_stretch=: ( @@ -151,6 +157,10 @@ module Imagekitio def default_image=: (String) -> String + attr_reader distort: String? + + def distort=: (String) -> String + attr_reader dpr: Float? def dpr=: (Float) -> Float @@ -346,10 +356,12 @@ module Imagekitio ?blur: Float, ?border: String, ?color_profile: bool, + ?color_replace: String, ?contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch, ?crop: Imagekitio::Models::Transformation::crop, ?crop_mode: Imagekitio::Models::Transformation::crop_mode, ?default_image: String, + ?distort: String, ?dpr: Float, ?duration: Imagekitio::Models::Transformation::duration, ?end_offset: Imagekitio::Models::Transformation::end_offset, @@ -401,10 +413,12 @@ module Imagekitio blur: Float, border: String, color_profile: bool, + color_replace: String, contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch, crop: Imagekitio::Models::Transformation::crop, crop_mode: Imagekitio::Models::Transformation::crop_mode, default_image: String, + distort: String, dpr: Float, duration: Imagekitio::Models::Transformation::duration, end_offset: Imagekitio::Models::Transformation::end_offset, @@ -650,7 +664,7 @@ module Imagekitio def self?.variants: -> ::Array[Imagekitio::Models::Transformation::page] end - type radius = Float | :max + type radius = Float | :max | String module Radius extend Imagekitio::Internal::Type::Union diff --git a/sig/imagekitio/models/upload_pre_transform_success_event.rbs b/sig/imagekitio/models/upload_pre_transform_success_event.rbs index 90bf431..e7de4a8 100644 --- a/sig/imagekitio/models/upload_pre_transform_success_event.rbs +++ b/sig/imagekitio/models/upload_pre_transform_success_event.rbs @@ -258,6 +258,7 @@ module Imagekitio type extension_status = { ai_auto_description: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg @@ -270,6 +271,12 @@ module Imagekitio Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description ) -> Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description + attr_reader ai_tasks: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_tasks? + + def ai_tasks=: ( + Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_tasks + ) -> Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_tasks + attr_reader aws_auto_tagging: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging? def aws_auto_tagging=: ( @@ -290,6 +297,7 @@ module Imagekitio def initialize: ( ?ai_auto_description: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description, + ?ai_tasks: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_tasks, ?aws_auto_tagging: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging, ?google_auto_tagging: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging, ?remove_bg: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg @@ -297,6 +305,7 @@ module Imagekitio def to_hash: -> { ai_auto_description: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description, + ai_tasks: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_tasks, aws_auto_tagging: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging, google_auto_tagging: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging, remove_bg: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg @@ -314,6 +323,18 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description] end + type ai_tasks = :success | :pending | :failed + + module AITasks + extend Imagekitio::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_tasks] + end + type aws_auto_tagging = :success | :pending | :failed module AwsAutoTagging diff --git a/sig/imagekitio/resources/saved_extensions.rbs b/sig/imagekitio/resources/saved_extensions.rbs new file mode 100644 index 0000000..879fad0 --- /dev/null +++ b/sig/imagekitio/resources/saved_extensions.rbs @@ -0,0 +1,33 @@ +module Imagekitio + module Resources + class SavedExtensions + def create: ( + config: Imagekitio::Models::extension_config, + description: String, + name: String, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::SavedExtension + + def update: ( + String id, + ?config: Imagekitio::Models::extension_config, + ?description: String, + ?name: String, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::SavedExtension + + def list: ( + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::Models::saved_extension_list_response + + def delete: (String id, ?request_options: Imagekitio::request_opts) -> nil + + def get: ( + String id, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::SavedExtension + + def initialize: (client: Imagekitio::Client) -> void + end + end +end diff --git a/test/imagekitio/client_test.rb b/test/imagekitio/client_test.rb index 617cd7e..c58cec4 100644 --- a/test/imagekitio/client_test.rb +++ b/test/imagekitio/client_test.rb @@ -276,7 +276,7 @@ def test_client_redirect_307 assert_requested(:any, "http://localhost/redirected", times: Imagekitio::Client::MAX_REDIRECTS) do assert_equal(recorded.method, _1.method) - assert_equal(recorded.body, _1.body) + # assert_equal(recorded.body, _1.body) skipping, since the request body is multipart encoded assert_equal( recorded.headers.transform_keys(&:downcase).fetch("content-type"), _1.headers.transform_keys(&:downcase).fetch("content-type") diff --git a/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb b/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb index 8cd6135..aa8298a 100644 --- a/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb +++ b/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb @@ -431,6 +431,9 @@ def test_should_generate_the_correct_url_with_many_transformations_including_vid sharpen: 10.0, unsharp_mask: "2-2-0.8-0.024", gradient: "from-red_to-white", + # New transformations + color_replace: "FF0000_50_0000FF", + distort: "p-100_50_200_150_300_250_400_350", original: true, page: "2_4", raw: "h-200,w-300,l-image,i-logo.png,l-end" @@ -446,7 +449,27 @@ def test_should_generate_the_correct_url_with_many_transformations_including_vid ) ) - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,x-10,y-20,xc-30,yc-40,fl-h,o-0.8,z-2,vc-h264,ac-aac,so-5,eo-15,du-10,sr-1440_1080,e-grayscale,e-upscale,e-retouch,e-genvar,e-dropshadow,e-changebg-prompt-car,e-edit-prompt-make it vintage,e-bgremove,e-contrast,e-shadow-bl-15_st-40_x-10_y-N5,e-sharpen-10,e-usm-2-2-0.8-0.024,e-gradient-from-red_to-white,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end" + expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,x-10,y-20,xc-30,yc-40,fl-h,o-0.8,z-2,vc-h264,ac-aac,so-5,eo-15,du-10,sr-1440_1080,e-grayscale,e-upscale,e-retouch,e-genvar,e-dropshadow,e-changebg-prompt-car,e-edit-prompt-make it vintage,e-bgremove,e-contrast,e-shadow-bl-15_st-40_x-10_y-N5,e-sharpen-10,e-usm-2-2-0.8-0.024,e-gradient-from-red_to-white,cr-FF0000_50_0000FF,e-distort-p-100_50_200_150_300_250_400_350,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end" + assert_equal(expected, url) + end + + def test_should_generate_the_correct_url_for_radius_with_string_value + transformation = [ + Imagekitio::Models::Transformation.new( + radius: "10_20_30_40" + ) + ] + + url = @client.helper.build_url( + Imagekitio::Models::SrcOptions.new( + src: "/test_path1.jpg", + url_endpoint: "https://ik.imagekit.io/test_url_endpoint", + transformation_position: :query, + transformation: transformation + ) + ) + + expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=r-10_20_30_40" assert_equal(expected, url) end diff --git a/test/imagekitio/custom-tests/url-generation/overlay_test.rb b/test/imagekitio/custom-tests/url-generation/overlay_test.rb index 1716ed7..f8dbf89 100644 --- a/test/imagekitio/custom-tests/url-generation/overlay_test.rb +++ b/test/imagekitio/custom-tests/url-generation/overlay_test.rb @@ -724,6 +724,103 @@ def test_should_properly_encode_overlay_text_when_transformations_are_in_query_p assert_equal(expected, url) end + # Layer mode tests + def test_should_generate_url_with_image_overlay_and_multiply_layer_mode + transformation = [ + Imagekitio::Models::Transformation.new( + overlay: Imagekitio::Models::ImageOverlay.new( + input: "overlay.png", + layer_mode: :multiply + ) + ) + ] + + url = @client.helper.build_url( + Imagekitio::Models::SrcOptions.new( + src: "/base-image.jpg", + url_endpoint: "https://ik.imagekit.io/test_url_endpoint", + transformation_position: :path, + transformation: transformation + ) + ) + + expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-overlay.png,lm-multiply,l-end/base-image.jpg" + assert_equal(expected, url) + end + + def test_should_generate_url_with_image_overlay_and_displace_layer_mode + transformation = [ + Imagekitio::Models::Transformation.new( + overlay: Imagekitio::Models::ImageOverlay.new( + input: "displacement-map.png", + layer_mode: :displace, + position: Imagekitio::Models::OverlayPosition.new( + x: "10", + y_: "20" + ) + ) + ) + ] + + url = @client.helper.build_url( + Imagekitio::Models::SrcOptions.new( + src: "/base-image.jpg", + url_endpoint: "https://ik.imagekit.io/test_url_endpoint", + transformation_position: :path, + transformation: transformation + ) + ) + + expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-displacement-map.png,lm-displace,lx-10,ly-20,l-end/base-image.jpg" + assert_equal(expected, url) + end + + def test_should_generate_url_with_image_overlay_and_cutout_layer_mode + transformation = [ + Imagekitio::Models::Transformation.new( + overlay: Imagekitio::Models::ImageOverlay.new( + input: "mask.png", + layer_mode: :cutout + ) + ) + ] + + url = @client.helper.build_url( + Imagekitio::Models::SrcOptions.new( + src: "/base-image.jpg", + url_endpoint: "https://ik.imagekit.io/test_url_endpoint", + transformation_position: :path, + transformation: transformation + ) + ) + + expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-mask.png,lm-cutout,l-end/base-image.jpg" + assert_equal(expected, url) + end + + def test_should_generate_url_with_image_overlay_and_cutter_layer_mode + transformation = [ + Imagekitio::Models::Transformation.new( + overlay: Imagekitio::Models::ImageOverlay.new( + input: "shape.png", + layer_mode: :cutter + ) + ) + ] + + url = @client.helper.build_url( + Imagekitio::Models::SrcOptions.new( + src: "/base-image.jpg", + url_endpoint: "https://ik.imagekit.io/test_url_endpoint", + transformation_position: :path, + transformation: transformation + ) + ) + + expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-shape.png,lm-cutter,l-end/base-image.jpg" + assert_equal(expected, url) + end + # Hash-based API test - verify that plain hashes work for overlays def test_should_work_with_plain_hashes_for_text_overlay # Using plain hashes for everything including overlay diff --git a/test/imagekitio/resources/saved_extensions_test.rb b/test/imagekitio/resources/saved_extensions_test.rb new file mode 100644 index 0000000..9ce1a47 --- /dev/null +++ b/test/imagekitio/resources/saved_extensions_test.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekitio::Test::Resources::SavedExtensionsTest < Imagekitio::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = + @image_kit.saved_extensions.create( + config: {name: :"remove-bg"}, + description: "Analyzes vehicle images for type, condition, and quality assessment", + name: "Car Quality Analysis" + ) + + assert_pattern do + response => Imagekitio::SavedExtension + end + + assert_pattern do + response => { + id: String | nil, + config: Imagekitio::ExtensionConfig | nil, + created_at: Time | nil, + description: String | nil, + name: String | nil, + updated_at: Time | nil + } + end + end + + def test_update + skip("Prism tests are disabled") + + response = @image_kit.saved_extensions.update("id") + + assert_pattern do + response => Imagekitio::SavedExtension + end + + assert_pattern do + response => { + id: String | nil, + config: Imagekitio::ExtensionConfig | nil, + created_at: Time | nil, + description: String | nil, + name: String | nil, + updated_at: Time | nil + } + end + end + + def test_list + skip("Prism tests are disabled") + + response = @image_kit.saved_extensions.list + + assert_pattern do + response => ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::SavedExtension]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @image_kit.saved_extensions.delete("id") + + assert_pattern do + response => nil + end + end + + def test_get + skip("Prism tests are disabled") + + response = @image_kit.saved_extensions.get("id") + + assert_pattern do + response => Imagekitio::SavedExtension + end + + assert_pattern do + response => { + id: String | nil, + config: Imagekitio::ExtensionConfig | nil, + created_at: Time | nil, + description: String | nil, + name: String | nil, + updated_at: Time | nil + } + end + end +end