diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 29102aeb..934f2cc0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.3.0" + ".": "4.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index df5aafb6..1ee5069c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-63aff1629530786015da3c86131afa8a9b60545d488884b77641f1d4b89c6e9d.yml -openapi_spec_hash: 586d357bd7e5217d240a99e0d83c6d1f -config_hash: 47cb702ee2cb52c58d803ae39ade9b44 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-70c42eda2bee929830b2537f758400a58dded1f1ef5686a286e2469c35a041a0.yml +openapi_spec_hash: cdaeed824e91657b45092765cf55eb42 +config_hash: 83967503e501e4199b4042d0d0f2b615 diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b5aacb..542c03de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,40 @@ # Changelog +## 4.4.0 (2026-04-13) + +Full Changelog: [v4.3.0...v4.4.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.3.0...v4.4.0) + +### Features + +* **api:** add missing types in ruby ([6a074df](https://github.com/imagekit-developer/imagekit-ruby/commit/6a074df0249e9ac9969c2bc4b8d12d9abbd1e233)) +* **api:** dam related webhook events ([d2ffbf3](https://github.com/imagekit-developer/imagekit-ruby/commit/d2ffbf33cabaddffbb97d4c7bc7e54be100a3c67)) +* **api:** fix spec indentation ([74e7a6a](https://github.com/imagekit-developer/imagekit-ruby/commit/74e7a6ae49a83d6faa29796443309f20633b430d)) +* **api:** indentation fix ([fae3b74](https://github.com/imagekit-developer/imagekit-ruby/commit/fae3b74e0de1bdd3e5a29c6061f546aacfc423cb)) +* **api:** merge with main to bring back missing parameters ([78377b5](https://github.com/imagekit-developer/imagekit-ruby/commit/78377b55c03f7818a5f2ae57d19464dfae58763a)) +* **api:** update webhook event names and remove DAM prefix ([c621b14](https://github.com/imagekit-developer/imagekit-ruby/commit/c621b14ca3a92b3428bd3a41156539aba3668097)) + + +### Bug Fixes + +* **api:** extract shared schemas to prevent Go webhook union breaking changes ([0325862](https://github.com/imagekit-developer/imagekit-ruby/commit/032586298410662b5f45b9b4189cc23ef74c1e40)) +* **api:** fix references of schema ([3d07367](https://github.com/imagekit-developer/imagekit-ruby/commit/3d073676557eaac1a3ce9447866936e707f45566)) +* **api:** rename DamFile events to File for consistency ([5998787](https://github.com/imagekit-developer/imagekit-ruby/commit/5998787a6607eb936b51b46b92e24679ac2dd321)) +* **docs:** remove redundant information about versioning in README ([a546963](https://github.com/imagekit-developer/imagekit-ruby/commit/a546963ec88a011e18426a2a9ad46893e8e45eec)) +* **docs:** remove redundant sub-item for webhook signature verification in README ([03f4b45](https://github.com/imagekit-developer/imagekit-ruby/commit/03f4b4580157f6c5a81905b549801e9abb2f3c2c)) +* **docs:** remove unnecessary password parameter from example ([77c9134](https://github.com/imagekit-developer/imagekit-ruby/commit/77c9134775b106ac5107579f3059390870ced790)) +* multipart encoding for file arrays ([5f02f3a](https://github.com/imagekit-developer/imagekit-ruby/commit/5f02f3a700d92bdcba063ce82d64c82fc70d37f8)) +* **webhooks:** encode webhook key in Base64 before verification ([db0b711](https://github.com/imagekit-developer/imagekit-ruby/commit/db0b711f50b3e992f36dd3f30ef74dac502a44a2)) + + +### Documentation + +* add webhook verification section to README ([ceb1927](https://github.com/imagekit-developer/imagekit-ruby/commit/ceb1927213edf8467e8e584a4b43999f0cedcf20)) + + +### Refactors + +* AITags to singular AITag schema with array items pattern ([01a4f00](https://github.com/imagekit-developer/imagekit-ruby/commit/01a4f00f0ce0b7f308f8f84351327c2a25a77408)) + ## 4.3.0 (2026-04-06) Full Changelog: [v4.2.0...v4.3.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.2.0...v4.3.0) diff --git a/Gemfile.lock b/Gemfile.lock index 04807972..fe1dd7d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - imagekitio (4.3.0) + imagekitio (4.4.0) cgi connection_pool standardwebhooks diff --git a/README.md b/README.md index eb891d04..abf93479 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ If you're using Ruby on Rails, the [ImageKit Rails gem](https://github.com/image - [Helper Methods](#helper-methods) - [Authentication parameters for client-side uploads](#authentication-parameters-for-client-side-uploads) - [Responsive image attributes](#responsive-image-attributes) +- [Webhook verification](#webhook-verification) - [Handling errors](#handling-errors) - [Retries](#retries) - [Timeouts](#timeouts) @@ -45,7 +46,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "imagekitio", "~> 4.3.0" +gem "imagekitio", "~> 4.4.0" ``` @@ -525,6 +526,12 @@ attrs = image_kit.helper.get_responsive_image_attributes({ }) ``` +## Webhook verification + +The ImageKit SDK provides utilities to verify webhook signatures for secure event handling. This ensures that webhook requests are actually coming from ImageKit and haven't been tampered with. + +For detailed information about webhook setup, signature verification, and handling different webhook events, refer to the [ImageKit webhook documentation](https://imagekit.io/docs/webhooks#verify-webhook-signature). + ### Handling errors When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Imagekitio::Errors::APIError` will be thrown: @@ -731,7 +738,7 @@ image_kit.assets.list( ## Versioning -This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time. +This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes. diff --git a/lib/imagekitio.rb b/lib/imagekitio.rb index 73020544..9dfc5b8e 100644 --- a/lib/imagekitio.rb +++ b/lib/imagekitio.rb @@ -55,11 +55,11 @@ require_relative "imagekitio/client" require_relative "imagekitio/models/accounts/origin_request" require_relative "imagekitio/models/accounts/url_endpoint_request" +require_relative "imagekitio/models/base_webhook_event" require_relative "imagekitio/models/update_file_request" require_relative "imagekitio/models/file" require_relative "imagekitio/models/src_options" require_relative "imagekitio/models/base_overlay" -require_relative "imagekitio/models/base_webhook_event" require_relative "imagekitio/models/accounts/origin_create_params" require_relative "imagekitio/models/accounts/origin_delete_params" require_relative "imagekitio/models/accounts/origin_get_params" @@ -76,6 +76,7 @@ require_relative "imagekitio/models/accounts/url_endpoint_update_params" require_relative "imagekitio/models/accounts/usage_get_params" require_relative "imagekitio/models/accounts/usage_get_response" +require_relative "imagekitio/models/ai_tag" require_relative "imagekitio/models/asset_list_params" require_relative "imagekitio/models/asset_list_response" require_relative "imagekitio/models/beta/v2/file_upload_params" @@ -84,6 +85,7 @@ require_relative "imagekitio/models/cache/invalidation_create_response" require_relative "imagekitio/models/cache/invalidation_get_params" require_relative "imagekitio/models/cache/invalidation_get_response" +require_relative "imagekitio/models/custom_metadata" require_relative "imagekitio/models/custom_metadata_field" require_relative "imagekitio/models/custom_metadata_field_create_params" require_relative "imagekitio/models/custom_metadata_field_delete_params" @@ -91,10 +93,13 @@ require_relative "imagekitio/models/custom_metadata_field_list_params" require_relative "imagekitio/models/custom_metadata_field_list_response" require_relative "imagekitio/models/custom_metadata_field_update_params" +require_relative "imagekitio/models/embedded_metadata" require_relative "imagekitio/models/extension_config" require_relative "imagekitio/models/extensions" require_relative "imagekitio/models/file_copy_params" require_relative "imagekitio/models/file_copy_response" +require_relative "imagekitio/models/file_create_event" +require_relative "imagekitio/models/file_delete_event" require_relative "imagekitio/models/file_delete_params" require_relative "imagekitio/models/file_get_params" require_relative "imagekitio/models/file_move_params" @@ -117,10 +122,13 @@ require_relative "imagekitio/models/files/version_list_params" require_relative "imagekitio/models/files/version_list_response" require_relative "imagekitio/models/files/version_restore_params" +require_relative "imagekitio/models/file_update_event" require_relative "imagekitio/models/file_update_params" require_relative "imagekitio/models/file_update_response" require_relative "imagekitio/models/file_upload_params" require_relative "imagekitio/models/file_upload_response" +require_relative "imagekitio/models/file_version_create_event" +require_relative "imagekitio/models/file_version_delete_event" require_relative "imagekitio/models/folder" require_relative "imagekitio/models/folder_copy_params" require_relative "imagekitio/models/folder_copy_response" @@ -148,6 +156,7 @@ require_relative "imagekitio/models/saved_extension_list_params" require_relative "imagekitio/models/saved_extension_list_response" require_relative "imagekitio/models/saved_extension_update_params" +require_relative "imagekitio/models/selected_fields_schema" require_relative "imagekitio/models/solid_color_overlay" require_relative "imagekitio/models/solid_color_overlay_transformation" require_relative "imagekitio/models/streaming_resolution" @@ -163,6 +172,7 @@ require_relative "imagekitio/models/upload_post_transform_success_event" require_relative "imagekitio/models/upload_pre_transform_error_event" require_relative "imagekitio/models/upload_pre_transform_success_event" +require_relative "imagekitio/models/version_info" require_relative "imagekitio/models/video_overlay" require_relative "imagekitio/models/video_transformation_accepted_event" require_relative "imagekitio/models/video_transformation_error_event" diff --git a/lib/imagekitio/internal/type/base_model.rb b/lib/imagekitio/internal/type/base_model.rb index 907a0f3f..5a5e8c1d 100644 --- a/lib/imagekitio/internal/type/base_model.rb +++ b/lib/imagekitio/internal/type/base_model.rb @@ -438,11 +438,11 @@ def deep_to_h = self.class.recursively_to_h(@data, convert: false) # @return [Hash{Symbol=>Object}] # # @example - # # `base_overlay` is a `Imagekitio::BaseOverlay` - # base_overlay => { - # layer_mode: layer_mode, - # position: position, - # timing: timing + # # `ai_tag` is a `Imagekitio::AITag` + # ai_tag => { + # confidence: confidence, + # name: name, + # source: source # } def deconstruct_keys(keys) (keys || self.class.known_fields.keys) diff --git a/lib/imagekitio/internal/util.rb b/lib/imagekitio/internal/util.rb index 84dfdcd1..ca4779fb 100644 --- a/lib/imagekitio/internal/util.rb +++ b/lib/imagekitio/internal/util.rb @@ -610,6 +610,7 @@ def encode_query_params(query) # # @return [Array(String, Enumerable)] private def encode_multipart_streaming(body) + # rubocop:disable Style/CaseEquality # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length boundary = SecureRandom.urlsafe_base64(46) @@ -619,7 +620,7 @@ def encode_query_params(query) in Hash body.each do |key, val| case val - in Array if val.all? { primitive?(_1) } + in Array if val.all? { primitive?(_1) || Imagekitio::Internal::Type::FileInput === _1 } val.each do |v| write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing) end @@ -635,6 +636,7 @@ def encode_query_params(query) fused_io = fused_enum(strio) { closing.each(&:call) } [boundary, fused_io] + # rubocop:enable Style/CaseEquality end # @api private diff --git a/lib/imagekitio/models.rb b/lib/imagekitio/models.rb index bc8f57a4..755cec6d 100644 --- a/lib/imagekitio/models.rb +++ b/lib/imagekitio/models.rb @@ -41,6 +41,8 @@ module Imagekitio Accounts = Imagekitio::Models::Accounts + AITag = Imagekitio::Models::AITag + AssetListParams = Imagekitio::Models::AssetListParams BaseOverlay = Imagekitio::Models::BaseOverlay @@ -51,6 +53,9 @@ module Imagekitio Cache = Imagekitio::Models::Cache + # @type [Imagekitio::Internal::Type::Converter] + CustomMetadata = Imagekitio::Models::CustomMetadata + CustomMetadataField = Imagekitio::Models::CustomMetadataField CustomMetadataFieldCreateParams = Imagekitio::Models::CustomMetadataFieldCreateParams @@ -61,6 +66,9 @@ module Imagekitio CustomMetadataFieldUpdateParams = Imagekitio::Models::CustomMetadataFieldUpdateParams + # @type [Imagekitio::Internal::Type::Converter] + EmbeddedMetadata = Imagekitio::Models::EmbeddedMetadata + ExtensionConfig = Imagekitio::Models::ExtensionConfig ExtensionItem = Imagekitio::Models::ExtensionItem @@ -72,6 +80,10 @@ module Imagekitio FileCopyParams = Imagekitio::Models::FileCopyParams + FileCreateEvent = Imagekitio::Models::FileCreateEvent + + FileDeleteEvent = Imagekitio::Models::FileDeleteEvent + FileDeleteParams = Imagekitio::Models::FileDeleteParams FileGetParams = Imagekitio::Models::FileGetParams @@ -82,10 +94,16 @@ module Imagekitio Files = Imagekitio::Models::Files + FileUpdateEvent = Imagekitio::Models::FileUpdateEvent + FileUpdateParams = Imagekitio::Models::FileUpdateParams FileUploadParams = Imagekitio::Models::FileUploadParams + FileVersionCreateEvent = Imagekitio::Models::FileVersionCreateEvent + + FileVersionDeleteEvent = Imagekitio::Models::FileVersionDeleteEvent + Folder = Imagekitio::Models::Folder FolderCopyParams = Imagekitio::Models::FolderCopyParams @@ -126,6 +144,11 @@ module Imagekitio SavedExtensionUpdateParams = Imagekitio::Models::SavedExtensionUpdateParams + # @type [Imagekitio::Internal::Type::Converter] + SelectedFieldsSchema = Imagekitio::Models::SelectedFieldsSchema + + SelectedFieldsSchemaItem = Imagekitio::Models::SelectedFieldsSchemaItem + SolidColorOverlay = Imagekitio::Models::SolidColorOverlay SolidColorOverlayTransformation = Imagekitio::Models::SolidColorOverlayTransformation @@ -160,6 +183,8 @@ module Imagekitio UploadPreTransformSuccessEvent = Imagekitio::Models::UploadPreTransformSuccessEvent + VersionInfo = Imagekitio::Models::VersionInfo + VideoOverlay = Imagekitio::Models::VideoOverlay VideoTransformationAcceptedEvent = Imagekitio::Models::VideoTransformationAcceptedEvent diff --git a/lib/imagekitio/models/ai_tag.rb b/lib/imagekitio/models/ai_tag.rb new file mode 100644 index 00000000..4c024d3a --- /dev/null +++ b/lib/imagekitio/models/ai_tag.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class AITag < Imagekitio::Internal::Type::BaseModel + # @!attribute confidence + # Confidence score of the tag. + # + # @return [Float, nil] + optional :confidence, Float + + # @!attribute name + # Name of the tag. + # + # @return [String, nil] + optional :name, String + + # @!attribute source + # Source of the tag. Possible values are `google-auto-tagging` and + # `aws-auto-tagging`. + # + # @return [String, nil] + optional :source, String + + # @!method initialize(confidence: nil, name: nil, source: nil) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::AITag} for more details. + # + # AI-generated tag associated with an image. These tags can be added using the + # `google-auto-tagging` or `aws-auto-tagging` extensions. + # + # @param confidence [Float] Confidence score of the tag. + # + # @param name [String] Name of the tag. + # + # @param source [String] Source of the tag. Possible values are `google-auto-tagging` and `aws-auto-taggi + end + end +end diff --git a/lib/imagekitio/models/beta/v2/file_upload_response.rb b/lib/imagekitio/models/beta/v2/file_upload_response.rb index 1fe9248e..219adf3e 100644 --- a/lib/imagekitio/models/beta/v2/file_upload_response.rb +++ b/lib/imagekitio/models/beta/v2/file_upload_response.rb @@ -9,9 +9,9 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # @!attribute ai_tags # An array of tags assigned to the uploaded file by auto tagging. # - # @return [Array, nil] + # @return [Array, nil] optional :ai_tags, - -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::Models::Beta::V2::FileUploadResponse::AITag] }, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag] }, api_name: :AITags, nil?: true @@ -151,9 +151,9 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # Keys are the names of the custom metadata fields; the value object has details # about the custom metadata schema. # - # @return [Hash{Symbol=>Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema}, nil] + # @return [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}, nil] optional :selected_fields_schema, - -> { Imagekitio::Internal::Type::HashOf[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema] }, + -> { Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem] }, api_name: :selectedFieldsSchema # @!attribute size @@ -185,10 +185,8 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # @!attribute version_info # An object containing the file or file version's `id` (versionId) and `name`. # - # @return [Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo, nil] - optional :version_info, - -> { Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo }, - api_name: :versionInfo + # @return [Imagekitio::Models::VersionInfo, nil] + optional :version_info, -> { Imagekitio::VersionInfo }, api_name: :versionInfo # @!attribute video_codec # The video codec used in the video (only for video). @@ -208,7 +206,7 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # # Object containing details of a successful upload. # - # @param ai_tags [Array, nil] An array of tags assigned to the uploaded file by auto tagging. + # @param ai_tags [Array, nil] An array of tags assigned to the uploaded file by auto tagging. # # @param audio_codec [String] The audio codec used in the video (only for video). # @@ -242,7 +240,7 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # # @param name [String] Name of the asset. # - # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema}] This field is included in the response only if the Path policy feature is availa + # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}] This field is included in the response only if the Path policy feature is availa # # @param size [Float] Size of the image file in Bytes. # @@ -252,44 +250,12 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # # @param url [String] A publicly accessible URL of the file. # - # @param version_info [Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo] An object containing the file or file version's `id` (versionId) and `name`. + # @param version_info [Imagekitio::Models::VersionInfo] An object containing the file or file version's `id` (versionId) and `name`. # # @param video_codec [String] The video codec used in the video (only for video). # # @param width [Float] Width of the image in pixels (Only for Images) - class AITag < Imagekitio::Internal::Type::BaseModel - # @!attribute confidence - # Confidence score of the tag. - # - # @return [Float, nil] - optional :confidence, Float - - # @!attribute name - # Name of the tag. - # - # @return [String, nil] - optional :name, String - - # @!attribute source - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - # - # @return [String, nil] - optional :source, String - - # @!method initialize(confidence: nil, name: nil, source: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Beta::V2::FileUploadResponse::AITag} for more details. - # - # @param confidence [Float] Confidence score of the tag. - # - # @param name [String] Name of the tag. - # - # @param source [String] Array of `AITags` associated with the image. If no `AITags` are set, it will be - end - # @see Imagekitio::Models::Beta::V2::FileUploadResponse#extension_status class ExtensionStatus < Imagekitio::Internal::Type::BaseModel # @!attribute ai_auto_description @@ -404,233 +370,6 @@ module RemoveBg # @return [Array] end end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - # @!attribute type - # Type of the custom metadata field. - # - # @return [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type] - required :type, enum: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type } - - # @!attribute default_value - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @return [String, Float, Boolean, Array, nil] - optional :default_value, - union: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue }, - api_name: :defaultValue - - # @!attribute is_value_required - # Specifies if the custom metadata field is required or not. - # - # @return [Boolean, nil] - optional :is_value_required, Imagekitio::Internal::Type::Boolean, api_name: :isValueRequired - - # @!attribute max_length - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :max_length, Float, api_name: :maxLength - - # @!attribute max_value - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :max_value, - union: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MaxValue }, - api_name: :maxValue - - # @!attribute min_length - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :min_length, Float, api_name: :minLength - - # @!attribute min_value - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :min_value, - union: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MinValue }, - api_name: :minValue - - # @!attribute read_only - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - # - # @return [Boolean, nil] - optional :read_only, Imagekitio::Internal::Type::Boolean, api_name: :readOnly - - # @!attribute select_options - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @return [Array, nil] - optional :select_options, - -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::SelectOption] }, - api_name: :selectOptions - - # @!attribute select_options_truncated - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - # - # @return [Boolean, nil] - optional :select_options_truncated, - Imagekitio::Internal::Type::Boolean, - api_name: :selectOptionsTruncated - - # @!method initialize(type:, default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, read_only: nil, select_options: nil, select_options_truncated: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema} for - # more details. - # - # @param type [Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type] Type of the custom metadata field. - # - # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. The value should match the `ty - # - # @param is_value_required [Boolean] Specifies if the custom metadata field is required or not. - # - # @param max_length [Float] Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param max_value [String, Float] Maximum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param min_length [Float] Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param min_value [String, Float] Minimum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param read_only [Boolean] Indicates whether the custom metadata field is read only. A read only field cann - # - # @param select_options [Array] An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @param select_options_truncated [Boolean] Specifies if the selectOptions array is truncated. It is truncated when number o - - # Type of the custom metadata field. - # - # @see Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema#type - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT = :Text - TEXTAREA = :Textarea - NUMBER = :Number - DATE = :Date - BOOLEAN = :Boolean - SINGLE_SELECT = :SingleSelect - MULTI_SELECT = :MultiSelect - - # @!method self.values - # @return [Array] - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @see Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema#default_value - module DefaultValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # Default value should be of type array when custom metadata field type is set to `MultiSelect`. - variant -> { Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::MixedArray } - - module Mixed - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - - # @!method self.variants - # @return [Array(String, Float, Boolean, Array)] - - # @type [Imagekitio::Internal::Type::Converter] - MixedArray = - Imagekitio::Internal::Type::ArrayOf[union: -> { Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed }] - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema#max_value - module MaxValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema#min_value - module MinValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - end - - # @see Imagekitio::Models::Beta::V2::FileUploadResponse#version_info - class VersionInfo < Imagekitio::Internal::Type::BaseModel - # @!attribute id - # Unique identifier of the file version. - # - # @return [String, nil] - optional :id, String - - # @!attribute name - # Name of the file version. - # - # @return [String, nil] - optional :name, String - - # @!method initialize(id: nil, name: nil) - # An object containing the file or file version's `id` (versionId) and `name`. - # - # @param id [String] Unique identifier of the file version. - # - # @param name [String] Name of the file version. - end end end end diff --git a/lib/imagekitio/models/custom_metadata.rb b/lib/imagekitio/models/custom_metadata.rb new file mode 100644 index 00000000..6f43e056 --- /dev/null +++ b/lib/imagekitio/models/custom_metadata.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @type [Imagekitio::Internal::Type::Converter] + CustomMetadata = Imagekitio::Internal::Type::HashOf[Imagekitio::Internal::Type::Unknown] + end +end diff --git a/lib/imagekitio/models/embedded_metadata.rb b/lib/imagekitio/models/embedded_metadata.rb new file mode 100644 index 00000000..78d9a9cb --- /dev/null +++ b/lib/imagekitio/models/embedded_metadata.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + # @type [Imagekitio::Internal::Type::Converter] + EmbeddedMetadata = Imagekitio::Internal::Type::HashOf[Imagekitio::Internal::Type::Unknown] + end +end diff --git a/lib/imagekitio/models/file.rb b/lib/imagekitio/models/file.rb index 294cff2d..fd3849f9 100644 --- a/lib/imagekitio/models/file.rb +++ b/lib/imagekitio/models/file.rb @@ -5,11 +5,12 @@ module Models # @see Imagekitio::Resources::Files#get class File < Imagekitio::Internal::Type::BaseModel # @!attribute ai_tags - # An array of tags assigned to the file by auto tagging. + # Array of AI-generated tags associated with the image. If no AITags are set, it + # will be null. # - # @return [Array, nil] + # @return [Array, nil] optional :ai_tags, - -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::File::AITag] }, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag] }, api_name: :AITags, nil?: true @@ -134,9 +135,9 @@ class File < Imagekitio::Internal::Type::BaseModel # Keys are the names of the custom metadata fields; the value object has details # about the custom metadata schema. # - # @return [Hash{Symbol=>Imagekitio::Models::File::SelectedFieldsSchema}, nil] + # @return [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}, nil] optional :selected_fields_schema, - -> { Imagekitio::Internal::Type::HashOf[Imagekitio::File::SelectedFieldsSchema] }, + -> { Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem] }, api_name: :selectedFieldsSchema # @!attribute size @@ -181,8 +182,8 @@ class File < Imagekitio::Internal::Type::BaseModel # @!attribute version_info # An object with details of the file version. # - # @return [Imagekitio::Models::File::VersionInfo, nil] - optional :version_info, -> { Imagekitio::File::VersionInfo }, api_name: :versionInfo + # @return [Imagekitio::Models::VersionInfo, nil] + optional :version_info, -> { Imagekitio::VersionInfo }, api_name: :versionInfo # @!attribute video_codec # The video codec used in the video (only for video). @@ -202,7 +203,7 @@ class File < Imagekitio::Internal::Type::BaseModel # # Object containing details of a file or file version. # - # @param ai_tags [Array, nil] An array of tags assigned to the file by auto tagging. + # @param ai_tags [Array, nil] Array of AI-generated tags associated with the image. If no AITags are set, it w # # @param audio_codec [String] The audio codec used in the video (only for video/audio). # @@ -238,7 +239,7 @@ class File < Imagekitio::Internal::Type::BaseModel # # @param name [String] Name of the asset. # - # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::File::SelectedFieldsSchema}] This field is included in the response only if the Path policy feature is availa + # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}] This field is included in the response only if the Path policy feature is availa # # @param size [Float] Size of the file in bytes. # @@ -252,255 +253,12 @@ class File < Imagekitio::Internal::Type::BaseModel # # @param url [String] URL of the file. # - # @param version_info [Imagekitio::Models::File::VersionInfo] An object with details of the file version. + # @param version_info [Imagekitio::Models::VersionInfo] An object with details of the file version. # # @param video_codec [String] The video codec used in the video (only for video). # # @param width [Float] Width of the file. - class AITag < Imagekitio::Internal::Type::BaseModel - # @!attribute confidence - # Confidence score of the tag. - # - # @return [Float, nil] - optional :confidence, Float - - # @!attribute name - # Name of the tag. - # - # @return [String, nil] - optional :name, String - - # @!attribute source - # Source of the tag. Possible values are `google-auto-tagging` and - # `aws-auto-tagging`. - # - # @return [String, nil] - optional :source, String - - # @!method initialize(confidence: nil, name: nil, source: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::File::AITag} for more details. - # - # @param confidence [Float] Confidence score of the tag. - # - # @param name [String] Name of the tag. - # - # @param source [String] Source of the tag. Possible values are `google-auto-tagging` and `aws-auto-taggi - end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - # @!attribute type - # Type of the custom metadata field. - # - # @return [Symbol, Imagekitio::Models::File::SelectedFieldsSchema::Type] - required :type, enum: -> { Imagekitio::File::SelectedFieldsSchema::Type } - - # @!attribute default_value - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @return [String, Float, Boolean, Array, nil] - optional :default_value, - union: -> { Imagekitio::File::SelectedFieldsSchema::DefaultValue }, - api_name: :defaultValue - - # @!attribute is_value_required - # Specifies if the custom metadata field is required or not. - # - # @return [Boolean, nil] - optional :is_value_required, Imagekitio::Internal::Type::Boolean, api_name: :isValueRequired - - # @!attribute max_length - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :max_length, Float, api_name: :maxLength - - # @!attribute max_value - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :max_value, - union: -> { - Imagekitio::File::SelectedFieldsSchema::MaxValue - }, - api_name: :maxValue - - # @!attribute min_length - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :min_length, Float, api_name: :minLength - - # @!attribute min_value - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :min_value, - union: -> { - Imagekitio::File::SelectedFieldsSchema::MinValue - }, - api_name: :minValue - - # @!attribute read_only - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - # - # @return [Boolean, nil] - optional :read_only, Imagekitio::Internal::Type::Boolean, api_name: :readOnly - - # @!attribute select_options - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @return [Array, nil] - optional :select_options, - -> { - Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::File::SelectedFieldsSchema::SelectOption] - }, - api_name: :selectOptions - - # @!attribute select_options_truncated - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - # - # @return [Boolean, nil] - optional :select_options_truncated, - Imagekitio::Internal::Type::Boolean, - api_name: :selectOptionsTruncated - - # @!method initialize(type:, default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, read_only: nil, select_options: nil, select_options_truncated: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::File::SelectedFieldsSchema} for more details. - # - # @param type [Symbol, Imagekitio::Models::File::SelectedFieldsSchema::Type] Type of the custom metadata field. - # - # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. The value should match the `ty - # - # @param is_value_required [Boolean] Specifies if the custom metadata field is required or not. - # - # @param max_length [Float] Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param max_value [String, Float] Maximum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param min_length [Float] Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param min_value [String, Float] Minimum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param read_only [Boolean] Indicates whether the custom metadata field is read only. A read only field cann - # - # @param select_options [Array] An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @param select_options_truncated [Boolean] Specifies if the selectOptions array is truncated. It is truncated when number o - - # Type of the custom metadata field. - # - # @see Imagekitio::Models::File::SelectedFieldsSchema#type - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT = :Text - TEXTAREA = :Textarea - NUMBER = :Number - DATE = :Date - BOOLEAN = :Boolean - SINGLE_SELECT = :SingleSelect - MULTI_SELECT = :MultiSelect - - # @!method self.values - # @return [Array] - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @see Imagekitio::Models::File::SelectedFieldsSchema#default_value - module DefaultValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # Default value should be of type array when custom metadata field type is set to `MultiSelect`. - variant -> { Imagekitio::Models::File::SelectedFieldsSchema::DefaultValue::MixedArray } - - module Mixed - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - - # @!method self.variants - # @return [Array(String, Float, Boolean, Array)] - - # @type [Imagekitio::Internal::Type::Converter] - MixedArray = - Imagekitio::Internal::Type::ArrayOf[union: -> { - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Mixed - }] - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::File::SelectedFieldsSchema#max_value - module MaxValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::File::SelectedFieldsSchema#min_value - module MinValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - end - # Type of the asset. # # @see Imagekitio::Models::File#type @@ -513,28 +271,6 @@ module Type # @!method self.values # @return [Array] end - - # @see Imagekitio::Models::File#version_info - class VersionInfo < Imagekitio::Internal::Type::BaseModel - # @!attribute id - # Unique identifier of the file version. - # - # @return [String, nil] - optional :id, String - - # @!attribute name - # Name of the file version. - # - # @return [String, nil] - optional :name, String - - # @!method initialize(id: nil, name: nil) - # An object with details of the file version. - # - # @param id [String] Unique identifier of the file version. - # - # @param name [String] Name of the file version. - end end end end diff --git a/lib/imagekitio/models/file_create_event.rb b/lib/imagekitio/models/file_create_event.rb new file mode 100644 index 00000000..d553fcd5 --- /dev/null +++ b/lib/imagekitio/models/file_create_event.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class FileCreateEvent < Imagekitio::Models::BaseWebhookEvent + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # Object containing details of a file or file version. + # + # @return [Imagekitio::Models::File] + required :data, -> { Imagekitio::File } + + # @!attribute type + # Type of the webhook event. + # + # @return [Symbol, :"file.created"] + required :type, const: :"file.created" + + # @!method initialize(created_at:, data:, type: :"file.created") + # Triggered when a file is created. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekitio::Models::File] Object containing details of a file or file version. + # + # @param type [Symbol, :"file.created"] Type of the webhook event. + end + end +end diff --git a/lib/imagekitio/models/file_delete_event.rb b/lib/imagekitio/models/file_delete_event.rb new file mode 100644 index 00000000..018b7e8e --- /dev/null +++ b/lib/imagekitio/models/file_delete_event.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class FileDeleteEvent < Imagekitio::Models::BaseWebhookEvent + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekitio::Models::FileDeleteEvent::Data] + required :data, -> { Imagekitio::FileDeleteEvent::Data } + + # @!attribute type + # Type of the webhook event. + # + # @return [Symbol, :"file.deleted"] + required :type, const: :"file.deleted" + + # @!method initialize(created_at:, data:, type: :"file.deleted") + # Triggered when a file is deleted. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekitio::Models::FileDeleteEvent::Data] + # + # @param type [Symbol, :"file.deleted"] Type of the webhook event. + + class Data < Imagekitio::Internal::Type::BaseModel + # @!attribute file_id + # The unique `fileId` of the deleted file. + # + # @return [String] + required :file_id, String, api_name: :fileId + + # @!method initialize(file_id:) + # @param file_id [String] The unique `fileId` of the deleted file. + end + end + end +end diff --git a/lib/imagekitio/models/file_update_event.rb b/lib/imagekitio/models/file_update_event.rb new file mode 100644 index 00000000..ffda8f90 --- /dev/null +++ b/lib/imagekitio/models/file_update_event.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class FileUpdateEvent < Imagekitio::Models::BaseWebhookEvent + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # Object containing details of a file or file version. + # + # @return [Imagekitio::Models::File] + required :data, -> { Imagekitio::File } + + # @!attribute type + # Type of the webhook event. + # + # @return [Symbol, :"file.updated"] + required :type, const: :"file.updated" + + # @!method initialize(created_at:, data:, type: :"file.updated") + # Triggered when a file is updated. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekitio::Models::File] Object containing details of a file or file version. + # + # @param type [Symbol, :"file.updated"] Type of the webhook event. + end + end +end diff --git a/lib/imagekitio/models/file_upload_response.rb b/lib/imagekitio/models/file_upload_response.rb index 04f81b03..e7d69c9c 100644 --- a/lib/imagekitio/models/file_upload_response.rb +++ b/lib/imagekitio/models/file_upload_response.rb @@ -7,9 +7,9 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # @!attribute ai_tags # An array of tags assigned to the uploaded file by auto tagging. # - # @return [Array, nil] + # @return [Array, nil] optional :ai_tags, - -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::Models::FileUploadResponse::AITag] }, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag] }, api_name: :AITags, nil?: true @@ -149,9 +149,9 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # Keys are the names of the custom metadata fields; the value object has details # about the custom metadata schema. # - # @return [Hash{Symbol=>Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema}, nil] + # @return [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}, nil] optional :selected_fields_schema, - -> { Imagekitio::Internal::Type::HashOf[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema] }, + -> { Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem] }, api_name: :selectedFieldsSchema # @!attribute size @@ -183,8 +183,8 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # @!attribute version_info # An object containing the file or file version's `id` (versionId) and `name`. # - # @return [Imagekitio::Models::FileUploadResponse::VersionInfo, nil] - optional :version_info, -> { Imagekitio::Models::FileUploadResponse::VersionInfo }, api_name: :versionInfo + # @return [Imagekitio::Models::VersionInfo, nil] + optional :version_info, -> { Imagekitio::VersionInfo }, api_name: :versionInfo # @!attribute video_codec # The video codec used in the video (only for video). @@ -204,7 +204,7 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # # Object containing details of a successful upload. # - # @param ai_tags [Array, nil] An array of tags assigned to the uploaded file by auto tagging. + # @param ai_tags [Array, nil] An array of tags assigned to the uploaded file by auto tagging. # # @param audio_codec [String] The audio codec used in the video (only for video). # @@ -238,7 +238,7 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # # @param name [String] Name of the asset. # - # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema}] This field is included in the response only if the Path policy feature is availa + # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}] This field is included in the response only if the Path policy feature is availa # # @param size [Float] Size of the image file in Bytes. # @@ -248,44 +248,12 @@ class FileUploadResponse < Imagekitio::Internal::Type::BaseModel # # @param url [String] A publicly accessible URL of the file. # - # @param version_info [Imagekitio::Models::FileUploadResponse::VersionInfo] An object containing the file or file version's `id` (versionId) and `name`. + # @param version_info [Imagekitio::Models::VersionInfo] An object containing the file or file version's `id` (versionId) and `name`. # # @param video_codec [String] The video codec used in the video (only for video). # # @param width [Float] Width of the image in pixels (Only for Images) - class AITag < Imagekitio::Internal::Type::BaseModel - # @!attribute confidence - # Confidence score of the tag. - # - # @return [Float, nil] - optional :confidence, Float - - # @!attribute name - # Name of the tag. - # - # @return [String, nil] - optional :name, String - - # @!attribute source - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - # - # @return [String, nil] - optional :source, String - - # @!method initialize(confidence: nil, name: nil, source: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::FileUploadResponse::AITag} for more details. - # - # @param confidence [Float] Confidence score of the tag. - # - # @param name [String] Name of the tag. - # - # @param source [String] Array of `AITags` associated with the image. If no `AITags` are set, it will be - end - # @see Imagekitio::Models::FileUploadResponse#extension_status class ExtensionStatus < Imagekitio::Internal::Type::BaseModel # @!attribute ai_auto_description @@ -400,232 +368,6 @@ module RemoveBg # @return [Array] end end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - # @!attribute type - # Type of the custom metadata field. - # - # @return [Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type] - required :type, enum: -> { Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type } - - # @!attribute default_value - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @return [String, Float, Boolean, Array, nil] - optional :default_value, - union: -> { Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue }, - api_name: :defaultValue - - # @!attribute is_value_required - # Specifies if the custom metadata field is required or not. - # - # @return [Boolean, nil] - optional :is_value_required, Imagekitio::Internal::Type::Boolean, api_name: :isValueRequired - - # @!attribute max_length - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :max_length, Float, api_name: :maxLength - - # @!attribute max_value - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :max_value, - union: -> { Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MaxValue }, - api_name: :maxValue - - # @!attribute min_length - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :min_length, Float, api_name: :minLength - - # @!attribute min_value - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :min_value, - union: -> { Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MinValue }, - api_name: :minValue - - # @!attribute read_only - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - # - # @return [Boolean, nil] - optional :read_only, Imagekitio::Internal::Type::Boolean, api_name: :readOnly - - # @!attribute select_options - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @return [Array, nil] - optional :select_options, - -> { Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::SelectOption] }, - api_name: :selectOptions - - # @!attribute select_options_truncated - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - # - # @return [Boolean, nil] - optional :select_options_truncated, - Imagekitio::Internal::Type::Boolean, - api_name: :selectOptionsTruncated - - # @!method initialize(type:, default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, read_only: nil, select_options: nil, select_options_truncated: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema} for more details. - # - # @param type [Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type] Type of the custom metadata field. - # - # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. The value should match the `ty - # - # @param is_value_required [Boolean] Specifies if the custom metadata field is required or not. - # - # @param max_length [Float] Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param max_value [String, Float] Maximum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param min_length [Float] Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param min_value [String, Float] Minimum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param read_only [Boolean] Indicates whether the custom metadata field is read only. A read only field cann - # - # @param select_options [Array] An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @param select_options_truncated [Boolean] Specifies if the selectOptions array is truncated. It is truncated when number o - - # Type of the custom metadata field. - # - # @see Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema#type - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT = :Text - TEXTAREA = :Textarea - NUMBER = :Number - DATE = :Date - BOOLEAN = :Boolean - SINGLE_SELECT = :SingleSelect - MULTI_SELECT = :MultiSelect - - # @!method self.values - # @return [Array] - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @see Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema#default_value - module DefaultValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # Default value should be of type array when custom metadata field type is set to `MultiSelect`. - variant -> { Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::MixedArray } - - module Mixed - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - - # @!method self.variants - # @return [Array(String, Float, Boolean, Array)] - - # @type [Imagekitio::Internal::Type::Converter] - MixedArray = - Imagekitio::Internal::Type::ArrayOf[union: -> { Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed }] - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema#max_value - module MaxValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema#min_value - module MinValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - end - - # @see Imagekitio::Models::FileUploadResponse#version_info - class VersionInfo < Imagekitio::Internal::Type::BaseModel - # @!attribute id - # Unique identifier of the file version. - # - # @return [String, nil] - optional :id, String - - # @!attribute name - # Name of the file version. - # - # @return [String, nil] - optional :name, String - - # @!method initialize(id: nil, name: nil) - # An object containing the file or file version's `id` (versionId) and `name`. - # - # @param id [String] Unique identifier of the file version. - # - # @param name [String] Name of the file version. - end end end end diff --git a/lib/imagekitio/models/file_version_create_event.rb b/lib/imagekitio/models/file_version_create_event.rb new file mode 100644 index 00000000..9d1a5a5d --- /dev/null +++ b/lib/imagekitio/models/file_version_create_event.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class FileVersionCreateEvent < Imagekitio::Models::BaseWebhookEvent + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # Object containing details of a file or file version. + # + # @return [Imagekitio::Models::File] + required :data, -> { Imagekitio::File } + + # @!attribute type + # Type of the webhook event. + # + # @return [Symbol, :"file-version.created"] + required :type, const: :"file-version.created" + + # @!method initialize(created_at:, data:, type: :"file-version.created") + # Triggered when a file version is created. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekitio::Models::File] Object containing details of a file or file version. + # + # @param type [Symbol, :"file-version.created"] Type of the webhook event. + end + end +end diff --git a/lib/imagekitio/models/file_version_delete_event.rb b/lib/imagekitio/models/file_version_delete_event.rb new file mode 100644 index 00000000..32592f6c --- /dev/null +++ b/lib/imagekitio/models/file_version_delete_event.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class FileVersionDeleteEvent < Imagekitio::Models::BaseWebhookEvent + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekitio::Models::FileVersionDeleteEvent::Data] + required :data, -> { Imagekitio::FileVersionDeleteEvent::Data } + + # @!attribute type + # Type of the webhook event. + # + # @return [Symbol, :"file-version.deleted"] + required :type, const: :"file-version.deleted" + + # @!method initialize(created_at:, data:, type: :"file-version.deleted") + # Triggered when a file version is deleted. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekitio::Models::FileVersionDeleteEvent::Data] + # + # @param type [Symbol, :"file-version.deleted"] Type of the webhook event. + + class Data < Imagekitio::Internal::Type::BaseModel + # @!attribute file_id + # The unique `fileId` of the deleted file. + # + # @return [String] + required :file_id, String, api_name: :fileId + + # @!attribute version_id + # The unique `versionId` of the deleted file version. + # + # @return [String] + required :version_id, String, api_name: :versionId + + # @!method initialize(file_id:, version_id:) + # @param file_id [String] The unique `fileId` of the deleted file. + # + # @param version_id [String] The unique `versionId` of the deleted file version. + end + end + end +end diff --git a/lib/imagekitio/models/selected_fields_schema.rb b/lib/imagekitio/models/selected_fields_schema.rb new file mode 100644 index 00000000..7fefd983 --- /dev/null +++ b/lib/imagekitio/models/selected_fields_schema.rb @@ -0,0 +1,212 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class SelectedFieldsSchemaItem < Imagekitio::Internal::Type::BaseModel + # @!attribute type + # Type of the custom metadata field. + # + # @return [Symbol, Imagekitio::Models::SelectedFieldsSchemaItem::Type] + required :type, enum: -> { Imagekitio::SelectedFieldsSchemaItem::Type } + + # @!attribute default_value + # The default value for this custom metadata field. The value should match the + # `type` of custom metadata field. + # + # @return [String, Float, Boolean, Array, nil] + optional :default_value, + union: -> { Imagekitio::SelectedFieldsSchemaItem::DefaultValue }, + api_name: :defaultValue + + # @!attribute is_value_required + # Specifies if the custom metadata field is required or not. + # + # @return [Boolean, nil] + optional :is_value_required, Imagekitio::Internal::Type::Boolean, api_name: :isValueRequired + + # @!attribute max_length + # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. + # + # @return [Float, nil] + optional :max_length, Float, api_name: :maxLength + + # @!attribute max_value + # Maximum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + # + # @return [String, Float, nil] + optional :max_value, union: -> { Imagekitio::SelectedFieldsSchemaItem::MaxValue }, api_name: :maxValue + + # @!attribute min_length + # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. + # + # @return [Float, nil] + optional :min_length, Float, api_name: :minLength + + # @!attribute min_value + # Minimum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + # + # @return [String, Float, nil] + optional :min_value, union: -> { Imagekitio::SelectedFieldsSchemaItem::MinValue }, api_name: :minValue + + # @!attribute read_only + # Indicates whether the custom metadata field is read only. A read only field + # cannot be modified after being set. This field is configurable only via the + # **Path policy** feature. + # + # @return [Boolean, nil] + optional :read_only, Imagekitio::Internal::Type::Boolean, api_name: :readOnly + + # @!attribute select_options + # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + # + # @return [Array, nil] + optional :select_options, + -> { + Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::SelectedFieldsSchemaItem::SelectOption] + }, + api_name: :selectOptions + + # @!attribute select_options_truncated + # Specifies if the selectOptions array is truncated. It is truncated when number + # of options are > 100. + # + # @return [Boolean, nil] + optional :select_options_truncated, + Imagekitio::Internal::Type::Boolean, + api_name: :selectOptionsTruncated + + # @!method initialize(type:, default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, read_only: nil, select_options: nil, select_options_truncated: nil) + # Some parameter documentations has been truncated, see + # {Imagekitio::Models::SelectedFieldsSchemaItem} for more details. + # + # @param type [Symbol, Imagekitio::Models::SelectedFieldsSchemaItem::Type] Type of the custom metadata field. + # + # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. The value should match the `ty + # + # @param is_value_required [Boolean] Specifies if the custom metadata field is required or not. + # + # @param max_length [Float] Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. + # + # @param max_value [String, Float] Maximum value of the field. Only set if field type is `Date` or `Number`. For `D + # + # @param min_length [Float] Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. + # + # @param min_value [String, Float] Minimum value of the field. Only set if field type is `Date` or `Number`. For `D + # + # @param read_only [Boolean] Indicates whether the custom metadata field is read only. A read only field cann + # + # @param select_options [Array] An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + # + # @param select_options_truncated [Boolean] Specifies if the selectOptions array is truncated. It is truncated when number o + + # Type of the custom metadata field. + # + # @see Imagekitio::Models::SelectedFieldsSchemaItem#type + module Type + extend Imagekitio::Internal::Type::Enum + + TEXT = :Text + TEXTAREA = :Textarea + NUMBER = :Number + DATE = :Date + BOOLEAN = :Boolean + SINGLE_SELECT = :SingleSelect + MULTI_SELECT = :MultiSelect + + # @!method self.values + # @return [Array] + end + + # The default value for this custom metadata field. The value should match the + # `type` of custom metadata field. + # + # @see Imagekitio::Models::SelectedFieldsSchemaItem#default_value + module DefaultValue + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # Default value should be of type array when custom metadata field type is set to `MultiSelect`. + variant -> { Imagekitio::Models::SelectedFieldsSchemaItem::DefaultValue::MixedArray } + + module Mixed + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekitio::Internal::Type::Converter] + MixedArray = + Imagekitio::Internal::Type::ArrayOf[union: -> { + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Mixed + }] + end + + # Maximum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + # + # @see Imagekitio::Models::SelectedFieldsSchemaItem#max_value + module MaxValue + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + # @!method self.variants + # @return [Array(String, Float)] + end + + # Minimum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + # + # @see Imagekitio::Models::SelectedFieldsSchemaItem#min_value + module MinValue + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + # @!method self.variants + # @return [Array(String, Float)] + end + + module SelectOption + extend Imagekitio::Internal::Type::Union + + variant String + + variant Float + + variant Imagekitio::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + end + + # @type [Imagekitio::Internal::Type::Converter] + SelectedFieldsSchema = Imagekitio::Internal::Type::HashOf[-> { Imagekitio::SelectedFieldsSchemaItem }] + end +end diff --git a/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb b/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb index 11c26bf4..c2fcb0fb 100644 --- a/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb +++ b/lib/imagekitio/models/unsafe_unwrap_webhook_event.rb @@ -31,8 +31,23 @@ module UnsafeUnwrapWebhookEvent # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. variant -> { Imagekitio::UploadPostTransformErrorEvent } + # Triggered when a file is created. + variant -> { Imagekitio::FileCreateEvent } + + # Triggered when a file is updated. + variant -> { Imagekitio::FileUpdateEvent } + + # Triggered when a file is deleted. + variant -> { Imagekitio::FileDeleteEvent } + + # Triggered when a file version is created. + variant -> { Imagekitio::FileVersionCreateEvent } + + # Triggered when a file version is deleted. + variant -> { Imagekitio::FileVersionDeleteEvent } + # @!method self.variants - # @return [Array(Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent)] + # @return [Array(Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent, Imagekitio::Models::FileCreateEvent, Imagekitio::Models::FileUpdateEvent, Imagekitio::Models::FileDeleteEvent, Imagekitio::Models::FileVersionCreateEvent, Imagekitio::Models::FileVersionDeleteEvent)] end end end diff --git a/lib/imagekitio/models/unwrap_webhook_event.rb b/lib/imagekitio/models/unwrap_webhook_event.rb index c9f71bc9..8c1121f3 100644 --- a/lib/imagekitio/models/unwrap_webhook_event.rb +++ b/lib/imagekitio/models/unwrap_webhook_event.rb @@ -31,8 +31,23 @@ module UnwrapWebhookEvent # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. variant -> { Imagekitio::UploadPostTransformErrorEvent } + # Triggered when a file is created. + variant -> { Imagekitio::FileCreateEvent } + + # Triggered when a file is updated. + variant -> { Imagekitio::FileUpdateEvent } + + # Triggered when a file is deleted. + variant -> { Imagekitio::FileDeleteEvent } + + # Triggered when a file version is created. + variant -> { Imagekitio::FileVersionCreateEvent } + + # Triggered when a file version is deleted. + variant -> { Imagekitio::FileVersionDeleteEvent } + # @!method self.variants - # @return [Array(Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent)] + # @return [Array(Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent, Imagekitio::Models::FileCreateEvent, Imagekitio::Models::FileUpdateEvent, Imagekitio::Models::FileDeleteEvent, Imagekitio::Models::FileVersionCreateEvent, Imagekitio::Models::FileVersionDeleteEvent)] end end end diff --git a/lib/imagekitio/models/upload_pre_transform_success_event.rb b/lib/imagekitio/models/upload_pre_transform_success_event.rb index 3e6d4a65..bdf641a3 100644 --- a/lib/imagekitio/models/upload_pre_transform_success_event.rb +++ b/lib/imagekitio/models/upload_pre_transform_success_event.rb @@ -42,11 +42,9 @@ class Data < Imagekitio::Internal::Type::BaseModel # @!attribute ai_tags # An array of tags assigned to the uploaded file by auto tagging. # - # @return [Array, nil] + # @return [Array, nil] optional :ai_tags, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::UploadPreTransformSuccessEvent::Data::AITag] - }, + -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag] }, api_name: :AITags, nil?: true @@ -186,11 +184,9 @@ class Data < Imagekitio::Internal::Type::BaseModel # Keys are the names of the custom metadata fields; the value object has details # about the custom metadata schema. # - # @return [Hash{Symbol=>Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema}, nil] + # @return [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}, nil] optional :selected_fields_schema, - -> { - Imagekitio::Internal::Type::HashOf[Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema] - }, + -> { Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem] }, api_name: :selectedFieldsSchema # @!attribute size @@ -222,10 +218,8 @@ class Data < Imagekitio::Internal::Type::BaseModel # @!attribute version_info # An object containing the file or file version's `id` (versionId) and `name`. # - # @return [Imagekitio::Models::UploadPreTransformSuccessEvent::Data::VersionInfo, nil] - optional :version_info, - -> { Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo }, - api_name: :versionInfo + # @return [Imagekitio::Models::VersionInfo, nil] + optional :version_info, -> { Imagekitio::VersionInfo }, api_name: :versionInfo # @!attribute video_codec # The video codec used in the video (only for video). @@ -245,7 +239,7 @@ class Data < Imagekitio::Internal::Type::BaseModel # # Object containing details of a successful upload. # - # @param ai_tags [Array, nil] An array of tags assigned to the uploaded file by auto tagging. + # @param ai_tags [Array, nil] An array of tags assigned to the uploaded file by auto tagging. # # @param audio_codec [String] The audio codec used in the video (only for video). # @@ -279,7 +273,7 @@ class Data < Imagekitio::Internal::Type::BaseModel # # @param name [String] Name of the asset. # - # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema}] This field is included in the response only if the Path policy feature is availa + # @param selected_fields_schema [Hash{Symbol=>Imagekitio::Models::SelectedFieldsSchemaItem}] This field is included in the response only if the Path policy feature is availa # # @param size [Float] Size of the image file in Bytes. # @@ -289,45 +283,12 @@ class Data < Imagekitio::Internal::Type::BaseModel # # @param url [String] A publicly accessible URL of the file. # - # @param version_info [Imagekitio::Models::UploadPreTransformSuccessEvent::Data::VersionInfo] An object containing the file or file version's `id` (versionId) and `name`. + # @param version_info [Imagekitio::Models::VersionInfo] An object containing the file or file version's `id` (versionId) and `name`. # # @param video_codec [String] The video codec used in the video (only for video). # # @param width [Float] Width of the image in pixels (Only for Images) - class AITag < Imagekitio::Internal::Type::BaseModel - # @!attribute confidence - # Confidence score of the tag. - # - # @return [Float, nil] - optional :confidence, Float - - # @!attribute name - # Name of the tag. - # - # @return [String, nil] - optional :name, String - - # @!attribute source - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - # - # @return [String, nil] - optional :source, String - - # @!method initialize(confidence: nil, name: nil, source: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::UploadPreTransformSuccessEvent::Data::AITag} for more - # details. - # - # @param confidence [Float] Confidence score of the tag. - # - # @param name [String] Name of the tag. - # - # @param source [String] Array of `AITags` associated with the image. If no `AITags` are set, it will be - end - # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data#extension_status class ExtensionStatus < Imagekitio::Internal::Type::BaseModel # @!attribute ai_auto_description @@ -448,243 +409,6 @@ module RemoveBg # @return [Array] end end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - # @!attribute type - # Type of the custom metadata field. - # - # @return [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type] - required :type, enum: -> { Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type } - - # @!attribute default_value - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @return [String, Float, Boolean, Array, nil] - optional :default_value, - union: -> { - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue - }, - api_name: :defaultValue - - # @!attribute is_value_required - # Specifies if the custom metadata field is required or not. - # - # @return [Boolean, nil] - optional :is_value_required, Imagekitio::Internal::Type::Boolean, api_name: :isValueRequired - - # @!attribute max_length - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :max_length, Float, api_name: :maxLength - - # @!attribute max_value - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :max_value, - union: -> { - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MaxValue - }, - api_name: :maxValue - - # @!attribute min_length - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @return [Float, nil] - optional :min_length, Float, api_name: :minLength - - # @!attribute min_value - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @return [String, Float, nil] - optional :min_value, - union: -> { - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MinValue - }, - api_name: :minValue - - # @!attribute read_only - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - # - # @return [Boolean, nil] - optional :read_only, Imagekitio::Internal::Type::Boolean, api_name: :readOnly - - # @!attribute select_options - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @return [Array, nil] - optional :select_options, - -> { - Imagekitio::Internal::Type::ArrayOf[union: Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::SelectOption] - }, - api_name: :selectOptions - - # @!attribute select_options_truncated - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - # - # @return [Boolean, nil] - optional :select_options_truncated, - Imagekitio::Internal::Type::Boolean, - api_name: :selectOptionsTruncated - - # @!method initialize(type:, default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, read_only: nil, select_options: nil, select_options_truncated: nil) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema} - # for more details. - # - # @param type [Symbol, Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type] Type of the custom metadata field. - # - # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. The value should match the `ty - # - # @param is_value_required [Boolean] Specifies if the custom metadata field is required or not. - # - # @param max_length [Float] Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param max_value [String, Float] Maximum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param min_length [Float] Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - # - # @param min_value [String, Float] Minimum value of the field. Only set if field type is `Date` or `Number`. For `D - # - # @param read_only [Boolean] Indicates whether the custom metadata field is read only. A read only field cann - # - # @param select_options [Array] An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - # - # @param select_options_truncated [Boolean] Specifies if the selectOptions array is truncated. It is truncated when number o - - # Type of the custom metadata field. - # - # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema#type - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT = :Text - TEXTAREA = :Textarea - NUMBER = :Number - DATE = :Date - BOOLEAN = :Boolean - SINGLE_SELECT = :SingleSelect - MULTI_SELECT = :MultiSelect - - # @!method self.values - # @return [Array] - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - # - # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema#default_value - module DefaultValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # Default value should be of type array when custom metadata field type is set to `MultiSelect`. - variant -> { Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::MixedArray } - - module Mixed - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - - # @!method self.variants - # @return [Array(String, Float, Boolean, Array)] - - # @type [Imagekitio::Internal::Type::Converter] - MixedArray = - Imagekitio::Internal::Type::ArrayOf[union: -> { - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Mixed - }] - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema#max_value - module MaxValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - # - # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema#min_value - module MinValue - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - # @!method self.variants - # @return [Array(String, Float)] - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - variant String - - variant Float - - variant Imagekitio::Internal::Type::Boolean - - # @!method self.variants - # @return [Array(String, Float, Boolean)] - end - end - - # @see Imagekitio::Models::UploadPreTransformSuccessEvent::Data#version_info - class VersionInfo < Imagekitio::Internal::Type::BaseModel - # @!attribute id - # Unique identifier of the file version. - # - # @return [String, nil] - optional :id, String - - # @!attribute name - # Name of the file version. - # - # @return [String, nil] - optional :name, String - - # @!method initialize(id: nil, name: nil) - # An object containing the file or file version's `id` (versionId) and `name`. - # - # @param id [String] Unique identifier of the file version. - # - # @param name [String] Name of the file version. - end end class Request < Imagekitio::Internal::Type::BaseModel diff --git a/lib/imagekitio/models/version_info.rb b/lib/imagekitio/models/version_info.rb new file mode 100644 index 00000000..32d7f45f --- /dev/null +++ b/lib/imagekitio/models/version_info.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Imagekitio + module Models + class VersionInfo < Imagekitio::Internal::Type::BaseModel + # @!attribute id + # Unique identifier of the file version. + # + # @return [String, nil] + optional :id, String + + # @!attribute name + # Name of the file version. + # + # @return [String, nil] + optional :name, String + + # @!method initialize(id: nil, name: nil) + # An object containing the file or file version's `id` (versionId) and `name`. + # + # @param id [String] Unique identifier of the file version. + # + # @param name [String] Name of the file version. + end + end +end diff --git a/lib/imagekitio/resources/webhooks.rb b/lib/imagekitio/resources/webhooks.rb index b00673ff..b9ae15bc 100644 --- a/lib/imagekitio/resources/webhooks.rb +++ b/lib/imagekitio/resources/webhooks.rb @@ -5,7 +5,7 @@ module Resources class Webhooks # @param payload [String] The raw webhook payload as a string # - # @return [Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent] + # @return [Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent, Imagekitio::Models::FileCreateEvent, Imagekitio::Models::FileUpdateEvent, Imagekitio::Models::FileDeleteEvent, Imagekitio::Models::FileVersionCreateEvent, Imagekitio::Models::FileVersionDeleteEvent] def unsafe_unwrap(payload) parsed = JSON.parse(payload, symbolize_names: true) Imagekitio::Internal::Type::Converter.coerce(Imagekitio::Models::UnsafeUnwrapWebhookEvent, parsed) @@ -17,13 +17,14 @@ def unsafe_unwrap(payload) # # @param key [String, nil] The webhook signing key # - # @return [Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent] + # @return [Imagekitio::Models::VideoTransformationAcceptedEvent, Imagekitio::Models::VideoTransformationReadyEvent, Imagekitio::Models::VideoTransformationErrorEvent, Imagekitio::Models::UploadPreTransformSuccessEvent, Imagekitio::Models::UploadPreTransformErrorEvent, Imagekitio::Models::UploadPostTransformSuccessEvent, Imagekitio::Models::UploadPostTransformErrorEvent, Imagekitio::Models::FileCreateEvent, Imagekitio::Models::FileUpdateEvent, Imagekitio::Models::FileDeleteEvent, Imagekitio::Models::FileVersionCreateEvent, Imagekitio::Models::FileVersionDeleteEvent] def unwrap(payload, headers:, key: @client.webhook_secret) if key.nil? raise ArgumentError.new("Cannot verify a webhook without a key on either the client's webhook_secret or passed in as an argument") end - ::StandardWebhooks::Webhook.new(key).verify(payload, headers) + encoded_key = Base64.strict_encode64(key) + ::StandardWebhooks::Webhook.new(encoded_key).verify(payload, headers) parsed = JSON.parse(payload, symbolize_names: true) Imagekitio::Internal::Type::Converter.coerce(Imagekitio::Models::UnwrapWebhookEvent, parsed) diff --git a/lib/imagekitio/version.rb b/lib/imagekitio/version.rb index 5d680d0b..cb9c766c 100644 --- a/lib/imagekitio/version.rb +++ b/lib/imagekitio/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Imagekitio - VERSION = "4.3.0" + VERSION = "4.4.0" end diff --git a/rbi/imagekitio/models.rbi b/rbi/imagekitio/models.rbi index 0d061049..9bd10e61 100644 --- a/rbi/imagekitio/models.rbi +++ b/rbi/imagekitio/models.rbi @@ -3,6 +3,8 @@ module Imagekitio Accounts = Imagekitio::Models::Accounts + AITag = Imagekitio::Models::AITag + AssetListParams = Imagekitio::Models::AssetListParams BaseOverlay = Imagekitio::Models::BaseOverlay @@ -13,6 +15,12 @@ module Imagekitio Cache = Imagekitio::Models::Cache + CustomMetadata = + T.let( + Imagekitio::Models::CustomMetadata, + Imagekitio::Internal::Type::Converter + ) + CustomMetadataField = Imagekitio::Models::CustomMetadataField CustomMetadataFieldCreateParams = @@ -27,6 +35,12 @@ module Imagekitio CustomMetadataFieldUpdateParams = Imagekitio::Models::CustomMetadataFieldUpdateParams + EmbeddedMetadata = + T.let( + Imagekitio::Models::EmbeddedMetadata, + Imagekitio::Internal::Type::Converter + ) + ExtensionConfig = Imagekitio::Models::ExtensionConfig ExtensionItem = Imagekitio::Models::ExtensionItem @@ -38,6 +52,10 @@ module Imagekitio FileCopyParams = Imagekitio::Models::FileCopyParams + FileCreateEvent = Imagekitio::Models::FileCreateEvent + + FileDeleteEvent = Imagekitio::Models::FileDeleteEvent + FileDeleteParams = Imagekitio::Models::FileDeleteParams FileGetParams = Imagekitio::Models::FileGetParams @@ -48,10 +66,16 @@ module Imagekitio Files = Imagekitio::Models::Files + FileUpdateEvent = Imagekitio::Models::FileUpdateEvent + FileUpdateParams = Imagekitio::Models::FileUpdateParams FileUploadParams = Imagekitio::Models::FileUploadParams + FileVersionCreateEvent = Imagekitio::Models::FileVersionCreateEvent + + FileVersionDeleteEvent = Imagekitio::Models::FileVersionDeleteEvent + Folder = Imagekitio::Models::Folder FolderCopyParams = Imagekitio::Models::FolderCopyParams @@ -92,6 +116,14 @@ module Imagekitio SavedExtensionUpdateParams = Imagekitio::Models::SavedExtensionUpdateParams + SelectedFieldsSchema = + T.let( + Imagekitio::Models::SelectedFieldsSchema, + Imagekitio::Internal::Type::Converter + ) + + SelectedFieldsSchemaItem = Imagekitio::Models::SelectedFieldsSchemaItem + SolidColorOverlay = Imagekitio::Models::SolidColorOverlay SolidColorOverlayTransformation = @@ -132,6 +164,8 @@ module Imagekitio UploadPreTransformSuccessEvent = Imagekitio::Models::UploadPreTransformSuccessEvent + VersionInfo = Imagekitio::Models::VersionInfo + VideoOverlay = Imagekitio::Models::VideoOverlay VideoTransformationAcceptedEvent = diff --git a/rbi/imagekitio/models/ai_tag.rbi b/rbi/imagekitio/models/ai_tag.rbi new file mode 100644 index 00000000..2ae035f9 --- /dev/null +++ b/rbi/imagekitio/models/ai_tag.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module Imagekitio + module Models + class AITag < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Imagekitio::AITag, Imagekitio::Internal::AnyHash) } + + # Confidence score of the tag. + sig { returns(T.nilable(Float)) } + attr_reader :confidence + + sig { params(confidence: Float).void } + attr_writer :confidence + + # Name of the tag. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Source of the tag. Possible values are `google-auto-tagging` and + # `aws-auto-tagging`. + sig { returns(T.nilable(String)) } + attr_reader :source + + sig { params(source: String).void } + attr_writer :source + + # AI-generated tag associated with an image. These tags can be added using the + # `google-auto-tagging` or `aws-auto-tagging` extensions. + sig do + params(confidence: Float, name: String, source: String).returns( + T.attached_class + ) + end + def self.new( + # Confidence score of the tag. + confidence: nil, + # Name of the tag. + name: nil, + # Source of the tag. Possible values are `google-auto-tagging` and + # `aws-auto-tagging`. + source: nil + ) + end + + sig do + override.returns({ confidence: Float, name: String, source: String }) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/beta/v2/file_upload_response.rbi b/rbi/imagekitio/models/beta/v2/file_upload_response.rbi index c89e24cf..70788949 100644 --- a/rbi/imagekitio/models/beta/v2/file_upload_response.rbi +++ b/rbi/imagekitio/models/beta/v2/file_upload_response.rbi @@ -14,15 +14,7 @@ module Imagekitio end # An array of tags assigned to the uploaded file by auto tagging. - sig do - returns( - T.nilable( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::AITag - ] - ) - ) - end + sig { returns(T.nilable(T::Array[Imagekitio::AITag])) } attr_accessor :ai_tags # The audio codec used in the video (only for video). @@ -179,12 +171,7 @@ module Imagekitio # about the custom metadata schema. sig do returns( - T.nilable( - T::Hash[ - Symbol, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema - ] - ) + T.nilable(T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem]) ) end attr_reader :selected_fields_schema @@ -192,10 +179,7 @@ module Imagekitio sig do params( selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::OrHash - ] + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash] ).void end attr_writer :selected_fields_schema @@ -228,21 +212,10 @@ module Imagekitio attr_writer :url # An object containing the file or file version's `id` (versionId) and `name`. - sig do - returns( - T.nilable( - Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo - ) - ) - end + sig { returns(T.nilable(Imagekitio::VersionInfo)) } attr_reader :version_info - sig do - params( - version_info: - Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo::OrHash - ).void - end + sig { params(version_info: Imagekitio::VersionInfo::OrHash).void } attr_writer :version_info # The video codec used in the video (only for video). @@ -262,12 +235,7 @@ module Imagekitio # Object containing details of a successful upload. sig do params( - ai_tags: - T.nilable( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::AITag::OrHash - ] - ), + ai_tags: T.nilable(T::Array[Imagekitio::AITag::OrHash]), audio_codec: String, bit_rate: Integer, custom_coordinates: T.nilable(String), @@ -286,16 +254,12 @@ module Imagekitio metadata: Imagekitio::Metadata::OrHash, name: String, selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::OrHash - ], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash], size: Float, tags: T.nilable(T::Array[String]), thumbnail_url: String, url: String, - version_info: - Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo::OrHash, + version_info: Imagekitio::VersionInfo::OrHash, video_codec: String, width: Float ).returns(T.attached_class) @@ -390,12 +354,7 @@ module Imagekitio sig do override.returns( { - ai_tags: - T.nilable( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::AITag - ] - ), + ai_tags: T.nilable(T::Array[Imagekitio::AITag]), audio_codec: String, bit_rate: Integer, custom_coordinates: T.nilable(String), @@ -414,16 +373,12 @@ module Imagekitio metadata: Imagekitio::Metadata, name: String, selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema - ], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem], size: Float, tags: T.nilable(T::Array[String]), thumbnail_url: String, url: String, - version_info: - Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } @@ -432,64 +387,6 @@ module Imagekitio def to_hash end - class AITag < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Models::Beta::V2::FileUploadResponse::AITag, - Imagekitio::Internal::AnyHash - ) - end - - # Confidence score of the tag. - sig { returns(T.nilable(Float)) } - attr_reader :confidence - - sig { params(confidence: Float).void } - attr_writer :confidence - - # Name of the tag. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - sig { returns(T.nilable(String)) } - attr_reader :source - - sig { params(source: String).void } - attr_writer :source - - sig do - params(confidence: Float, name: String, source: String).returns( - T.attached_class - ) - end - def self.new( - # Confidence score of the tag. - confidence: nil, - # Name of the tag. - name: nil, - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - source: nil - ) - end - - sig do - override.returns( - { confidence: Float, name: String, source: String } - ) - end - def to_hash - end - end - class ExtensionStatus < Imagekitio::Internal::Type::BaseModel OrHash = T.type_alias do @@ -830,427 +727,6 @@ module Imagekitio end end end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema, - Imagekitio::Internal::AnyHash - ) - end - - # Type of the custom metadata field. - sig do - returns( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - end - attr_accessor :type - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - sig do - returns( - T.nilable( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants - ) - ) - end - attr_reader :default_value - - sig do - params( - default_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants - ).void - end - attr_writer :default_value - - # Specifies if the custom metadata field is required or not. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :is_value_required - - sig { params(is_value_required: T::Boolean).void } - attr_writer :is_value_required - - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :max_length - - sig { params(max_length: Float).void } - attr_writer :max_length - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants - ) - ) - end - attr_reader :max_value - - sig do - params( - max_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants - ).void - end - attr_writer :max_value - - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :min_length - - sig { params(min_length: Float).void } - attr_writer :min_length - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants - ) - ) - end - attr_reader :min_value - - sig do - params( - min_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants - ).void - end - attr_writer :min_value - - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :read_only - - sig { params(read_only: T::Boolean).void } - attr_writer :read_only - - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - sig do - returns( - T.nilable( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ] - ) - ) - end - attr_reader :select_options - - sig do - params( - select_options: - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ] - ).void - end - attr_writer :select_options - - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :select_options_truncated - - sig { params(select_options_truncated: T::Boolean).void } - attr_writer :select_options_truncated - - sig do - params( - type: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::OrSymbol, - default_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Type of the custom metadata field. - type:, - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - default_value: nil, - # Specifies if the custom metadata field is required or not. - is_value_required: nil, - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - max_length: nil, - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - max_value: nil, - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - min_length: nil, - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - min_value: nil, - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - read_only: nil, - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - select_options: nil, - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - select_options_truncated: nil - ) - end - - sig do - override.returns( - { - type: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol, - default_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - } - ) - end - def to_hash - end - - # Type of the custom metadata field. - module Type - extend Imagekitio::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TEXT = - T.let( - :Text, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - TEXTAREA = - T.let( - :Textarea, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - NUMBER = - T.let( - :Number, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - DATE = - T.let( - :Date, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - BOOLEAN = - T.let( - :Boolean, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - SINGLE_SELECT = - T.let( - :SingleSelect, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - MULTI_SELECT = - T.let( - :MultiSelect, - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ] - ) - end - def self.values - end - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - module DefaultValue - extend Imagekitio::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - String, - Float, - T::Boolean, - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - - module Mixed - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - def self.variants - end - end - - sig do - override.returns( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants - ] - ) - end - def self.variants - end - - MixedArray = - T.let( - Imagekitio::Internal::Type::ArrayOf[ - union: - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed - ], - Imagekitio::Internal::Type::Converter - ) - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MaxValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants - ] - ) - end - def self.variants - end - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MinValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants - ] - ) - end - def self.variants - end - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ] - ) - end - def self.variants - end - end - end - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo, - Imagekitio::Internal::AnyHash - ) - end - - # Unique identifier of the file version. - sig { returns(T.nilable(String)) } - attr_reader :id - - sig { params(id: String).void } - attr_writer :id - - # Name of the file version. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # An object containing the file or file version's `id` (versionId) and `name`. - sig { params(id: String, name: String).returns(T.attached_class) } - def self.new( - # Unique identifier of the file version. - id: nil, - # Name of the file version. - name: nil - ) - end - - sig { override.returns({ id: String, name: String }) } - def to_hash - end - end end end end diff --git a/rbi/imagekitio/models/custom_metadata.rbi b/rbi/imagekitio/models/custom_metadata.rbi new file mode 100644 index 00000000..84f40e78 --- /dev/null +++ b/rbi/imagekitio/models/custom_metadata.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Imagekitio + module Models + CustomMetadata = + T.let( + Imagekitio::Internal::Type::HashOf[Imagekitio::Internal::Type::Unknown], + Imagekitio::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekitio/models/embedded_metadata.rbi b/rbi/imagekitio/models/embedded_metadata.rbi new file mode 100644 index 00000000..51a71b7c --- /dev/null +++ b/rbi/imagekitio/models/embedded_metadata.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Imagekitio + module Models + EmbeddedMetadata = + T.let( + Imagekitio::Internal::Type::HashOf[Imagekitio::Internal::Type::Unknown], + Imagekitio::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekitio/models/file.rbi b/rbi/imagekitio/models/file.rbi index 95a78ea1..0c5897bd 100644 --- a/rbi/imagekitio/models/file.rbi +++ b/rbi/imagekitio/models/file.rbi @@ -6,8 +6,9 @@ module Imagekitio OrHash = T.type_alias { T.any(Imagekitio::File, Imagekitio::Internal::AnyHash) } - # An array of tags assigned to the file by auto tagging. - sig { returns(T.nilable(T::Array[Imagekitio::File::AITag])) } + # Array of AI-generated tags associated with the image. If no AITags are set, it + # will be null. + sig { returns(T.nilable(T::Array[Imagekitio::AITag])) } attr_accessor :ai_tags # The audio codec used in the video (only for video/audio). @@ -141,7 +142,7 @@ module Imagekitio # about the custom metadata schema. sig do returns( - T.nilable(T::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema]) + T.nilable(T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem]) ) end attr_reader :selected_fields_schema @@ -149,7 +150,7 @@ module Imagekitio sig do params( selected_fields_schema: - T::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema::OrHash] + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash] ).void end attr_writer :selected_fields_schema @@ -197,10 +198,10 @@ module Imagekitio attr_writer :url # An object with details of the file version. - sig { returns(T.nilable(Imagekitio::File::VersionInfo)) } + sig { returns(T.nilable(Imagekitio::VersionInfo)) } attr_reader :version_info - sig { params(version_info: Imagekitio::File::VersionInfo::OrHash).void } + sig { params(version_info: Imagekitio::VersionInfo::OrHash).void } attr_writer :version_info # The video codec used in the video (only for video). @@ -220,7 +221,7 @@ module Imagekitio # Object containing details of a file or file version. sig do params( - ai_tags: T.nilable(T::Array[Imagekitio::File::AITag::OrHash]), + ai_tags: T.nilable(T::Array[Imagekitio::AITag::OrHash]), audio_codec: String, bit_rate: Integer, created_at: Time, @@ -239,20 +240,21 @@ module Imagekitio mime: String, name: String, selected_fields_schema: - T::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema::OrHash], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash], size: Float, tags: T.nilable(T::Array[String]), thumbnail: String, type: Imagekitio::File::Type::OrSymbol, updated_at: Time, url: String, - version_info: Imagekitio::File::VersionInfo::OrHash, + version_info: Imagekitio::VersionInfo::OrHash, video_codec: String, width: Float ).returns(T.attached_class) end def self.new( - # An array of tags assigned to the file by auto tagging. + # Array of AI-generated tags associated with the image. If no AITags are set, it + # will be null. ai_tags: nil, # The audio codec used in the video (only for video/audio). audio_codec: nil, @@ -329,7 +331,7 @@ module Imagekitio sig do override.returns( { - ai_tags: T.nilable(T::Array[Imagekitio::File::AITag]), + ai_tags: T.nilable(T::Array[Imagekitio::AITag]), audio_codec: String, bit_rate: Integer, created_at: Time, @@ -348,14 +350,14 @@ module Imagekitio mime: String, name: String, selected_fields_schema: - T::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem], size: Float, tags: T.nilable(T::Array[String]), thumbnail: String, type: Imagekitio::File::Type::TaggedSymbol, updated_at: Time, url: String, - version_info: Imagekitio::File::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } @@ -364,433 +366,6 @@ module Imagekitio def to_hash end - class AITag < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any(Imagekitio::File::AITag, Imagekitio::Internal::AnyHash) - end - - # Confidence score of the tag. - sig { returns(T.nilable(Float)) } - attr_reader :confidence - - sig { params(confidence: Float).void } - attr_writer :confidence - - # Name of the tag. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # Source of the tag. Possible values are `google-auto-tagging` and - # `aws-auto-tagging`. - sig { returns(T.nilable(String)) } - attr_reader :source - - sig { params(source: String).void } - attr_writer :source - - sig do - params(confidence: Float, name: String, source: String).returns( - T.attached_class - ) - end - def self.new( - # Confidence score of the tag. - confidence: nil, - # Name of the tag. - name: nil, - # Source of the tag. Possible values are `google-auto-tagging` and - # `aws-auto-tagging`. - source: nil - ) - end - - sig do - override.returns({ confidence: Float, name: String, source: String }) - end - def to_hash - end - end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::File::SelectedFieldsSchema, - Imagekitio::Internal::AnyHash - ) - end - - # Type of the custom metadata field. - sig do - returns(Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol) - end - attr_accessor :type - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - sig do - returns( - T.nilable( - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Variants - ) - ) - end - attr_reader :default_value - - sig do - params( - default_value: - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Variants - ).void - end - attr_writer :default_value - - # Specifies if the custom metadata field is required or not. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :is_value_required - - sig { params(is_value_required: T::Boolean).void } - attr_writer :is_value_required - - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :max_length - - sig { params(max_length: Float).void } - attr_writer :max_length - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::File::SelectedFieldsSchema::MaxValue::Variants - ) - ) - end - attr_reader :max_value - - sig do - params( - max_value: - Imagekitio::File::SelectedFieldsSchema::MaxValue::Variants - ).void - end - attr_writer :max_value - - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :min_length - - sig { params(min_length: Float).void } - attr_writer :min_length - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::File::SelectedFieldsSchema::MinValue::Variants - ) - ) - end - attr_reader :min_value - - sig do - params( - min_value: - Imagekitio::File::SelectedFieldsSchema::MinValue::Variants - ).void - end - attr_writer :min_value - - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :read_only - - sig { params(read_only: T::Boolean).void } - attr_writer :read_only - - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - sig do - returns( - T.nilable( - T::Array[ - Imagekitio::File::SelectedFieldsSchema::SelectOption::Variants - ] - ) - ) - end - attr_reader :select_options - - sig do - params( - select_options: - T::Array[ - Imagekitio::File::SelectedFieldsSchema::SelectOption::Variants - ] - ).void - end - attr_writer :select_options - - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :select_options_truncated - - sig { params(select_options_truncated: T::Boolean).void } - attr_writer :select_options_truncated - - sig do - params( - type: Imagekitio::File::SelectedFieldsSchema::Type::OrSymbol, - default_value: - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::File::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::File::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::File::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Type of the custom metadata field. - type:, - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - default_value: nil, - # Specifies if the custom metadata field is required or not. - is_value_required: nil, - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - max_length: nil, - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - max_value: nil, - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - min_length: nil, - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - min_value: nil, - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - read_only: nil, - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - select_options: nil, - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - select_options_truncated: nil - ) - end - - sig do - override.returns( - { - type: Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol, - default_value: - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::File::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::File::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::File::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - } - ) - end - def to_hash - end - - # Type of the custom metadata field. - module Type - extend Imagekitio::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all(Symbol, Imagekitio::File::SelectedFieldsSchema::Type) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TEXT = - T.let( - :Text, - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ) - TEXTAREA = - T.let( - :Textarea, - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ) - NUMBER = - T.let( - :Number, - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ) - DATE = - T.let( - :Date, - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ) - BOOLEAN = - T.let( - :Boolean, - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ) - SINGLE_SELECT = - T.let( - :SingleSelect, - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ) - MULTI_SELECT = - T.let( - :MultiSelect, - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - Imagekitio::File::SelectedFieldsSchema::Type::TaggedSymbol - ] - ) - end - def self.values - end - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - module DefaultValue - extend Imagekitio::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - String, - Float, - T::Boolean, - T::Array[ - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - - module Mixed - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - def self.variants - end - end - - sig do - override.returns( - T::Array[ - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Variants - ] - ) - end - def self.variants - end - - MixedArray = - T.let( - Imagekitio::Internal::Type::ArrayOf[ - union: - Imagekitio::File::SelectedFieldsSchema::DefaultValue::Mixed - ], - Imagekitio::Internal::Type::Converter - ) - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MaxValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::File::SelectedFieldsSchema::MaxValue::Variants - ] - ) - end - def self.variants - end - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MinValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::File::SelectedFieldsSchema::MinValue::Variants - ] - ) - end - def self.variants - end - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::File::SelectedFieldsSchema::SelectOption::Variants - ] - ) - end - def self.variants - end - end - end - # Type of the asset. module Type extend Imagekitio::Internal::Type::Enum @@ -806,41 +381,6 @@ module Imagekitio def self.values end end - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any(Imagekitio::File::VersionInfo, Imagekitio::Internal::AnyHash) - end - - # Unique identifier of the file version. - sig { returns(T.nilable(String)) } - attr_reader :id - - sig { params(id: String).void } - attr_writer :id - - # Name of the file version. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # An object with details of the file version. - sig { params(id: String, name: String).returns(T.attached_class) } - def self.new( - # Unique identifier of the file version. - id: nil, - # Name of the file version. - name: nil - ) - end - - sig { override.returns({ id: String, name: String }) } - def to_hash - end - end end end end diff --git a/rbi/imagekitio/models/file_create_event.rbi b/rbi/imagekitio/models/file_create_event.rbi new file mode 100644 index 00000000..69ff431c --- /dev/null +++ b/rbi/imagekitio/models/file_create_event.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module Imagekitio + module Models + class FileCreateEvent < Imagekitio::Models::BaseWebhookEvent + OrHash = + T.type_alias do + T.any(Imagekitio::FileCreateEvent, Imagekitio::Internal::AnyHash) + end + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + # Object containing details of a file or file version. + sig { returns(Imagekitio::File) } + attr_reader :data + + sig { params(data: Imagekitio::File::OrHash).void } + attr_writer :data + + # Type of the webhook event. + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a file is created. + sig do + params( + created_at: Time, + data: Imagekitio::File::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + # Object containing details of a file or file version. + data:, + # Type of the webhook event. + type: :"file.created" + ) + end + + sig do + override.returns( + { created_at: Time, data: Imagekitio::File, type: Symbol } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/file_delete_event.rbi b/rbi/imagekitio/models/file_delete_event.rbi new file mode 100644 index 00000000..71f2042b --- /dev/null +++ b/rbi/imagekitio/models/file_delete_event.rbi @@ -0,0 +1,80 @@ +# typed: strong + +module Imagekitio + module Models + class FileDeleteEvent < Imagekitio::Models::BaseWebhookEvent + OrHash = + T.type_alias do + T.any(Imagekitio::FileDeleteEvent, Imagekitio::Internal::AnyHash) + end + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekitio::FileDeleteEvent::Data) } + attr_reader :data + + sig { params(data: Imagekitio::FileDeleteEvent::Data::OrHash).void } + attr_writer :data + + # Type of the webhook event. + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a file is deleted. + sig do + params( + created_at: Time, + data: Imagekitio::FileDeleteEvent::Data::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + data:, + # Type of the webhook event. + type: :"file.deleted" + ) + end + + sig do + override.returns( + { + created_at: Time, + data: Imagekitio::FileDeleteEvent::Data, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::FileDeleteEvent::Data, + Imagekitio::Internal::AnyHash + ) + end + + # The unique `fileId` of the deleted file. + sig { returns(String) } + attr_accessor :file_id + + sig { params(file_id: String).returns(T.attached_class) } + def self.new( + # The unique `fileId` of the deleted file. + file_id: + ) + end + + sig { override.returns({ file_id: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekitio/models/file_update_event.rbi b/rbi/imagekitio/models/file_update_event.rbi new file mode 100644 index 00000000..2315aa75 --- /dev/null +++ b/rbi/imagekitio/models/file_update_event.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module Imagekitio + module Models + class FileUpdateEvent < Imagekitio::Models::BaseWebhookEvent + OrHash = + T.type_alias do + T.any(Imagekitio::FileUpdateEvent, Imagekitio::Internal::AnyHash) + end + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + # Object containing details of a file or file version. + sig { returns(Imagekitio::File) } + attr_reader :data + + sig { params(data: Imagekitio::File::OrHash).void } + attr_writer :data + + # Type of the webhook event. + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a file is updated. + sig do + params( + created_at: Time, + data: Imagekitio::File::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + # Object containing details of a file or file version. + data:, + # Type of the webhook event. + type: :"file.updated" + ) + end + + sig do + override.returns( + { created_at: Time, data: Imagekitio::File, type: Symbol } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/file_upload_response.rbi b/rbi/imagekitio/models/file_upload_response.rbi index 5db02369..63c23ea4 100644 --- a/rbi/imagekitio/models/file_upload_response.rbi +++ b/rbi/imagekitio/models/file_upload_response.rbi @@ -12,11 +12,7 @@ module Imagekitio end # An array of tags assigned to the uploaded file by auto tagging. - sig do - returns( - T.nilable(T::Array[Imagekitio::Models::FileUploadResponse::AITag]) - ) - end + sig { returns(T.nilable(T::Array[Imagekitio::AITag])) } attr_accessor :ai_tags # The audio codec used in the video (only for video). @@ -171,12 +167,7 @@ module Imagekitio # about the custom metadata schema. sig do returns( - T.nilable( - T::Hash[ - Symbol, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema - ] - ) + T.nilable(T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem]) ) end attr_reader :selected_fields_schema @@ -184,10 +175,7 @@ module Imagekitio sig do params( selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::OrHash - ] + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash] ).void end attr_writer :selected_fields_schema @@ -220,17 +208,10 @@ module Imagekitio attr_writer :url # An object containing the file or file version's `id` (versionId) and `name`. - sig do - returns(T.nilable(Imagekitio::Models::FileUploadResponse::VersionInfo)) - end + sig { returns(T.nilable(Imagekitio::VersionInfo)) } attr_reader :version_info - sig do - params( - version_info: - Imagekitio::Models::FileUploadResponse::VersionInfo::OrHash - ).void - end + sig { params(version_info: Imagekitio::VersionInfo::OrHash).void } attr_writer :version_info # The video codec used in the video (only for video). @@ -250,10 +231,7 @@ module Imagekitio # Object containing details of a successful upload. sig do params( - ai_tags: - T.nilable( - T::Array[Imagekitio::Models::FileUploadResponse::AITag::OrHash] - ), + ai_tags: T.nilable(T::Array[Imagekitio::AITag::OrHash]), audio_codec: String, bit_rate: Integer, custom_coordinates: T.nilable(String), @@ -272,16 +250,12 @@ module Imagekitio metadata: Imagekitio::Metadata::OrHash, name: String, selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::OrHash - ], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash], size: Float, tags: T.nilable(T::Array[String]), thumbnail_url: String, url: String, - version_info: - Imagekitio::Models::FileUploadResponse::VersionInfo::OrHash, + version_info: Imagekitio::VersionInfo::OrHash, video_codec: String, width: Float ).returns(T.attached_class) @@ -376,10 +350,7 @@ module Imagekitio sig do override.returns( { - ai_tags: - T.nilable( - T::Array[Imagekitio::Models::FileUploadResponse::AITag] - ), + ai_tags: T.nilable(T::Array[Imagekitio::AITag]), audio_codec: String, bit_rate: Integer, custom_coordinates: T.nilable(String), @@ -398,15 +369,12 @@ module Imagekitio metadata: Imagekitio::Metadata, name: String, selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema - ], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem], size: Float, tags: T.nilable(T::Array[String]), thumbnail_url: String, url: String, - version_info: Imagekitio::Models::FileUploadResponse::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } @@ -415,62 +383,6 @@ module Imagekitio def to_hash end - class AITag < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Models::FileUploadResponse::AITag, - Imagekitio::Internal::AnyHash - ) - end - - # Confidence score of the tag. - sig { returns(T.nilable(Float)) } - attr_reader :confidence - - sig { params(confidence: Float).void } - attr_writer :confidence - - # Name of the tag. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - sig { returns(T.nilable(String)) } - attr_reader :source - - sig { params(source: String).void } - attr_writer :source - - sig do - params(confidence: Float, name: String, source: String).returns( - T.attached_class - ) - end - def self.new( - # Confidence score of the tag. - confidence: nil, - # Name of the tag. - name: nil, - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - source: nil - ) - end - - sig do - override.returns({ confidence: Float, name: String, source: String }) - end - def to_hash - end - end - class ExtensionStatus < Imagekitio::Internal::Type::BaseModel OrHash = T.type_alias do @@ -811,427 +723,6 @@ module Imagekitio end end end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema, - Imagekitio::Internal::AnyHash - ) - end - - # Type of the custom metadata field. - sig do - returns( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - end - attr_accessor :type - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - sig do - returns( - T.nilable( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants - ) - ) - end - attr_reader :default_value - - sig do - params( - default_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants - ).void - end - attr_writer :default_value - - # Specifies if the custom metadata field is required or not. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :is_value_required - - sig { params(is_value_required: T::Boolean).void } - attr_writer :is_value_required - - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :max_length - - sig { params(max_length: Float).void } - attr_writer :max_length - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants - ) - ) - end - attr_reader :max_value - - sig do - params( - max_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants - ).void - end - attr_writer :max_value - - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :min_length - - sig { params(min_length: Float).void } - attr_writer :min_length - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants - ) - ) - end - attr_reader :min_value - - sig do - params( - min_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants - ).void - end - attr_writer :min_value - - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :read_only - - sig { params(read_only: T::Boolean).void } - attr_writer :read_only - - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - sig do - returns( - T.nilable( - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ] - ) - ) - end - attr_reader :select_options - - sig do - params( - select_options: - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ] - ).void - end - attr_writer :select_options - - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :select_options_truncated - - sig { params(select_options_truncated: T::Boolean).void } - attr_writer :select_options_truncated - - sig do - params( - type: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::OrSymbol, - default_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Type of the custom metadata field. - type:, - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - default_value: nil, - # Specifies if the custom metadata field is required or not. - is_value_required: nil, - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - max_length: nil, - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - max_value: nil, - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - min_length: nil, - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - min_value: nil, - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - read_only: nil, - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - select_options: nil, - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - select_options_truncated: nil - ) - end - - sig do - override.returns( - { - type: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol, - default_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - } - ) - end - def to_hash - end - - # Type of the custom metadata field. - module Type - extend Imagekitio::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TEXT = - T.let( - :Text, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - TEXTAREA = - T.let( - :Textarea, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - NUMBER = - T.let( - :Number, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - DATE = - T.let( - :Date, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - BOOLEAN = - T.let( - :Boolean, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - SINGLE_SELECT = - T.let( - :SingleSelect, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - MULTI_SELECT = - T.let( - :MultiSelect, - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::Type::TaggedSymbol - ] - ) - end - def self.values - end - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - module DefaultValue - extend Imagekitio::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - String, - Float, - T::Boolean, - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - - module Mixed - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - def self.variants - end - end - - sig do - override.returns( - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Variants - ] - ) - end - def self.variants - end - - MixedArray = - T.let( - Imagekitio::Internal::Type::ArrayOf[ - union: - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::Mixed - ], - Imagekitio::Internal::Type::Converter - ) - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MaxValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MaxValue::Variants - ] - ) - end - def self.variants - end - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MinValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::MinValue::Variants - ] - ) - end - def self.variants - end - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::SelectOption::Variants - ] - ) - end - def self.variants - end - end - end - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Models::FileUploadResponse::VersionInfo, - Imagekitio::Internal::AnyHash - ) - end - - # Unique identifier of the file version. - sig { returns(T.nilable(String)) } - attr_reader :id - - sig { params(id: String).void } - attr_writer :id - - # Name of the file version. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # An object containing the file or file version's `id` (versionId) and `name`. - sig { params(id: String, name: String).returns(T.attached_class) } - def self.new( - # Unique identifier of the file version. - id: nil, - # Name of the file version. - name: nil - ) - end - - sig { override.returns({ id: String, name: String }) } - def to_hash - end - end end end end diff --git a/rbi/imagekitio/models/file_version_create_event.rbi b/rbi/imagekitio/models/file_version_create_event.rbi new file mode 100644 index 00000000..da6844b3 --- /dev/null +++ b/rbi/imagekitio/models/file_version_create_event.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module Imagekitio + module Models + class FileVersionCreateEvent < Imagekitio::Models::BaseWebhookEvent + OrHash = + T.type_alias do + T.any( + Imagekitio::FileVersionCreateEvent, + Imagekitio::Internal::AnyHash + ) + end + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + # Object containing details of a file or file version. + sig { returns(Imagekitio::File) } + attr_reader :data + + sig { params(data: Imagekitio::File::OrHash).void } + attr_writer :data + + # Type of the webhook event. + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a file version is created. + sig do + params( + created_at: Time, + data: Imagekitio::File::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + # Object containing details of a file or file version. + data:, + # Type of the webhook event. + type: :"file-version.created" + ) + end + + sig do + override.returns( + { created_at: Time, data: Imagekitio::File, type: Symbol } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/models/file_version_delete_event.rbi b/rbi/imagekitio/models/file_version_delete_event.rbi new file mode 100644 index 00000000..586ea3d9 --- /dev/null +++ b/rbi/imagekitio/models/file_version_delete_event.rbi @@ -0,0 +1,93 @@ +# typed: strong + +module Imagekitio + module Models + class FileVersionDeleteEvent < Imagekitio::Models::BaseWebhookEvent + OrHash = + T.type_alias do + T.any( + Imagekitio::FileVersionDeleteEvent, + Imagekitio::Internal::AnyHash + ) + end + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekitio::FileVersionDeleteEvent::Data) } + attr_reader :data + + sig do + params(data: Imagekitio::FileVersionDeleteEvent::Data::OrHash).void + end + attr_writer :data + + # Type of the webhook event. + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a file version is deleted. + sig do + params( + created_at: Time, + data: Imagekitio::FileVersionDeleteEvent::Data::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + data:, + # Type of the webhook event. + type: :"file-version.deleted" + ) + end + + sig do + override.returns( + { + created_at: Time, + data: Imagekitio::FileVersionDeleteEvent::Data, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::FileVersionDeleteEvent::Data, + Imagekitio::Internal::AnyHash + ) + end + + # The unique `fileId` of the deleted file. + sig { returns(String) } + attr_accessor :file_id + + # The unique `versionId` of the deleted file version. + sig { returns(String) } + attr_accessor :version_id + + sig do + params(file_id: String, version_id: String).returns(T.attached_class) + end + def self.new( + # The unique `fileId` of the deleted file. + file_id:, + # The unique `versionId` of the deleted file version. + version_id: + ) + end + + sig { override.returns({ file_id: String, version_id: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekitio/models/selected_fields_schema.rbi b/rbi/imagekitio/models/selected_fields_schema.rbi new file mode 100644 index 00000000..d6b205f8 --- /dev/null +++ b/rbi/imagekitio/models/selected_fields_schema.rbi @@ -0,0 +1,364 @@ +# typed: strong + +module Imagekitio + module Models + class SelectedFieldsSchemaItem < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekitio::SelectedFieldsSchemaItem, + Imagekitio::Internal::AnyHash + ) + end + + # Type of the custom metadata field. + sig { returns(Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol) } + attr_accessor :type + + # The default value for this custom metadata field. The value should match the + # `type` of custom metadata field. + sig do + returns( + T.nilable( + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Variants + ) + ) + end + attr_reader :default_value + + sig do + params( + default_value: + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Variants + ).void + end + attr_writer :default_value + + # Specifies if the custom metadata field is required or not. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_value_required + + sig { params(is_value_required: T::Boolean).void } + attr_writer :is_value_required + + # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. + sig { returns(T.nilable(Float)) } + attr_reader :max_length + + sig { params(max_length: Float).void } + attr_writer :max_length + + # Maximum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + sig do + returns( + T.nilable(Imagekitio::SelectedFieldsSchemaItem::MaxValue::Variants) + ) + end + attr_reader :max_value + + sig do + params( + max_value: Imagekitio::SelectedFieldsSchemaItem::MaxValue::Variants + ).void + end + attr_writer :max_value + + # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. + sig { returns(T.nilable(Float)) } + attr_reader :min_length + + sig { params(min_length: Float).void } + attr_writer :min_length + + # Minimum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + sig do + returns( + T.nilable(Imagekitio::SelectedFieldsSchemaItem::MinValue::Variants) + ) + end + attr_reader :min_value + + sig do + params( + min_value: Imagekitio::SelectedFieldsSchemaItem::MinValue::Variants + ).void + end + attr_writer :min_value + + # Indicates whether the custom metadata field is read only. A read only field + # cannot be modified after being set. This field is configurable only via the + # **Path policy** feature. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only + + sig { params(read_only: T::Boolean).void } + attr_writer :read_only + + # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + sig do + returns( + T.nilable( + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::SelectOption::Variants + ] + ) + ) + end + attr_reader :select_options + + sig do + params( + select_options: + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::SelectOption::Variants + ] + ).void + end + attr_writer :select_options + + # Specifies if the selectOptions array is truncated. It is truncated when number + # of options are > 100. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :select_options_truncated + + sig { params(select_options_truncated: T::Boolean).void } + attr_writer :select_options_truncated + + sig do + params( + type: Imagekitio::SelectedFieldsSchemaItem::Type::OrSymbol, + default_value: + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: Imagekitio::SelectedFieldsSchemaItem::MaxValue::Variants, + min_length: Float, + min_value: Imagekitio::SelectedFieldsSchemaItem::MinValue::Variants, + read_only: T::Boolean, + select_options: + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::SelectOption::Variants + ], + select_options_truncated: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Type of the custom metadata field. + type:, + # The default value for this custom metadata field. The value should match the + # `type` of custom metadata field. + default_value: nil, + # Specifies if the custom metadata field is required or not. + is_value_required: nil, + # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. + max_length: nil, + # Maximum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + max_value: nil, + # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. + min_length: nil, + # Minimum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + min_value: nil, + # Indicates whether the custom metadata field is read only. A read only field + # cannot be modified after being set. This field is configurable only via the + # **Path policy** feature. + read_only: nil, + # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + select_options: nil, + # Specifies if the selectOptions array is truncated. It is truncated when number + # of options are > 100. + select_options_truncated: nil + ) + end + + sig do + override.returns( + { + type: Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol, + default_value: + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: Imagekitio::SelectedFieldsSchemaItem::MaxValue::Variants, + min_length: Float, + min_value: Imagekitio::SelectedFieldsSchemaItem::MinValue::Variants, + read_only: T::Boolean, + select_options: + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::SelectOption::Variants + ], + select_options_truncated: T::Boolean + } + ) + end + def to_hash + end + + # Type of the custom metadata field. + module Type + extend Imagekitio::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekitio::SelectedFieldsSchemaItem::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TEXT = + T.let(:Text, Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol) + TEXTAREA = + T.let( + :Textarea, + Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol + ) + NUMBER = + T.let( + :Number, + Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol + ) + DATE = + T.let(:Date, Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol) + BOOLEAN = + T.let( + :Boolean, + Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol + ) + SINGLE_SELECT = + T.let( + :SingleSelect, + Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol + ) + MULTI_SELECT = + T.let( + :MultiSelect, + Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Imagekitio::SelectedFieldsSchemaItem::Type::TaggedSymbol] + ) + end + def self.values + end + end + + # The default value for this custom metadata field. The value should match the + # `type` of custom metadata field. + module DefaultValue + extend Imagekitio::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekitio::Internal::Type::ArrayOf[ + union: Imagekitio::SelectedFieldsSchemaItem::DefaultValue::Mixed + ], + Imagekitio::Internal::Type::Converter + ) + end + + # Maximum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + module MaxValue + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[Imagekitio::SelectedFieldsSchemaItem::MaxValue::Variants] + ) + end + def self.variants + end + end + + # Minimum value of the field. Only set if field type is `Date` or `Number`. For + # `Date` type field, the value will be in ISO8601 string format. For `Number` type + # field, it will be a numeric value. + module MinValue + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[Imagekitio::SelectedFieldsSchemaItem::MinValue::Variants] + ) + end + def self.variants + end + end + + module SelectOption + extend Imagekitio::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekitio::SelectedFieldsSchemaItem::SelectOption::Variants + ] + ) + end + def self.variants + end + end + end + + SelectedFieldsSchema = + T.let( + Imagekitio::Internal::Type::HashOf[ + Imagekitio::SelectedFieldsSchemaItem + ], + Imagekitio::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekitio/models/unsafe_unwrap_webhook_event.rbi b/rbi/imagekitio/models/unsafe_unwrap_webhook_event.rbi index 2e878626..2738c1ac 100644 --- a/rbi/imagekitio/models/unsafe_unwrap_webhook_event.rbi +++ b/rbi/imagekitio/models/unsafe_unwrap_webhook_event.rbi @@ -17,7 +17,12 @@ module Imagekitio Imagekitio::UploadPreTransformSuccessEvent, Imagekitio::UploadPreTransformErrorEvent, Imagekitio::UploadPostTransformSuccessEvent, - Imagekitio::UploadPostTransformErrorEvent + Imagekitio::UploadPostTransformErrorEvent, + Imagekitio::FileCreateEvent, + Imagekitio::FileUpdateEvent, + Imagekitio::FileDeleteEvent, + Imagekitio::FileVersionCreateEvent, + Imagekitio::FileVersionDeleteEvent ) end diff --git a/rbi/imagekitio/models/unwrap_webhook_event.rbi b/rbi/imagekitio/models/unwrap_webhook_event.rbi index 8dcbd0dd..a567656f 100644 --- a/rbi/imagekitio/models/unwrap_webhook_event.rbi +++ b/rbi/imagekitio/models/unwrap_webhook_event.rbi @@ -17,7 +17,12 @@ module Imagekitio Imagekitio::UploadPreTransformSuccessEvent, Imagekitio::UploadPreTransformErrorEvent, Imagekitio::UploadPostTransformSuccessEvent, - Imagekitio::UploadPostTransformErrorEvent + Imagekitio::UploadPostTransformErrorEvent, + Imagekitio::FileCreateEvent, + Imagekitio::FileUpdateEvent, + Imagekitio::FileDeleteEvent, + Imagekitio::FileVersionCreateEvent, + Imagekitio::FileVersionDeleteEvent ) end diff --git a/rbi/imagekitio/models/upload_pre_transform_success_event.rbi b/rbi/imagekitio/models/upload_pre_transform_success_event.rbi index d20ff55f..8aa7bb7b 100644 --- a/rbi/imagekitio/models/upload_pre_transform_success_event.rbi +++ b/rbi/imagekitio/models/upload_pre_transform_success_event.rbi @@ -83,13 +83,7 @@ module Imagekitio end # An array of tags assigned to the uploaded file by auto tagging. - sig do - returns( - T.nilable( - T::Array[Imagekitio::UploadPreTransformSuccessEvent::Data::AITag] - ) - ) - end + sig { returns(T.nilable(T::Array[Imagekitio::AITag])) } attr_accessor :ai_tags # The audio codec used in the video (only for video). @@ -246,12 +240,7 @@ module Imagekitio # about the custom metadata schema. sig do returns( - T.nilable( - T::Hash[ - Symbol, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema - ] - ) + T.nilable(T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem]) ) end attr_reader :selected_fields_schema @@ -259,10 +248,7 @@ module Imagekitio sig do params( selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::OrHash - ] + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash] ).void end attr_writer :selected_fields_schema @@ -295,21 +281,10 @@ module Imagekitio attr_writer :url # An object containing the file or file version's `id` (versionId) and `name`. - sig do - returns( - T.nilable( - Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo - ) - ) - end + sig { returns(T.nilable(Imagekitio::VersionInfo)) } attr_reader :version_info - sig do - params( - version_info: - Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo::OrHash - ).void - end + sig { params(version_info: Imagekitio::VersionInfo::OrHash).void } attr_writer :version_info # The video codec used in the video (only for video). @@ -329,12 +304,7 @@ module Imagekitio # Object containing details of a successful upload. sig do params( - ai_tags: - T.nilable( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::AITag::OrHash - ] - ), + ai_tags: T.nilable(T::Array[Imagekitio::AITag::OrHash]), audio_codec: String, bit_rate: Integer, custom_coordinates: T.nilable(String), @@ -353,16 +323,12 @@ module Imagekitio metadata: Imagekitio::Metadata::OrHash, name: String, selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::OrHash - ], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem::OrHash], size: Float, tags: T.nilable(T::Array[String]), thumbnail_url: String, url: String, - version_info: - Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo::OrHash, + version_info: Imagekitio::VersionInfo::OrHash, video_codec: String, width: Float ).returns(T.attached_class) @@ -457,12 +423,7 @@ module Imagekitio sig do override.returns( { - ai_tags: - T.nilable( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::AITag - ] - ), + ai_tags: T.nilable(T::Array[Imagekitio::AITag]), audio_codec: String, bit_rate: Integer, custom_coordinates: T.nilable(String), @@ -481,16 +442,12 @@ module Imagekitio metadata: Imagekitio::Metadata, name: String, selected_fields_schema: - T::Hash[ - Symbol, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema - ], + T::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem], size: Float, tags: T.nilable(T::Array[String]), thumbnail_url: String, url: String, - version_info: - Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } @@ -499,64 +456,6 @@ module Imagekitio def to_hash end - class AITag < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::UploadPreTransformSuccessEvent::Data::AITag, - Imagekitio::Internal::AnyHash - ) - end - - # Confidence score of the tag. - sig { returns(T.nilable(Float)) } - attr_reader :confidence - - sig { params(confidence: Float).void } - attr_writer :confidence - - # Name of the tag. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - sig { returns(T.nilable(String)) } - attr_reader :source - - sig { params(source: String).void } - attr_writer :source - - sig do - params(confidence: Float, name: String, source: String).returns( - T.attached_class - ) - end - def self.new( - # Confidence score of the tag. - confidence: nil, - # Name of the tag. - name: nil, - # Array of `AITags` associated with the image. If no `AITags` are set, it will be - # null. These tags can be added using the `google-auto-tagging` or - # `aws-auto-tagging` extensions. - source: nil - ) - end - - sig do - override.returns( - { confidence: Float, name: String, source: String } - ) - end - def to_hash - end - end - class ExtensionStatus < Imagekitio::Internal::Type::BaseModel OrHash = T.type_alias do @@ -897,427 +796,6 @@ module Imagekitio end end end - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema, - Imagekitio::Internal::AnyHash - ) - end - - # Type of the custom metadata field. - sig do - returns( - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - end - attr_accessor :type - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - sig do - returns( - T.nilable( - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Variants - ) - ) - end - attr_reader :default_value - - sig do - params( - default_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Variants - ).void - end - attr_writer :default_value - - # Specifies if the custom metadata field is required or not. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :is_value_required - - sig { params(is_value_required: T::Boolean).void } - attr_writer :is_value_required - - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :max_length - - sig { params(max_length: Float).void } - attr_writer :max_length - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MaxValue::Variants - ) - ) - end - attr_reader :max_value - - sig do - params( - max_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MaxValue::Variants - ).void - end - attr_writer :max_value - - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - sig { returns(T.nilable(Float)) } - attr_reader :min_length - - sig { params(min_length: Float).void } - attr_writer :min_length - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - sig do - returns( - T.nilable( - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MinValue::Variants - ) - ) - end - attr_reader :min_value - - sig do - params( - min_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MinValue::Variants - ).void - end - attr_writer :min_value - - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :read_only - - sig { params(read_only: T::Boolean).void } - attr_writer :read_only - - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - sig do - returns( - T.nilable( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::SelectOption::Variants - ] - ) - ) - end - attr_reader :select_options - - sig do - params( - select_options: - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::SelectOption::Variants - ] - ).void - end - attr_writer :select_options - - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :select_options_truncated - - sig { params(select_options_truncated: T::Boolean).void } - attr_writer :select_options_truncated - - sig do - params( - type: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::OrSymbol, - default_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Type of the custom metadata field. - type:, - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - default_value: nil, - # Specifies if the custom metadata field is required or not. - is_value_required: nil, - # Maximum length of string. Only set if `type` is set to `Text` or `Textarea`. - max_length: nil, - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - max_value: nil, - # Minimum length of string. Only set if `type` is set to `Text` or `Textarea`. - min_length: nil, - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - min_value: nil, - # Indicates whether the custom metadata field is read only. A read only field - # cannot be modified after being set. This field is configurable only via the - # **Path policy** feature. - read_only: nil, - # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. - select_options: nil, - # Specifies if the selectOptions array is truncated. It is truncated when number - # of options are > 100. - select_options_truncated: nil - ) - end - - sig do - override.returns( - { - type: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol, - default_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Variants, - is_value_required: T::Boolean, - max_length: Float, - max_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MaxValue::Variants, - min_length: Float, - min_value: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MinValue::Variants, - read_only: T::Boolean, - select_options: - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::SelectOption::Variants - ], - select_options_truncated: T::Boolean - } - ) - end - def to_hash - end - - # Type of the custom metadata field. - module Type - extend Imagekitio::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - TEXT = - T.let( - :Text, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - TEXTAREA = - T.let( - :Textarea, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - NUMBER = - T.let( - :Number, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - DATE = - T.let( - :Date, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - BOOLEAN = - T.let( - :Boolean, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - SINGLE_SELECT = - T.let( - :SingleSelect, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - MULTI_SELECT = - T.let( - :MultiSelect, - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::Type::TaggedSymbol - ] - ) - end - def self.values - end - end - - # The default value for this custom metadata field. The value should match the - # `type` of custom metadata field. - module DefaultValue - extend Imagekitio::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - String, - Float, - T::Boolean, - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - - module Mixed - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Mixed::Variants - ] - ) - end - def self.variants - end - end - - sig do - override.returns( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Variants - ] - ) - end - def self.variants - end - - MixedArray = - T.let( - Imagekitio::Internal::Type::ArrayOf[ - union: - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::Mixed - ], - Imagekitio::Internal::Type::Converter - ) - end - - # Maximum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MaxValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MaxValue::Variants - ] - ) - end - def self.variants - end - end - - # Minimum value of the field. Only set if field type is `Date` or `Number`. For - # `Date` type field, the value will be in ISO8601 string format. For `Number` type - # field, it will be a numeric value. - module MinValue - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float) } - - sig do - override.returns( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::MinValue::Variants - ] - ) - end - def self.variants - end - end - - module SelectOption - extend Imagekitio::Internal::Type::Union - - Variants = T.type_alias { T.any(String, Float, T::Boolean) } - - sig do - override.returns( - T::Array[ - Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::SelectOption::Variants - ] - ) - end - def self.variants - end - end - end - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo, - Imagekitio::Internal::AnyHash - ) - end - - # Unique identifier of the file version. - sig { returns(T.nilable(String)) } - attr_reader :id - - sig { params(id: String).void } - attr_writer :id - - # Name of the file version. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # An object containing the file or file version's `id` (versionId) and `name`. - sig { params(id: String, name: String).returns(T.attached_class) } - def self.new( - # Unique identifier of the file version. - id: nil, - # Name of the file version. - name: nil - ) - end - - sig { override.returns({ id: String, name: String }) } - def to_hash - end - end end class Request < Imagekitio::Internal::Type::BaseModel diff --git a/rbi/imagekitio/models/version_info.rbi b/rbi/imagekitio/models/version_info.rbi new file mode 100644 index 00000000..ad85e520 --- /dev/null +++ b/rbi/imagekitio/models/version_info.rbi @@ -0,0 +1,40 @@ +# typed: strong + +module Imagekitio + module Models + class VersionInfo < Imagekitio::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekitio::VersionInfo, Imagekitio::Internal::AnyHash) + end + + # Unique identifier of the file version. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Name of the file version. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # An object containing the file or file version's `id` (versionId) and `name`. + sig { params(id: String, name: String).returns(T.attached_class) } + def self.new( + # Unique identifier of the file version. + id: nil, + # Name of the file version. + name: nil + ) + end + + sig { override.returns({ id: String, name: String }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekitio/resources/webhooks.rbi b/rbi/imagekitio/resources/webhooks.rbi index 93b2c422..e835a320 100644 --- a/rbi/imagekitio/resources/webhooks.rbi +++ b/rbi/imagekitio/resources/webhooks.rbi @@ -12,7 +12,12 @@ module Imagekitio Imagekitio::UploadPreTransformSuccessEvent, Imagekitio::UploadPreTransformErrorEvent, Imagekitio::UploadPostTransformSuccessEvent, - Imagekitio::UploadPostTransformErrorEvent + Imagekitio::UploadPostTransformErrorEvent, + Imagekitio::FileCreateEvent, + Imagekitio::FileUpdateEvent, + Imagekitio::FileDeleteEvent, + Imagekitio::FileVersionCreateEvent, + Imagekitio::FileVersionDeleteEvent ) ) end @@ -35,7 +40,12 @@ module Imagekitio Imagekitio::UploadPreTransformSuccessEvent, Imagekitio::UploadPreTransformErrorEvent, Imagekitio::UploadPostTransformSuccessEvent, - Imagekitio::UploadPostTransformErrorEvent + Imagekitio::UploadPostTransformErrorEvent, + Imagekitio::FileCreateEvent, + Imagekitio::FileUpdateEvent, + Imagekitio::FileDeleteEvent, + Imagekitio::FileVersionCreateEvent, + Imagekitio::FileVersionDeleteEvent ) ) end diff --git a/sig/imagekitio/models.rbs b/sig/imagekitio/models.rbs index 37031be9..865f1c55 100644 --- a/sig/imagekitio/models.rbs +++ b/sig/imagekitio/models.rbs @@ -1,6 +1,8 @@ module Imagekitio module Accounts = Imagekitio::Models::Accounts + class AITag = Imagekitio::Models::AITag + class AssetListParams = Imagekitio::Models::AssetListParams class BaseOverlay = Imagekitio::Models::BaseOverlay @@ -11,6 +13,8 @@ module Imagekitio module Cache = Imagekitio::Models::Cache + CustomMetadata: Imagekitio::Internal::Type::Converter + class CustomMetadataField = Imagekitio::Models::CustomMetadataField class CustomMetadataFieldCreateParams = Imagekitio::Models::CustomMetadataFieldCreateParams @@ -21,6 +25,8 @@ module Imagekitio class CustomMetadataFieldUpdateParams = Imagekitio::Models::CustomMetadataFieldUpdateParams + EmbeddedMetadata: Imagekitio::Internal::Type::Converter + type extension_item = Imagekitio::Models::extension_item module ExtensionConfig = Imagekitio::Models::ExtensionConfig @@ -31,6 +37,10 @@ module Imagekitio class FileCopyParams = Imagekitio::Models::FileCopyParams + class FileCreateEvent = Imagekitio::Models::FileCreateEvent + + class FileDeleteEvent = Imagekitio::Models::FileDeleteEvent + class FileDeleteParams = Imagekitio::Models::FileDeleteParams class FileGetParams = Imagekitio::Models::FileGetParams @@ -41,10 +51,16 @@ module Imagekitio module Files = Imagekitio::Models::Files + class FileUpdateEvent = Imagekitio::Models::FileUpdateEvent + class FileUpdateParams = Imagekitio::Models::FileUpdateParams class FileUploadParams = Imagekitio::Models::FileUploadParams + class FileVersionCreateEvent = Imagekitio::Models::FileVersionCreateEvent + + class FileVersionDeleteEvent = Imagekitio::Models::FileVersionDeleteEvent + class Folder = Imagekitio::Models::Folder class FolderCopyParams = Imagekitio::Models::FolderCopyParams @@ -85,6 +101,10 @@ module Imagekitio class SavedExtensionUpdateParams = Imagekitio::Models::SavedExtensionUpdateParams + SelectedFieldsSchema: Imagekitio::Internal::Type::Converter + + class SelectedFieldsSchemaItem = Imagekitio::Models::SelectedFieldsSchemaItem + class SolidColorOverlay = Imagekitio::Models::SolidColorOverlay class SolidColorOverlayTransformation = Imagekitio::Models::SolidColorOverlayTransformation @@ -119,6 +139,8 @@ module Imagekitio class UploadPreTransformSuccessEvent = Imagekitio::Models::UploadPreTransformSuccessEvent + class VersionInfo = Imagekitio::Models::VersionInfo + class VideoOverlay = Imagekitio::Models::VideoOverlay class VideoTransformationAcceptedEvent = Imagekitio::Models::VideoTransformationAcceptedEvent diff --git a/sig/imagekitio/models/ai_tag.rbs b/sig/imagekitio/models/ai_tag.rbs new file mode 100644 index 00000000..2bc338cd --- /dev/null +++ b/sig/imagekitio/models/ai_tag.rbs @@ -0,0 +1,27 @@ +module Imagekitio + module Models + type ai_tag = { confidence: Float, name: String, source: String } + + class AITag < Imagekitio::Internal::Type::BaseModel + attr_reader confidence: Float? + + def confidence=: (Float) -> Float + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader source: String? + + def source=: (String) -> String + + def initialize: ( + ?confidence: Float, + ?name: String, + ?source: String + ) -> void + + def to_hash: -> { confidence: Float, name: String, source: String } + end + end +end diff --git a/sig/imagekitio/models/beta/v2/file_upload_response.rbs b/sig/imagekitio/models/beta/v2/file_upload_response.rbs index f552c5a7..421d0e5c 100644 --- a/sig/imagekitio/models/beta/v2/file_upload_response.rbs +++ b/sig/imagekitio/models/beta/v2/file_upload_response.rbs @@ -4,14 +4,14 @@ module Imagekitio module V2 type file_upload_response = { - ai_tags: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, extension_status: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus, file_id: String, file_path: String, @@ -21,18 +21,18 @@ module Imagekitio is_published: bool, metadata: Imagekitio::Metadata, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail_url: String, url: String, - version_info: Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } class FileUploadResponse < Imagekitio::Internal::Type::BaseModel - attr_accessor ai_tags: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::AITag]? + attr_accessor ai_tags: ::Array[Imagekitio::AITag]? attr_reader audio_codec: String? @@ -44,9 +44,11 @@ module Imagekitio attr_accessor custom_coordinates: String? - attr_reader custom_metadata: ::Hash[Symbol, top]? + attr_reader custom_metadata: Imagekitio::Models::custom_metadata? - def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def custom_metadata=: ( + Imagekitio::Models::custom_metadata + ) -> Imagekitio::Models::custom_metadata attr_reader description: String? @@ -56,9 +58,11 @@ module Imagekitio def duration=: (Integer) -> Integer - attr_reader embedded_metadata: ::Hash[Symbol, top]? + attr_reader embedded_metadata: Imagekitio::Models::embedded_metadata? - def embedded_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def embedded_metadata=: ( + Imagekitio::Models::embedded_metadata + ) -> Imagekitio::Models::embedded_metadata attr_reader extension_status: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus? @@ -98,11 +102,11 @@ module Imagekitio def name=: (String) -> String - attr_reader selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema]? + attr_reader selected_fields_schema: Imagekitio::Models::selected_fields_schema? def selected_fields_schema=: ( - ::Hash[Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema] - ) -> ::Hash[Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema] + Imagekitio::Models::selected_fields_schema + ) -> Imagekitio::Models::selected_fields_schema attr_reader size: Float? @@ -118,11 +122,11 @@ module Imagekitio def url=: (String) -> String - attr_reader version_info: Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo? + attr_reader version_info: Imagekitio::VersionInfo? def version_info=: ( - Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo - ) -> Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo + Imagekitio::VersionInfo + ) -> Imagekitio::VersionInfo attr_reader video_codec: String? @@ -133,14 +137,14 @@ module Imagekitio def width=: (Float) -> Float def initialize: ( - ?ai_tags: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::AITag]?, + ?ai_tags: ::Array[Imagekitio::AITag]?, ?audio_codec: String, ?bit_rate: Integer, ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], + ?custom_metadata: Imagekitio::Models::custom_metadata, ?description: String, ?duration: Integer, - ?embedded_metadata: ::Hash[Symbol, top], + ?embedded_metadata: Imagekitio::Models::embedded_metadata, ?extension_status: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus, ?file_id: String, ?file_path: String, @@ -150,25 +154,25 @@ module Imagekitio ?is_published: bool, ?metadata: Imagekitio::Metadata, ?name: String, - ?selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema], + ?selected_fields_schema: Imagekitio::Models::selected_fields_schema, ?size: Float, ?tags: ::Array[String]?, ?thumbnail_url: String, ?url: String, - ?version_info: Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo, + ?version_info: Imagekitio::VersionInfo, ?video_codec: String, ?width: Float ) -> void def to_hash: -> { - ai_tags: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, extension_status: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus, file_id: String, file_path: String, @@ -178,40 +182,16 @@ module Imagekitio is_published: bool, metadata: Imagekitio::Metadata, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail_url: String, url: String, - version_info: Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } - type ai_tag = { confidence: Float, name: String, source: String } - - class AITag < Imagekitio::Internal::Type::BaseModel - attr_reader confidence: Float? - - def confidence=: (Float) -> Float - - attr_reader name: String? - - def name=: (String) -> String - - attr_reader source: String? - - def source=: (String) -> String - - def initialize: ( - ?confidence: Float, - ?name: String, - ?source: String - ) -> void - - def to_hash: -> { confidence: Float, name: String, source: String } - end - type extension_status = { ai_auto_description: Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description, @@ -328,179 +308,6 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg] end end - - type selected_fields_schema = - { - type: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - attr_accessor type: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::type_ - - attr_reader default_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::default_value? - - def default_value=: ( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::default_value - ) -> Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::default_value - - attr_reader is_value_required: bool? - - def is_value_required=: (bool) -> bool - - attr_reader max_length: Float? - - def max_length=: (Float) -> Float - - attr_reader max_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::max_value? - - def max_value=: ( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::max_value - ) -> Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::max_value - - attr_reader min_length: Float? - - def min_length=: (Float) -> Float - - attr_reader min_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::min_value? - - def min_value=: ( - Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::min_value - ) -> Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::min_value - - attr_reader read_only: bool? - - def read_only=: (bool) -> bool - - attr_reader select_options: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::select_option]? - - def select_options=: ( - ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::select_option] - ) -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::select_option] - - attr_reader select_options_truncated: bool? - - def select_options_truncated=: (bool) -> bool - - def initialize: ( - type: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::type_, - ?default_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::default_value, - ?is_value_required: bool, - ?max_length: Float, - ?max_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::max_value, - ?min_length: Float, - ?min_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::min_value, - ?read_only: bool, - ?select_options: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::select_option], - ?select_options_truncated: bool - ) -> void - - def to_hash: -> { - type: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - type type_ = - :Text - | :Textarea - | :Number - | :Date - | :Boolean - | :SingleSelect - | :MultiSelect - - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT: :Text - TEXTAREA: :Textarea - NUMBER: :Number - DATE: :Date - BOOLEAN: :Boolean - SINGLE_SELECT: :SingleSelect - MULTI_SELECT: :MultiSelect - - def self?.values: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::type_] - end - - type default_value = - String - | Float - | bool - | ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::mixed] - - module DefaultValue - extend Imagekitio::Internal::Type::Union - - type mixed = String | Float | bool - - module Mixed - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::DefaultValue::mixed] - end - - def self?.variants: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::default_value] - - MixedArray: Imagekitio::Internal::Type::Converter - end - - type max_value = String | Float - - module MaxValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::max_value] - end - - type min_value = String | Float - - module MinValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::min_value] - end - - type select_option = String | Float | bool - - module SelectOption - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema::select_option] - end - end - - type version_info = { id: String, name: String } - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - attr_reader id: String? - - def id=: (String) -> String - - attr_reader name: String? - - def name=: (String) -> String - - def initialize: (?id: String, ?name: String) -> void - - def to_hash: -> { id: String, name: String } - end end end end diff --git a/sig/imagekitio/models/custom_metadata.rbs b/sig/imagekitio/models/custom_metadata.rbs new file mode 100644 index 00000000..3d5f88dd --- /dev/null +++ b/sig/imagekitio/models/custom_metadata.rbs @@ -0,0 +1,7 @@ +module Imagekitio + module Models + type custom_metadata = ::Hash[Symbol, top] + + CustomMetadata: Imagekitio::Internal::Type::Converter + end +end diff --git a/sig/imagekitio/models/embedded_metadata.rbs b/sig/imagekitio/models/embedded_metadata.rbs new file mode 100644 index 00000000..22a038e6 --- /dev/null +++ b/sig/imagekitio/models/embedded_metadata.rbs @@ -0,0 +1,7 @@ +module Imagekitio + module Models + type embedded_metadata = ::Hash[Symbol, top] + + EmbeddedMetadata: Imagekitio::Internal::Type::Converter + end +end diff --git a/sig/imagekitio/models/file.rbs b/sig/imagekitio/models/file.rbs index 8915e785..0ffa7620 100644 --- a/sig/imagekitio/models/file.rbs +++ b/sig/imagekitio/models/file.rbs @@ -2,15 +2,15 @@ module Imagekitio module Models type file = { - ai_tags: ::Array[Imagekitio::File::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, created_at: Time, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, file_id: String, file_path: String, file_type: String, @@ -20,20 +20,20 @@ module Imagekitio is_published: bool, mime: String, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail: String, type: Imagekitio::Models::File::type_, updated_at: Time, url: String, - version_info: Imagekitio::File::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } class File < Imagekitio::Internal::Type::BaseModel - attr_accessor ai_tags: ::Array[Imagekitio::File::AITag]? + attr_accessor ai_tags: ::Array[Imagekitio::AITag]? attr_reader audio_codec: String? @@ -49,9 +49,11 @@ module Imagekitio attr_accessor custom_coordinates: String? - attr_reader custom_metadata: ::Hash[Symbol, top]? + attr_reader custom_metadata: Imagekitio::Models::custom_metadata? - def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def custom_metadata=: ( + Imagekitio::Models::custom_metadata + ) -> Imagekitio::Models::custom_metadata attr_reader description: String? @@ -61,9 +63,11 @@ module Imagekitio def duration=: (Integer) -> Integer - attr_reader embedded_metadata: ::Hash[Symbol, top]? + attr_reader embedded_metadata: Imagekitio::Models::embedded_metadata? - def embedded_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def embedded_metadata=: ( + Imagekitio::Models::embedded_metadata + ) -> Imagekitio::Models::embedded_metadata attr_reader file_id: String? @@ -101,11 +105,11 @@ module Imagekitio def name=: (String) -> String - attr_reader selected_fields_schema: ::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema]? + attr_reader selected_fields_schema: Imagekitio::Models::selected_fields_schema? def selected_fields_schema=: ( - ::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema] - ) -> ::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema] + Imagekitio::Models::selected_fields_schema + ) -> Imagekitio::Models::selected_fields_schema attr_reader size: Float? @@ -131,11 +135,9 @@ module Imagekitio def url=: (String) -> String - attr_reader version_info: Imagekitio::File::VersionInfo? + attr_reader version_info: Imagekitio::VersionInfo? - def version_info=: ( - Imagekitio::File::VersionInfo - ) -> Imagekitio::File::VersionInfo + def version_info=: (Imagekitio::VersionInfo) -> Imagekitio::VersionInfo attr_reader video_codec: String? @@ -146,15 +148,15 @@ module Imagekitio def width=: (Float) -> Float def initialize: ( - ?ai_tags: ::Array[Imagekitio::File::AITag]?, + ?ai_tags: ::Array[Imagekitio::AITag]?, ?audio_codec: String, ?bit_rate: Integer, ?created_at: Time, ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], + ?custom_metadata: Imagekitio::Models::custom_metadata, ?description: String, ?duration: Integer, - ?embedded_metadata: ::Hash[Symbol, top], + ?embedded_metadata: Imagekitio::Models::embedded_metadata, ?file_id: String, ?file_path: String, ?file_type: String, @@ -164,28 +166,28 @@ module Imagekitio ?is_published: bool, ?mime: String, ?name: String, - ?selected_fields_schema: ::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema], + ?selected_fields_schema: Imagekitio::Models::selected_fields_schema, ?size: Float, ?tags: ::Array[String]?, ?thumbnail: String, ?type: Imagekitio::Models::File::type_, ?updated_at: Time, ?url: String, - ?version_info: Imagekitio::File::VersionInfo, + ?version_info: Imagekitio::VersionInfo, ?video_codec: String, ?width: Float ) -> void def to_hash: -> { - ai_tags: ::Array[Imagekitio::File::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, created_at: Time, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, file_id: String, file_path: String, file_type: String, @@ -195,199 +197,18 @@ module Imagekitio is_published: bool, mime: String, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::File::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail: String, type: Imagekitio::Models::File::type_, updated_at: Time, url: String, - version_info: Imagekitio::File::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } - type ai_tag = { confidence: Float, name: String, source: String } - - class AITag < Imagekitio::Internal::Type::BaseModel - attr_reader confidence: Float? - - def confidence=: (Float) -> Float - - attr_reader name: String? - - def name=: (String) -> String - - attr_reader source: String? - - def source=: (String) -> String - - def initialize: ( - ?confidence: Float, - ?name: String, - ?source: String - ) -> void - - def to_hash: -> { confidence: Float, name: String, source: String } - end - - type selected_fields_schema = - { - type: Imagekitio::Models::File::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::File::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::File::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::File::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::File::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - attr_accessor type: Imagekitio::Models::File::SelectedFieldsSchema::type_ - - attr_reader default_value: Imagekitio::Models::File::SelectedFieldsSchema::default_value? - - def default_value=: ( - Imagekitio::Models::File::SelectedFieldsSchema::default_value - ) -> Imagekitio::Models::File::SelectedFieldsSchema::default_value - - attr_reader is_value_required: bool? - - def is_value_required=: (bool) -> bool - - attr_reader max_length: Float? - - def max_length=: (Float) -> Float - - attr_reader max_value: Imagekitio::Models::File::SelectedFieldsSchema::max_value? - - def max_value=: ( - Imagekitio::Models::File::SelectedFieldsSchema::max_value - ) -> Imagekitio::Models::File::SelectedFieldsSchema::max_value - - attr_reader min_length: Float? - - def min_length=: (Float) -> Float - - attr_reader min_value: Imagekitio::Models::File::SelectedFieldsSchema::min_value? - - def min_value=: ( - Imagekitio::Models::File::SelectedFieldsSchema::min_value - ) -> Imagekitio::Models::File::SelectedFieldsSchema::min_value - - attr_reader read_only: bool? - - def read_only=: (bool) -> bool - - attr_reader select_options: ::Array[Imagekitio::Models::File::SelectedFieldsSchema::select_option]? - - def select_options=: ( - ::Array[Imagekitio::Models::File::SelectedFieldsSchema::select_option] - ) -> ::Array[Imagekitio::Models::File::SelectedFieldsSchema::select_option] - - attr_reader select_options_truncated: bool? - - def select_options_truncated=: (bool) -> bool - - def initialize: ( - type: Imagekitio::Models::File::SelectedFieldsSchema::type_, - ?default_value: Imagekitio::Models::File::SelectedFieldsSchema::default_value, - ?is_value_required: bool, - ?max_length: Float, - ?max_value: Imagekitio::Models::File::SelectedFieldsSchema::max_value, - ?min_length: Float, - ?min_value: Imagekitio::Models::File::SelectedFieldsSchema::min_value, - ?read_only: bool, - ?select_options: ::Array[Imagekitio::Models::File::SelectedFieldsSchema::select_option], - ?select_options_truncated: bool - ) -> void - - def to_hash: -> { - type: Imagekitio::Models::File::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::File::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::File::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::File::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::File::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - type type_ = - :Text - | :Textarea - | :Number - | :Date - | :Boolean - | :SingleSelect - | :MultiSelect - - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT: :Text - TEXTAREA: :Textarea - NUMBER: :Number - DATE: :Date - BOOLEAN: :Boolean - SINGLE_SELECT: :SingleSelect - MULTI_SELECT: :MultiSelect - - def self?.values: -> ::Array[Imagekitio::Models::File::SelectedFieldsSchema::type_] - end - - type default_value = - String - | Float - | bool - | ::Array[Imagekitio::Models::File::SelectedFieldsSchema::DefaultValue::mixed] - - module DefaultValue - extend Imagekitio::Internal::Type::Union - - type mixed = String | Float | bool - - module Mixed - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::File::SelectedFieldsSchema::DefaultValue::mixed] - end - - def self?.variants: -> ::Array[Imagekitio::Models::File::SelectedFieldsSchema::default_value] - - MixedArray: Imagekitio::Internal::Type::Converter - end - - type max_value = String | Float - - module MaxValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::File::SelectedFieldsSchema::max_value] - end - - type min_value = String | Float - - module MinValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::File::SelectedFieldsSchema::min_value] - end - - type select_option = String | Float | bool - - module SelectOption - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::File::SelectedFieldsSchema::select_option] - end - end - type type_ = :file | :"file-version" module Type @@ -398,22 +219,6 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::File::type_] end - - type version_info = { id: String, name: String } - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - attr_reader id: String? - - def id=: (String) -> String - - attr_reader name: String? - - def name=: (String) -> String - - def initialize: (?id: String, ?name: String) -> void - - def to_hash: -> { id: String, name: String } - end end end end diff --git a/sig/imagekitio/models/file_create_event.rbs b/sig/imagekitio/models/file_create_event.rbs new file mode 100644 index 00000000..d981e2e3 --- /dev/null +++ b/sig/imagekitio/models/file_create_event.rbs @@ -0,0 +1,32 @@ +module Imagekitio + module Models + type file_create_event = + { created_at: Time, data: Imagekitio::File, type: :"file.created" } + + class FileCreateEvent < Imagekitio::Models::BaseWebhookEvent + def created_at: -> Time + + def created_at=: (Time _) -> Time + + def data: -> Imagekitio::File + + def data=: (Imagekitio::File _) -> Imagekitio::File + + def `type`: -> :"file.created" + + def type=: (:"file.created" _) -> :"file.created" + + def initialize: ( + created_at: Time, + data: Imagekitio::File, + ?type: :"file.created" + ) -> void + + def to_hash: -> { + created_at: Time, + data: Imagekitio::File, + type: :"file.created" + } + end + end +end diff --git a/sig/imagekitio/models/file_delete_event.rbs b/sig/imagekitio/models/file_delete_event.rbs new file mode 100644 index 00000000..fd7337cc --- /dev/null +++ b/sig/imagekitio/models/file_delete_event.rbs @@ -0,0 +1,48 @@ +module Imagekitio + module Models + type file_delete_event = + { + created_at: Time, + data: Imagekitio::FileDeleteEvent::Data, + type: :"file.deleted" + } + + class FileDeleteEvent < Imagekitio::Models::BaseWebhookEvent + def created_at: -> Time + + def created_at=: (Time _) -> Time + + def data: -> Imagekitio::FileDeleteEvent::Data + + def data=: ( + Imagekitio::FileDeleteEvent::Data _ + ) -> Imagekitio::FileDeleteEvent::Data + + def `type`: -> :"file.deleted" + + def type=: (:"file.deleted" _) -> :"file.deleted" + + def initialize: ( + created_at: Time, + data: Imagekitio::FileDeleteEvent::Data, + ?type: :"file.deleted" + ) -> void + + def to_hash: -> { + created_at: Time, + data: Imagekitio::FileDeleteEvent::Data, + type: :"file.deleted" + } + + type data = { file_id: String } + + class Data < Imagekitio::Internal::Type::BaseModel + attr_accessor file_id: String + + def initialize: (file_id: String) -> void + + def to_hash: -> { file_id: String } + end + end + end +end diff --git a/sig/imagekitio/models/file_update_event.rbs b/sig/imagekitio/models/file_update_event.rbs new file mode 100644 index 00000000..f9ddae3b --- /dev/null +++ b/sig/imagekitio/models/file_update_event.rbs @@ -0,0 +1,32 @@ +module Imagekitio + module Models + type file_update_event = + { created_at: Time, data: Imagekitio::File, type: :"file.updated" } + + class FileUpdateEvent < Imagekitio::Models::BaseWebhookEvent + def created_at: -> Time + + def created_at=: (Time _) -> Time + + def data: -> Imagekitio::File + + def data=: (Imagekitio::File _) -> Imagekitio::File + + def `type`: -> :"file.updated" + + def type=: (:"file.updated" _) -> :"file.updated" + + def initialize: ( + created_at: Time, + data: Imagekitio::File, + ?type: :"file.updated" + ) -> void + + def to_hash: -> { + created_at: Time, + data: Imagekitio::File, + type: :"file.updated" + } + end + end +end diff --git a/sig/imagekitio/models/file_upload_response.rbs b/sig/imagekitio/models/file_upload_response.rbs index abb9c68d..f9b8d47b 100644 --- a/sig/imagekitio/models/file_upload_response.rbs +++ b/sig/imagekitio/models/file_upload_response.rbs @@ -2,14 +2,14 @@ module Imagekitio module Models type file_upload_response = { - ai_tags: ::Array[Imagekitio::Models::FileUploadResponse::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, extension_status: Imagekitio::Models::FileUploadResponse::ExtensionStatus, file_id: String, file_path: String, @@ -19,18 +19,18 @@ module Imagekitio is_published: bool, metadata: Imagekitio::Metadata, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail_url: String, url: String, - version_info: Imagekitio::Models::FileUploadResponse::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } class FileUploadResponse < Imagekitio::Internal::Type::BaseModel - attr_accessor ai_tags: ::Array[Imagekitio::Models::FileUploadResponse::AITag]? + attr_accessor ai_tags: ::Array[Imagekitio::AITag]? attr_reader audio_codec: String? @@ -42,9 +42,11 @@ module Imagekitio attr_accessor custom_coordinates: String? - attr_reader custom_metadata: ::Hash[Symbol, top]? + attr_reader custom_metadata: Imagekitio::Models::custom_metadata? - def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def custom_metadata=: ( + Imagekitio::Models::custom_metadata + ) -> Imagekitio::Models::custom_metadata attr_reader description: String? @@ -54,9 +56,11 @@ module Imagekitio def duration=: (Integer) -> Integer - attr_reader embedded_metadata: ::Hash[Symbol, top]? + attr_reader embedded_metadata: Imagekitio::Models::embedded_metadata? - def embedded_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def embedded_metadata=: ( + Imagekitio::Models::embedded_metadata + ) -> Imagekitio::Models::embedded_metadata attr_reader extension_status: Imagekitio::Models::FileUploadResponse::ExtensionStatus? @@ -96,11 +100,11 @@ module Imagekitio def name=: (String) -> String - attr_reader selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema]? + attr_reader selected_fields_schema: Imagekitio::Models::selected_fields_schema? def selected_fields_schema=: ( - ::Hash[Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema] - ) -> ::Hash[Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema] + Imagekitio::Models::selected_fields_schema + ) -> Imagekitio::Models::selected_fields_schema attr_reader size: Float? @@ -116,11 +120,9 @@ module Imagekitio def url=: (String) -> String - attr_reader version_info: Imagekitio::Models::FileUploadResponse::VersionInfo? + attr_reader version_info: Imagekitio::VersionInfo? - def version_info=: ( - Imagekitio::Models::FileUploadResponse::VersionInfo - ) -> Imagekitio::Models::FileUploadResponse::VersionInfo + def version_info=: (Imagekitio::VersionInfo) -> Imagekitio::VersionInfo attr_reader video_codec: String? @@ -131,14 +133,14 @@ module Imagekitio def width=: (Float) -> Float def initialize: ( - ?ai_tags: ::Array[Imagekitio::Models::FileUploadResponse::AITag]?, + ?ai_tags: ::Array[Imagekitio::AITag]?, ?audio_codec: String, ?bit_rate: Integer, ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], + ?custom_metadata: Imagekitio::Models::custom_metadata, ?description: String, ?duration: Integer, - ?embedded_metadata: ::Hash[Symbol, top], + ?embedded_metadata: Imagekitio::Models::embedded_metadata, ?extension_status: Imagekitio::Models::FileUploadResponse::ExtensionStatus, ?file_id: String, ?file_path: String, @@ -148,25 +150,25 @@ module Imagekitio ?is_published: bool, ?metadata: Imagekitio::Metadata, ?name: String, - ?selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema], + ?selected_fields_schema: Imagekitio::Models::selected_fields_schema, ?size: Float, ?tags: ::Array[String]?, ?thumbnail_url: String, ?url: String, - ?version_info: Imagekitio::Models::FileUploadResponse::VersionInfo, + ?version_info: Imagekitio::VersionInfo, ?video_codec: String, ?width: Float ) -> void def to_hash: -> { - ai_tags: ::Array[Imagekitio::Models::FileUploadResponse::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, extension_status: Imagekitio::Models::FileUploadResponse::ExtensionStatus, file_id: String, file_path: String, @@ -176,40 +178,16 @@ module Imagekitio is_published: bool, metadata: Imagekitio::Metadata, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail_url: String, url: String, - version_info: Imagekitio::Models::FileUploadResponse::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } - type ai_tag = { confidence: Float, name: String, source: String } - - class AITag < Imagekitio::Internal::Type::BaseModel - attr_reader confidence: Float? - - def confidence=: (Float) -> Float - - attr_reader name: String? - - def name=: (String) -> String - - attr_reader source: String? - - def source=: (String) -> String - - def initialize: ( - ?confidence: Float, - ?name: String, - ?source: String - ) -> void - - def to_hash: -> { confidence: Float, name: String, source: String } - end - type extension_status = { ai_auto_description: Imagekitio::Models::FileUploadResponse::ExtensionStatus::ai_auto_description, @@ -326,179 +304,6 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::FileUploadResponse::ExtensionStatus::remove_bg] end end - - type selected_fields_schema = - { - type: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - attr_accessor type: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::type_ - - attr_reader default_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::default_value? - - def default_value=: ( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::default_value - ) -> Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::default_value - - attr_reader is_value_required: bool? - - def is_value_required=: (bool) -> bool - - attr_reader max_length: Float? - - def max_length=: (Float) -> Float - - attr_reader max_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::max_value? - - def max_value=: ( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::max_value - ) -> Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::max_value - - attr_reader min_length: Float? - - def min_length=: (Float) -> Float - - attr_reader min_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::min_value? - - def min_value=: ( - Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::min_value - ) -> Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::min_value - - attr_reader read_only: bool? - - def read_only=: (bool) -> bool - - attr_reader select_options: ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::select_option]? - - def select_options=: ( - ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::select_option] - ) -> ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::select_option] - - attr_reader select_options_truncated: bool? - - def select_options_truncated=: (bool) -> bool - - def initialize: ( - type: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::type_, - ?default_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::default_value, - ?is_value_required: bool, - ?max_length: Float, - ?max_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::max_value, - ?min_length: Float, - ?min_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::min_value, - ?read_only: bool, - ?select_options: ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::select_option], - ?select_options_truncated: bool - ) -> void - - def to_hash: -> { - type: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - type type_ = - :Text - | :Textarea - | :Number - | :Date - | :Boolean - | :SingleSelect - | :MultiSelect - - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT: :Text - TEXTAREA: :Textarea - NUMBER: :Number - DATE: :Date - BOOLEAN: :Boolean - SINGLE_SELECT: :SingleSelect - MULTI_SELECT: :MultiSelect - - def self?.values: -> ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::type_] - end - - type default_value = - String - | Float - | bool - | ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::mixed] - - module DefaultValue - extend Imagekitio::Internal::Type::Union - - type mixed = String | Float | bool - - module Mixed - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::DefaultValue::mixed] - end - - def self?.variants: -> ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::default_value] - - MixedArray: Imagekitio::Internal::Type::Converter - end - - type max_value = String | Float - - module MaxValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::max_value] - end - - type min_value = String | Float - - module MinValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::min_value] - end - - type select_option = String | Float | bool - - module SelectOption - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema::select_option] - end - end - - type version_info = { id: String, name: String } - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - attr_reader id: String? - - def id=: (String) -> String - - attr_reader name: String? - - def name=: (String) -> String - - def initialize: (?id: String, ?name: String) -> void - - def to_hash: -> { id: String, name: String } - end end end end diff --git a/sig/imagekitio/models/file_version_create_event.rbs b/sig/imagekitio/models/file_version_create_event.rbs new file mode 100644 index 00000000..b6872e4c --- /dev/null +++ b/sig/imagekitio/models/file_version_create_event.rbs @@ -0,0 +1,36 @@ +module Imagekitio + module Models + type file_version_create_event = + { + created_at: Time, + data: Imagekitio::File, + type: :"file-version.created" + } + + class FileVersionCreateEvent < Imagekitio::Models::BaseWebhookEvent + def created_at: -> Time + + def created_at=: (Time _) -> Time + + def data: -> Imagekitio::File + + def data=: (Imagekitio::File _) -> Imagekitio::File + + def `type`: -> :"file-version.created" + + def type=: (:"file-version.created" _) -> :"file-version.created" + + def initialize: ( + created_at: Time, + data: Imagekitio::File, + ?type: :"file-version.created" + ) -> void + + def to_hash: -> { + created_at: Time, + data: Imagekitio::File, + type: :"file-version.created" + } + end + end +end diff --git a/sig/imagekitio/models/file_version_delete_event.rbs b/sig/imagekitio/models/file_version_delete_event.rbs new file mode 100644 index 00000000..e4667c92 --- /dev/null +++ b/sig/imagekitio/models/file_version_delete_event.rbs @@ -0,0 +1,50 @@ +module Imagekitio + module Models + type file_version_delete_event = + { + created_at: Time, + data: Imagekitio::FileVersionDeleteEvent::Data, + type: :"file-version.deleted" + } + + class FileVersionDeleteEvent < Imagekitio::Models::BaseWebhookEvent + def created_at: -> Time + + def created_at=: (Time _) -> Time + + def data: -> Imagekitio::FileVersionDeleteEvent::Data + + def data=: ( + Imagekitio::FileVersionDeleteEvent::Data _ + ) -> Imagekitio::FileVersionDeleteEvent::Data + + def `type`: -> :"file-version.deleted" + + def type=: (:"file-version.deleted" _) -> :"file-version.deleted" + + def initialize: ( + created_at: Time, + data: Imagekitio::FileVersionDeleteEvent::Data, + ?type: :"file-version.deleted" + ) -> void + + def to_hash: -> { + created_at: Time, + data: Imagekitio::FileVersionDeleteEvent::Data, + type: :"file-version.deleted" + } + + type data = { file_id: String, version_id: String } + + class Data < Imagekitio::Internal::Type::BaseModel + attr_accessor file_id: String + + attr_accessor version_id: String + + def initialize: (file_id: String, version_id: String) -> void + + def to_hash: -> { file_id: String, version_id: String } + end + end + end +end diff --git a/sig/imagekitio/models/selected_fields_schema.rbs b/sig/imagekitio/models/selected_fields_schema.rbs new file mode 100644 index 00000000..aa3fbd91 --- /dev/null +++ b/sig/imagekitio/models/selected_fields_schema.rbs @@ -0,0 +1,165 @@ +module Imagekitio + module Models + type selected_fields_schema_item = + { + type: Imagekitio::Models::SelectedFieldsSchemaItem::type_, + default_value: Imagekitio::Models::SelectedFieldsSchemaItem::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekitio::Models::SelectedFieldsSchemaItem::max_value, + min_length: Float, + min_value: Imagekitio::Models::SelectedFieldsSchemaItem::min_value, + read_only: bool, + select_options: ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::select_option], + select_options_truncated: bool + } + + class SelectedFieldsSchemaItem < Imagekitio::Internal::Type::BaseModel + attr_accessor type: Imagekitio::Models::SelectedFieldsSchemaItem::type_ + + attr_reader default_value: Imagekitio::Models::SelectedFieldsSchemaItem::default_value? + + def default_value=: ( + Imagekitio::Models::SelectedFieldsSchemaItem::default_value + ) -> Imagekitio::Models::SelectedFieldsSchemaItem::default_value + + attr_reader is_value_required: bool? + + def is_value_required=: (bool) -> bool + + attr_reader max_length: Float? + + def max_length=: (Float) -> Float + + attr_reader max_value: Imagekitio::Models::SelectedFieldsSchemaItem::max_value? + + def max_value=: ( + Imagekitio::Models::SelectedFieldsSchemaItem::max_value + ) -> Imagekitio::Models::SelectedFieldsSchemaItem::max_value + + attr_reader min_length: Float? + + def min_length=: (Float) -> Float + + attr_reader min_value: Imagekitio::Models::SelectedFieldsSchemaItem::min_value? + + def min_value=: ( + Imagekitio::Models::SelectedFieldsSchemaItem::min_value + ) -> Imagekitio::Models::SelectedFieldsSchemaItem::min_value + + attr_reader read_only: bool? + + def read_only=: (bool) -> bool + + attr_reader select_options: ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::select_option]? + + def select_options=: ( + ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::select_option] + ) -> ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::select_option] + + attr_reader select_options_truncated: bool? + + def select_options_truncated=: (bool) -> bool + + def initialize: ( + type: Imagekitio::Models::SelectedFieldsSchemaItem::type_, + ?default_value: Imagekitio::Models::SelectedFieldsSchemaItem::default_value, + ?is_value_required: bool, + ?max_length: Float, + ?max_value: Imagekitio::Models::SelectedFieldsSchemaItem::max_value, + ?min_length: Float, + ?min_value: Imagekitio::Models::SelectedFieldsSchemaItem::min_value, + ?read_only: bool, + ?select_options: ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::select_option], + ?select_options_truncated: bool + ) -> void + + def to_hash: -> { + type: Imagekitio::Models::SelectedFieldsSchemaItem::type_, + default_value: Imagekitio::Models::SelectedFieldsSchemaItem::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekitio::Models::SelectedFieldsSchemaItem::max_value, + min_length: Float, + min_value: Imagekitio::Models::SelectedFieldsSchemaItem::min_value, + read_only: bool, + select_options: ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::select_option], + select_options_truncated: bool + } + + type type_ = + :Text + | :Textarea + | :Number + | :Date + | :Boolean + | :SingleSelect + | :MultiSelect + + module Type + extend Imagekitio::Internal::Type::Enum + + TEXT: :Text + TEXTAREA: :Textarea + NUMBER: :Number + DATE: :Date + BOOLEAN: :Boolean + SINGLE_SELECT: :SingleSelect + MULTI_SELECT: :MultiSelect + + def self?.values: -> ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::type_] + end + + type default_value = + String + | Float + | bool + | ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::DefaultValue::mixed] + + module DefaultValue + extend Imagekitio::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::DefaultValue::mixed] + end + + def self?.variants: -> ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::default_value] + + MixedArray: Imagekitio::Internal::Type::Converter + end + + type max_value = String | Float + + module MaxValue + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::max_value] + end + + type min_value = String | Float + + module MinValue + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::min_value] + end + + type select_option = String | Float | bool + + module SelectOption + extend Imagekitio::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekitio::Models::SelectedFieldsSchemaItem::select_option] + end + end + + type selected_fields_schema = + ::Hash[Symbol, Imagekitio::SelectedFieldsSchemaItem] + + SelectedFieldsSchema: Imagekitio::Internal::Type::Converter + end +end diff --git a/sig/imagekitio/models/unsafe_unwrap_webhook_event.rbs b/sig/imagekitio/models/unsafe_unwrap_webhook_event.rbs index 12322bc6..c61e069e 100644 --- a/sig/imagekitio/models/unsafe_unwrap_webhook_event.rbs +++ b/sig/imagekitio/models/unsafe_unwrap_webhook_event.rbs @@ -8,6 +8,11 @@ module Imagekitio | Imagekitio::UploadPreTransformErrorEvent | Imagekitio::UploadPostTransformSuccessEvent | Imagekitio::UploadPostTransformErrorEvent + | Imagekitio::FileCreateEvent + | Imagekitio::FileUpdateEvent + | Imagekitio::FileDeleteEvent + | Imagekitio::FileVersionCreateEvent + | Imagekitio::FileVersionDeleteEvent module UnsafeUnwrapWebhookEvent extend Imagekitio::Internal::Type::Union diff --git a/sig/imagekitio/models/unwrap_webhook_event.rbs b/sig/imagekitio/models/unwrap_webhook_event.rbs index f6d1bbc3..4468c7b7 100644 --- a/sig/imagekitio/models/unwrap_webhook_event.rbs +++ b/sig/imagekitio/models/unwrap_webhook_event.rbs @@ -8,6 +8,11 @@ module Imagekitio | Imagekitio::UploadPreTransformErrorEvent | Imagekitio::UploadPostTransformSuccessEvent | Imagekitio::UploadPostTransformErrorEvent + | Imagekitio::FileCreateEvent + | Imagekitio::FileUpdateEvent + | Imagekitio::FileDeleteEvent + | Imagekitio::FileVersionCreateEvent + | Imagekitio::FileVersionDeleteEvent module UnwrapWebhookEvent extend Imagekitio::Internal::Type::Union diff --git a/sig/imagekitio/models/upload_pre_transform_success_event.rbs b/sig/imagekitio/models/upload_pre_transform_success_event.rbs index e7de4a8d..75cb9256 100644 --- a/sig/imagekitio/models/upload_pre_transform_success_event.rbs +++ b/sig/imagekitio/models/upload_pre_transform_success_event.rbs @@ -47,14 +47,14 @@ module Imagekitio type data = { - ai_tags: ::Array[Imagekitio::UploadPreTransformSuccessEvent::Data::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, extension_status: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus, file_id: String, file_path: String, @@ -64,18 +64,18 @@ module Imagekitio is_published: bool, metadata: Imagekitio::Metadata, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail_url: String, url: String, - version_info: Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } class Data < Imagekitio::Internal::Type::BaseModel - attr_accessor ai_tags: ::Array[Imagekitio::UploadPreTransformSuccessEvent::Data::AITag]? + attr_accessor ai_tags: ::Array[Imagekitio::AITag]? attr_reader audio_codec: String? @@ -87,9 +87,11 @@ module Imagekitio attr_accessor custom_coordinates: String? - attr_reader custom_metadata: ::Hash[Symbol, top]? + attr_reader custom_metadata: Imagekitio::Models::custom_metadata? - def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def custom_metadata=: ( + Imagekitio::Models::custom_metadata + ) -> Imagekitio::Models::custom_metadata attr_reader description: String? @@ -99,9 +101,11 @@ module Imagekitio def duration=: (Integer) -> Integer - attr_reader embedded_metadata: ::Hash[Symbol, top]? + attr_reader embedded_metadata: Imagekitio::Models::embedded_metadata? - def embedded_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + def embedded_metadata=: ( + Imagekitio::Models::embedded_metadata + ) -> Imagekitio::Models::embedded_metadata attr_reader extension_status: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus? @@ -141,11 +145,11 @@ module Imagekitio def name=: (String) -> String - attr_reader selected_fields_schema: ::Hash[Symbol, Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema]? + attr_reader selected_fields_schema: Imagekitio::Models::selected_fields_schema? def selected_fields_schema=: ( - ::Hash[Symbol, Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema] - ) -> ::Hash[Symbol, Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema] + Imagekitio::Models::selected_fields_schema + ) -> Imagekitio::Models::selected_fields_schema attr_reader size: Float? @@ -161,11 +165,9 @@ module Imagekitio def url=: (String) -> String - attr_reader version_info: Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo? + attr_reader version_info: Imagekitio::VersionInfo? - def version_info=: ( - Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo - ) -> Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo + def version_info=: (Imagekitio::VersionInfo) -> Imagekitio::VersionInfo attr_reader video_codec: String? @@ -176,14 +178,14 @@ module Imagekitio def width=: (Float) -> Float def initialize: ( - ?ai_tags: ::Array[Imagekitio::UploadPreTransformSuccessEvent::Data::AITag]?, + ?ai_tags: ::Array[Imagekitio::AITag]?, ?audio_codec: String, ?bit_rate: Integer, ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], + ?custom_metadata: Imagekitio::Models::custom_metadata, ?description: String, ?duration: Integer, - ?embedded_metadata: ::Hash[Symbol, top], + ?embedded_metadata: Imagekitio::Models::embedded_metadata, ?extension_status: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus, ?file_id: String, ?file_path: String, @@ -193,25 +195,25 @@ module Imagekitio ?is_published: bool, ?metadata: Imagekitio::Metadata, ?name: String, - ?selected_fields_schema: ::Hash[Symbol, Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema], + ?selected_fields_schema: Imagekitio::Models::selected_fields_schema, ?size: Float, ?tags: ::Array[String]?, ?thumbnail_url: String, ?url: String, - ?version_info: Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo, + ?version_info: Imagekitio::VersionInfo, ?video_codec: String, ?width: Float ) -> void def to_hash: -> { - ai_tags: ::Array[Imagekitio::UploadPreTransformSuccessEvent::Data::AITag]?, + ai_tags: ::Array[Imagekitio::AITag]?, audio_codec: String, bit_rate: Integer, custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], + custom_metadata: Imagekitio::Models::custom_metadata, description: String, duration: Integer, - embedded_metadata: ::Hash[Symbol, top], + embedded_metadata: Imagekitio::Models::embedded_metadata, extension_status: Imagekitio::UploadPreTransformSuccessEvent::Data::ExtensionStatus, file_id: String, file_path: String, @@ -221,40 +223,16 @@ module Imagekitio is_published: bool, metadata: Imagekitio::Metadata, name: String, - selected_fields_schema: ::Hash[Symbol, Imagekitio::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema], + selected_fields_schema: Imagekitio::Models::selected_fields_schema, size: Float, tags: ::Array[String]?, thumbnail_url: String, url: String, - version_info: Imagekitio::UploadPreTransformSuccessEvent::Data::VersionInfo, + version_info: Imagekitio::VersionInfo, video_codec: String, width: Float } - type ai_tag = { confidence: Float, name: String, source: String } - - class AITag < Imagekitio::Internal::Type::BaseModel - attr_reader confidence: Float? - - def confidence=: (Float) -> Float - - attr_reader name: String? - - def name=: (String) -> String - - attr_reader source: String? - - def source=: (String) -> String - - def initialize: ( - ?confidence: Float, - ?name: String, - ?source: String - ) -> void - - def to_hash: -> { confidence: Float, name: String, source: String } - end - type extension_status = { ai_auto_description: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description, @@ -371,179 +349,6 @@ module Imagekitio def self?.values: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg] end end - - type selected_fields_schema = - { - type: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - class SelectedFieldsSchema < Imagekitio::Internal::Type::BaseModel - attr_accessor type: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::type_ - - attr_reader default_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::default_value? - - def default_value=: ( - Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::default_value - ) -> Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::default_value - - attr_reader is_value_required: bool? - - def is_value_required=: (bool) -> bool - - attr_reader max_length: Float? - - def max_length=: (Float) -> Float - - attr_reader max_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::max_value? - - def max_value=: ( - Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::max_value - ) -> Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::max_value - - attr_reader min_length: Float? - - def min_length=: (Float) -> Float - - attr_reader min_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::min_value? - - def min_value=: ( - Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::min_value - ) -> Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::min_value - - attr_reader read_only: bool? - - def read_only=: (bool) -> bool - - attr_reader select_options: ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::select_option]? - - def select_options=: ( - ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::select_option] - ) -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::select_option] - - attr_reader select_options_truncated: bool? - - def select_options_truncated=: (bool) -> bool - - def initialize: ( - type: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::type_, - ?default_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::default_value, - ?is_value_required: bool, - ?max_length: Float, - ?max_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::max_value, - ?min_length: Float, - ?min_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::min_value, - ?read_only: bool, - ?select_options: ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::select_option], - ?select_options_truncated: bool - ) -> void - - def to_hash: -> { - type: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::type_, - default_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::default_value, - is_value_required: bool, - max_length: Float, - max_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::max_value, - min_length: Float, - min_value: Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::min_value, - read_only: bool, - select_options: ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::select_option], - select_options_truncated: bool - } - - type type_ = - :Text - | :Textarea - | :Number - | :Date - | :Boolean - | :SingleSelect - | :MultiSelect - - module Type - extend Imagekitio::Internal::Type::Enum - - TEXT: :Text - TEXTAREA: :Textarea - NUMBER: :Number - DATE: :Date - BOOLEAN: :Boolean - SINGLE_SELECT: :SingleSelect - MULTI_SELECT: :MultiSelect - - def self?.values: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::type_] - end - - type default_value = - String - | Float - | bool - | ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::mixed] - - module DefaultValue - extend Imagekitio::Internal::Type::Union - - type mixed = String | Float | bool - - module Mixed - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::DefaultValue::mixed] - end - - def self?.variants: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::default_value] - - MixedArray: Imagekitio::Internal::Type::Converter - end - - type max_value = String | Float - - module MaxValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::max_value] - end - - type min_value = String | Float - - module MinValue - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::min_value] - end - - type select_option = String | Float | bool - - module SelectOption - extend Imagekitio::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekitio::Models::UploadPreTransformSuccessEvent::Data::SelectedFieldsSchema::select_option] - end - end - - type version_info = { id: String, name: String } - - class VersionInfo < Imagekitio::Internal::Type::BaseModel - attr_reader id: String? - - def id=: (String) -> String - - attr_reader name: String? - - def name=: (String) -> String - - def initialize: (?id: String, ?name: String) -> void - - def to_hash: -> { id: String, name: String } - end end type request = { transformation: String, x_request_id: String } diff --git a/sig/imagekitio/models/version_info.rbs b/sig/imagekitio/models/version_info.rbs new file mode 100644 index 00000000..c7f74101 --- /dev/null +++ b/sig/imagekitio/models/version_info.rbs @@ -0,0 +1,19 @@ +module Imagekitio + module Models + type version_info = { id: String, name: String } + + class VersionInfo < Imagekitio::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + def initialize: (?id: String, ?name: String) -> void + + def to_hash: -> { id: String, name: String } + end + end +end diff --git a/sig/imagekitio/resources/webhooks.rbs b/sig/imagekitio/resources/webhooks.rbs index a3ba0487..5126929f 100644 --- a/sig/imagekitio/resources/webhooks.rbs +++ b/sig/imagekitio/resources/webhooks.rbs @@ -9,7 +9,12 @@ module Imagekitio | Imagekitio::UploadPreTransformSuccessEvent | Imagekitio::UploadPreTransformErrorEvent | Imagekitio::UploadPostTransformSuccessEvent - | Imagekitio::UploadPostTransformErrorEvent) + | Imagekitio::UploadPostTransformErrorEvent + | Imagekitio::FileCreateEvent + | Imagekitio::FileUpdateEvent + | Imagekitio::FileDeleteEvent + | Imagekitio::FileVersionCreateEvent + | Imagekitio::FileVersionDeleteEvent) def unwrap: ( String payload, @@ -21,7 +26,12 @@ module Imagekitio | Imagekitio::UploadPreTransformSuccessEvent | Imagekitio::UploadPreTransformErrorEvent | Imagekitio::UploadPostTransformSuccessEvent - | Imagekitio::UploadPostTransformErrorEvent) + | Imagekitio::UploadPostTransformErrorEvent + | Imagekitio::FileCreateEvent + | Imagekitio::FileUpdateEvent + | Imagekitio::FileDeleteEvent + | Imagekitio::FileVersionCreateEvent + | Imagekitio::FileVersionDeleteEvent) def initialize: (client: Imagekitio::Client) -> void end diff --git a/test/imagekitio/resources/beta/v2/files_test.rb b/test/imagekitio/resources/beta/v2/files_test.rb index 5cdce6e3..9bb9ffea 100644 --- a/test/imagekitio/resources/beta/v2/files_test.rb +++ b/test/imagekitio/resources/beta/v2/files_test.rb @@ -14,7 +14,7 @@ def test_upload_required_params assert_pattern do response => { - ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::Models::Beta::V2::FileUploadResponse::AITag]) | nil, + ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag]) | nil, audio_codec: String | nil, bit_rate: Integer | nil, custom_coordinates: String | nil, @@ -31,12 +31,12 @@ def test_upload_required_params is_published: Imagekitio::Internal::Type::Boolean | nil, metadata: Imagekitio::Metadata | nil, name: String | nil, - selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::Models::Beta::V2::FileUploadResponse::SelectedFieldsSchema]) | nil, + selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem]) | nil, size: Float | nil, tags: ^(Imagekitio::Internal::Type::ArrayOf[String]) | nil, thumbnail_url: String | nil, url: String | nil, - version_info: Imagekitio::Models::Beta::V2::FileUploadResponse::VersionInfo | nil, + version_info: Imagekitio::VersionInfo | nil, video_codec: String | nil, width: Float | nil } diff --git a/test/imagekitio/resources/files/versions_test.rb b/test/imagekitio/resources/files/versions_test.rb index 3abf45a6..28cf60a2 100644 --- a/test/imagekitio/resources/files/versions_test.rb +++ b/test/imagekitio/resources/files/versions_test.rb @@ -40,7 +40,7 @@ def test_get_required_params assert_pattern do response => { - ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::File::AITag]) | nil, + ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag]) | nil, audio_codec: String | nil, bit_rate: Integer | nil, created_at: Time | nil, @@ -58,14 +58,14 @@ def test_get_required_params is_published: Imagekitio::Internal::Type::Boolean | nil, mime: String | nil, name: String | nil, - selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::File::SelectedFieldsSchema]) | nil, + selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem]) | nil, size: Float | nil, tags: ^(Imagekitio::Internal::Type::ArrayOf[String]) | nil, thumbnail: String | nil, type: Imagekitio::File::Type | nil, updated_at: Time | nil, url: String | nil, - version_info: Imagekitio::File::VersionInfo | nil, + version_info: Imagekitio::VersionInfo | nil, video_codec: String | nil, width: Float | nil } @@ -83,7 +83,7 @@ def test_restore_required_params assert_pattern do response => { - ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::File::AITag]) | nil, + ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag]) | nil, audio_codec: String | nil, bit_rate: Integer | nil, created_at: Time | nil, @@ -101,14 +101,14 @@ def test_restore_required_params is_published: Imagekitio::Internal::Type::Boolean | nil, mime: String | nil, name: String | nil, - selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::File::SelectedFieldsSchema]) | nil, + selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem]) | nil, size: Float | nil, tags: ^(Imagekitio::Internal::Type::ArrayOf[String]) | nil, thumbnail: String | nil, type: Imagekitio::File::Type | nil, updated_at: Time | nil, url: String | nil, - version_info: Imagekitio::File::VersionInfo | nil, + version_info: Imagekitio::VersionInfo | nil, video_codec: String | nil, width: Float | nil } diff --git a/test/imagekitio/resources/files_test.rb b/test/imagekitio/resources/files_test.rb index a666619a..0803391e 100644 --- a/test/imagekitio/resources/files_test.rb +++ b/test/imagekitio/resources/files_test.rb @@ -51,7 +51,7 @@ def test_get assert_pattern do response => { - ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::File::AITag]) | nil, + ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag]) | nil, audio_codec: String | nil, bit_rate: Integer | nil, created_at: Time | nil, @@ -69,14 +69,14 @@ def test_get is_published: Imagekitio::Internal::Type::Boolean | nil, mime: String | nil, name: String | nil, - selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::File::SelectedFieldsSchema]) | nil, + selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem]) | nil, size: Float | nil, tags: ^(Imagekitio::Internal::Type::ArrayOf[String]) | nil, thumbnail: String | nil, type: Imagekitio::File::Type | nil, updated_at: Time | nil, url: String | nil, - version_info: Imagekitio::File::VersionInfo | nil, + version_info: Imagekitio::VersionInfo | nil, video_codec: String | nil, width: Float | nil } @@ -127,7 +127,7 @@ def test_upload_required_params assert_pattern do response => { - ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::Models::FileUploadResponse::AITag]) | nil, + ai_tags: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::AITag]) | nil, audio_codec: String | nil, bit_rate: Integer | nil, custom_coordinates: String | nil, @@ -144,12 +144,12 @@ def test_upload_required_params is_published: Imagekitio::Internal::Type::Boolean | nil, metadata: Imagekitio::Metadata | nil, name: String | nil, - selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::Models::FileUploadResponse::SelectedFieldsSchema]) | nil, + selected_fields_schema: ^(Imagekitio::Internal::Type::HashOf[Imagekitio::SelectedFieldsSchemaItem]) | nil, size: Float | nil, tags: ^(Imagekitio::Internal::Type::ArrayOf[String]) | nil, thumbnail_url: String | nil, url: String | nil, - version_info: Imagekitio::Models::FileUploadResponse::VersionInfo | nil, + version_info: Imagekitio::VersionInfo | nil, video_codec: String | nil, width: Float | nil }