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/.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/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/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 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.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/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 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/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 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/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 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/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 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/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 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/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 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/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 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/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 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