From 005ac46b180614608444677e24aec88b9a9dbd2d Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 5 Aug 2026 07:11:41 +0000 Subject: [PATCH 1/6] Build SDK Stainless-Generated-From: 5cc546b2d1e4a5ff843442ae63e60757daffaaa8 --- .stats.yml | 2 +- lib/imagekitio.rb | 8 + lib/imagekitio/client.rb | 4 + lib/imagekitio/models.rb | 12 ++ lib/imagekitio/models/named_transformation.rb | 57 +++++++ .../named_transformation_create_params.rb | 49 ++++++ .../named_transformation_delete_params.rb | 20 +++ .../models/named_transformation_get_params.rb | 20 +++ .../named_transformation_list_params.rb | 14 ++ .../named_transformation_list_response.rb | 9 + .../named_transformation_update_params.rb | 50 ++++++ .../resources/named_transformations.rb | 158 ++++++++++++++++++ rbi/imagekitio/client.rbi | 3 + rbi/imagekitio/models.rbi | 17 ++ .../models/named_transformation.rbi | 90 ++++++++++ .../named_transformation_create_params.rbi | 81 +++++++++ .../named_transformation_delete_params.rbi | 38 +++++ .../named_transformation_get_params.rbi | 38 +++++ .../named_transformation_list_params.rbi | 30 ++++ .../named_transformation_list_response.rbi | 11 ++ .../named_transformation_update_params.rbi | 81 +++++++++ .../resources/named_transformations.rbi | 125 ++++++++++++++ sig/imagekitio/client.rbs | 2 + sig/imagekitio/models.rbs | 12 ++ .../models/named_transformation.rbs | 50 ++++++ .../named_transformation_create_params.rbs | 34 ++++ .../named_transformation_delete_params.rbs | 23 +++ .../named_transformation_get_params.rbs | 23 +++ .../named_transformation_list_params.rbs | 15 ++ .../named_transformation_list_response.rbs | 8 + .../named_transformation_update_params.rbs | 42 +++++ .../resources/named_transformations.rbs | 36 ++++ .../resources/named_transformations_test.rb | 99 +++++++++++ 33 files changed, 1260 insertions(+), 1 deletion(-) create mode 100644 lib/imagekitio/models/named_transformation.rb create mode 100644 lib/imagekitio/models/named_transformation_create_params.rb create mode 100644 lib/imagekitio/models/named_transformation_delete_params.rb create mode 100644 lib/imagekitio/models/named_transformation_get_params.rb create mode 100644 lib/imagekitio/models/named_transformation_list_params.rb create mode 100644 lib/imagekitio/models/named_transformation_list_response.rb create mode 100644 lib/imagekitio/models/named_transformation_update_params.rb create mode 100644 lib/imagekitio/resources/named_transformations.rb create mode 100644 rbi/imagekitio/models/named_transformation.rbi create mode 100644 rbi/imagekitio/models/named_transformation_create_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_delete_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_get_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_list_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_list_response.rbi create mode 100644 rbi/imagekitio/models/named_transformation_update_params.rbi create mode 100644 rbi/imagekitio/resources/named_transformations.rbi create mode 100644 sig/imagekitio/models/named_transformation.rbs create mode 100644 sig/imagekitio/models/named_transformation_create_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_delete_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_get_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_list_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_list_response.rbs create mode 100644 sig/imagekitio/models/named_transformation_update_params.rbs create mode 100644 sig/imagekitio/resources/named_transformations.rbs create mode 100644 test/imagekitio/resources/named_transformations_test.rb diff --git a/.stats.yml b/.stats.yml index 58526a77..847bd32c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 48 +configured_endpoints: 53 diff --git a/lib/imagekitio.rb b/lib/imagekitio.rb index 4b049982..56e023ac 100644 --- a/lib/imagekitio.rb +++ b/lib/imagekitio.rb @@ -149,6 +149,13 @@ require_relative "imagekitio/models/get_image_attributes_options" require_relative "imagekitio/models/image_overlay" require_relative "imagekitio/models/metadata" +require_relative "imagekitio/models/named_transformation" +require_relative "imagekitio/models/named_transformation_create_params" +require_relative "imagekitio/models/named_transformation_delete_params" +require_relative "imagekitio/models/named_transformation_get_params" +require_relative "imagekitio/models/named_transformation_list_params" +require_relative "imagekitio/models/named_transformation_list_response" +require_relative "imagekitio/models/named_transformation_update_params" require_relative "imagekitio/models/overlay" require_relative "imagekitio/models/overlay_position" require_relative "imagekitio/models/overlay_timing" @@ -202,6 +209,7 @@ require_relative "imagekitio/resources/files/versions" require_relative "imagekitio/resources/folders" require_relative "imagekitio/resources/folders/job" +require_relative "imagekitio/resources/named_transformations" 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 6b3ec5ee..d9b6a586 100644 --- a/lib/imagekitio/client.rb +++ b/lib/imagekitio/client.rb @@ -41,6 +41,9 @@ class Client < Imagekitio::Internal::Transport::BaseClient # @return [Imagekitio::Resources::SavedExtensions] attr_reader :saved_extensions + # @return [Imagekitio::Resources::NamedTransformations] + attr_reader :named_transformations + # @return [Imagekitio::Resources::Assets] attr_reader :assets @@ -149,6 +152,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) + @named_transformations = Imagekitio::Resources::NamedTransformations.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/models.rb b/lib/imagekitio/models.rb index 755cec6d..044cee5b 100644 --- a/lib/imagekitio/models.rb +++ b/lib/imagekitio/models.rb @@ -124,6 +124,18 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata + NamedTransformation = Imagekitio::Models::NamedTransformation + + NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams + + NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams + + NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams + + NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams + + NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams + Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/lib/imagekitio/models/named_transformation.rb b/lib/imagekitio/models/named_transformation.rb new file mode 100644 index 00000000..7548cde4 --- /dev/null +++ b/lib/imagekitio/models/named_transformation.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class NamedTransformation < Imagekitio::Internal::Type::BaseModel + # @!attribute id + # Unique identifier of the named transformation. This is generated by ImageKit + # when you create a new named transformation. + # + # @return [String, nil] + optional :id, String + + # @!attribute created_at + # Timestamp when the named transformation was created. + # + # @return [Time, nil] + optional :created_at, Time, api_name: :createdAt + + # @!attribute disabled + # Whether this named transformation is currently disabled. + # + # @return [Boolean, nil] + optional :disabled, Imagekitio::Internal::Type::Boolean + + # @!attribute name + # Name of the named transformation, used as `tr:n-` in image and video URLs. + # + # @return [String, nil] + optional :name, String + + # @!attribute transformation + # The transformation string this name refers to. + # + # @return [String, nil] + optional :transformation, String + + # @!method initialize(id: nil, created_at: nil, disabled: nil, name: nil, transformation: nil) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformation} for more details. + # + # A named transformation is an alias for an actual transformation string, allowing + # you to apply and later update complex transformations without changing your + # image or video URLs. Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + # + # @param id [String] Unique identifier of the named transformation. This is generated by ImageKit whe + # + # @param created_at [Time] Timestamp when the named transformation was created. + # + # @param disabled [Boolean] Whether this named transformation is currently disabled. + # + # @param name [String] Name of the named transformation, used as `tr:n-` in image and video URLs. + # + # @param transformation [String] The transformation string this name refers to. + end + end +end diff --git a/lib/imagekitio/models/named_transformation_create_params.rb b/lib/imagekitio/models/named_transformation_create_params.rb new file mode 100644 index 00000000..d7223ca1 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_create_params.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#create + class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute name + # Name of the named transformation. This is the alias used to refer to the + # transformation string in image and video URLs, for example `tr:n-`. Can + # only contain alphanumeric characters, `_` and `-`, and must be unique for your + # account (case-insensitive). + # + # @return [String] + required :name, String + + # @!attribute transformation + # The transformation string this name refers to. It must start with `tr:` followed + # by one or more transformation parameters, for example + # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the + # [transformation syntax](https://imagekit.io/docs/transformations). + # + # @return [String] + required :transformation, String + + # @!attribute disabled + # Whether this named transformation is disabled. Set to `true` to temporarily + # disable it without deleting it — requests using a disabled named transformation + # fail at delivery time. + # + # @return [Boolean, nil] + optional :disabled, Imagekitio::Internal::Type::Boolean + + # @!method initialize(name:, transformation:, disabled: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationCreateParams} for more details. + # + # @param name [String] Name of the named transformation. This is the alias used to refer to the transfo + # + # @param transformation [String] The transformation string this name refers to. It must start with `tr:` followed + # + # @param disabled [Boolean] Whether this named transformation is disabled. Set to `true` to temporarily disa + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/named_transformation_delete_params.rb b/lib/imagekitio/models/named_transformation_delete_params.rb new file mode 100644 index 00000000..0ba9e107 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_delete_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#delete + class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:, request_options: {}) + # @param id [String] + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/named_transformation_get_params.rb b/lib/imagekitio/models/named_transformation_get_params.rb new file mode 100644 index 00000000..2a0b29d5 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_get_params.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#get + class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute id + # + # @return [String] + required :id, String + + # @!method initialize(id:, request_options: {}) + # @param id [String] + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/named_transformation_list_params.rb b/lib/imagekitio/models/named_transformation_list_params.rb new file mode 100644 index 00000000..d455f5a9 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_list_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#list + class NamedTransformationListParams < 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/named_transformation_list_response.rb b/lib/imagekitio/models/named_transformation_list_response.rb new file mode 100644 index 00000000..d7ac92ec --- /dev/null +++ b/lib/imagekitio/models/named_transformation_list_response.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @type [Imagekitio::Internal::Type::Converter] + NamedTransformationListResponse = + Imagekitio::Internal::Type::ArrayOf[-> { Imagekitio::NamedTransformation }] + end +end diff --git a/lib/imagekitio/models/named_transformation_update_params.rb b/lib/imagekitio/models/named_transformation_update_params.rb new file mode 100644 index 00000000..6a6dc12f --- /dev/null +++ b/lib/imagekitio/models/named_transformation_update_params.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#update + class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute id + # + # @return [String] + required :id, String + + # @!attribute disabled + # Whether this named transformation is disabled. + # + # @return [Boolean, nil] + optional :disabled, Imagekitio::Internal::Type::Boolean + + # @!attribute name + # Updated name of the named transformation. Can only contain alphanumeric + # characters, `_` and `-`, and must be unique for your account (case-insensitive). + # + # @return [String, nil] + optional :name, String + + # @!attribute transformation + # Updated transformation string. It must start with `tr:` followed by one or more + # transformation parameters. + # + # @return [String, nil] + optional :transformation, String + + # @!method initialize(id:, disabled: nil, name: nil, transformation: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. + # + # @param id [String] + # + # @param disabled [Boolean] Whether this named transformation is disabled. + # + # @param name [String] Updated name of the named transformation. Can only contain alphanumeric characte + # + # @param transformation [String] Updated transformation string. It must start with `tr:` followed by one or more + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/resources/named_transformations.rb b/lib/imagekitio/resources/named_transformations.rb new file mode 100644 index 00000000..d14111ce --- /dev/null +++ b/lib/imagekitio/resources/named_transformations.rb @@ -0,0 +1,158 @@ +# frozen_string_literal: true + +module Imagekitio + module Resources + class NamedTransformations + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationCreateParams} for more details. + # + # Creates a new named transformation and returns the created object. + # + # Named transformations let you assign a short, reusable name to a complex + # transformation string, so it can be applied in image and video URLs as + # `tr:n-` and later updated without changing any existing URLs. + # + # Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + # + # @overload create(name:, transformation:, disabled: nil, request_options: {}) + # + # @param name [String] Name of the named transformation. This is the alias used to refer to the transfo + # + # @param transformation [String] The transformation string this name refers to. It must start with `tr:` followed + # + # @param disabled [Boolean] Whether this named transformation is disabled. Set to `true` to temporarily disa + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::NamedTransformation] + # + # @see Imagekitio::Models::NamedTransformationCreateParams + def create(params) + parsed, options = Imagekitio::NamedTransformationCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/named-transformations", + body: parsed, + model: Imagekitio::NamedTransformation, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. + # + # Updates the named transformation identified by `id` and returns the updated + # object. Only the fields present in the request body are updated; omitted fields + # are left unchanged. + # + # @overload update(id, disabled: nil, name: nil, transformation: nil, request_options: {}) + # + # @param id [String] Unique identifier of the named transformation. This is the `id` returned when th + # + # @param disabled [Boolean] Whether this named transformation is disabled. + # + # @param name [String] Updated name of the named transformation. Can only contain alphanumeric characte + # + # @param transformation [String] Updated transformation string. It must start with `tr:` followed by one or more + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::NamedTransformation] + # + # @see Imagekitio::Models::NamedTransformationUpdateParams + def update(id, params = {}) + parsed, options = Imagekitio::NamedTransformationUpdateParams.dump_request(params) + @client.request( + method: :patch, + path: ["v1/named-transformations/%1$s", id], + body: parsed, + model: Imagekitio::NamedTransformation, + options: options + ) + end + + # Returns an array of all named transformations configured for your account. + # + # @overload list(request_options: {}) + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekitio::Models::NamedTransformationListParams + def list(params = {}) + @client.request( + method: :get, + path: "v1/named-transformations", + model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationDeleteParams} for more details. + # + # Permanently deletes the named transformation identified by `id` and returns the + # deleted object. + # + # **Note:** + # + # - If another named transformation, or your account's upload + # pre-transformation/post-transformation settings, reference this named + # transformation (via the `n-` token), the request fails with a `409` + # error whose `message` describes what it is referenced by. Remove those + # references first, then retry the deletion. This is a best-effort check and + # cannot detect references baked into your own application code or previously + # generated URLs. + # + # @overload delete(id, request_options: {}) + # + # @param id [String] Unique identifier of the named transformation. This is the `id` returned when th + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::NamedTransformation] + # + # @see Imagekitio::Models::NamedTransformationDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["v1/named-transformations/%1$s", id], + model: Imagekitio::NamedTransformation, + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationGetParams} for more details. + # + # Retrieves the named transformation identified by `id`. + # + # @overload get(id, request_options: {}) + # + # @param id [String] Unique identifier of the named transformation. This is the `id` returned when th + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::NamedTransformation] + # + # @see Imagekitio::Models::NamedTransformationGetParams + def get(id, params = {}) + @client.request( + method: :get, + path: ["v1/named-transformations/%1$s", id], + model: Imagekitio::NamedTransformation, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekitio::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/rbi/imagekitio/client.rbi b/rbi/imagekitio/client.rbi index 90f1116e..c04d2374 100644 --- a/rbi/imagekitio/client.rbi +++ b/rbi/imagekitio/client.rbi @@ -36,6 +36,9 @@ module Imagekitio sig { returns(Imagekitio::Resources::SavedExtensions) } attr_reader :saved_extensions + sig { returns(Imagekitio::Resources::NamedTransformations) } + attr_reader :named_transformations + sig { returns(Imagekitio::Resources::Assets) } attr_reader :assets diff --git a/rbi/imagekitio/models.rbi b/rbi/imagekitio/models.rbi index 9bd10e61..6bbbe1a7 100644 --- a/rbi/imagekitio/models.rbi +++ b/rbi/imagekitio/models.rbi @@ -96,6 +96,23 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata + NamedTransformation = Imagekitio::Models::NamedTransformation + + NamedTransformationCreateParams = + Imagekitio::Models::NamedTransformationCreateParams + + NamedTransformationDeleteParams = + Imagekitio::Models::NamedTransformationDeleteParams + + NamedTransformationGetParams = + Imagekitio::Models::NamedTransformationGetParams + + NamedTransformationListParams = + Imagekitio::Models::NamedTransformationListParams + + NamedTransformationUpdateParams = + Imagekitio::Models::NamedTransformationUpdateParams + Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/rbi/imagekitio/models/named_transformation.rbi b/rbi/imagekitio/models/named_transformation.rbi new file mode 100644 index 00000000..c92aae7f --- /dev/null +++ b/rbi/imagekitio/models/named_transformation.rbi @@ -0,0 +1,90 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformation < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekitio::NamedTransformation, Imagekitio::Internal::AnyHash) + end + + # Unique identifier of the named transformation. This is generated by ImageKit + # when you create a new named transformation. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Timestamp when the named transformation was created. + sig { returns(T.nilable(Time)) } + attr_reader :created_at + + sig { params(created_at: Time).void } + attr_writer :created_at + + # Whether this named transformation is currently disabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :disabled + + sig { params(disabled: T::Boolean).void } + attr_writer :disabled + + # Name of the named transformation, used as `tr:n-` in image and video URLs. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # The transformation string this name refers to. + sig { returns(T.nilable(String)) } + attr_reader :transformation + + sig { params(transformation: String).void } + attr_writer :transformation + + # A named transformation is an alias for an actual transformation string, allowing + # you to apply and later update complex transformations without changing your + # image or video URLs. Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + sig do + params( + id: String, + created_at: Time, + disabled: T::Boolean, + name: String, + transformation: String + ).returns(T.attached_class) + end + def self.new( + # Unique identifier of the named transformation. This is generated by ImageKit + # when you create a new named transformation. + id: nil, + # Timestamp when the named transformation was created. + created_at: nil, + # Whether this named transformation is currently disabled. + disabled: nil, + # Name of the named transformation, used as `tr:n-` in image and video URLs. + name: nil, + # The transformation string this name refers to. + transformation: nil + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + disabled: T::Boolean, + name: String, + transformation: String + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_create_params.rbi b/rbi/imagekitio/models/named_transformation_create_params.rbi new file mode 100644 index 00000000..921181db --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_create_params.rbi @@ -0,0 +1,81 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationCreateParams, + Imagekitio::Internal::AnyHash + ) + end + + # Name of the named transformation. This is the alias used to refer to the + # transformation string in image and video URLs, for example `tr:n-`. Can + # only contain alphanumeric characters, `_` and `-`, and must be unique for your + # account (case-insensitive). + sig { returns(String) } + attr_accessor :name + + # The transformation string this name refers to. It must start with `tr:` followed + # by one or more transformation parameters, for example + # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the + # [transformation syntax](https://imagekit.io/docs/transformations). + sig { returns(String) } + attr_accessor :transformation + + # Whether this named transformation is disabled. Set to `true` to temporarily + # disable it without deleting it — requests using a disabled named transformation + # fail at delivery time. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :disabled + + sig { params(disabled: T::Boolean).void } + attr_writer :disabled + + sig do + params( + name: String, + transformation: String, + disabled: T::Boolean, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Name of the named transformation. This is the alias used to refer to the + # transformation string in image and video URLs, for example `tr:n-`. Can + # only contain alphanumeric characters, `_` and `-`, and must be unique for your + # account (case-insensitive). + name:, + # The transformation string this name refers to. It must start with `tr:` followed + # by one or more transformation parameters, for example + # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the + # [transformation syntax](https://imagekit.io/docs/transformations). + transformation:, + # Whether this named transformation is disabled. Set to `true` to temporarily + # disable it without deleting it — requests using a disabled named transformation + # fail at delivery time. + disabled: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + name: String, + transformation: String, + disabled: T::Boolean, + request_options: Imagekitio::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_delete_params.rbi b/rbi/imagekitio/models/named_transformation_delete_params.rbi new file mode 100644 index 00000000..3d83b411 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_delete_params.rbi @@ -0,0 +1,38 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationDeleteParams, + Imagekitio::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(id:, request_options: {}) + end + + sig do + override.returns( + { id: String, request_options: Imagekitio::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_get_params.rbi b/rbi/imagekitio/models/named_transformation_get_params.rbi new file mode 100644 index 00000000..f0e13de0 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_get_params.rbi @@ -0,0 +1,38 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationGetParams, + Imagekitio::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(id:, request_options: {}) + end + + sig do + override.returns( + { id: String, request_options: Imagekitio::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_list_params.rbi b/rbi/imagekitio/models/named_transformation_list_params.rbi new file mode 100644 index 00000000..c26ca9cf --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_list_params.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationListParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationListParams, + 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/named_transformation_list_response.rbi b/rbi/imagekitio/models/named_transformation_list_response.rbi new file mode 100644 index 00000000..d344b117 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Imagekitio + module Models + NamedTransformationListResponse = + T.let( + Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], + Imagekitio::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekitio/models/named_transformation_update_params.rbi b/rbi/imagekitio/models/named_transformation_update_params.rbi new file mode 100644 index 00000000..87da0706 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_update_params.rbi @@ -0,0 +1,81 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationUpdateParams, + Imagekitio::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :id + + # Whether this named transformation is disabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :disabled + + sig { params(disabled: T::Boolean).void } + attr_writer :disabled + + # Updated name of the named transformation. Can only contain alphanumeric + # characters, `_` and `-`, and must be unique for your account (case-insensitive). + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Updated transformation string. It must start with `tr:` followed by one or more + # transformation parameters. + sig { returns(T.nilable(String)) } + attr_reader :transformation + + sig { params(transformation: String).void } + attr_writer :transformation + + sig do + params( + id: String, + disabled: T::Boolean, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + id:, + # Whether this named transformation is disabled. + disabled: nil, + # Updated name of the named transformation. Can only contain alphanumeric + # characters, `_` and `-`, and must be unique for your account (case-insensitive). + name: nil, + # Updated transformation string. It must start with `tr:` followed by one or more + # transformation parameters. + transformation: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + id: String, + disabled: T::Boolean, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/resources/named_transformations.rbi b/rbi/imagekitio/resources/named_transformations.rbi new file mode 100644 index 00000000..e4e22e00 --- /dev/null +++ b/rbi/imagekitio/resources/named_transformations.rbi @@ -0,0 +1,125 @@ +# typed: strong + +module Imagekitio + module Resources + class NamedTransformations + # Creates a new named transformation and returns the created object. + # + # Named transformations let you assign a short, reusable name to a complex + # transformation string, so it can be applied in image and video URLs as + # `tr:n-` and later updated without changing any existing URLs. + # + # Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + sig do + params( + name: String, + transformation: String, + disabled: T::Boolean, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::NamedTransformation) + end + def create( + # Name of the named transformation. This is the alias used to refer to the + # transformation string in image and video URLs, for example `tr:n-`. Can + # only contain alphanumeric characters, `_` and `-`, and must be unique for your + # account (case-insensitive). + name:, + # The transformation string this name refers to. It must start with `tr:` followed + # by one or more transformation parameters, for example + # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the + # [transformation syntax](https://imagekit.io/docs/transformations). + transformation:, + # Whether this named transformation is disabled. Set to `true` to temporarily + # disable it without deleting it — requests using a disabled named transformation + # fail at delivery time. + disabled: nil, + request_options: {} + ) + end + + # Updates the named transformation identified by `id` and returns the updated + # object. Only the fields present in the request body are updated; omitted fields + # are left unchanged. + sig do + params( + id: String, + disabled: T::Boolean, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::NamedTransformation) + end + def update( + # Unique identifier of the named transformation. This is the `id` returned when + # the named transformation was created. + id, + # Whether this named transformation is disabled. + disabled: nil, + # Updated name of the named transformation. Can only contain alphanumeric + # characters, `_` and `-`, and must be unique for your account (case-insensitive). + name: nil, + # Updated transformation string. It must start with `tr:` followed by one or more + # transformation parameters. + transformation: nil, + request_options: {} + ) + end + + # Returns an array of all named transformations configured for your account. + sig do + params(request_options: Imagekitio::RequestOptions::OrHash).returns( + T::Array[Imagekitio::NamedTransformation] + ) + end + def list(request_options: {}) + end + + # Permanently deletes the named transformation identified by `id` and returns the + # deleted object. + # + # **Note:** + # + # - If another named transformation, or your account's upload + # pre-transformation/post-transformation settings, reference this named + # transformation (via the `n-` token), the request fails with a `409` + # error whose `message` describes what it is referenced by. Remove those + # references first, then retry the deletion. This is a best-effort check and + # cannot detect references baked into your own application code or previously + # generated URLs. + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::NamedTransformation) + end + def delete( + # Unique identifier of the named transformation. This is the `id` returned when + # the named transformation was created. + id, + request_options: {} + ) + end + + # Retrieves the named transformation identified by `id`. + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::NamedTransformation) + end + def get( + # Unique identifier of the named transformation. This is the `id` returned when + # the named transformation was created. + 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 dec87d14..57af63f0 100644 --- a/sig/imagekitio/client.rbs +++ b/sig/imagekitio/client.rbs @@ -20,6 +20,8 @@ module Imagekitio attr_reader saved_extensions: Imagekitio::Resources::SavedExtensions + attr_reader named_transformations: Imagekitio::Resources::NamedTransformations + attr_reader assets: Imagekitio::Resources::Assets attr_reader cache: Imagekitio::Resources::Cache diff --git a/sig/imagekitio/models.rbs b/sig/imagekitio/models.rbs index c63f18f8..ce6b4abe 100644 --- a/sig/imagekitio/models.rbs +++ b/sig/imagekitio/models.rbs @@ -81,6 +81,18 @@ module Imagekitio class Metadata = Imagekitio::Models::Metadata + class NamedTransformation = Imagekitio::Models::NamedTransformation + + class NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams + + class NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams + + class NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams + + class NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams + + class NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams + module Overlay = Imagekitio::Models::Overlay class OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/sig/imagekitio/models/named_transformation.rbs b/sig/imagekitio/models/named_transformation.rbs new file mode 100644 index 00000000..8a6233c2 --- /dev/null +++ b/sig/imagekitio/models/named_transformation.rbs @@ -0,0 +1,50 @@ +module Imagekitio + module Models + type named_transformation = + { + id: String, + created_at: Time, + disabled: bool, + name: String, + transformation: String + } + + class NamedTransformation < Imagekitio::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + attr_reader created_at: Time? + + def created_at=: (Time) -> Time + + attr_reader disabled: bool? + + def disabled=: (bool) -> bool + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader transformation: String? + + def transformation=: (String) -> String + + def initialize: ( + ?id: String, + ?created_at: Time, + ?disabled: bool, + ?name: String, + ?transformation: String + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + disabled: bool, + name: String, + transformation: String + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_create_params.rbs b/sig/imagekitio/models/named_transformation_create_params.rbs new file mode 100644 index 00000000..7ecd1a58 --- /dev/null +++ b/sig/imagekitio/models/named_transformation_create_params.rbs @@ -0,0 +1,34 @@ +module Imagekitio + module Models + type named_transformation_create_params = + { name: String, transformation: String, disabled: bool } + & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor name: String + + attr_accessor transformation: String + + attr_reader disabled: bool? + + def disabled=: (bool) -> bool + + def initialize: ( + name: String, + transformation: String, + ?disabled: bool, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + name: String, + transformation: String, + disabled: bool, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_delete_params.rbs b/sig/imagekitio/models/named_transformation_delete_params.rbs new file mode 100644 index 00000000..4aa8e42f --- /dev/null +++ b/sig/imagekitio/models/named_transformation_delete_params.rbs @@ -0,0 +1,23 @@ +module Imagekitio + module Models + type named_transformation_delete_params = + { id: String } & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor id: String + + def initialize: ( + id: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + id: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_get_params.rbs b/sig/imagekitio/models/named_transformation_get_params.rbs new file mode 100644 index 00000000..bc8c27c1 --- /dev/null +++ b/sig/imagekitio/models/named_transformation_get_params.rbs @@ -0,0 +1,23 @@ +module Imagekitio + module Models + type named_transformation_get_params = + { id: String } & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor id: String + + def initialize: ( + id: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + id: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_list_params.rbs b/sig/imagekitio/models/named_transformation_list_params.rbs new file mode 100644 index 00000000..91dc04e5 --- /dev/null +++ b/sig/imagekitio/models/named_transformation_list_params.rbs @@ -0,0 +1,15 @@ +module Imagekitio + module Models + type named_transformation_list_params = + { } & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationListParams < 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/named_transformation_list_response.rbs b/sig/imagekitio/models/named_transformation_list_response.rbs new file mode 100644 index 00000000..c800123e --- /dev/null +++ b/sig/imagekitio/models/named_transformation_list_response.rbs @@ -0,0 +1,8 @@ +module Imagekitio + module Models + type named_transformation_list_response = + ::Array[Imagekitio::NamedTransformation] + + NamedTransformationListResponse: Imagekitio::Internal::Type::Converter + end +end diff --git a/sig/imagekitio/models/named_transformation_update_params.rbs b/sig/imagekitio/models/named_transformation_update_params.rbs new file mode 100644 index 00000000..21bfb5ac --- /dev/null +++ b/sig/imagekitio/models/named_transformation_update_params.rbs @@ -0,0 +1,42 @@ +module Imagekitio + module Models + type named_transformation_update_params = + { id: String, disabled: bool, name: String, transformation: String } + & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor id: String + + attr_reader disabled: bool? + + def disabled=: (bool) -> bool + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader transformation: String? + + def transformation=: (String) -> String + + def initialize: ( + id: String, + ?disabled: bool, + ?name: String, + ?transformation: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + id: String, + disabled: bool, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/resources/named_transformations.rbs b/sig/imagekitio/resources/named_transformations.rbs new file mode 100644 index 00000000..40e752fd --- /dev/null +++ b/sig/imagekitio/resources/named_transformations.rbs @@ -0,0 +1,36 @@ +module Imagekitio + module Resources + class NamedTransformations + def create: ( + name: String, + transformation: String, + ?disabled: bool, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::NamedTransformation + + def update: ( + String id, + ?disabled: bool, + ?name: String, + ?transformation: String, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::NamedTransformation + + def list: ( + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::Models::named_transformation_list_response + + def delete: ( + String id, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::NamedTransformation + + def get: ( + String id, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::NamedTransformation + + def initialize: (client: Imagekitio::Client) -> void + end + end +end diff --git a/test/imagekitio/resources/named_transformations_test.rb b/test/imagekitio/resources/named_transformations_test.rb new file mode 100644 index 00000000..df7809a2 --- /dev/null +++ b/test/imagekitio/resources/named_transformations_test.rb @@ -0,0 +1,99 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekitio::Test::Resources::NamedTransformationsTest < Imagekitio::Test::ResourceTest + def test_create_required_params + skip("Mock server tests are disabled") + + response = + @image_kit.named_transformations.create( + name: "small_thumbnail", + transformation: "tr:w-150,h-150,fo-center,cm-resize" + ) + + assert_pattern do + response => Imagekitio::NamedTransformation + end + + assert_pattern do + response => { + id: String | nil, + created_at: Time | nil, + disabled: Imagekitio::Internal::Type::Boolean | nil, + name: String | nil, + transformation: String | nil + } + end + end + + def test_update + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.update("id") + + assert_pattern do + response => Imagekitio::NamedTransformation + end + + assert_pattern do + response => { + id: String | nil, + created_at: Time | nil, + disabled: Imagekitio::Internal::Type::Boolean | nil, + name: String | nil, + transformation: String | nil + } + end + end + + def test_list + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.list + + assert_pattern do + response => ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation]) + end + end + + def test_delete + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.delete("id") + + assert_pattern do + response => Imagekitio::NamedTransformation + end + + assert_pattern do + response => { + id: String | nil, + created_at: Time | nil, + disabled: Imagekitio::Internal::Type::Boolean | nil, + name: String | nil, + transformation: String | nil + } + end + end + + def test_get + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.get("id") + + assert_pattern do + response => Imagekitio::NamedTransformation + end + + assert_pattern do + response => { + id: String | nil, + created_at: Time | nil, + disabled: Imagekitio::Internal::Type::Boolean | nil, + name: String | nil, + transformation: String | nil + } + end + end +end From f86bf8e78a5fc75323bfeb1a529b2e4045a62729 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 13 Aug 2026 06:04:07 +0000 Subject: [PATCH 2/6] feat: add description field in custom metadata field api Stainless-Generated-From: d73cd29d45cea38f91a0f82fa79544dc8ae73081 --- .stats.yml | 2 +- lib/imagekitio.rb | 8 - lib/imagekitio/client.rb | 4 - lib/imagekitio/models.rb | 12 -- .../models/custom_metadata_field.rb | 12 +- .../custom_metadata_field_create_params.rb | 12 +- .../custom_metadata_field_update_params.rb | 13 +- lib/imagekitio/models/named_transformation.rb | 57 ------- .../named_transformation_create_params.rb | 49 ------ .../named_transformation_delete_params.rb | 20 --- .../models/named_transformation_get_params.rb | 20 --- .../named_transformation_list_params.rb | 14 -- .../named_transformation_list_response.rb | 9 - .../named_transformation_update_params.rb | 50 ------ .../resources/custom_metadata_fields.rb | 11 +- .../resources/named_transformations.rb | 158 ------------------ rbi/imagekitio/client.rbi | 3 - rbi/imagekitio/models.rbi | 17 -- .../models/custom_metadata_field.rbi | 21 ++- .../custom_metadata_field_create_params.rbi | 15 ++ .../custom_metadata_field_update_params.rbi | 17 ++ .../models/named_transformation.rbi | 90 ---------- .../named_transformation_create_params.rbi | 81 --------- .../named_transformation_delete_params.rbi | 38 ----- .../named_transformation_get_params.rbi | 38 ----- .../named_transformation_list_params.rbi | 30 ---- .../named_transformation_list_response.rbi | 11 -- .../named_transformation_update_params.rbi | 81 --------- .../resources/custom_metadata_fields.rbi | 14 +- .../resources/named_transformations.rbi | 125 -------------- sig/imagekitio/client.rbs | 2 - sig/imagekitio/models.rbs | 12 -- .../models/custom_metadata_field.rbs | 13 +- .../custom_metadata_field_create_params.rbs | 9 +- .../custom_metadata_field_update_params.rbs | 7 + .../models/named_transformation.rbs | 50 ------ .../named_transformation_create_params.rbs | 34 ---- .../named_transformation_delete_params.rbs | 23 --- .../named_transformation_get_params.rbs | 23 --- .../named_transformation_list_params.rbs | 15 -- .../named_transformation_list_response.rbs | 8 - .../named_transformation_update_params.rbs | 42 ----- .../resources/custom_metadata_fields.rbs | 2 + .../resources/named_transformations.rbs | 36 ---- .../resources/custom_metadata_fields_test.rb | 6 +- .../resources/named_transformations_test.rb | 99 ----------- 46 files changed, 137 insertions(+), 1276 deletions(-) delete mode 100644 lib/imagekitio/models/named_transformation.rb delete mode 100644 lib/imagekitio/models/named_transformation_create_params.rb delete mode 100644 lib/imagekitio/models/named_transformation_delete_params.rb delete mode 100644 lib/imagekitio/models/named_transformation_get_params.rb delete mode 100644 lib/imagekitio/models/named_transformation_list_params.rb delete mode 100644 lib/imagekitio/models/named_transformation_list_response.rb delete mode 100644 lib/imagekitio/models/named_transformation_update_params.rb delete mode 100644 lib/imagekitio/resources/named_transformations.rb delete mode 100644 rbi/imagekitio/models/named_transformation.rbi delete mode 100644 rbi/imagekitio/models/named_transformation_create_params.rbi delete mode 100644 rbi/imagekitio/models/named_transformation_delete_params.rbi delete mode 100644 rbi/imagekitio/models/named_transformation_get_params.rbi delete mode 100644 rbi/imagekitio/models/named_transformation_list_params.rbi delete mode 100644 rbi/imagekitio/models/named_transformation_list_response.rbi delete mode 100644 rbi/imagekitio/models/named_transformation_update_params.rbi delete mode 100644 rbi/imagekitio/resources/named_transformations.rbi delete mode 100644 sig/imagekitio/models/named_transformation.rbs delete mode 100644 sig/imagekitio/models/named_transformation_create_params.rbs delete mode 100644 sig/imagekitio/models/named_transformation_delete_params.rbs delete mode 100644 sig/imagekitio/models/named_transformation_get_params.rbs delete mode 100644 sig/imagekitio/models/named_transformation_list_params.rbs delete mode 100644 sig/imagekitio/models/named_transformation_list_response.rbs delete mode 100644 sig/imagekitio/models/named_transformation_update_params.rbs delete mode 100644 sig/imagekitio/resources/named_transformations.rbs delete mode 100644 test/imagekitio/resources/named_transformations_test.rb diff --git a/.stats.yml b/.stats.yml index 847bd32c..58526a77 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 53 +configured_endpoints: 48 diff --git a/lib/imagekitio.rb b/lib/imagekitio.rb index 56e023ac..4b049982 100644 --- a/lib/imagekitio.rb +++ b/lib/imagekitio.rb @@ -149,13 +149,6 @@ require_relative "imagekitio/models/get_image_attributes_options" require_relative "imagekitio/models/image_overlay" require_relative "imagekitio/models/metadata" -require_relative "imagekitio/models/named_transformation" -require_relative "imagekitio/models/named_transformation_create_params" -require_relative "imagekitio/models/named_transformation_delete_params" -require_relative "imagekitio/models/named_transformation_get_params" -require_relative "imagekitio/models/named_transformation_list_params" -require_relative "imagekitio/models/named_transformation_list_response" -require_relative "imagekitio/models/named_transformation_update_params" require_relative "imagekitio/models/overlay" require_relative "imagekitio/models/overlay_position" require_relative "imagekitio/models/overlay_timing" @@ -209,7 +202,6 @@ require_relative "imagekitio/resources/files/versions" require_relative "imagekitio/resources/folders" require_relative "imagekitio/resources/folders/job" -require_relative "imagekitio/resources/named_transformations" 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 d9b6a586..6b3ec5ee 100644 --- a/lib/imagekitio/client.rb +++ b/lib/imagekitio/client.rb @@ -41,9 +41,6 @@ class Client < Imagekitio::Internal::Transport::BaseClient # @return [Imagekitio::Resources::SavedExtensions] attr_reader :saved_extensions - # @return [Imagekitio::Resources::NamedTransformations] - attr_reader :named_transformations - # @return [Imagekitio::Resources::Assets] attr_reader :assets @@ -152,7 +149,6 @@ 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) - @named_transformations = Imagekitio::Resources::NamedTransformations.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/models.rb b/lib/imagekitio/models.rb index 044cee5b..755cec6d 100644 --- a/lib/imagekitio/models.rb +++ b/lib/imagekitio/models.rb @@ -124,18 +124,6 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata - NamedTransformation = Imagekitio::Models::NamedTransformation - - NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams - - NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams - - NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams - - NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams - - NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams - Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/lib/imagekitio/models/custom_metadata_field.rb b/lib/imagekitio/models/custom_metadata_field.rb index bf69f73f..786b98dd 100644 --- a/lib/imagekitio/models/custom_metadata_field.rb +++ b/lib/imagekitio/models/custom_metadata_field.rb @@ -31,7 +31,15 @@ class CustomMetadataField < Imagekitio::Internal::Type::BaseModel # @return [Imagekitio::Models::CustomMetadataField::Schema] required :schema, -> { Imagekitio::CustomMetadataField::Schema } - # @!method initialize(id:, label:, name:, schema:) + # @!attribute description + # Optional description of the custom metadata field. Only present when a + # description has been set. Shown as a hint to the users while setting the field's + # value on an asset in the media library UI. + # + # @return [String, nil] + optional :description, String + + # @!method initialize(id:, label:, name:, schema:, description: nil) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataField} for more details. # @@ -44,6 +52,8 @@ class CustomMetadataField < Imagekitio::Internal::Type::BaseModel # @param name [String] API name of the custom metadata field. This becomes the key while setting `custo # # @param schema [Imagekitio::Models::CustomMetadataField::Schema] An object that describes the rules for the custom metadata field value. + # + # @param description [String] Optional description of the custom metadata field. Only present when a descripti # @see Imagekitio::Models::CustomMetadataField#schema class Schema < Imagekitio::Internal::Type::BaseModel diff --git a/lib/imagekitio/models/custom_metadata_field_create_params.rb b/lib/imagekitio/models/custom_metadata_field_create_params.rb index 570b94cb..c3c0a08c 100644 --- a/lib/imagekitio/models/custom_metadata_field_create_params.rb +++ b/lib/imagekitio/models/custom_metadata_field_create_params.rb @@ -28,7 +28,15 @@ class CustomMetadataFieldCreateParams < Imagekitio::Internal::Type::BaseModel # @return [Imagekitio::Models::CustomMetadataFieldCreateParams::Schema] required :schema, -> { Imagekitio::CustomMetadataFieldCreateParams::Schema } - # @!method initialize(label:, name:, schema:, request_options: {}) + # @!attribute description + # Optional description for the custom metadata field. Can be up to 500 characters. + # This is shown as a hint to the users while setting the field's value on an asset + # in the media library UI. + # + # @return [String, nil] + optional :description, String + + # @!method initialize(label:, name:, schema:, description: nil, request_options: {}) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataFieldCreateParams} for more details. # @@ -38,6 +46,8 @@ class CustomMetadataFieldCreateParams < Imagekitio::Internal::Type::BaseModel # # @param schema [Imagekitio::Models::CustomMetadataFieldCreateParams::Schema] # + # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. + # # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] class Schema < Imagekitio::Internal::Type::BaseModel diff --git a/lib/imagekitio/models/custom_metadata_field_update_params.rb b/lib/imagekitio/models/custom_metadata_field_update_params.rb index 49cda636..3eb7ec90 100644 --- a/lib/imagekitio/models/custom_metadata_field_update_params.rb +++ b/lib/imagekitio/models/custom_metadata_field_update_params.rb @@ -12,6 +12,15 @@ class CustomMetadataFieldUpdateParams < Imagekitio::Internal::Type::BaseModel # @return [String] required :id, String + # @!attribute description + # Optional description for the custom metadata field. Can be up to 500 characters. + # Send an empty string to clear an existing description. This is shown as a hint + # to the users while setting the field's value on an asset in the media library + # UI. + # + # @return [String, nil] + optional :description, String + # @!attribute label # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field @@ -30,12 +39,14 @@ class CustomMetadataFieldUpdateParams < Imagekitio::Internal::Type::BaseModel # @return [Imagekitio::Models::CustomMetadataFieldUpdateParams::Schema, nil] optional :schema, -> { Imagekitio::CustomMetadataFieldUpdateParams::Schema } - # @!method initialize(id:, label: nil, schema: nil, request_options: {}) + # @!method initialize(id:, description: nil, label: nil, schema: nil, request_options: {}) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataFieldUpdateParams} for more details. # # @param id [String] # + # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. + # # @param label [String] Human readable name of the custom metadata field. This should be unique across a # # @param schema [Imagekitio::Models::CustomMetadataFieldUpdateParams::Schema] An object that describes the rules for the custom metadata key. This parameter i diff --git a/lib/imagekitio/models/named_transformation.rb b/lib/imagekitio/models/named_transformation.rb deleted file mode 100644 index 7548cde4..00000000 --- a/lib/imagekitio/models/named_transformation.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - class NamedTransformation < Imagekitio::Internal::Type::BaseModel - # @!attribute id - # Unique identifier of the named transformation. This is generated by ImageKit - # when you create a new named transformation. - # - # @return [String, nil] - optional :id, String - - # @!attribute created_at - # Timestamp when the named transformation was created. - # - # @return [Time, nil] - optional :created_at, Time, api_name: :createdAt - - # @!attribute disabled - # Whether this named transformation is currently disabled. - # - # @return [Boolean, nil] - optional :disabled, Imagekitio::Internal::Type::Boolean - - # @!attribute name - # Name of the named transformation, used as `tr:n-` in image and video URLs. - # - # @return [String, nil] - optional :name, String - - # @!attribute transformation - # The transformation string this name refers to. - # - # @return [String, nil] - optional :transformation, String - - # @!method initialize(id: nil, created_at: nil, disabled: nil, name: nil, transformation: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformation} for more details. - # - # A named transformation is an alias for an actual transformation string, allowing - # you to apply and later update complex transformations without changing your - # image or video URLs. Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - # - # @param id [String] Unique identifier of the named transformation. This is generated by ImageKit whe - # - # @param created_at [Time] Timestamp when the named transformation was created. - # - # @param disabled [Boolean] Whether this named transformation is currently disabled. - # - # @param name [String] Name of the named transformation, used as `tr:n-` in image and video URLs. - # - # @param transformation [String] The transformation string this name refers to. - end - end -end diff --git a/lib/imagekitio/models/named_transformation_create_params.rb b/lib/imagekitio/models/named_transformation_create_params.rb deleted file mode 100644 index d7223ca1..00000000 --- a/lib/imagekitio/models/named_transformation_create_params.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#create - class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute name - # Name of the named transformation. This is the alias used to refer to the - # transformation string in image and video URLs, for example `tr:n-`. Can - # only contain alphanumeric characters, `_` and `-`, and must be unique for your - # account (case-insensitive). - # - # @return [String] - required :name, String - - # @!attribute transformation - # The transformation string this name refers to. It must start with `tr:` followed - # by one or more transformation parameters, for example - # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the - # [transformation syntax](https://imagekit.io/docs/transformations). - # - # @return [String] - required :transformation, String - - # @!attribute disabled - # Whether this named transformation is disabled. Set to `true` to temporarily - # disable it without deleting it — requests using a disabled named transformation - # fail at delivery time. - # - # @return [Boolean, nil] - optional :disabled, Imagekitio::Internal::Type::Boolean - - # @!method initialize(name:, transformation:, disabled: nil, request_options: {}) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationCreateParams} for more details. - # - # @param name [String] Name of the named transformation. This is the alias used to refer to the transfo - # - # @param transformation [String] The transformation string this name refers to. It must start with `tr:` followed - # - # @param disabled [Boolean] Whether this named transformation is disabled. Set to `true` to temporarily disa - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/named_transformation_delete_params.rb b/lib/imagekitio/models/named_transformation_delete_params.rb deleted file mode 100644 index 0ba9e107..00000000 --- a/lib/imagekitio/models/named_transformation_delete_params.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#delete - class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute id - # - # @return [String] - required :id, String - - # @!method initialize(id:, request_options: {}) - # @param id [String] - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/named_transformation_get_params.rb b/lib/imagekitio/models/named_transformation_get_params.rb deleted file mode 100644 index 2a0b29d5..00000000 --- a/lib/imagekitio/models/named_transformation_get_params.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#get - class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute id - # - # @return [String] - required :id, String - - # @!method initialize(id:, request_options: {}) - # @param id [String] - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/named_transformation_list_params.rb b/lib/imagekitio/models/named_transformation_list_params.rb deleted file mode 100644 index d455f5a9..00000000 --- a/lib/imagekitio/models/named_transformation_list_params.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#list - class NamedTransformationListParams < 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/named_transformation_list_response.rb b/lib/imagekitio/models/named_transformation_list_response.rb deleted file mode 100644 index d7ac92ec..00000000 --- a/lib/imagekitio/models/named_transformation_list_response.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @type [Imagekitio::Internal::Type::Converter] - NamedTransformationListResponse = - Imagekitio::Internal::Type::ArrayOf[-> { Imagekitio::NamedTransformation }] - end -end diff --git a/lib/imagekitio/models/named_transformation_update_params.rb b/lib/imagekitio/models/named_transformation_update_params.rb deleted file mode 100644 index 6a6dc12f..00000000 --- a/lib/imagekitio/models/named_transformation_update_params.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#update - class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute id - # - # @return [String] - required :id, String - - # @!attribute disabled - # Whether this named transformation is disabled. - # - # @return [Boolean, nil] - optional :disabled, Imagekitio::Internal::Type::Boolean - - # @!attribute name - # Updated name of the named transformation. Can only contain alphanumeric - # characters, `_` and `-`, and must be unique for your account (case-insensitive). - # - # @return [String, nil] - optional :name, String - - # @!attribute transformation - # Updated transformation string. It must start with `tr:` followed by one or more - # transformation parameters. - # - # @return [String, nil] - optional :transformation, String - - # @!method initialize(id:, disabled: nil, name: nil, transformation: nil, request_options: {}) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. - # - # @param id [String] - # - # @param disabled [Boolean] Whether this named transformation is disabled. - # - # @param name [String] Updated name of the named transformation. Can only contain alphanumeric characte - # - # @param transformation [String] Updated transformation string. It must start with `tr:` followed by one or more - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/resources/custom_metadata_fields.rb b/lib/imagekitio/resources/custom_metadata_fields.rb index 73971d27..4feb3241 100644 --- a/lib/imagekitio/resources/custom_metadata_fields.rb +++ b/lib/imagekitio/resources/custom_metadata_fields.rb @@ -11,7 +11,7 @@ class CustomMetadataFields # on the assets. The value of a field for an asset can be set using the media # library UI or programmatically through upload or update assets API. # - # @overload create(label:, name:, schema:, request_options: {}) + # @overload create(label:, name:, schema:, description: nil, request_options: {}) # # @param label [String] Human readable name of the custom metadata field. This should be unique across a # @@ -19,6 +19,8 @@ class CustomMetadataFields # # @param schema [Imagekitio::Models::CustomMetadataFieldCreateParams::Schema] # + # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. + # # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [Imagekitio::Models::CustomMetadataField] @@ -38,12 +40,15 @@ def create(params) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataFieldUpdateParams} for more details. # - # This API updates the label or schema of an existing custom metadata field. + # This API updates the label, description, or schema of an existing custom + # metadata field. # - # @overload update(id, label: nil, schema: nil, request_options: {}) + # @overload update(id, description: nil, label: nil, schema: nil, request_options: {}) # # @param id [String] Should be a valid custom metadata field id. # + # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. + # # @param label [String] Human readable name of the custom metadata field. This should be unique across a # # @param schema [Imagekitio::Models::CustomMetadataFieldUpdateParams::Schema] An object that describes the rules for the custom metadata key. This parameter i diff --git a/lib/imagekitio/resources/named_transformations.rb b/lib/imagekitio/resources/named_transformations.rb deleted file mode 100644 index d14111ce..00000000 --- a/lib/imagekitio/resources/named_transformations.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Resources - class NamedTransformations - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationCreateParams} for more details. - # - # Creates a new named transformation and returns the created object. - # - # Named transformations let you assign a short, reusable name to a complex - # transformation string, so it can be applied in image and video URLs as - # `tr:n-` and later updated without changing any existing URLs. - # - # Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - # - # @overload create(name:, transformation:, disabled: nil, request_options: {}) - # - # @param name [String] Name of the named transformation. This is the alias used to refer to the transfo - # - # @param transformation [String] The transformation string this name refers to. It must start with `tr:` followed - # - # @param disabled [Boolean] Whether this named transformation is disabled. Set to `true` to temporarily disa - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::NamedTransformation] - # - # @see Imagekitio::Models::NamedTransformationCreateParams - def create(params) - parsed, options = Imagekitio::NamedTransformationCreateParams.dump_request(params) - @client.request( - method: :post, - path: "v1/named-transformations", - body: parsed, - model: Imagekitio::NamedTransformation, - options: options - ) - end - - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. - # - # Updates the named transformation identified by `id` and returns the updated - # object. Only the fields present in the request body are updated; omitted fields - # are left unchanged. - # - # @overload update(id, disabled: nil, name: nil, transformation: nil, request_options: {}) - # - # @param id [String] Unique identifier of the named transformation. This is the `id` returned when th - # - # @param disabled [Boolean] Whether this named transformation is disabled. - # - # @param name [String] Updated name of the named transformation. Can only contain alphanumeric characte - # - # @param transformation [String] Updated transformation string. It must start with `tr:` followed by one or more - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::NamedTransformation] - # - # @see Imagekitio::Models::NamedTransformationUpdateParams - def update(id, params = {}) - parsed, options = Imagekitio::NamedTransformationUpdateParams.dump_request(params) - @client.request( - method: :patch, - path: ["v1/named-transformations/%1$s", id], - body: parsed, - model: Imagekitio::NamedTransformation, - options: options - ) - end - - # Returns an array of all named transformations configured for your account. - # - # @overload list(request_options: {}) - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Array] - # - # @see Imagekitio::Models::NamedTransformationListParams - def list(params = {}) - @client.request( - method: :get, - path: "v1/named-transformations", - model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], - options: params[:request_options] - ) - end - - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationDeleteParams} for more details. - # - # Permanently deletes the named transformation identified by `id` and returns the - # deleted object. - # - # **Note:** - # - # - If another named transformation, or your account's upload - # pre-transformation/post-transformation settings, reference this named - # transformation (via the `n-` token), the request fails with a `409` - # error whose `message` describes what it is referenced by. Remove those - # references first, then retry the deletion. This is a best-effort check and - # cannot detect references baked into your own application code or previously - # generated URLs. - # - # @overload delete(id, request_options: {}) - # - # @param id [String] Unique identifier of the named transformation. This is the `id` returned when th - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::NamedTransformation] - # - # @see Imagekitio::Models::NamedTransformationDeleteParams - def delete(id, params = {}) - @client.request( - method: :delete, - path: ["v1/named-transformations/%1$s", id], - model: Imagekitio::NamedTransformation, - options: params[:request_options] - ) - end - - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationGetParams} for more details. - # - # Retrieves the named transformation identified by `id`. - # - # @overload get(id, request_options: {}) - # - # @param id [String] Unique identifier of the named transformation. This is the `id` returned when th - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::NamedTransformation] - # - # @see Imagekitio::Models::NamedTransformationGetParams - def get(id, params = {}) - @client.request( - method: :get, - path: ["v1/named-transformations/%1$s", id], - model: Imagekitio::NamedTransformation, - options: params[:request_options] - ) - end - - # @api private - # - # @param client [Imagekitio::Client] - def initialize(client:) - @client = client - end - end - end -end diff --git a/rbi/imagekitio/client.rbi b/rbi/imagekitio/client.rbi index c04d2374..90f1116e 100644 --- a/rbi/imagekitio/client.rbi +++ b/rbi/imagekitio/client.rbi @@ -36,9 +36,6 @@ module Imagekitio sig { returns(Imagekitio::Resources::SavedExtensions) } attr_reader :saved_extensions - sig { returns(Imagekitio::Resources::NamedTransformations) } - attr_reader :named_transformations - sig { returns(Imagekitio::Resources::Assets) } attr_reader :assets diff --git a/rbi/imagekitio/models.rbi b/rbi/imagekitio/models.rbi index 6bbbe1a7..9bd10e61 100644 --- a/rbi/imagekitio/models.rbi +++ b/rbi/imagekitio/models.rbi @@ -96,23 +96,6 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata - NamedTransformation = Imagekitio::Models::NamedTransformation - - NamedTransformationCreateParams = - Imagekitio::Models::NamedTransformationCreateParams - - NamedTransformationDeleteParams = - Imagekitio::Models::NamedTransformationDeleteParams - - NamedTransformationGetParams = - Imagekitio::Models::NamedTransformationGetParams - - NamedTransformationListParams = - Imagekitio::Models::NamedTransformationListParams - - NamedTransformationUpdateParams = - Imagekitio::Models::NamedTransformationUpdateParams - Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/rbi/imagekitio/models/custom_metadata_field.rbi b/rbi/imagekitio/models/custom_metadata_field.rbi index d727d437..43a725e7 100644 --- a/rbi/imagekitio/models/custom_metadata_field.rbi +++ b/rbi/imagekitio/models/custom_metadata_field.rbi @@ -32,13 +32,23 @@ module Imagekitio end attr_writer :schema + # Optional description of the custom metadata field. Only present when a + # description has been set. Shown as a hint to the users while setting the field's + # value on an asset in the media library UI. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + # Object containing details of a custom metadata field. sig do params( id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema::OrHash + schema: Imagekitio::CustomMetadataField::Schema::OrHash, + description: String ).returns(T.attached_class) end def self.new( @@ -52,7 +62,11 @@ module Imagekitio # `customMetadata` (key-value object) for an asset using upload or update API. name:, # An object that describes the rules for the custom metadata field value. - schema: + schema:, + # Optional description of the custom metadata field. Only present when a + # description has been set. Shown as a hint to the users while setting the field's + # value on an asset in the media library UI. + description: nil ) end @@ -62,7 +76,8 @@ module Imagekitio id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema + schema: Imagekitio::CustomMetadataField::Schema, + description: String } ) end diff --git a/rbi/imagekitio/models/custom_metadata_field_create_params.rbi b/rbi/imagekitio/models/custom_metadata_field_create_params.rbi index a6622776..2eae77da 100644 --- a/rbi/imagekitio/models/custom_metadata_field_create_params.rbi +++ b/rbi/imagekitio/models/custom_metadata_field_create_params.rbi @@ -36,11 +36,21 @@ module Imagekitio end attr_writer :schema + # Optional description for the custom metadata field. Can be up to 500 characters. + # This is shown as a hint to the users while setting the field's value on an asset + # in the media library UI. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + sig do params( label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema::OrHash, + description: String, request_options: Imagekitio::RequestOptions::OrHash ).returns(T.attached_class) end @@ -54,6 +64,10 @@ module Imagekitio # (including deleted) custom metadata fields. name:, schema:, + # Optional description for the custom metadata field. Can be up to 500 characters. + # This is shown as a hint to the users while setting the field's value on an asset + # in the media library UI. + description: nil, request_options: {} ) end @@ -64,6 +78,7 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, + description: String, request_options: Imagekitio::RequestOptions } ) diff --git a/rbi/imagekitio/models/custom_metadata_field_update_params.rbi b/rbi/imagekitio/models/custom_metadata_field_update_params.rbi index a7c631ae..0f7e57dc 100644 --- a/rbi/imagekitio/models/custom_metadata_field_update_params.rbi +++ b/rbi/imagekitio/models/custom_metadata_field_update_params.rbi @@ -17,6 +17,16 @@ module Imagekitio sig { returns(String) } attr_accessor :id + # Optional description for the custom metadata field. Can be up to 500 characters. + # Send an empty string to clear an existing description. This is shown as a hint + # to the users while setting the field's value on an asset in the media library + # UI. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field # label to the users while setting field value on an asset in the media library @@ -46,6 +56,7 @@ module Imagekitio sig do params( id: String, + description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema::OrHash, request_options: Imagekitio::RequestOptions::OrHash @@ -53,6 +64,11 @@ module Imagekitio end def self.new( id:, + # Optional description for the custom metadata field. Can be up to 500 characters. + # Send an empty string to clear an existing description. This is shown as a hint + # to the users while setting the field's value on an asset in the media library + # UI. + description: nil, # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field # label to the users while setting field value on an asset in the media library @@ -71,6 +87,7 @@ module Imagekitio override.returns( { id: String, + description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, request_options: Imagekitio::RequestOptions diff --git a/rbi/imagekitio/models/named_transformation.rbi b/rbi/imagekitio/models/named_transformation.rbi deleted file mode 100644 index c92aae7f..00000000 --- a/rbi/imagekitio/models/named_transformation.rbi +++ /dev/null @@ -1,90 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformation < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any(Imagekitio::NamedTransformation, Imagekitio::Internal::AnyHash) - end - - # Unique identifier of the named transformation. This is generated by ImageKit - # when you create a new named transformation. - sig { returns(T.nilable(String)) } - attr_reader :id - - sig { params(id: String).void } - attr_writer :id - - # Timestamp when the named transformation was created. - sig { returns(T.nilable(Time)) } - attr_reader :created_at - - sig { params(created_at: Time).void } - attr_writer :created_at - - # Whether this named transformation is currently disabled. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :disabled - - sig { params(disabled: T::Boolean).void } - attr_writer :disabled - - # Name of the named transformation, used as `tr:n-` in image and video URLs. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # The transformation string this name refers to. - sig { returns(T.nilable(String)) } - attr_reader :transformation - - sig { params(transformation: String).void } - attr_writer :transformation - - # A named transformation is an alias for an actual transformation string, allowing - # you to apply and later update complex transformations without changing your - # image or video URLs. Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - sig do - params( - id: String, - created_at: Time, - disabled: T::Boolean, - name: String, - transformation: String - ).returns(T.attached_class) - end - def self.new( - # Unique identifier of the named transformation. This is generated by ImageKit - # when you create a new named transformation. - id: nil, - # Timestamp when the named transformation was created. - created_at: nil, - # Whether this named transformation is currently disabled. - disabled: nil, - # Name of the named transformation, used as `tr:n-` in image and video URLs. - name: nil, - # The transformation string this name refers to. - transformation: nil - ) - end - - sig do - override.returns( - { - id: String, - created_at: Time, - disabled: T::Boolean, - name: String, - transformation: String - } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_create_params.rbi b/rbi/imagekitio/models/named_transformation_create_params.rbi deleted file mode 100644 index 921181db..00000000 --- a/rbi/imagekitio/models/named_transformation_create_params.rbi +++ /dev/null @@ -1,81 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationCreateParams, - Imagekitio::Internal::AnyHash - ) - end - - # Name of the named transformation. This is the alias used to refer to the - # transformation string in image and video URLs, for example `tr:n-`. Can - # only contain alphanumeric characters, `_` and `-`, and must be unique for your - # account (case-insensitive). - sig { returns(String) } - attr_accessor :name - - # The transformation string this name refers to. It must start with `tr:` followed - # by one or more transformation parameters, for example - # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the - # [transformation syntax](https://imagekit.io/docs/transformations). - sig { returns(String) } - attr_accessor :transformation - - # Whether this named transformation is disabled. Set to `true` to temporarily - # disable it without deleting it — requests using a disabled named transformation - # fail at delivery time. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :disabled - - sig { params(disabled: T::Boolean).void } - attr_writer :disabled - - sig do - params( - name: String, - transformation: String, - disabled: T::Boolean, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new( - # Name of the named transformation. This is the alias used to refer to the - # transformation string in image and video URLs, for example `tr:n-`. Can - # only contain alphanumeric characters, `_` and `-`, and must be unique for your - # account (case-insensitive). - name:, - # The transformation string this name refers to. It must start with `tr:` followed - # by one or more transformation parameters, for example - # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the - # [transformation syntax](https://imagekit.io/docs/transformations). - transformation:, - # Whether this named transformation is disabled. Set to `true` to temporarily - # disable it without deleting it — requests using a disabled named transformation - # fail at delivery time. - disabled: nil, - request_options: {} - ) - end - - sig do - override.returns( - { - name: String, - transformation: String, - disabled: T::Boolean, - request_options: Imagekitio::RequestOptions - } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_delete_params.rbi b/rbi/imagekitio/models/named_transformation_delete_params.rbi deleted file mode 100644 index 3d83b411..00000000 --- a/rbi/imagekitio/models/named_transformation_delete_params.rbi +++ /dev/null @@ -1,38 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationDeleteParams, - Imagekitio::Internal::AnyHash - ) - end - - sig { returns(String) } - attr_accessor :id - - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new(id:, request_options: {}) - end - - sig do - override.returns( - { id: String, request_options: Imagekitio::RequestOptions } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_get_params.rbi b/rbi/imagekitio/models/named_transformation_get_params.rbi deleted file mode 100644 index f0e13de0..00000000 --- a/rbi/imagekitio/models/named_transformation_get_params.rbi +++ /dev/null @@ -1,38 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationGetParams, - Imagekitio::Internal::AnyHash - ) - end - - sig { returns(String) } - attr_accessor :id - - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new(id:, request_options: {}) - end - - sig do - override.returns( - { id: String, request_options: Imagekitio::RequestOptions } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_list_params.rbi b/rbi/imagekitio/models/named_transformation_list_params.rbi deleted file mode 100644 index c26ca9cf..00000000 --- a/rbi/imagekitio/models/named_transformation_list_params.rbi +++ /dev/null @@ -1,30 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationListParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationListParams, - 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/named_transformation_list_response.rbi b/rbi/imagekitio/models/named_transformation_list_response.rbi deleted file mode 100644 index d344b117..00000000 --- a/rbi/imagekitio/models/named_transformation_list_response.rbi +++ /dev/null @@ -1,11 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - NamedTransformationListResponse = - T.let( - Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], - Imagekitio::Internal::Type::Converter - ) - end -end diff --git a/rbi/imagekitio/models/named_transformation_update_params.rbi b/rbi/imagekitio/models/named_transformation_update_params.rbi deleted file mode 100644 index 87da0706..00000000 --- a/rbi/imagekitio/models/named_transformation_update_params.rbi +++ /dev/null @@ -1,81 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationUpdateParams, - Imagekitio::Internal::AnyHash - ) - end - - sig { returns(String) } - attr_accessor :id - - # Whether this named transformation is disabled. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :disabled - - sig { params(disabled: T::Boolean).void } - attr_writer :disabled - - # Updated name of the named transformation. Can only contain alphanumeric - # characters, `_` and `-`, and must be unique for your account (case-insensitive). - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # Updated transformation string. It must start with `tr:` followed by one or more - # transformation parameters. - sig { returns(T.nilable(String)) } - attr_reader :transformation - - sig { params(transformation: String).void } - attr_writer :transformation - - sig do - params( - id: String, - disabled: T::Boolean, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new( - id:, - # Whether this named transformation is disabled. - disabled: nil, - # Updated name of the named transformation. Can only contain alphanumeric - # characters, `_` and `-`, and must be unique for your account (case-insensitive). - name: nil, - # Updated transformation string. It must start with `tr:` followed by one or more - # transformation parameters. - transformation: nil, - request_options: {} - ) - end - - sig do - override.returns( - { - id: String, - disabled: T::Boolean, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions - } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/resources/custom_metadata_fields.rbi b/rbi/imagekitio/resources/custom_metadata_fields.rbi index c3f0a4cb..ee08b726 100644 --- a/rbi/imagekitio/resources/custom_metadata_fields.rbi +++ b/rbi/imagekitio/resources/custom_metadata_fields.rbi @@ -12,6 +12,7 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema::OrHash, + description: String, request_options: Imagekitio::RequestOptions::OrHash ).returns(Imagekitio::CustomMetadataField) end @@ -25,14 +26,20 @@ module Imagekitio # (including deleted) custom metadata fields. name:, schema:, + # Optional description for the custom metadata field. Can be up to 500 characters. + # This is shown as a hint to the users while setting the field's value on an asset + # in the media library UI. + description: nil, request_options: {} ) end - # This API updates the label or schema of an existing custom metadata field. + # This API updates the label, description, or schema of an existing custom + # metadata field. sig do params( id: String, + description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema::OrHash, request_options: Imagekitio::RequestOptions::OrHash @@ -41,6 +48,11 @@ module Imagekitio def update( # Should be a valid custom metadata field id. id, + # Optional description for the custom metadata field. Can be up to 500 characters. + # Send an empty string to clear an existing description. This is shown as a hint + # to the users while setting the field's value on an asset in the media library + # UI. + description: nil, # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field # label to the users while setting field value on an asset in the media library diff --git a/rbi/imagekitio/resources/named_transformations.rbi b/rbi/imagekitio/resources/named_transformations.rbi deleted file mode 100644 index e4e22e00..00000000 --- a/rbi/imagekitio/resources/named_transformations.rbi +++ /dev/null @@ -1,125 +0,0 @@ -# typed: strong - -module Imagekitio - module Resources - class NamedTransformations - # Creates a new named transformation and returns the created object. - # - # Named transformations let you assign a short, reusable name to a complex - # transformation string, so it can be applied in image and video URLs as - # `tr:n-` and later updated without changing any existing URLs. - # - # Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - sig do - params( - name: String, - transformation: String, - disabled: T::Boolean, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::NamedTransformation) - end - def create( - # Name of the named transformation. This is the alias used to refer to the - # transformation string in image and video URLs, for example `tr:n-`. Can - # only contain alphanumeric characters, `_` and `-`, and must be unique for your - # account (case-insensitive). - name:, - # The transformation string this name refers to. It must start with `tr:` followed - # by one or more transformation parameters, for example - # `tr:w-150,h-150,fo-center,cm-resize`. Learn more about the - # [transformation syntax](https://imagekit.io/docs/transformations). - transformation:, - # Whether this named transformation is disabled. Set to `true` to temporarily - # disable it without deleting it — requests using a disabled named transformation - # fail at delivery time. - disabled: nil, - request_options: {} - ) - end - - # Updates the named transformation identified by `id` and returns the updated - # object. Only the fields present in the request body are updated; omitted fields - # are left unchanged. - sig do - params( - id: String, - disabled: T::Boolean, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::NamedTransformation) - end - def update( - # Unique identifier of the named transformation. This is the `id` returned when - # the named transformation was created. - id, - # Whether this named transformation is disabled. - disabled: nil, - # Updated name of the named transformation. Can only contain alphanumeric - # characters, `_` and `-`, and must be unique for your account (case-insensitive). - name: nil, - # Updated transformation string. It must start with `tr:` followed by one or more - # transformation parameters. - transformation: nil, - request_options: {} - ) - end - - # Returns an array of all named transformations configured for your account. - sig do - params(request_options: Imagekitio::RequestOptions::OrHash).returns( - T::Array[Imagekitio::NamedTransformation] - ) - end - def list(request_options: {}) - end - - # Permanently deletes the named transformation identified by `id` and returns the - # deleted object. - # - # **Note:** - # - # - If another named transformation, or your account's upload - # pre-transformation/post-transformation settings, reference this named - # transformation (via the `n-` token), the request fails with a `409` - # error whose `message` describes what it is referenced by. Remove those - # references first, then retry the deletion. This is a best-effort check and - # cannot detect references baked into your own application code or previously - # generated URLs. - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::NamedTransformation) - end - def delete( - # Unique identifier of the named transformation. This is the `id` returned when - # the named transformation was created. - id, - request_options: {} - ) - end - - # Retrieves the named transformation identified by `id`. - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::NamedTransformation) - end - def get( - # Unique identifier of the named transformation. This is the `id` returned when - # the named transformation was created. - 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 57af63f0..dec87d14 100644 --- a/sig/imagekitio/client.rbs +++ b/sig/imagekitio/client.rbs @@ -20,8 +20,6 @@ module Imagekitio attr_reader saved_extensions: Imagekitio::Resources::SavedExtensions - attr_reader named_transformations: Imagekitio::Resources::NamedTransformations - attr_reader assets: Imagekitio::Resources::Assets attr_reader cache: Imagekitio::Resources::Cache diff --git a/sig/imagekitio/models.rbs b/sig/imagekitio/models.rbs index ce6b4abe..c63f18f8 100644 --- a/sig/imagekitio/models.rbs +++ b/sig/imagekitio/models.rbs @@ -81,18 +81,6 @@ module Imagekitio class Metadata = Imagekitio::Models::Metadata - class NamedTransformation = Imagekitio::Models::NamedTransformation - - class NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams - - class NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams - - class NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams - - class NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams - - class NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams - module Overlay = Imagekitio::Models::Overlay class OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/sig/imagekitio/models/custom_metadata_field.rbs b/sig/imagekitio/models/custom_metadata_field.rbs index 3c2071f5..63a2d006 100644 --- a/sig/imagekitio/models/custom_metadata_field.rbs +++ b/sig/imagekitio/models/custom_metadata_field.rbs @@ -5,7 +5,8 @@ module Imagekitio id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema + schema: Imagekitio::CustomMetadataField::Schema, + description: String } class CustomMetadataField < Imagekitio::Internal::Type::BaseModel @@ -17,18 +18,24 @@ module Imagekitio attr_accessor schema: Imagekitio::CustomMetadataField::Schema + attr_reader description: String? + + def description=: (String) -> String + def initialize: ( id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema + schema: Imagekitio::CustomMetadataField::Schema, + ?description: String ) -> void def to_hash: -> { id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema + schema: Imagekitio::CustomMetadataField::Schema, + description: String } type schema = diff --git a/sig/imagekitio/models/custom_metadata_field_create_params.rbs b/sig/imagekitio/models/custom_metadata_field_create_params.rbs index 78f2ab99..4be05e40 100644 --- a/sig/imagekitio/models/custom_metadata_field_create_params.rbs +++ b/sig/imagekitio/models/custom_metadata_field_create_params.rbs @@ -4,7 +4,8 @@ module Imagekitio { label: String, name: String, - schema: Imagekitio::CustomMetadataFieldCreateParams::Schema + schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, + description: String } & Imagekitio::Internal::Type::request_parameters @@ -18,10 +19,15 @@ module Imagekitio attr_accessor schema: Imagekitio::CustomMetadataFieldCreateParams::Schema + attr_reader description: String? + + def description=: (String) -> String + def initialize: ( label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, + ?description: String, ?request_options: Imagekitio::request_opts ) -> void @@ -29,6 +35,7 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, + description: String, request_options: Imagekitio::RequestOptions } diff --git a/sig/imagekitio/models/custom_metadata_field_update_params.rbs b/sig/imagekitio/models/custom_metadata_field_update_params.rbs index 99db4963..1da43c1c 100644 --- a/sig/imagekitio/models/custom_metadata_field_update_params.rbs +++ b/sig/imagekitio/models/custom_metadata_field_update_params.rbs @@ -3,6 +3,7 @@ module Imagekitio type custom_metadata_field_update_params = { id: String, + description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema } @@ -14,6 +15,10 @@ module Imagekitio attr_accessor id: String + attr_reader description: String? + + def description=: (String) -> String + attr_reader label: String? def label=: (String) -> String @@ -26,6 +31,7 @@ module Imagekitio def initialize: ( id: String, + ?description: String, ?label: String, ?schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, ?request_options: Imagekitio::request_opts @@ -33,6 +39,7 @@ module Imagekitio def to_hash: -> { id: String, + description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, request_options: Imagekitio::RequestOptions diff --git a/sig/imagekitio/models/named_transformation.rbs b/sig/imagekitio/models/named_transformation.rbs deleted file mode 100644 index 8a6233c2..00000000 --- a/sig/imagekitio/models/named_transformation.rbs +++ /dev/null @@ -1,50 +0,0 @@ -module Imagekitio - module Models - type named_transformation = - { - id: String, - created_at: Time, - disabled: bool, - name: String, - transformation: String - } - - class NamedTransformation < Imagekitio::Internal::Type::BaseModel - attr_reader id: String? - - def id=: (String) -> String - - attr_reader created_at: Time? - - def created_at=: (Time) -> Time - - attr_reader disabled: bool? - - def disabled=: (bool) -> bool - - attr_reader name: String? - - def name=: (String) -> String - - attr_reader transformation: String? - - def transformation=: (String) -> String - - def initialize: ( - ?id: String, - ?created_at: Time, - ?disabled: bool, - ?name: String, - ?transformation: String - ) -> void - - def to_hash: -> { - id: String, - created_at: Time, - disabled: bool, - name: String, - transformation: String - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_create_params.rbs b/sig/imagekitio/models/named_transformation_create_params.rbs deleted file mode 100644 index 7ecd1a58..00000000 --- a/sig/imagekitio/models/named_transformation_create_params.rbs +++ /dev/null @@ -1,34 +0,0 @@ -module Imagekitio - module Models - type named_transformation_create_params = - { name: String, transformation: String, disabled: bool } - & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor name: String - - attr_accessor transformation: String - - attr_reader disabled: bool? - - def disabled=: (bool) -> bool - - def initialize: ( - name: String, - transformation: String, - ?disabled: bool, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - name: String, - transformation: String, - disabled: bool, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_delete_params.rbs b/sig/imagekitio/models/named_transformation_delete_params.rbs deleted file mode 100644 index 4aa8e42f..00000000 --- a/sig/imagekitio/models/named_transformation_delete_params.rbs +++ /dev/null @@ -1,23 +0,0 @@ -module Imagekitio - module Models - type named_transformation_delete_params = - { id: String } & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor id: String - - def initialize: ( - id: String, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - id: String, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_get_params.rbs b/sig/imagekitio/models/named_transformation_get_params.rbs deleted file mode 100644 index bc8c27c1..00000000 --- a/sig/imagekitio/models/named_transformation_get_params.rbs +++ /dev/null @@ -1,23 +0,0 @@ -module Imagekitio - module Models - type named_transformation_get_params = - { id: String } & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor id: String - - def initialize: ( - id: String, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - id: String, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_list_params.rbs b/sig/imagekitio/models/named_transformation_list_params.rbs deleted file mode 100644 index 91dc04e5..00000000 --- a/sig/imagekitio/models/named_transformation_list_params.rbs +++ /dev/null @@ -1,15 +0,0 @@ -module Imagekitio - module Models - type named_transformation_list_params = - { } & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationListParams < 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/named_transformation_list_response.rbs b/sig/imagekitio/models/named_transformation_list_response.rbs deleted file mode 100644 index c800123e..00000000 --- a/sig/imagekitio/models/named_transformation_list_response.rbs +++ /dev/null @@ -1,8 +0,0 @@ -module Imagekitio - module Models - type named_transformation_list_response = - ::Array[Imagekitio::NamedTransformation] - - NamedTransformationListResponse: Imagekitio::Internal::Type::Converter - end -end diff --git a/sig/imagekitio/models/named_transformation_update_params.rbs b/sig/imagekitio/models/named_transformation_update_params.rbs deleted file mode 100644 index 21bfb5ac..00000000 --- a/sig/imagekitio/models/named_transformation_update_params.rbs +++ /dev/null @@ -1,42 +0,0 @@ -module Imagekitio - module Models - type named_transformation_update_params = - { id: String, disabled: bool, name: String, transformation: String } - & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor id: String - - attr_reader disabled: bool? - - def disabled=: (bool) -> bool - - attr_reader name: String? - - def name=: (String) -> String - - attr_reader transformation: String? - - def transformation=: (String) -> String - - def initialize: ( - id: String, - ?disabled: bool, - ?name: String, - ?transformation: String, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - id: String, - disabled: bool, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/resources/custom_metadata_fields.rbs b/sig/imagekitio/resources/custom_metadata_fields.rbs index f4f8e326..a7f4e41a 100644 --- a/sig/imagekitio/resources/custom_metadata_fields.rbs +++ b/sig/imagekitio/resources/custom_metadata_fields.rbs @@ -5,11 +5,13 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, + ?description: String, ?request_options: Imagekitio::request_opts ) -> Imagekitio::CustomMetadataField def update: ( String id, + ?description: String, ?label: String, ?schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, ?request_options: Imagekitio::request_opts diff --git a/sig/imagekitio/resources/named_transformations.rbs b/sig/imagekitio/resources/named_transformations.rbs deleted file mode 100644 index 40e752fd..00000000 --- a/sig/imagekitio/resources/named_transformations.rbs +++ /dev/null @@ -1,36 +0,0 @@ -module Imagekitio - module Resources - class NamedTransformations - def create: ( - name: String, - transformation: String, - ?disabled: bool, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::NamedTransformation - - def update: ( - String id, - ?disabled: bool, - ?name: String, - ?transformation: String, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::NamedTransformation - - def list: ( - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::Models::named_transformation_list_response - - def delete: ( - String id, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::NamedTransformation - - def get: ( - String id, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::NamedTransformation - - def initialize: (client: Imagekitio::Client) -> void - end - end -end diff --git a/test/imagekitio/resources/custom_metadata_fields_test.rb b/test/imagekitio/resources/custom_metadata_fields_test.rb index 1d455ad6..b0023832 100644 --- a/test/imagekitio/resources/custom_metadata_fields_test.rb +++ b/test/imagekitio/resources/custom_metadata_fields_test.rb @@ -18,7 +18,8 @@ def test_create_required_params id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema + schema: Imagekitio::CustomMetadataField::Schema, + description: String | nil } end end @@ -37,7 +38,8 @@ def test_update id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema + schema: Imagekitio::CustomMetadataField::Schema, + description: String | nil } end end diff --git a/test/imagekitio/resources/named_transformations_test.rb b/test/imagekitio/resources/named_transformations_test.rb deleted file mode 100644 index df7809a2..00000000 --- a/test/imagekitio/resources/named_transformations_test.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -require_relative "../test_helper" - -class Imagekitio::Test::Resources::NamedTransformationsTest < Imagekitio::Test::ResourceTest - def test_create_required_params - skip("Mock server tests are disabled") - - response = - @image_kit.named_transformations.create( - name: "small_thumbnail", - transformation: "tr:w-150,h-150,fo-center,cm-resize" - ) - - assert_pattern do - response => Imagekitio::NamedTransformation - end - - assert_pattern do - response => { - id: String | nil, - created_at: Time | nil, - disabled: Imagekitio::Internal::Type::Boolean | nil, - name: String | nil, - transformation: String | nil - } - end - end - - def test_update - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.update("id") - - assert_pattern do - response => Imagekitio::NamedTransformation - end - - assert_pattern do - response => { - id: String | nil, - created_at: Time | nil, - disabled: Imagekitio::Internal::Type::Boolean | nil, - name: String | nil, - transformation: String | nil - } - end - end - - def test_list - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.list - - assert_pattern do - response => ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation]) - end - end - - def test_delete - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.delete("id") - - assert_pattern do - response => Imagekitio::NamedTransformation - end - - assert_pattern do - response => { - id: String | nil, - created_at: Time | nil, - disabled: Imagekitio::Internal::Type::Boolean | nil, - name: String | nil, - transformation: String | nil - } - end - end - - def test_get - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.get("id") - - assert_pattern do - response => Imagekitio::NamedTransformation - end - - assert_pattern do - response => { - id: String | nil, - created_at: Time | nil, - disabled: Imagekitio::Internal::Type::Boolean | nil, - name: String | nil, - transformation: String | nil - } - end - end -end From 431111b97b244e213eb0ba6de36a9255c125cbfc Mon Sep 17 00:00:00 2001 From: release-as-bot Date: Thu, 13 Aug 2026 06:04:47 +0000 Subject: [PATCH 3/6] chore: pin next release Release-As: 4.9.0 From 512b517e3c7c7fa22c9a20e0a20715f3381c66ac Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 15 Aug 2026 09:52:34 +0000 Subject: [PATCH 4/6] feat(api): Named Transformations Stainless-Generated-From: 23b87b10f455588159fd0b39f911c91478f7227b --- .stats.yml | 2 +- lib/imagekitio.rb | 8 + lib/imagekitio/client.rb | 4 + lib/imagekitio/models.rb | 12 ++ lib/imagekitio/models/named_transformation.rb | 60 +++++++ .../named_transformation_create_params.rb | 45 ++++++ .../named_transformation_delete_params.rb | 22 +++ .../models/named_transformation_get_params.rb | 22 +++ .../named_transformation_list_params.rb | 14 ++ .../named_transformation_list_response.rb | 9 ++ .../named_transformation_update_params.rb | 53 ++++++ .../resources/named_transformations.rb | 151 ++++++++++++++++++ rbi/imagekitio/client.rbi | 3 + rbi/imagekitio/models.rbi | 17 ++ .../models/named_transformation.rbi | 81 ++++++++++ .../named_transformation_create_params.rbi | 73 +++++++++ .../named_transformation_delete_params.rbi | 43 +++++ .../named_transformation_get_params.rbi | 43 +++++ .../named_transformation_list_params.rbi | 30 ++++ .../named_transformation_list_response.rbi | 11 ++ .../named_transformation_update_params.rbi | 87 ++++++++++ .../resources/named_transformations.rbi | 119 ++++++++++++++ sig/imagekitio/client.rbs | 2 + sig/imagekitio/models.rbs | 12 ++ .../models/named_transformation.rbs | 40 +++++ .../named_transformation_create_params.rbs | 34 ++++ .../named_transformation_delete_params.rbs | 23 +++ .../named_transformation_get_params.rbs | 23 +++ .../named_transformation_list_params.rbs | 15 ++ .../named_transformation_list_response.rbs | 8 + .../named_transformation_update_params.rbs | 42 +++++ .../resources/named_transformations.rbs | 33 ++++ .../resources/named_transformations_test.rb | 89 +++++++++++ 33 files changed, 1229 insertions(+), 1 deletion(-) create mode 100644 lib/imagekitio/models/named_transformation.rb create mode 100644 lib/imagekitio/models/named_transformation_create_params.rb create mode 100644 lib/imagekitio/models/named_transformation_delete_params.rb create mode 100644 lib/imagekitio/models/named_transformation_get_params.rb create mode 100644 lib/imagekitio/models/named_transformation_list_params.rb create mode 100644 lib/imagekitio/models/named_transformation_list_response.rb create mode 100644 lib/imagekitio/models/named_transformation_update_params.rb create mode 100644 lib/imagekitio/resources/named_transformations.rb create mode 100644 rbi/imagekitio/models/named_transformation.rbi create mode 100644 rbi/imagekitio/models/named_transformation_create_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_delete_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_get_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_list_params.rbi create mode 100644 rbi/imagekitio/models/named_transformation_list_response.rbi create mode 100644 rbi/imagekitio/models/named_transformation_update_params.rbi create mode 100644 rbi/imagekitio/resources/named_transformations.rbi create mode 100644 sig/imagekitio/models/named_transformation.rbs create mode 100644 sig/imagekitio/models/named_transformation_create_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_delete_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_get_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_list_params.rbs create mode 100644 sig/imagekitio/models/named_transformation_list_response.rbs create mode 100644 sig/imagekitio/models/named_transformation_update_params.rbs create mode 100644 sig/imagekitio/resources/named_transformations.rbs create mode 100644 test/imagekitio/resources/named_transformations_test.rb diff --git a/.stats.yml b/.stats.yml index 58526a77..847bd32c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 48 +configured_endpoints: 53 diff --git a/lib/imagekitio.rb b/lib/imagekitio.rb index 4b049982..56e023ac 100644 --- a/lib/imagekitio.rb +++ b/lib/imagekitio.rb @@ -149,6 +149,13 @@ require_relative "imagekitio/models/get_image_attributes_options" require_relative "imagekitio/models/image_overlay" require_relative "imagekitio/models/metadata" +require_relative "imagekitio/models/named_transformation" +require_relative "imagekitio/models/named_transformation_create_params" +require_relative "imagekitio/models/named_transformation_delete_params" +require_relative "imagekitio/models/named_transformation_get_params" +require_relative "imagekitio/models/named_transformation_list_params" +require_relative "imagekitio/models/named_transformation_list_response" +require_relative "imagekitio/models/named_transformation_update_params" require_relative "imagekitio/models/overlay" require_relative "imagekitio/models/overlay_position" require_relative "imagekitio/models/overlay_timing" @@ -202,6 +209,7 @@ require_relative "imagekitio/resources/files/versions" require_relative "imagekitio/resources/folders" require_relative "imagekitio/resources/folders/job" +require_relative "imagekitio/resources/named_transformations" 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 6b3ec5ee..d9b6a586 100644 --- a/lib/imagekitio/client.rb +++ b/lib/imagekitio/client.rb @@ -41,6 +41,9 @@ class Client < Imagekitio::Internal::Transport::BaseClient # @return [Imagekitio::Resources::SavedExtensions] attr_reader :saved_extensions + # @return [Imagekitio::Resources::NamedTransformations] + attr_reader :named_transformations + # @return [Imagekitio::Resources::Assets] attr_reader :assets @@ -149,6 +152,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) + @named_transformations = Imagekitio::Resources::NamedTransformations.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/models.rb b/lib/imagekitio/models.rb index 755cec6d..044cee5b 100644 --- a/lib/imagekitio/models.rb +++ b/lib/imagekitio/models.rb @@ -124,6 +124,18 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata + NamedTransformation = Imagekitio::Models::NamedTransformation + + NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams + + NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams + + NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams + + NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams + + NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams + Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/lib/imagekitio/models/named_transformation.rb b/lib/imagekitio/models/named_transformation.rb new file mode 100644 index 00000000..de72dff4 --- /dev/null +++ b/lib/imagekitio/models/named_transformation.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class NamedTransformation < Imagekitio::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for a named transformation. + # + # @return [String] + required :id, String + + # @!attribute created_at + # ISO 8601 timestamp of when the named transformation was created. + # + # @return [Time] + required :created_at, Time, api_name: :createdAt + + # @!attribute enabled + # Whether the named transformation is currently enabled. When set to `false`, + # requests using this named transformation fail at delivery time. + # + # @return [Boolean] + required :enabled, Imagekitio::Internal::Type::Boolean + + # @!attribute name + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + # + # @return [String] + required :name, String + + # @!attribute transformation + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + # + # @return [String] + required :transformation, String + + # @!method initialize(id:, created_at:, enabled:, name:, transformation:) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformation} for more details. + # + # A named transformation is an alias for a transformation string, letting you + # apply and later update complex transformations without changing your image or + # video URLs. Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + # + # @param id [String] Unique identifier for a named transformation. + # + # @param created_at [Time] ISO 8601 timestamp of when the named transformation was created. + # + # @param enabled [Boolean] Whether the named transformation is currently enabled. When set to `false`, requ + # + # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case + # + # @param transformation [String] The transformation string this named transformation refers to. Learn more about + end + end +end diff --git a/lib/imagekitio/models/named_transformation_create_params.rb b/lib/imagekitio/models/named_transformation_create_params.rb new file mode 100644 index 00000000..7f7721d2 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_create_params.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#create + class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute name + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + # + # @return [String] + required :name, String + + # @!attribute transformation + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + # + # @return [String] + required :transformation, String + + # @!attribute enabled + # Whether the named transformation is currently enabled. When set to `false`, + # requests using this named transformation fail at delivery time. + # + # @return [Boolean, nil] + optional :enabled, Imagekitio::Internal::Type::Boolean + + # @!method initialize(name:, transformation:, enabled: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationCreateParams} for more details. + # + # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case + # + # @param transformation [String] The transformation string this named transformation refers to. Learn more about + # + # @param enabled [Boolean] Whether the named transformation is currently enabled. When set to `false`, requ + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/named_transformation_delete_params.rb b/lib/imagekitio/models/named_transformation_delete_params.rb new file mode 100644 index 00000000..1ee3960a --- /dev/null +++ b/lib/imagekitio/models/named_transformation_delete_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#delete + class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute id + # Unique identifier for a named transformation. + # + # @return [String] + required :id, String + + # @!method initialize(id:, request_options: {}) + # @param id [String] Unique identifier for a named transformation. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/named_transformation_get_params.rb b/lib/imagekitio/models/named_transformation_get_params.rb new file mode 100644 index 00000000..b2fd0287 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_get_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#get + class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute id + # Unique identifier for a named transformation. + # + # @return [String] + required :id, String + + # @!method initialize(id:, request_options: {}) + # @param id [String] Unique identifier for a named transformation. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/models/named_transformation_list_params.rb b/lib/imagekitio/models/named_transformation_list_params.rb new file mode 100644 index 00000000..d455f5a9 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_list_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#list + class NamedTransformationListParams < 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/named_transformation_list_response.rb b/lib/imagekitio/models/named_transformation_list_response.rb new file mode 100644 index 00000000..d7ac92ec --- /dev/null +++ b/lib/imagekitio/models/named_transformation_list_response.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @type [Imagekitio::Internal::Type::Converter] + NamedTransformationListResponse = + Imagekitio::Internal::Type::ArrayOf[-> { Imagekitio::NamedTransformation }] + end +end diff --git a/lib/imagekitio/models/named_transformation_update_params.rb b/lib/imagekitio/models/named_transformation_update_params.rb new file mode 100644 index 00000000..5187bb96 --- /dev/null +++ b/lib/imagekitio/models/named_transformation_update_params.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @see Imagekitio::Resources::NamedTransformations#update + class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + # @!attribute id + # Unique identifier for a named transformation. + # + # @return [String] + required :id, String + + # @!attribute enabled + # Whether the named transformation is enabled. Omit to leave the current value + # unchanged. + # + # @return [Boolean, nil] + optional :enabled, Imagekitio::Internal::Type::Boolean + + # @!attribute name + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + # + # @return [String, nil] + optional :name, String + + # @!attribute transformation + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + # + # @return [String, nil] + optional :transformation, String + + # @!method initialize(id:, enabled: nil, name: nil, transformation: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. + # + # @param id [String] Unique identifier for a named transformation. + # + # @param enabled [Boolean] Whether the named transformation is enabled. Omit to leave the current value unc + # + # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case + # + # @param transformation [String] The transformation string this named transformation refers to. Learn more about + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekitio/resources/named_transformations.rb b/lib/imagekitio/resources/named_transformations.rb new file mode 100644 index 00000000..c845d42a --- /dev/null +++ b/lib/imagekitio/resources/named_transformations.rb @@ -0,0 +1,151 @@ +# frozen_string_literal: true + +module Imagekitio + module Resources + class NamedTransformations + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationCreateParams} for more details. + # + # Creates a new named transformation and returns the created object. + # + # A named transformation is a short, reusable name for a transformation string. + # Use it in image and video URLs as `tr:n-`, and update the underlying + # transformation later without changing existing URLs. Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + # + # You can create up to 250 named transformations per account. + # + # @overload create(name:, transformation:, enabled: nil, request_options: {}) + # + # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case + # + # @param transformation [String] The transformation string this named transformation refers to. Learn more about + # + # @param enabled [Boolean] Whether the named transformation is currently enabled. When set to `false`, requ + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::NamedTransformation] + # + # @see Imagekitio::Models::NamedTransformationCreateParams + def create(params) + parsed, options = Imagekitio::NamedTransformationCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/named-transformations", + body: parsed, + model: Imagekitio::NamedTransformation, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. + # + # Updates the named transformation identified by `id` and returns the updated + # object. Only the fields present in the request body are updated; other fields + # stay unchanged. + # + # Renaming or disabling a named transformation fails with a `409` error if it is + # still referenced (via the `n-` token) by an upload pre-transformation or + # post-transformation setting. This check is best-effort and can't detect + # references in your own application code or in previously generated URLs. + # + # @overload update(id, enabled: nil, name: nil, transformation: nil, request_options: {}) + # + # @param id [String] Unique identifier for a named transformation. + # + # @param enabled [Boolean] Whether the named transformation is enabled. Omit to leave the current value unc + # + # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case + # + # @param transformation [String] The transformation string this named transformation refers to. Learn more about + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::NamedTransformation] + # + # @see Imagekitio::Models::NamedTransformationUpdateParams + def update(id, params = {}) + parsed, options = Imagekitio::NamedTransformationUpdateParams.dump_request(params) + @client.request( + method: :patch, + path: ["v1/named-transformations/%1$s", id], + body: parsed, + model: Imagekitio::NamedTransformation, + options: options + ) + end + + # Returns an array of all named transformations configured for your account. + # + # @overload list(request_options: {}) + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekitio::Models::NamedTransformationListParams + def list(params = {}) + @client.request( + method: :get, + path: "v1/named-transformations", + model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], + options: params[:request_options] + ) + end + + # Permanently deletes the named transformation identified by `id`. + # + # Deletion fails with a `409` error if the named transformation is still + # referenced (via the `n-` token) by an upload pre-transformation or + # post-transformation setting. This check is best-effort and can't detect + # references in your own application code or in previously generated URLs. + # + # @overload delete(id, request_options: {}) + # + # @param id [String] Unique identifier for a named transformation. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Imagekitio::Models::NamedTransformationDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["v1/named-transformations/%1$s", id], + model: NilClass, + options: params[:request_options] + ) + end + + # Retrieves the named transformation identified by `id`. + # + # @overload get(id, request_options: {}) + # + # @param id [String] Unique identifier for a named transformation. + # + # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekitio::Models::NamedTransformation] + # + # @see Imagekitio::Models::NamedTransformationGetParams + def get(id, params = {}) + @client.request( + method: :get, + path: ["v1/named-transformations/%1$s", id], + model: Imagekitio::NamedTransformation, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekitio::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/rbi/imagekitio/client.rbi b/rbi/imagekitio/client.rbi index 90f1116e..c04d2374 100644 --- a/rbi/imagekitio/client.rbi +++ b/rbi/imagekitio/client.rbi @@ -36,6 +36,9 @@ module Imagekitio sig { returns(Imagekitio::Resources::SavedExtensions) } attr_reader :saved_extensions + sig { returns(Imagekitio::Resources::NamedTransformations) } + attr_reader :named_transformations + sig { returns(Imagekitio::Resources::Assets) } attr_reader :assets diff --git a/rbi/imagekitio/models.rbi b/rbi/imagekitio/models.rbi index 9bd10e61..6bbbe1a7 100644 --- a/rbi/imagekitio/models.rbi +++ b/rbi/imagekitio/models.rbi @@ -96,6 +96,23 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata + NamedTransformation = Imagekitio::Models::NamedTransformation + + NamedTransformationCreateParams = + Imagekitio::Models::NamedTransformationCreateParams + + NamedTransformationDeleteParams = + Imagekitio::Models::NamedTransformationDeleteParams + + NamedTransformationGetParams = + Imagekitio::Models::NamedTransformationGetParams + + NamedTransformationListParams = + Imagekitio::Models::NamedTransformationListParams + + NamedTransformationUpdateParams = + Imagekitio::Models::NamedTransformationUpdateParams + Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/rbi/imagekitio/models/named_transformation.rbi b/rbi/imagekitio/models/named_transformation.rbi new file mode 100644 index 00000000..00a2fcd0 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation.rbi @@ -0,0 +1,81 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformation < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekitio::NamedTransformation, Imagekitio::Internal::AnyHash) + end + + # Unique identifier for a named transformation. + sig { returns(String) } + attr_accessor :id + + # ISO 8601 timestamp of when the named transformation was created. + sig { returns(Time) } + attr_accessor :created_at + + # Whether the named transformation is currently enabled. When set to `false`, + # requests using this named transformation fail at delivery time. + sig { returns(T::Boolean) } + attr_accessor :enabled + + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + sig { returns(String) } + attr_accessor :name + + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + sig { returns(String) } + attr_accessor :transformation + + # A named transformation is an alias for a transformation string, letting you + # apply and later update complex transformations without changing your image or + # video URLs. Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + sig do + params( + id: String, + created_at: Time, + enabled: T::Boolean, + name: String, + transformation: String + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for a named transformation. + id:, + # ISO 8601 timestamp of when the named transformation was created. + created_at:, + # Whether the named transformation is currently enabled. When set to `false`, + # requests using this named transformation fail at delivery time. + enabled:, + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + name:, + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + transformation: + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + enabled: T::Boolean, + name: String, + transformation: String + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_create_params.rbi b/rbi/imagekitio/models/named_transformation_create_params.rbi new file mode 100644 index 00000000..b1a2becd --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_create_params.rbi @@ -0,0 +1,73 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationCreateParams, + Imagekitio::Internal::AnyHash + ) + end + + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + sig { returns(String) } + attr_accessor :name + + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + sig { returns(String) } + attr_accessor :transformation + + # Whether the named transformation is currently enabled. When set to `false`, + # requests using this named transformation fail at delivery time. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enabled + + sig { params(enabled: T::Boolean).void } + attr_writer :enabled + + sig do + params( + name: String, + transformation: String, + enabled: T::Boolean, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + name:, + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + transformation:, + # Whether the named transformation is currently enabled. When set to `false`, + # requests using this named transformation fail at delivery time. + enabled: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + name: String, + transformation: String, + enabled: T::Boolean, + request_options: Imagekitio::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_delete_params.rbi b/rbi/imagekitio/models/named_transformation_delete_params.rbi new file mode 100644 index 00000000..8519763a --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_delete_params.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationDeleteParams, + Imagekitio::Internal::AnyHash + ) + end + + # Unique identifier for a named transformation. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for a named transformation. + id:, + request_options: {} + ) + end + + sig do + override.returns( + { id: String, request_options: Imagekitio::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_get_params.rbi b/rbi/imagekitio/models/named_transformation_get_params.rbi new file mode 100644 index 00000000..62fc3f84 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_get_params.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationGetParams, + Imagekitio::Internal::AnyHash + ) + end + + # Unique identifier for a named transformation. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for a named transformation. + id:, + request_options: {} + ) + end + + sig do + override.returns( + { id: String, request_options: Imagekitio::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/named_transformation_list_params.rbi b/rbi/imagekitio/models/named_transformation_list_params.rbi new file mode 100644 index 00000000..c26ca9cf --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_list_params.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationListParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationListParams, + 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/named_transformation_list_response.rbi b/rbi/imagekitio/models/named_transformation_list_response.rbi new file mode 100644 index 00000000..d344b117 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Imagekitio + module Models + NamedTransformationListResponse = + T.let( + Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], + Imagekitio::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekitio/models/named_transformation_update_params.rbi b/rbi/imagekitio/models/named_transformation_update_params.rbi new file mode 100644 index 00000000..a35fd2b0 --- /dev/null +++ b/rbi/imagekitio/models/named_transformation_update_params.rbi @@ -0,0 +1,87 @@ +# typed: strong + +module Imagekitio + module Models + class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekitio::NamedTransformationUpdateParams, + Imagekitio::Internal::AnyHash + ) + end + + # Unique identifier for a named transformation. + sig { returns(String) } + attr_accessor :id + + # Whether the named transformation is enabled. Omit to leave the current value + # unchanged. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enabled + + sig { params(enabled: T::Boolean).void } + attr_writer :enabled + + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + sig { returns(T.nilable(String)) } + attr_reader :transformation + + sig { params(transformation: String).void } + attr_writer :transformation + + sig do + params( + id: String, + enabled: T::Boolean, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for a named transformation. + id:, + # Whether the named transformation is enabled. Omit to leave the current value + # unchanged. + enabled: nil, + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + name: nil, + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + transformation: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + id: String, + enabled: T::Boolean, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/resources/named_transformations.rbi b/rbi/imagekitio/resources/named_transformations.rbi new file mode 100644 index 00000000..65eaa1ce --- /dev/null +++ b/rbi/imagekitio/resources/named_transformations.rbi @@ -0,0 +1,119 @@ +# typed: strong + +module Imagekitio + module Resources + class NamedTransformations + # Creates a new named transformation and returns the created object. + # + # A named transformation is a short, reusable name for a transformation string. + # Use it in image and video URLs as `tr:n-`, and update the underlying + # transformation later without changing existing URLs. Learn more about + # [named transformations](https://imagekit.io/docs/transformations#named-transformations). + # + # You can create up to 250 named transformations per account. + sig do + params( + name: String, + transformation: String, + enabled: T::Boolean, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::NamedTransformation) + end + def create( + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + name:, + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + transformation:, + # Whether the named transformation is currently enabled. When set to `false`, + # requests using this named transformation fail at delivery time. + enabled: nil, + request_options: {} + ) + end + + # Updates the named transformation identified by `id` and returns the updated + # object. Only the fields present in the request body are updated; other fields + # stay unchanged. + # + # Renaming or disabling a named transformation fails with a `409` error if it is + # still referenced (via the `n-` token) by an upload pre-transformation or + # post-transformation setting. This check is best-effort and can't detect + # references in your own application code or in previously generated URLs. + sig do + params( + id: String, + enabled: T::Boolean, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::NamedTransformation) + end + def update( + # Unique identifier for a named transformation. + id, + # Whether the named transformation is enabled. Omit to leave the current value + # unchanged. + enabled: nil, + # Alias for the transformation string, used in URLs as `tr:n-`. This is + # case-sensitive, contains only alphanumeric characters or `_` (underscore), and + # is unique across all named transformations for your account. + name: nil, + # The transformation string this named transformation refers to. Learn more about + # the [transformation string syntax](https://imagekit.io/docs/transformations). + transformation: nil, + request_options: {} + ) + end + + # Returns an array of all named transformations configured for your account. + sig do + params(request_options: Imagekitio::RequestOptions::OrHash).returns( + T::Array[Imagekitio::NamedTransformation] + ) + end + def list(request_options: {}) + end + + # Permanently deletes the named transformation identified by `id`. + # + # Deletion fails with a `409` error if the named transformation is still + # referenced (via the `n-` token) by an upload pre-transformation or + # post-transformation setting. This check is best-effort and can't detect + # references in your own application code or in previously generated URLs. + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).void + end + def delete( + # Unique identifier for a named transformation. + id, + request_options: {} + ) + end + + # Retrieves the named transformation identified by `id`. + sig do + params( + id: String, + request_options: Imagekitio::RequestOptions::OrHash + ).returns(Imagekitio::NamedTransformation) + end + def get( + # Unique identifier for a named transformation. + 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 dec87d14..57af63f0 100644 --- a/sig/imagekitio/client.rbs +++ b/sig/imagekitio/client.rbs @@ -20,6 +20,8 @@ module Imagekitio attr_reader saved_extensions: Imagekitio::Resources::SavedExtensions + attr_reader named_transformations: Imagekitio::Resources::NamedTransformations + attr_reader assets: Imagekitio::Resources::Assets attr_reader cache: Imagekitio::Resources::Cache diff --git a/sig/imagekitio/models.rbs b/sig/imagekitio/models.rbs index c63f18f8..ce6b4abe 100644 --- a/sig/imagekitio/models.rbs +++ b/sig/imagekitio/models.rbs @@ -81,6 +81,18 @@ module Imagekitio class Metadata = Imagekitio::Models::Metadata + class NamedTransformation = Imagekitio::Models::NamedTransformation + + class NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams + + class NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams + + class NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams + + class NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams + + class NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams + module Overlay = Imagekitio::Models::Overlay class OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/sig/imagekitio/models/named_transformation.rbs b/sig/imagekitio/models/named_transformation.rbs new file mode 100644 index 00000000..edcb6747 --- /dev/null +++ b/sig/imagekitio/models/named_transformation.rbs @@ -0,0 +1,40 @@ +module Imagekitio + module Models + type named_transformation = + { + id: String, + created_at: Time, + enabled: bool, + name: String, + transformation: String + } + + class NamedTransformation < Imagekitio::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor enabled: bool + + attr_accessor name: String + + attr_accessor transformation: String + + def initialize: ( + id: String, + created_at: Time, + enabled: bool, + name: String, + transformation: String + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + enabled: bool, + name: String, + transformation: String + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_create_params.rbs b/sig/imagekitio/models/named_transformation_create_params.rbs new file mode 100644 index 00000000..7a534d11 --- /dev/null +++ b/sig/imagekitio/models/named_transformation_create_params.rbs @@ -0,0 +1,34 @@ +module Imagekitio + module Models + type named_transformation_create_params = + { name: String, transformation: String, enabled: bool } + & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor name: String + + attr_accessor transformation: String + + attr_reader enabled: bool? + + def enabled=: (bool) -> bool + + def initialize: ( + name: String, + transformation: String, + ?enabled: bool, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + name: String, + transformation: String, + enabled: bool, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_delete_params.rbs b/sig/imagekitio/models/named_transformation_delete_params.rbs new file mode 100644 index 00000000..4aa8e42f --- /dev/null +++ b/sig/imagekitio/models/named_transformation_delete_params.rbs @@ -0,0 +1,23 @@ +module Imagekitio + module Models + type named_transformation_delete_params = + { id: String } & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor id: String + + def initialize: ( + id: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + id: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_get_params.rbs b/sig/imagekitio/models/named_transformation_get_params.rbs new file mode 100644 index 00000000..bc8c27c1 --- /dev/null +++ b/sig/imagekitio/models/named_transformation_get_params.rbs @@ -0,0 +1,23 @@ +module Imagekitio + module Models + type named_transformation_get_params = + { id: String } & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor id: String + + def initialize: ( + id: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + id: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/models/named_transformation_list_params.rbs b/sig/imagekitio/models/named_transformation_list_params.rbs new file mode 100644 index 00000000..91dc04e5 --- /dev/null +++ b/sig/imagekitio/models/named_transformation_list_params.rbs @@ -0,0 +1,15 @@ +module Imagekitio + module Models + type named_transformation_list_params = + { } & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationListParams < 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/named_transformation_list_response.rbs b/sig/imagekitio/models/named_transformation_list_response.rbs new file mode 100644 index 00000000..c800123e --- /dev/null +++ b/sig/imagekitio/models/named_transformation_list_response.rbs @@ -0,0 +1,8 @@ +module Imagekitio + module Models + type named_transformation_list_response = + ::Array[Imagekitio::NamedTransformation] + + NamedTransformationListResponse: Imagekitio::Internal::Type::Converter + end +end diff --git a/sig/imagekitio/models/named_transformation_update_params.rbs b/sig/imagekitio/models/named_transformation_update_params.rbs new file mode 100644 index 00000000..db06473b --- /dev/null +++ b/sig/imagekitio/models/named_transformation_update_params.rbs @@ -0,0 +1,42 @@ +module Imagekitio + module Models + type named_transformation_update_params = + { id: String, enabled: bool, name: String, transformation: String } + & Imagekitio::Internal::Type::request_parameters + + class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel + extend Imagekitio::Internal::Type::RequestParameters::Converter + include Imagekitio::Internal::Type::RequestParameters + + attr_accessor id: String + + attr_reader enabled: bool? + + def enabled=: (bool) -> bool + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader transformation: String? + + def transformation=: (String) -> String + + def initialize: ( + id: String, + ?enabled: bool, + ?name: String, + ?transformation: String, + ?request_options: Imagekitio::request_opts + ) -> void + + def to_hash: -> { + id: String, + enabled: bool, + name: String, + transformation: String, + request_options: Imagekitio::RequestOptions + } + end + end +end diff --git a/sig/imagekitio/resources/named_transformations.rbs b/sig/imagekitio/resources/named_transformations.rbs new file mode 100644 index 00000000..ba6d0be6 --- /dev/null +++ b/sig/imagekitio/resources/named_transformations.rbs @@ -0,0 +1,33 @@ +module Imagekitio + module Resources + class NamedTransformations + def create: ( + name: String, + transformation: String, + ?enabled: bool, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::NamedTransformation + + def update: ( + String id, + ?enabled: bool, + ?name: String, + ?transformation: String, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::NamedTransformation + + def list: ( + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::Models::named_transformation_list_response + + def delete: (String id, ?request_options: Imagekitio::request_opts) -> nil + + def get: ( + String id, + ?request_options: Imagekitio::request_opts + ) -> Imagekitio::NamedTransformation + + def initialize: (client: Imagekitio::Client) -> void + end + end +end diff --git a/test/imagekitio/resources/named_transformations_test.rb b/test/imagekitio/resources/named_transformations_test.rb new file mode 100644 index 00000000..0028f334 --- /dev/null +++ b/test/imagekitio/resources/named_transformations_test.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekitio::Test::Resources::NamedTransformationsTest < Imagekitio::Test::ResourceTest + def test_create_required_params + skip("Mock server tests are disabled") + + response = + @image_kit.named_transformations.create( + name: "small_thumbnail", + transformation: "w-150,h-150,fo-center,cm-pad_resize" + ) + + assert_pattern do + response => Imagekitio::NamedTransformation + end + + assert_pattern do + response => { + id: String, + created_at: Time, + enabled: Imagekitio::Internal::Type::Boolean, + name: String, + transformation: String + } + end + end + + def test_update + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.update("6bZ9x2ZUx") + + assert_pattern do + response => Imagekitio::NamedTransformation + end + + assert_pattern do + response => { + id: String, + created_at: Time, + enabled: Imagekitio::Internal::Type::Boolean, + name: String, + transformation: String + } + end + end + + def test_list + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.list + + assert_pattern do + response => ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation]) + end + end + + def test_delete + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.delete("6bZ9x2ZUx") + + assert_pattern do + response => nil + end + end + + def test_get + skip("Mock server tests are disabled") + + response = @image_kit.named_transformations.get("6bZ9x2ZUx") + + assert_pattern do + response => Imagekitio::NamedTransformation + end + + assert_pattern do + response => { + id: String, + created_at: Time, + enabled: Imagekitio::Internal::Type::Boolean, + name: String, + transformation: String + } + end + end +end From 0adb2b15a22c06a42cb0f5ba1eda75554d7c9c86 Mon Sep 17 00:00:00 2001 From: "ImageKit.io" <45416977+imagekitio@users.noreply.github.com> Date: Sat, 15 Aug 2026 15:22:55 +0530 Subject: [PATCH 5/6] release: 4.9.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ README.md | 2 +- lib/imagekitio/version.rb | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 90eeef65..6b467676 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.8.0" + ".": "4.9.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b5355b72..5509ce0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [4.9.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.8.0...v4.9.0) (2026-08-15) + + +### Features + +* add description field in custom metadata field api ([f86bf8e](https://github.com/imagekit-developer/imagekit-ruby/commit/f86bf8e78a5fc75323bfeb1a529b2e4045a62729)) +* **api:** Named Transformations ([512b517](https://github.com/imagekit-developer/imagekit-ruby/commit/512b517e3c7c7fa22c9a20e0a20715f3381c66ac)) + + +### Chores + +* change default branch name ([9b3e035](https://github.com/imagekit-developer/imagekit-ruby/commit/9b3e0352461524f45131bc23b5a466116cc26745)) +* move to one repo structure ([c5b6c51](https://github.com/imagekit-developer/imagekit-ruby/commit/c5b6c513b4da32c2426a699c27f90225aae7e346)) +* pin next release ([431111b](https://github.com/imagekit-developer/imagekit-ruby/commit/431111b97b244e213eb0ba6de36a9255c125cbfc)) + ## [4.8.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.7.0...v4.8.0) (2026-07-14) diff --git a/README.md b/README.md index 82e35501..61cef4a3 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "imagekitio", "~> 4.8.0" +gem "imagekitio", "~> 4.9.0" ``` diff --git a/lib/imagekitio/version.rb b/lib/imagekitio/version.rb index 65c2c5c8..01521bad 100644 --- a/lib/imagekitio/version.rb +++ b/lib/imagekitio/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Imagekitio - VERSION = "4.8.0" + VERSION = "4.9.0" end From 9bc7a2a53cd46f8782fff43784a7e1fed761f358 Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sat, 15 Aug 2026 11:49:03 +0000 Subject: [PATCH 6/6] codegen udpate Stainless-Generated-From: 5e2dcf33e4a45d12cfcb1bed457b8bc03a787169 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1dc783b7..b7057abf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - imagekitio (4.8.0) + imagekitio (4.9.0) cgi connection_pool standardwebhooks